[meta-freescale] Using OpenCV and OpenGL together

Andre Silva Andre.Silva at freescale.com
Thu Dec 19 03:55:53 PST 2013

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.


From: Fikret Alim [mailto:fikret.alim at gmail.com]
Sent: Thursday, December 19, 2013 5:40 AM
To: Fabio Estevam
Cc: meta-freescale at yoctoproject.org; 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.


Then, PlaneSetTex function will be;

void PlaneSetTex (Mat texture_data)
 cvtColor (texture_data, _texture_data, CV_BGR2RGB);
 glBindTexture(GL_TEXTURE_2D, _texture);
 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 320, 240, 0, GL_RGB, GL_UNSIGNED_BYTE, _texture_data.data);

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,

On Wed, Dec 18, 2013 at 8:18 PM, Fabio Estevam <festevam at gmail.com<mailto:festevam at gmail.com>> wrote:
On Wed, Dec 11, 2013 at 12:18 PM, Fikret Alim <fikret.alim at gmail.com<mailto:fikret.alim at gmail.com>> 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.


Fabio Estevam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20131219/b933d3a3/attachment-0001.html>

More information about the meta-freescale mailing list