Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,

I am trying to show a webcam on the window using c++.

For that i created a window with createwindowex() function and to this window i need

to add the camera. Using opencv i tried access the camera but it is not displaying the

window also. i tried in many ways but not displaying the camera.

can anyone suggest me in other way.

Thanks in advance.
Posted
Updated 24-Sep-12 22:49pm
v2
Comments
Sergey Alexandrovich Kryukov 24-Sep-12 12:37pm    
You can show a Web camera in your windows by photographing of this camera with the help of any other camera and making a bitmap file for it. Showing it in the window is simple :-)
--SA
Kumar 09 24-Sep-12 21:30pm    
any example plz
Sergey Alexandrovich Kryukov 25-Sep-12 0:17am    
Example? Sure: Fujifilm, Canon, Pentax, Nikon, Olympus, Sigma, Leika, Ricoh, Samsung, Panasonic...
--SA
Legor 25-Sep-12 4:50am    
How do you use openCV to show the camera output? You have to provide more details (the specific lines of code) where you have problems. Use the "Improve question" button to add more details to your question.
Kumar 09 2-Oct-12 2:05am    
Hello,

I am working on Credential Provider using VC++. Where i want start a web cam using

opencv classes and libraries. Added all the header files and its libraries to

credential provider for accessing.

Code Like this:

cvCapture *camera = 0;
IplImage *frame;
IplImage *showimg;
cvNamedWindow("Input", CV_WINDOW_AUTOSIZE);
camera = cvCaptureFromCAM(0);
cvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_WIDTH, 360);
cvSetCaptureProperty(camera, CV_CAP_PROP_FRAME_HEIGHT, 240);
while(1)
{
frame = cvQueryFrame(camera);
showimg = cvCloneImage(frame);
cvShowImage("Input", showimg);
}

added this code to display the cam on the window.

but its not displaying cam but displaying the window and giving the error Like this:

"This application has requested the runtime to terminate it in a unusual way. Please contact the application's support team for more information".

Can anyone give me some idea, how to solve this issue.

Thanks in Advance. .

If you want to capture video (from your webcam) using OpenCV, check out the following sample at OpenCV wiki:
http://opencv.willowgarage.com/wiki/CameraCapture[^]

If you want to use Win SDK, use either Video for Windows (WfW) or DirectShow.

WfW provides capCreateCaptureWindow() API to create a Window for capturing video. There are a lot of samples available on the Internet.

E.g. a basic sample is available at MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd757699(v=vs.85).aspx[^]

Good luck!
 
Share this answer
 
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900