資源簡(jiǎn)介
采用雙線程,用opencv同時(shí)打開兩個(gè)攝像頭
代碼片段和文件信息
#include“cv.h“
#include“highgui.h“
#include?
#include?
#include?
#include?
#include?
void?test(void*w)
{
int?han?lie?lieju?channel?imgsize?l?=?1;
CvCapture?*?capture;
if?((capture?=?cvCreateCameraCapture(0))?==?NULL)
{
printf(“Camera?Open?Fail!Please?check?your?Camera.“);
char?c?=?cvWaitKey(33);
return;
}
cvNamedWindow(“Camera?Show1“?CV_WINDOW_AUTOSIZE);
IplImage?*?frame;
cvWaitKey(300);
while?(1)
{
frame?=?cvQueryframe(capture);
if?(!frame)
break;
//frame?=?cvLoadImage(“f://1.jpg“);
//char?*data?=?frame->imageData;
if?(l?==?1)
{
han?=?frame->height;
lie?=?frame->width;
lieju?=?frame->widthStep;
channel?=?frame->nChannels;
imgsize?=?frame->imageSize;
printf(“han=%dlie=%dlieju=%dchannel=%dimgsize?=?%d“?han?lie?lieju?channel?imgsize);
//for?(int?i?=?0;?i //for?(int?j?=?0;?j //for?(int?k?=?0;?k
評(píng)論
共有 條評(píng)論