Ask Your Question

Rogeeeer's profile - activity

2017-07-22 08:41:46 -0600 received badge  Notable Question (source)
2016-11-29 12:10:18 -0600 received badge  Popular Question (source)
2013-12-03 09:00:36 -0600 commented question cv::findContours understanding.

copy/paste error.

2013-12-03 08:33:06 -0600 asked a question cv::findContours understanding.

Hi,

I'm trying to create a marker detector, and I need to use findContours(). Original code :

std::vector<std::vector<cv::Point>> contours;
cv::findContours(thresholdImg, contours_, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

I have access violation with this one. So I looked in the code, and I have an error in contours.cpp:1720 when OpenCV try to call create on the OutputArray in the arguments. std::vector.create() doesn't exists. So I tried to give it a matrix to see :

cv::Mat contours;
cv::findContours(thresholdImg, contours_, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

The create step is OK, but in contours.cpp:1726 I have an error and with the debugger the function from matrix.cpp:1391 is used instead of the one in matrix.cpp:1363. So the assert is not respected because arguments are not the same.

It seems to be an internal problem of OpenCV, maybe my configuration is not good ? I already created a working project for face detection (but without findContours).

Environment : Windows 7 64bits, Visual Studio 2010, OpenCV 2.4.9

I'm using 2.4.9 because i needed a function not implemented in previous versions.

Edit :

Using 2.4.7 instead of 2.4.9 solve the problem.

2013-06-13 05:44:09 -0600 received badge  Nice Answer (source)
2013-05-31 04:54:30 -0600 answered a question How to combine two or more overlapping bounding boxes?

You have multiple bounding boxes, and want to combine in one big box ?

If you take an array of boxes and detect xmin, xmax, ymin, ymax and return a cv::Rect(xmin, ymin, xmax-xmin, ymax-ymin) can't work ? Or you want to know how to detect if the boxes are overlapping ?

2013-05-31 04:44:03 -0600 commented question Master branch 2.4.9 is it stable? How to check it? Gpu functionality not building...

With VS2010, W7x64 I use OpenCV 2.4.9 built with CUDA support (juste check the cuda line in cmake GUI). I don't had any errors... But my project changed and I never used the GPU module.

Sooo I don't know if it really helps you but : Just installing the CUDA sdk from NVIDIA website, build works.

I can search in my install which packages I included if you want.

One more thing : building with CUDA took 4-5h for debug + release on intel Xeon W3565 + 4Gb memory + Quadro 600. It's long !

2013-05-22 05:39:56 -0600 commented answer opencv -display multiple images in single window

I didn't find any documentation, but i use it and it works fine :

Mat appSet;

vconcat(shapesBVec*weights, texBVec, appSet);

and they are int the cv namespace !

2013-05-22 04:47:16 -0600 answered a question opencv -display multiple images in single window

Try hconcat() and vconcat(), you can pass an array of matrix.

2013-05-22 03:08:18 -0600 asked a question OpenCV + OpenGL context resizing

Hi,

I'm using OpenGL to accelerate some texture warping using an OpenCV window for context. Now I need to do 3D rendering. So I made 2 FBO :

-The first (let's say FBO1) is to warp textures and works well. The size here is fixed and always < to size of FBO2.

-The second is to apply transformations on a 3D model. The size here change for every frame with the ROI on the image.

I saw that there is a cv::setopenglcontext, but I would like to limit the amount of windows displaying nothing.

Here is my problem : The FBO2 always have the same size as the first. I know it, because when I read the buffer (with glReadPixels) in a Mat with FBO2's size it's not ok. But when I read in a Mat with FBO1's size the image is not deformed but it's just a part of the image :

image description

I check for OpenGL errors, but I don't have any one.

The FBO1 is 1 channel 32bit floating data (GL_R32F).

The FBO2 is 4 channel 32bit unsigned byte (GL_UNSIGNED_BYTE).

I just draw a red square to test.

Maybe it's a part of the problem, but I saw in window.cpp that OpenCV already use buffers to deal with CV_WINDOW_OPENGL. Can it be the source of my problem : I resize all "my" context, but not the OpenCV buffer. I tried to call imshow() with bigger image to force it to resize "his" buffer but it's all black then.

Some code :

void ARContext(){

resizeWindow("GL", roi.width, roi.height);

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);


glMatrixMode(GL_PROJECTION);
glLoadIdentity();
perspectiveGL( 47.0, roi.width/roi.height, 0.01, 100.0 );

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();   
glViewport(0, 0, roi.width, roi.height);

glBindTexture(GL_TEXTURE_2D, poseTexID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, roi.width, roi.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);

glBindRenderbuffer(GL_RENDERBUFFER, poseDBufferID);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, roi.width, roi.height);
glBindRenderbuffer(GL_RENDERBUFFER, 0);

glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, poseFBO);

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, poseTexID, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, poseDBufferID);

errorCheck("AR Context");

}

void WarpContext(){

resizeWindow("GL", model->getROI().width, model->getROI().height);

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);

glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, *warpFBOID);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, model->getROI().width, 0, model->getROI().height, -5.0, 5.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, model->getROI().width, model->getROI().height);

errorCheck("Warp Context");

}

void drawModel(){

glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glTranslatef(0.0f, 0.0f, -3.0f);

glColor4f(1.0f, 0.0f, 0.0f, 1.0f);

glBegin(GL_QUADS);
    glVertex3f(-1.0f, 1.0f, 0.0f);
    glVertex3f(1.0f, 1.0f, 0.0f);
    glVertex3f(1.0f, -1.0f, 0.0f);
    glVertex3f(-1.0f, -1.0f, 0.0f);
glEnd();

}

void ARStuff(Mat& source){

ARContext();

Mat ip(pIndex.size(), 1, CV_32FC2, Scalar::all(0.0));

for(int i = 0; i < pIndex.size(); i++){
    ip.at<Vec2f>(i) = Vec2f(shape->at(2*pIndex[i]), shape->at(2*pIndex[i]+1));
}

solvePose(ip);

drawModel();

Mat image(roi.height, roi.width, CV_8UC4, Scalar::all(0));

glReadPixels ...
(more)
2013-05-16 08:58:40 -0600 received badge  Scholar (source)
2013-05-15 08:04:23 -0600 asked a question Matrix multiplication

Hi,

I have to reimplement some methods from opencv for real time operations. But some of these are using gemm for "simple" matrix multiplication.

Looking in the sources I can't find the operator* for cv::Mat.

When I write something like C = A*B (with A, B, C cv::Mat). Does it call gemm(A, B, 1.0, Mat(), 0.0, C); ?

2013-04-30 07:13:10 -0600 answered a question superimpose 3D graphics objects on the recognized object

From my experience : The easy way to do AR is to use some toolkit like nyARToolkit, flARToolkit, 3Dvia, unity3D, or whichever you want...

Using OpenCV can give you way more flexibility but you need time to learn some theory (we can't do it for you...).

The book "mastering opencv with practical computer vision projects" can teach you a lot and fast if you dive into the code from the repository.

2013-04-30 05:10:58 -0600 commented question CascadeClassifier::load function always returns false

your code works with vs2010 and opencv 2.4.5 ... Maybe your path isn't correct ?

2013-04-29 02:17:48 -0600 answered a question how do we get yaw, roll, pitch from POSIT rotation matrix

You can use the c implementation, it still works. You can also use solvePnP, which seems to replace cvPOSIT for pose estimation.

Pedro Martins in his Master's thesis explain what you want with cvPOSIT :

http://www2.isr.uc.pt/~pedromartins/Publications/pmartins_MScThesis.pdf

And here with solvePnP :

http://www.morethantechnical.com/2012/10/17/head-pose-estimation-with-opencv-opengl-revisited-w-code/

2013-04-26 09:12:34 -0600 answered a question CV_8UC3 pixel format question Update

CV_8UC3 explain just the way the data are stored in your matrix, it means 3 channels with 8bits in each. It don't explicit what sould be stored in it.

To convert image from one color format to another you have...

http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-convertto

2013-04-26 08:26:26 -0600 commented question Adding three images in opencv

As far as i know greenObjectsMask = hueMask & saturationMask & valueMask; is more bitwise_and than add in matlab

2013-04-26 06:59:35 -0600 commented question findcontours problem in vs2010

The guilty line is more Canny( src_gray, canny_output, thresh, thresh*2, 3 );. The green arrow point the next instruction to be executed.

Did you check what's in your src_gray at the begining of the "tresh_callback" ? Like an imshow to see if the matrix is ok. Maybe it can be the contours matrix that have to be initialized ? Take a look at the documentation :

http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html

The output matrix is already initialized...

2013-04-26 05:06:01 -0600 answered a question Get top-down view
2013-04-26 04:48:20 -0600 commented question findcontours problem in vs2010

Is it in release or debug mode ? What is the line where the error occures ?

2013-04-26 04:27:17 -0600 commented answer How to resize Float Matrix in OpenCV

Maybe there is something I don't get, but isn't it normal if you put data in a matrix, then expand it to not have the same result everywhere because of the interpolation ?

Even if the matrix is homogeneous, i noticed that OpenCV do some weird things with floating point values (maybe some double => float truncation) that I couldn't explain by the fact that the set of floating point values is not continuous.

So the essence of interpolation is to "create" data that could be correct regarding the neighbourhood.

Or am I just really far of the problem here ?

2013-04-26 03:52:11 -0600 commented answer Face recognition using java in Android

You could just export your desktop in dynamic libraries, and make some simple interface with JNI : you get the frame from your device, transform it to RGB and let the library process it and return a picture with detected faces, or number of faces ou whatever you want.

But i'm absolutely not sure about performance, you have a lot of interfaces here between your code and the hardware...

2013-04-25 12:55:35 -0600 answered a question Defined an object on photo observed at a certain angle. Appreciate its size.

If you know the angle and the distance to the considered object and the camera (calibration) pparameters you can apply some funny geometry :

http://answers.opencv.org/question/1149/focal-length-and-calibration/

But it's a complex problem covering as far as I know a lot of computer vision subjects. You can't really assume that, taking in consideration the fact that the real world is 3D + perspective, you have a simple linear transformation between 2D photo and the objects represented.

You can read http://research.microsoft.com/apps/pubs/default.aspx?id=67278 :)

2013-04-25 12:29:30 -0600 answered a question Compute pose using feature points
2013-04-25 09:52:22 -0600 commented answer Set the OpenCV enviroment variable and add it to the systems path

Oh you have 2 choices : -You create a new variable named OPENCV_DIR with value D:\OpenCV\Build\x86\vc10; and add %OPENCV_DIR%\bin to the PATH. -You add ;D:\OpenCV\Build\x86\vc10\bin to the PATH.

Maybe the first is more correct, I made a mistake sorry.

2013-04-25 09:32:21 -0600 asked a question constant errors with solvePnP

I'm using solvePnP (with EPNP) to find 3D face orientation. But I have different results : Sometimes it's good, sometimes it's almost good but with 180° rotation /Zaxis and/or -90° rotation /Yaxis.

The errors are constant, but I don't find any correlation between inputs and error.

For information I use IMM face database + landmarks and 3D model from http://aifi.isr.uc.pt/Downloads/OpenGL/ normalized between [-1 1] with 5 points for pose guess to avoid too much co-planar estimation, and noise impact.

Someone already had this kind of problem ?

2013-04-25 09:24:39 -0600 commented answer Set the OpenCV enviroment variable and add it to the systems path

Sorry Steven, thought it could be easier for this time...

2013-04-25 09:13:53 -0600 answered a question Set the OpenCV enviroment variable and add it to the systems path

Translated the topic to English, since this is the main language of the forum

Please follow the next steps:

  • Right click on 'Computer'
  • Properties
  • Advanced system properties
  • Environment variables
  • Look for PATH variable under system variables --> double click
  • Add the text at the back = D:\OpenCV\Build\x86\vc10;
2013-04-25 08:13:52 -0600 commented question Error during extraction opencv 2.4.5

Your archive seems to be corrupted... Maybe your firewall don't like .bat & .cmd files !

2013-04-25 04:21:55 -0600 received badge  Teacher (source)
2013-04-25 03:17:28 -0600 commented answer Simply count number of faces?

In windows, it's in (opencvdir)\data\lbpcascades. It must be the same structure for linux :)

Edit : sorry berak, you're right...

2013-04-25 02:54:57 -0600 commented question A basic question on OpenCV on "#include <opencv2/core/core.hpp>",

Did you check your OpenCV folder ? I had some troubles when building OpenCV (but it's 2.4.9) on w7 64bits with VS2010 : my opencv\build\include folder was empty.

The "normal" structure is : opencv\build\include\opencv <== here you have C headers opencv\build\include\opencv2 <== here you have C++ headers

It can also be in project properties > c/c++ > other include directories (not sure for the names, my vs is in french...). is it opencv\build\include\opencv or opencv\build\include ?

2013-04-25 02:49:37 -0600 answered a question OpenCV includes / libraries documetation

Here you have the documentation for OpenCV 2.4.5 :

http://docs.opencv.org/index.html

what did you mean by "I do not see "cv anywhere" ? The C++ implementation don't have all the "cv" in front of everything, it's the easiest way to know if it's C or C++ function. All the functions, types, etc. are in cv namespace.

To build the libraries... Well you can read the tutorial in the documentation, it's pretty clear : http://docs.opencv.org/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction

2013-04-24 09:36:08 -0600 commented question POSIT params without camera

If it can help someone, I found (for solvePnP but I think it don't really change) : http://www.morethantechnical.com/2012/10/17/head-pose-estimation-with-opencv-opengl-revisited-w-code/ where the author just set fx and fy with image max(w,h), and optical center to cx = w/2, cy = h/2. It makes sense when you think about opengl mvp matrix...

2013-04-24 08:55:52 -0600 received badge  Supporter (source)
2013-04-24 08:54:14 -0600 answered a question Saving High Quality Image

JPEG is a lossy format, so even with 100 for CV_IMWRITE_JPEG_QUALITY the quality will decrease. Maybe you should try PNG instead which is lossless format and more logic when you have an alpha channel.

2013-04-24 08:54:11 -0600 answered a question Saving High Quality Image

JPEG is a lossy format, so even with 100 for CV_IMWRITE_JPEG_QUALITY the quality will decrease. Maybe you should try PNG instead which is lossless format and more logic when you have an alpha channel.

2013-04-24 08:54:06 -0600 answered a question Saving High Quality Image

JPEG is a lossy format, so even with 100 for CV_IMWRITE_JPEG_QUALITY the quality will decrease. Maybe you should try PNG instead which is lossless format and more logic when you have an alpha channel.

2013-04-20 13:44:58 -0600 received badge  Student (source)
2013-04-19 08:09:00 -0600 commented question Motion Detection with android

The codebook is just an algorithm, you can find the description in the book "Learning OpenCV", you can either buy it or download it or whatever but I can't give you the URL here :)