Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ OpenCV
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 24-Sep-12 1:43am
Kumar 091.2K
Edited 24-Sep-12 23:49pm
Legor5.6K
v2
Comments
Sergey Alexandrovich Kryukov at 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 at 24-Sep-12 21:30pm
   
any example plz
Sergey Alexandrovich Kryukov at 25-Sep-12 0:17am
   
Example? Sure: Fujifilm, Canon, Pentax, Nikon, Olympus, Sigma, Leika, Ricoh, Samsung, Panasonic...
--SA
Legor at 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 at 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. .
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 400
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 245
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100