Ask Your Question

kartikeygupta9097's profile - activity

2019-02-06 13:40:50 -0500 received badge  Popular Question (source)
2019-02-06 13:40:50 -0500 received badge  Notable Question (source)
2018-04-28 07:14:35 -0500 received badge  Famous Question (source)
2018-01-27 07:57:11 -0500 edited answer Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

Answering my own question here. Here are the steps I followed... Download OpenCV, MinGW, CMake. Install MinGW and CMa

2017-09-05 08:04:38 -0500 received badge  Notable Question (source)
2017-07-03 01:59:48 -0500 received badge  Popular Question (source)
2017-02-19 12:54:20 -0500 commented question Unexpected results while copying transparent image over another image.

TL;DR - I created my own blending procedure, but it's pretty basic...

Don't have enough karma points to reopen the question, but I figured out the solution. I imported the overlay image as a 4-channel image, and converted the underlay image into a 4-channel image. Then I set the origin of the overlay image on the underlay image, and ran a for loop(i=0->overlay.rows) within a for loop(j=0->overlay.cols). If the alpha parameter for the overlay[i][j] was 0, I set the underlay[i+origin.y][j+origin.x]'s RGBA to underlay[i][j]'s RGBA....

2017-01-23 05:27:52 -0500 received badge  Supporter (source)
2017-01-23 04:43:59 -0500 asked a question Unexpected results while copying transparent image over another image.

I have a transparent PNG image (shown below)... image description

and another image (shown below) image description

I want to copy the resize the first image and place it over the second image, and I tried doing so using the resize() and copyTo() functions. But the result was not what I expected or wanted...

image description

How do I get rid of that green color in the background?

EDIT - So, I did further research and found that this is probably because I am using a three channel image and I need to use a four channel image. So how do I convert a 3-channel image to a 4-channel image?

2017-01-23 04:23:00 -0500 commented question Size parameter in Pyrdown?

Nvr mnd. I found out about the resize() func....

2017-01-23 04:02:29 -0500 commented question Size parameter in Pyrdown?

@berak So, is there a work-around to this or do I have to keep scaling down by 2 till I reach as close to the desired size?

2017-01-20 06:18:41 -0500 received badge  Nice Answer (source)
2017-01-19 11:41:08 -0500 received badge  Student (source)
2017-01-19 11:17:42 -0500 received badge  Editor (source)
2017-01-19 11:10:59 -0500 marked best answer Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

The installer I downloaded from OpenCV's site had only a 'x64' folder. I use an i686 system. I want to build my libraries (don't know how) using GCC 6.2.0. If you could help me, it'd be cool of you. : D

2017-01-19 11:10:59 -0500 received badge  Scholar (source)
2017-01-19 08:51:58 -0500 received badge  Teacher (source)
2017-01-19 08:47:27 -0500 received badge  Self-Learner (source)
2017-01-19 08:45:05 -0500 answered a question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

Answering my own question here.

Here are the steps I followed...

  1. Download OpenCV, MinGW, CMake. Install MinGW and CMake.
  2. Run the OpenCV<version>.exe file. It'll ask you for the extraction location (I chose C:)
  3. Then open cmake gui and choose the location "C:/opencv/sources" for source directory ,and choose whatever build (destination) directory you want. (I chose "C:/opencv-mingw")
  4. Configure. Use default native compiler. Choose "MinGW Makefiles" as the compiler.
  5. After hitting "Configure", I made sure that all the options under "BUILD_opencv_..." where checked. As @berak told me, if you want seperate, individual libraries, uncheck "BUILD_opencv_world" option.
  6. Hit "Generate".
  7. Open CMD, and navigate to the build (destination) folder.
  8. Type mingw32-make or mingw-make, whatever does the job.
  9. Let the building take its sweet time.
  10. After the building process is complete, type mingw32-make install or mingw-make install, whatever your CMD understands.
  11. Done.
  12. You'll find your libraries at "<build-directory>/install/x86(or x64)/mingw/bin". Alternatively, you can also find them at "<build-directory>/bin" folder. Includes are present in the "<build-directory>/install/include" path. Set this path as the default include path.

P.S. - If you want to build the supplied example files as well, check the BUILD_EXAMPLES option in step 4.

2017-01-19 08:27:43 -0500 commented answer I want to capture video from webcam, but window disappears after capturing one frame

So now, it displays the the output of the webcam for a quick second, and then the program terminates. What should I do to display it like a video, and just one peek at a still image.

Here's the python example that works fine... https://gist.github.com/kartikeygupta/15e10e02bb35e1fce821f8ff6ef723b9 (https://gist.github.com/kartikeygupta...)

2017-01-19 08:17:13 -0500 commented question I want to capture video from webcam, but window disappears after capturing one frame

It just displays one still image and that's it. The guy who wrote the code promised that it'll display a live, moving video stream.

2017-01-19 08:15:39 -0500 commented question I want to capture video from webcam, but window disappears after capturing one frame

@berak This is the link (https://gist.github.com/kartikeygupta/69b675d96829f52880dcb952c7a544c5 (https://gist.github.com/kartikeygupta...)).

2017-01-19 07:57:55 -0500 asked a question I want to capture video from webcam, but window disappears after capturing one frame

Hi. I'm trying to capture video from my webcam via OpenCV C++. The program works fine, but the window terminates after displaying just one frame. I've tried Python examples as well on my computer, and they work as advertised. Help please.

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;

int main()
{
    VideoCapture stream1(0);   //0 is the id of video device.0 if you have only one camera.
    if (!stream1.isOpened())//check if video device has been initialised
        cout << "cannot open camera";
    //unconditional loop
    while (true)
    {
        Mat cameraFrame;
        stream1.read(cameraFrame);
        imshow("cam", cameraFrame);
        if (waitKey(0) >= 0)
            break;
    }
    return 0;
}
2017-01-19 07:01:30 -0500 received badge  Enthusiast
2017-01-17 09:01:51 -0500 commented answer What does the "isContinuous()" function do?

Didn't show up on google. I must have tried the wrong keywords.

2017-01-17 08:42:09 -0500 asked a question What does the "isContinuous()" function do?
Mat I;
//blah, blah, blah. Do Something....
if(I.isContinuous())
//do something.....
2017-01-17 08:33:16 -0500 asked a question Beginner here. Can't figure out what this function does.

This a function from OpenCV's tutorial (Page Title - "How to scan images, lookup tables and time measurement with OpenCV" Subheading - "The Efficient Way")...

When it comes to performance you cannot beat the classic C style operator[] (pointer) access. Therefore, the most efficient method we can recommend for making the assignment is:

Mat& ScanImageAndReduceC(Mat& I, const uchar* const table)
{
// accept only char type matrices
CV_Assert(I.depth() == CV_8U);
int channels = I.channels();
int nRows = I.rows;
int nCols = I.cols * channels;
if (I.isContinuous())
{
    nCols *= nRows;
    nRows = 1;
}
int i,j;
uchar* p;
for( i = 0; i < nRows; ++i)
{
    p = I.ptr<uchar>(i);
    for ( j = 0; j < nCols; ++j)
    {
        p[j] = table[p[j]];
    }
}
return I;
}

No idea what happens here.

2017-01-16 10:36:15 -0500 commented question I'm a newbie, and I can't figure out the problem with this code.

Thanks. Not sure what happened, but using opencv_world, instead of using the separate libraries, worked.

2017-01-16 02:36:17 -0500 asked a question I'm a newbie, and I can't figure out the problem with this code.

TL;DR - Certain code from OpenCV's own tutorial won't work on my system, when multiple examples already do...

I think I have correctly installed OpenCV 3.2.0 on my i686 system via MinGW 6.2.0, because when I was building my libraries, I also build that contours.cpp example, and it along with 3 other example files worked fine. I have now picked up this tutorial code from OpenCV's own Eclipse CDT documention.

#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
  Mat image;
  image = imread( argv[1], 1 );
 if( argc != 2 || !image.data )
  {
      printf( "No image data \n" );
      return -1;
  }
 namedWindow( "Display Image", WINDOW_AUTOSIZE );
 imshow( "Display Image", image );
 waitKey(0);
 return 0;
}

but it displays the following error on my system...

undefined reference to `cv::imread(cv::String const&, int)'

Please tell me what I'm doing wrong...

2017-01-15 10:46:34 -0500 commented question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

You the man,@berak. Thanks.

2017-01-15 10:29:16 -0500 commented question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

@berak. So this time, I build the example files too, and their generated .exe files work just fine. So, can I assume that OpenCV has been successfully installed?.

2017-01-15 08:01:45 -0500 commented question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

I actually rage quit by deleting directory where I installed the files. So, right now, I'm rebuilding them. But I think I remember seeing a "opencv_world320.dll.a". So, in any of my further projects, Do I just link to that library, and that's it?

2017-01-15 07:47:08 -0500 commented question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

@berak So, does it mean that I can use OpenCV on my system?

2017-01-15 05:28:50 -0500 commented question Is it possible to build OpenCV 3.2.0 libraries using MinGW for a 32bit Windows?

Here's the steps I followed... 1. Extracted the OpenCV files to "C:/". 2. Used CMake to configure and generate install files in another folder (named it "opencv-mingw"). 3. Went to that folder using CMD,used the "mingw32-make" and "mingw32-make install" commands.

The problem is that there are no libraries in "opencv-mingw/install/x86/lib" path except "opencv_world320.dll"

What do I do?