Re: WebCam with wxEuphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
Jerome said...

Thanks for the help so far! I've tried the following:

1) Saving the image to disk from OpenCV and opening the image in my EU code to display on screen
2) Drawing the individual pixel values of the image using draw_point
3) The method suggested by raseunew that creates wxImage from the pixels in memory

Method 2 works better but also has a noticeable lag from drawing the individual pixels.

There might be some ways to speed it up. For instance, since you're capturing video, many of the pixels may not be changing in each frame. You could possibly skip updating those. You might also detect if you have the same color pixel multiple times, and use draw_line() to reduce the number of calls. There might also be some micro optimizations possible in your euphoria code. Finally, you might compare the difference interpreted vs translated.

Jerome said...

I like what raseunew suggested but I'm getting strange results. I'm working with 320 by 240 images from my webcam and using the code below, the picture shrinks and is tiled when displayed in my EU program. I thought there might be a problem with how I'm interfacing with my C++ code, but Method 2 would not work if there was a problem there. I can make things slightly better by playing with set_user_scale but this does not seem like the appropriate solution. Any help is appreciated!

- Ira

raseunew said...
--// create image from converted bgr surface 
atom img = wx:create(wxImage, { openCVImageWidth, openCVImageHeight, bgr }) 
--// free converted bgr surface 
free(bgr) 
 
--// create bitmap from image 
atom bmp = wx:create(wxBitmap,{ BM_FROM_IMAGE, img, -1 }) 

I'm really surprised that works at all. The "data" parameter is supposed to be XPM data. If you're not familiar with XPM, there are several used in the demos. When they're created, the wxEuphoria library converts the euphoria sequences into "raw" xpm char data. It's basically an array of pointers to C strings.

You can pass the euphoria sequence versions to the wxBitmap constructor, and the library converts it, or you can convert it yourself and pass it to the wxImage constructor.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu