本文整理汇总了C++中cvSetCaptureProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ cvSetCaptureProperty函数的具体用法?C++ cvSetCaptureProperty怎么用?C++ cvSetCaptureProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cvSetCaptureProperty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cvCreateCameraCapture
void VirtualGlasses::startCamera(){
/* std::string str="c:\\bigb.mpg";
const char * c = str.c_str();
capture =cvCreateFileCapture(c);
*/
capture = cvCreateCameraCapture(0);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 800 );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 600);
}
开发者ID:arvinyang,项目名称:VirtualGlasses,代码行数:9,代码来源:virtualglasses.cpp
示例2: Image_Handler
void Image_Handler(FCGIContext * context, char * params)
{
int num = 0, width = 800, height = 600;
FCGIValue val[] = {
{"num", &num, FCGI_INT_T},
{"width", &width, FCGI_INT_T},
{"height", &height, FCGI_INT_T}
};
if (!FCGI_ParseRequest(context, params, val, 3))
return;
else if (num < 0 || num > 1) {
FCGI_RejectJSON(context, "Invalid capture number");
return;
} else if (width <= 0 || height <= 0) {
FCGI_RejectJSON(context, "Invalid width/height");
return;
}
if (captureID != num) {
if (captureID >= 0) {
cvReleaseCapture(&capture);
}
capture = cvCreateCameraCapture(num);
captureID = num;
}
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, width);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, height);
static int p[] = {CV_IMWRITE_JPEG_QUALITY, 100, 0};
IplImage * frame = cvQueryFrame(capture);
assert(frame != NULL);
// CvMat stub;
// CvMat * background = cvGetMat(frame, &stub, 0, 0);
// CvMat *cv8u = cvCreateMat(frame->width, frame->height, CV_8U);
// double min, max;
// CvPoint a,b;
// cvMinMaxLoc(background, &min, &max, &a, &b, 0);
// double ccscale = 255.0/(max-min);
// double ccshift = -min;
//cvCvtScale(frame, cv8u, ccscale, ccshift);
CvMat * jpg = cvEncodeImage(".jpg", frame, p);
// Will this work?
Log(LOGNOTE, "Sending image!");
FCGI_PrintRaw("Content-type: image/jpg\r\n");
FCGI_PrintRaw("Cache-Control: no-cache, no-store, must-revalidate\r\n\r\n");
//FCGI_PrintRaw("Content-Length: %d", jpg->rows*jpg->cols);
FCGI_WriteBinary(jpg->data.ptr,1,jpg->rows*jpg->cols);
cvReleaseMat(&jpg);
cvReleaseImageHeader(&frame);
}
开发者ID:Callum-,项目名称:MCTX3420,代码行数:57,代码来源:image.c
示例3: cvSetCaptureProperty
void VideoInput::setImageSize(size_t width, size_t height)
{
if (_video_capture)
{
cvSetCaptureProperty(_video_capture, CV_CAP_PROP_FRAME_WIDTH, width);
cvSetCaptureProperty(_video_capture, CV_CAP_PROP_FRAME_HEIGHT, height);
std::cerr << "setImageSize: " << width << "x" << height << std::endl;
}
}
开发者ID:j30206868,项目名称:ProjCamCalibration,代码行数:9,代码来源:VideoInput.cpp
示例4: main
int main( int argc, char** argv )
{
Display *dpy = XOpenDisplay (0);
CvCapture* capture = cvCaptureFromCAM(0);
IplImage *frame = 0;
// set up the camera and windows
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, WIDTH);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT);
if( !capture )
{
fprintf(stderr,"Could not initialize capturing...\n");
return -1;
}
cvNamedWindow( "CamShiftDemo", 1 );
cvSetMouseCallback( "CamShiftDemo", on_mouse, 0 );
frame = cvQueryFrame( capture );
int step = frame->widthStep / sizeof (uchar);
// grab frames forever
for(;;)
{
// grab the image
frame = cvQueryFrame( capture );
// try again later if we weren't successful
if( !frame )
break;
// mirror it
cvFlip (frame, 0, 1);
track_red (frame, dpy);
// draw a box around the detected red region
cvRectangle (frame, topleft, bottomright, cvScalar(255,255,255), 3-4*state, 8, 0);
cvShowImage ("CamShiftDemo", frame);
// close if they press escape
char c = cvWaitKey(10);
}
// clean up
cvReleaseCapture( &capture );
cvDestroyWindow("CamShiftDemo");
return 0;
}
开发者ID:GXmachin,项目名称:redglove,代码行数:57,代码来源:redglove.cpp
示例5: cvCaptureFromCAM
WebCam::WebCam(int id, int camW, int camH)
{
liveView=false;
saveCount=1;
capture = cvCaptureFromCAM(id);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, camW );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, camH);
}
开发者ID:FrankHXW,项目名称:3DUNDERWORLD-Structured-Light-Scanner,代码行数:9,代码来源:WebCam.cpp
示例6: QThread
/*不可重入线程*/
GrabVideo::GrabVideo(QObject *parent) :
QThread(parent)
{
/*功能编程*/
capture = cvCreateCameraCapture(0); //初始化摄像头读取视频
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,320);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,240);
cvSetCaptureProperty(capture,CV_CAP_PROP_FPS,20);
}
开发者ID:zengweitotty,项目名称:QtWork,代码行数:10,代码来源:grabvideo.cpp
示例7: cvCreateCameraCapture
CCamOpenCV::CCamOpenCV(int cameraID, int width, int height)
{
_capture = cvCreateCameraCapture(cameraID);
if (_capture && 0 < width && 0 < height) {
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_WIDTH, width);
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_HEIGHT, height);
}
}
开发者ID:rootetc,项目名称:Lane,代码行数:9,代码来源:CamOpenCV.cpp
示例8: cvCaptureFromCAM
int EdgeTest::Run()
{
CvCapture* capture;
IplImage* frame;
// Initialize the capture device
capture = cvCaptureFromCAM(-1);
if(!capture)
{
ShowError("Cannot find webcam");
return -1;
}
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 700);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 700);
cvSetCaptureProperty(capture, CV_CAP_PROP_CONTRAST, 0);
// Create windows to display results
cvNamedWindow("Capture", 1);
for(;;)
{
// Retrive data from webcam and copy the frame to frame_mod
if(!cvGrabFrame(capture))
break;
frame = cvRetrieveFrame(capture);
if(!frame)
break;
// Show image on capture screen
cvFlip(frame, frame, -1);
cvShowImage("Capture", frame);
// Esc key
if(cvWaitKey(10) >= 0)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("EdgeTest");
cvDestroyWindow("Capture");
return 0;
}
开发者ID:dakk,项目名称:Misc,代码行数:56,代码来源:EdgeTest.cpp
示例9: cvCaptureFromCAM
Frame::Frame(int width, int height)
{
capture = cvCaptureFromCAM( 0 );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, width );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, height );
Frame::type = Frame::VIDEO;
Frame::size = cvSize(width, height);
Frame::motionTrack=cvCreateImage(size,IPL_DEPTH_8U, 3);
cvZero(Frame::motionTrack);
}
开发者ID:yogevyuval,项目名称:paintcode_v2,代码行数:10,代码来源:Frame.cpp
示例10: main
int main(int argc, char** argv)
{
int width = kDefaultWidth;
int height = kDefaultHeight;
if (argc > 2) {
int w = atoi(argv[1]);
width = w ? w : width;
int h = atoi(argv[2]);
height = h ? h : height;
}
// カメラからのビデオキャプチャを初期化する
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
if (capture == NULL) {
fprintf(stderr, "ERROR: Camera not found\n");
return 1;
}
// キャプチャサイズを設定する
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, width);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, height);
// ウィンドウを作成する
cvNamedWindow(kWindowName, CV_WINDOW_AUTOSIZE);
// フォント構造体を初期化する
CvFont font;
cvInitFont(&font, CV_FONT_HERSHEY_PLAIN, 1.0f, 1.0f, 0.0f, 1, CV_AA);
// カメラから画像をキャプチャする
while (1) {
long startTick = cvGetTickCount();
IplImage* image = cvQueryFrame(capture); // カメラから一つのフレームを取り出して返す
long stopTick = cvGetTickCount();
char message[kMessageSize];
snprintf(message, kMessageSize, "%.3f [ms]", (stopTick - startTick) / cvGetTickFrequency() / 1000);
cvPutText(image, message, cvPoint(10, 20), &font, CV_RGB(0, 0, 0)); // 画像に文字列を描画する
cvShowImage(kWindowName, image); // ウィンドウに画像を表示する
int key = cvWaitKey(1); // キーが押されるまで待機する
if (key == 'q') {
break;
} else if (key == 's') {
char* filename = "capture.png";
printf("Save a capture image: %s\n", filename);
//cvSaveImage(filename, image); // OpenCV 1.0
cvSaveImage(filename, image, 0); // OpenCV 2.0
}
}
cvReleaseCapture(&capture);
cvDestroyWindow(kWindowName);
return 0;
}
开发者ID:yksz,项目名称:ComputerVision-misc,代码行数:55,代码来源:main.c
示例11: main
int main(){
CvCapture* capture =0;
capture = cvCaptureFromCAM(0);
if(!capture){
printf("Capture failure\n");
return -1;
}
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,320);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,240);
cvSetCaptureProperty(capture,CV_CAP_PROP_FPS,50);
IplImage* frame=0;
setwindowSettings();
//iterate through each frames of the video
while(true){
frame = cvQueryFrame(capture);
if(!frame) break;
frame=cvCloneImage(frame);
// optional load an image
//frame = cvLoadImage("imagen3.png",CV_LOAD_IMAGE_COLOR );
cvSmooth(frame, frame, CV_GAUSSIAN,3,3);
IplImage* imgHSV = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvCvtColor(frame, imgHSV, CV_BGR2HSV); //Change the color format from BGR to HSV
IplImage* imgThresh = GetThresholdedImage(imgHSV);
cvShowImage("Ball", imgThresh);
cvShowImage("Video", frame);
//Clean up used images
cvReleaseImage(&imgHSV);
cvReleaseImage(&imgThresh);
cvReleaseImage(&frame);
//Wait 80mS
int c = cvWaitKey(80);
//If 'ESC' is pressed, break the loop
if((char)c==27 ) break;
}
cvDestroyAllWindows();
cvReleaseCapture(&capture);
return 0;
}
开发者ID:Cryptosports,项目名称:AHRobot,代码行数:55,代码来源:CHECK_HSV.cpp
示例12: init
/**
* Initialize images, memory, and windows
*/
void
init()
{
char* msg[] = { "Blink Detection 1.0",
"Copyright (c) 2009",
"http://nashruddin.com",
"Press 'q' to quit...",
"Press 'r' to restart...",
"Have fun!" };
int delay, i;
capture = cvCaptureFromCAM(0);
if (!capture)
exit_nicely("Cannot initialize camera!");
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, FRAME_WIDTH);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, FRAME_HEIGHT);
frame = cvQueryFrame(capture);
if (!frame)
exit_nicely("cannot query frame!");
cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.4, 0.4, 0, 1, 8);
cvNamedWindow(wnd_name, 1);
for (delay = 20, i = 0; i < 6; i++, delay = 20)
while (delay)
{
frame = cvQueryFrame(capture);
if (!frame)
exit_nicely("cannot query frame!");
DRAW_TEXT(frame, msg[i], delay, 0);
cvShowImage(wnd_name, frame);
cvWaitKey(30);
}
storage = cvCreateMemStorage(0);
if (!storage)
exit_nicely("cannot allocate memory storage!");
kernel = cvCreateStructuringElementEx(3, 3, 1, 1, CV_SHAPE_CROSS, NULL);
gray = cvCreateImage(cvGetSize(frame), 8, 1);
prev = cvCreateImage(cvGetSize(frame), 8, 1);
diff = cvCreateImage(cvGetSize(frame), 8, 1);
tpl = cvCreateImage(cvSize(TPL_WIDTH, TPL_HEIGHT), 8, 1);
if (!kernel || !gray || !prev || !diff || !tpl)
exit_nicely("system error.");
gray->origin = frame->origin;
prev->origin = frame->origin;
diff->origin = frame->origin;
cvNamedWindow(wnd_debug, 1);
}
开发者ID:exceptionhandle,项目名称:EyeBlink-KeySimulation,代码行数:58,代码来源:blink.c
示例13: cvSetCaptureProperty
bool VideoDevice::OpenDev()
{
cp=cvCreateCameraCapture(dev);
if (cp == NULL)
{
return false;
}
cvSetCaptureProperty(cp,CV_CAP_PROP_FRAME_WIDTH , 1620);
cvSetCaptureProperty(cp,CV_CAP_PROP_FRAME_HEIGHT, 1240);
return true;
}
开发者ID:laststar2014,项目名称:BBK,代码行数:11,代码来源:videodevice.cpp
示例14: cvSetCaptureProperty
void Camera::setSize(int w, int h)
{
// TODO: The following doesn't seem to work. OpenCV build issue?
// XXX: I hacked DEFAULT_V4L_WIDTH/HEIGHT in highgui/cvcap_v4l.cpp as a
// temporary fix for this problem. Video4Linux definitely needs patching.
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, (double)w);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, (double)h);
width = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
height = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
}
开发者ID:spsu,项目名称:image-research,代码行数:11,代码来源:Camera.cpp
示例15: main
int main(int argc, char* argv[])
{
CvSize size = cvSize(640,480);
CvCapture* capture = cvCaptureFromCAM(0);
if(!capture)
{
fprintf(stderr, "Error in opening the Camera.\n");
exit(1);
}
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 640);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 480);
cvNamedWindow("Camera", CV_WINDOW_AUTOSIZE);
cvNamedWindow("HSV", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Hue", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Saturation", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Value", CV_WINDOW_AUTOSIZE);
IplImage* frame = cvQueryFrame(capture);
if(!frame)
exit(1);
IplImage* hsv = cvCreateImage(size, IPL_DEPTH_8U, 3);
IplImage* hue = cvCreateImage(size, IPL_DEPTH_8U, 1);
IplImage* saturation = cvCreateImage(size, IPL_DEPTH_8U, 1);
IplImage* value = cvCreateImage(size, IPL_DEPTH_8U, 1);
while(1)
{
frame = cvQueryFrame(capture);
if(!frame)
{
fprintf(stderr, "Failed to capture an Image.\n");
break;
}
cvCvtColor(frame, hsv, CV_BGR2HSV);
cvSplit(hsv, hue, saturation, value, 0);
cvSmooth(hue, hue, CV_GAUSSIAN,9,9,0,0);
cvSmooth(saturation, saturation, CV_GAUSSIAN,9,9,0,0);
cvShowImage("Camera", frame);
cvShowImage("HSV", hsv);
cvShowImage("Hue", hue);
cvShowImage("Saturation", saturation);
cvShowImage("Value", value);
char c=cvWaitKey(33);
if(c == 27)
break;
}
cvDestroyAllWindows();
cvReleaseCapture(&capture);
cvReleaseImage(&frame);
cvReleaseImage(&hsv);
}
开发者ID:iitj,项目名称:Swarm_Robot,代码行数:53,代码来源:test.c
示例16: main
int main()
{
CvCapture* capture = cvCreateCameraCapture(1);
if(!capture)
{
printf("Camera error.\n");
return -1;
}
// set camera property
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, FRAMEWIDTH);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, FRAMEHEIGHT);
IplImage* frame = cvQueryFrame(capture);
IplImage* frame_prior = cvCreateImage(
cvGetSize(frame), frame->depth, frame->nChannels);
IplImage * diff12 = cvCreateImage(
cvGetSize(frame), frame->depth, frame->nChannels);
if(!frame)
{
return -1;
}
cvCopy(frame, frame_prior);
char c;
char file_name[128];
int count_frame = 0;
while( 1 )
{
frame = cvQueryFrame(capture);
if(!frame)
{
return -1;
}
cvAbsDiff(frame, frame_prior, diff12);
cvCopy(frame, frame_prior);
sprintf(file_name, "%sframe_%d.bmp", SAVEIMGDIR, count_frame++ );
cvSaveImage(file_name, frame);
printf("%d: %s\n", count_frame, file_name);
cvShowImage("diff", diff12);
c = cvWaitKey(50);
if(c == 27)
{
break;
}
}
cvDestroyAllWindows();
cvReleaseImage(&frame);
}
开发者ID:qdsclove,项目名称:LearningOpenCV_Exercises,代码行数:53,代码来源:main.cpp
示例17: cvSetCaptureProperty
bool MyCam::Init(const int iw, const int ih)
{
if(NULL == (m_cap = cvCreateCameraCapture(0)) || NULL ==cvQueryFrame(m_cap)){
return false;
}
else{
cvSetCaptureProperty(m_cap, CV_CAP_PROP_FRAME_WIDTH, iw);
cvSetCaptureProperty(m_cap, CV_CAP_PROP_FRAME_HEIGHT, ih);
w=iw, h=ih;
return true;
}
}
开发者ID:SPhoenixx,项目名称:PGROU,代码行数:12,代码来源:mycam.cpp
示例18: m_bSelfRefresh
CCameraThread::CCameraThread(CLineAdjustDlg *cLineAdj, CvCapture *pCamera, CMotorCtrl *pMotorCtrl, int index)
: m_bSelfRefresh(false)
, m_pTimer(0)
, m_bAdjust(false)
{
m_cLineAdj = cLineAdj;
m_pCamera = pCamera;
m_iIndex = index;
m_pMotorCtrl = pMotorCtrl;
cvSetCaptureProperty(m_pCamera, CV_CAP_PROP_FRAME_WIDTH, FRAME_MAX_WIDTH);
cvSetCaptureProperty(m_pCamera, CV_CAP_PROP_FRAME_HEIGHT, FRAME_MAX_HEIGHT);
}
开发者ID:peterzjin,项目名称:LineAdjust,代码行数:12,代码来源:CameraThread.cpp
示例19: cvSetCaptureProperty
void USBCamera::setImageSize(int width, int height)
{
Capture::setImageSize(width, height);
try
{
cvSetCaptureProperty(m_camera, CV_CAP_PROP_FRAME_WIDTH, m_frameWidth);
cvSetCaptureProperty(m_camera, CV_CAP_PROP_FRAME_HEIGHT, m_frameHeight);
}
catch(cv::Exception & ex)
{
throw OpenCVException(ex.msg.c_str());
}
}
开发者ID:FranciscMoldovan,项目名称:machinery,代码行数:13,代码来源:USBCamera.cpp
示例20: mvCamera
/** mvCamera methods **/
mvCamera:: mvCamera (unsigned cam_number) :
bin_resize ("mvCamera - resize"),
bin_getFrame ("mvCamera - getFrame")
{
//unsigned width, height;
//read_common_mv_setting ("IMG_WIDTH_COMMON", width);
//read_common_mv_setting ("IMG_HEIGHT_COMMON", height);
_capture = cvCreateCameraCapture (cam_number);
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_WIDTH, 400);
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_HEIGHT, 300);
_imgResized = mvGetScratchImage_Color();
}
开发者ID:JasonLiu0728,项目名称:MDA-Software,代码行数:14,代码来源:mgui.cpp
注:本文中的cvSetCaptureProperty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论