当前位置:网站首页>Opencv environment, and open a local PC camera.

Opencv environment, and open a local PC camera.

2022-07-07 03:11:00 Full stack programmer webmaster

Hello everyone , I meet you again , I'm the king of the whole stack

1、opencv Environmental structure

Recommended links http://www.cnblogs.com/Anykong/archive/2011/04/06/Anykong_OpenCV1.html

2、 Here's the basic test , And open the camera program :

My test is in win8 On the system .

 #include <cv.h>  
#include <highgui.h>  
  
#if 0

// Testing opencv Environmental data 
int main()  
  
{  
	const char* filename = "g:\\test.jpg" ;// Change to your own file pathname !! Please note that , Double slash !!
  	const char* wndname = "http://blog.csdn.net/moc062066" ;  	IplImage* pImage = cvLoadImage(filename,CV_LOAD_IMAGE_COLOR) ;  	  	cvNamedWindow(wndname,CV_WINDOW_AUTOSIZE);  	cvShowImage(wndname,pImage);    	cvWaitKey(0);    	cvReleaseImage(&pImage);  	cvDestroyWindow(wndname);    	return 0;    } #else // Collect camera data #include <cv.h>#include <cxcore.h>#include <highgui.h> int main( int argc, char** argv ){  // Statement IplImage The pointer   IplImage* pFrame = NULL; // Get the camera   CvCapture* pCapture = cvCreateCameraCapture(-1);   // Create a form   cvNamedWindow("video", 1);  cvResizeWindow("video",300,300);   // Display video   while(1)  {	  pFrame=cvQueryFrame( pCapture );	  if(!pFrame)break;	  cvShowImage("video",pFrame);	  char c=cvWaitKey(33);	  if(c==27)break;  }  cvReleaseCapture(&pCapture);  cvDestroyWindow("video");}#endif
  

Copyright notice : This article is the original article of the blogger , Blog , Do not reprint without permission .

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/116782.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061935440137.html