Hi Friket,

Please, check the imageSize (image->imageSize) to see if nothing wrong is being 
passed. I will take a look in the code to see if I find anything else.

Regards,
Andre

From: Fikret Alim [mailto:[email protected]]
Sent: Thursday, December 19, 2013 12:48 PM
To: Silva Andre-B22958
Cc: Fabio Estevam; [email protected]
Subject: Re: [meta-freescale] Using OpenCV and OpenGL together

Dear Andre,

I am using OpenCV 2.4 and I am sure that OpenCV correctly sets the resolution, 
because if I comment out everything related to OpenGL and add and imshow 
command after capturing the image with OpenCV, there is no proble, I can see 
the video resolution as expected. So, I think that the problem is related to 
OpenGL part of the code.

Thanks,
Fikret

On Thu, Dec 19, 2013 at 4:40 PM, Andre Silva 
<[email protected]<mailto:[email protected]>> wrote:
Hi Friket,

Which OpenCV version are you using ? I remember 1.1 had an issue with setting 
the camera resolution using these functions, I usually needed to set it 
directly in CV´s code and then recompiling all the lib.

Regards,
andre

From: Fikret Alim [mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, December 19, 2013 11:56 AM
To: Silva Andre-B22958
Cc: Fabio Estevam; 
[email protected]<mailto:[email protected]>

Subject: Re: [meta-freescale] Using OpenCV and OpenGL together

Hi Andre,

There are only two places that I change for the resolution inside the code. 
This first one is capture resolution that openCV uses, the other one is 
glTexImage2D function. I only modify them for the resolution and I don't see 
any other functions that can be related to resolution.

cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 320, 240, 0, GL_RGB, GL_UNSIGNED_BYTE, 
bgr_img.data);

The strange thing is; if I set 160x120, 320x240 and even 320x320 resolutions, I 
don't see any problem. But if I set higher resolutions such as 640x480, 800x600 
or 1024x768, etc., I got segmentation fault. Do you have a recommendation for 
me where and what to check inside the code?

Thanks,
Fikret

On Thu, Dec 19, 2013 at 1:55 PM, Andre Silva 
<[email protected]<mailto:[email protected]>> wrote:
Hi Fikret,

I believe that there are another functions in the code using this resolution, 
if you change the resolution without modifying these other parts the segfault 
will occur. The only limitation using 320x240 is the performance, since OpenCV 
runs on cpu, if we use higher resolution the performance will decrease a lot.

Regards,
andre

From: Fikret Alim [mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, December 19, 2013 5:40 AM
To: Fabio Estevam
Cc: [email protected]<mailto:[email protected]>; 
Silva Andre-B22958
Subject: Re: [meta-freescale] Using OpenCV and OpenGL together

Dear Marek,

Thank you for your answer,

I will check the file you sent. I have solved the problem in a different way, I 
am not sure if this is the correct way or not, but at least it worked after 
this change:

I have only moved the following two lines from PlaneCreateTex function to 
PlaneSetTex function.

 glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

Then, PlaneSetTex function will be;

void PlaneSetTex (Mat texture_data)
{
 cvtColor (texture_data, _texture_data, CV_BGR2RGB);
 //imshow("_texture_data",_texture_data);
 glBindTexture(GL_TEXTURE_2D, _texture);
 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 320, 240, 0, GL_RGB, GL_UNSIGNED_BYTE, 
_texture_data.data);
 glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

With this change, now I can run Andre's gesture recognition example, and also I 
have tried some GLSL shaders for image processing like sobel detection.

But, let me ask a different question: Is there a limition for the webcam 
resolution? I can only use 320x240 resolution for both Andre's example and gpu 
sdk examples. If I set a higher resolution, then I get segmentation fault 
error. I am sure that my webcam supports higher resolutions, since I can get 
video with openCV at higher resolutions. What can be wrong? Is there a 
limitation, or do I need to perform some other operations for higher 
resolutions?

Thanks&Best Regards,
Fikret

On Wed, Dec 18, 2013 at 8:18 PM, Fabio Estevam 
<[email protected]<mailto:[email protected]>> wrote:
On Wed, Dec 11, 2013 at 12:18 PM, Fikret Alim 
<[email protected]<mailto:[email protected]>> wrote:
> Hello,
>
>
>
> I am trying to use OpenCV and OpenGL together for some image processing
> tasks. I have already run OpenCV examples on IMX6, I can also compile and
> run the examples under gpu sdk of Freescale with X11, but when I try to use
> them together I have some problems.
>
>
>
> Actually, what I am trying to make has already been done by Freescale
>
> http://imxcv.blogspot.com/2012/03/gesture-recognition-on-imx6.html
Adding Andre.

Regards,

Fabio Estevam



_______________________________________________
meta-freescale mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-freescale

Reply via email to