Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example of OpenCV application

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

1. Load Picture

# include "stdafx.h" # include "highgui.h" # include using namespace std;using namespace cv;int main (int argc, char** argv) {IplImage* img = cvLoadImage ("lena.jpg"); / / load picture cvNamedWindow ("Example1", CV_WINDOW_AUTOSIZE); cvShowImage ("Example1", img); cvWaitKey (0); cvReleaseImage (& img); cvDestroyWindow ("Example1");}

two。 Load video

# include "stdafx.h" # include "highgui.h" # include using namespace std;using namespace cv;int main (int argc, char** argv) {cvNamedWindow ("Example2", CV_WINDOW_AUTOSIZE); / / CvCapture* capture = cvCaptureFromAVI (argv [1]); / / either one will work CvCapture* capture = cvCreateFileCapture ("E:\\ video material\\ aaa.avi"); IplImage* frame While (1) {frame = cvQueryFrame (capture); if (! frame) break; cvShowImage ("Example2", frame); char c = cvWaitKey (33); if (c = 27) break;} cvReleaseCapture (& capture); cvDestroyWindow ("Example2");}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report