opencv1.0+vc++图像处理CV_IMWRITE_JPEG_QUALITY没定义?

在做图像处理时,保存图片时显示出错,没定义,代码如下:
#include "stdafx.h"
#include "highgui.h"
#include "cxcore.h"
#include "cv.h"
#include "iostream.h"

int main()

{

CvCapture* capture = cvCaptureFromCAM(0);

CvVideoWriter* video = NULL;

IplImage* frame = NULL;

IplImage* pSaveFrame = NULL;

char filename[20];  
int i = 0;  
int p[3];  
p[0] = CV_IMWRITE_JPEG_QUALITY;  
p[1] = 255;  //质量值    
p[2] = 255;  

int n;  
if (!capture) //如果不能打开摄像头给出警告  
{  
    cout << "Can not open the camera." << endl;  
    return -1;  
}  
else  
{  
    frame = cvQueryFrame(capture); //首先取得摄像头中的一帧  
    video = cvCreateVideoWriter("camera.avi",  
        CV_FOURCC('X','V','I','D'),  
        25,  
        cvSize(frame->width, frame->height)); //创建CvVideoWriter对象并分配空间  

    //保存的文件名为camera.avi,编码要在运行程序时选择,大小就是摄像头视频的大小,帧频率是32  
    if (video) //如果能创建CvVideoWriter对象则表明成功  
    {  
        cout << "VideoWriter has created." << endl;  
    }  
    cvNamedWindow("Camera Video", 1); //新建一个窗口  
    while (i<200)  
    {  
        frame = cvQueryFrame(capture); //从CvCapture中获得一帧  

        if (!frame)  
        {  
            cout << "Can not get frame from the capture." << endl;  
            break;  
        }  

        n = cvWriteFrame(video, frame); //判断是否写入成功,如果返回的是1,表示写入成功  
        cout << n << endl;  

        cvShowImage("Camera Video", frame); //显示视频内容的图片  

        pSaveFrame = cvCreateImage(cvSize(frame->width, frame->height),  
            frame->depth,  
            frame->nChannels);  
        sprintf(filename, "%d.jpg", i);  
        i++;  
        cvResize(frame, pSaveFrame, CV_INTER_LINEAR);  
        cvSaveImage("F://zhao.jpg", pSaveFrame);  
        cvReleaseImage(&pSaveFrame);  

        if (cvWaitKey(1)>0) break; //有其他键盘响应,则退出  
    }  
    cvReleaseVideoWriter(&video);  
    cvReleaseCapture(&capture);  
    cvDestroyWindow("Camera Video");  
}  
return 0; 
    求大神帮忙

1个回答

p[0] = CV_IMWRITE_JPEG_QUALITY;

p[1] = 255; //质量值

p[2] = 255;

这三个东西你在哪里用到的?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问