Ask Your Question
1

How to open camera in VS2010 (MDI App) as a view

asked 2012-08-06 02:48:42 -0600

Gaurang gravatar image

Hi! I'm new to opencv, and not an experienced programmer. I am using OpenCV 2.4 and VS2010. I am using MDI application. I want to open camera in a view. Please help me, how to do?

Thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2012-08-06 05:33:15 -0600

Adi gravatar image

updated 2012-08-09 12:43:53 -0600

CvvImage was a highgui class that was removed from OpenCV from ver. 2.2.
It had 2 methods relevant to drawing in a Win32/MFC application.

#if defined WIN32 || defined _WIN32
    /* draw part of image to the specified DC */
    virtual void  Show( HDC dc, int x, int y, int width, int height,
                        int from_x = 0, int from_y = 0 );
    /* draw the current image ROI to the specified rectangle of the destination DC */
    virtual void  DrawToHDC( HDC hDCDst, RECT* pDstRect );
#endif

Unfortunately, if you don't use the HighGui windows, then after you grab the frame you'll have to display it yourself using the Windows APIs (e.g. Win32 or MFC).
The relevant Win32/MFC functions to do this are ::SetDIBitsToDevice or ::StretchDIBits.

You can refer to c:\OpenCV_install_folder\modules\highgui\src\window_w32.cpp to see how it's done there.

edit flag offensive delete link more

Comments

CvvImage is not working in Opencv 2.4.2 Please let me know how to display camera in VS2010 using OpenCV.

CvvImage is not working.....

Gaurang gravatar imageGaurang ( 2012-08-08 07:21:05 -0600 )edit

What is CvvImage?? Please note, that OpenCV has its own method for displaying images, here is sample code http://answers.opencv.org/question/279/ . But if you want to use any other GUI framework, you have to do it by yourself.

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-08-09 02:19:07 -0600 )edit
0

answered 2015-05-06 05:25:28 -0600

pklab gravatar image

updated 2015-05-06 05:40:14 -0600

CvvImage::DrawTOHDC was available before OpenCV 2.2.

You could retrieve some old code from somewhere

Anyway you can check my own class PkMatToGDI that uses same principle of DrawTOHDC http://www.pklab.net/?&id=390&lang=EN...

An interesting implementation is here: http://www.codeproject.com/Tips/81521... The author creates a namedWindow as child of MFC Dialog over a Dialog ctrol. After this he uses cv::imshow

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-08-06 02:48:42 -0600

Seen: 1,686 times

Last updated: May 06 '15