Re: WebCam with wxEuphoria
- Posted by Jerome Mar 27, 2011
- 1254 views
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 1 is the slowest with lots of jitter in the picture. Method 2 works better but also has a noticeable lag from drawing the individual pixels. 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
--// 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 }) --// update client DC atom clientDC = wx:create(wxClientDC, this) wx:begin_drawing(clientDC) wx:draw_bitmap(clientDC, bmp, 0, 0, true) wx:end_drawing(clientDC) --// clean up wx:delete_instance(clientDC) wx:delete_instance(bmp) wx:delete_instance(img)