Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convert sequentially camera image to gray scale image

hi all,

i am new in programming in OpenCv.

i am not able to do cvCvtcolor command for the sequential images which is captured by cameraCapture command. please do needful.

Thank you in advanced..

my code is here...(I don't get compilation error.. but not get output images..)

//////////////////////////////////////////////////////////////////////// int c=1; IplImage* img=0; char buffer[2000]; CvCapture* cv_cap=cvCaptureFromCAM(1); cvNamedWindow("Video",CV_WINDOW_AUTOSIZE); while(1) { img=cvQueryFrame(cv_cap); cvShowImage("Video",img); cvCvtColor(img,img,CV_RGB2GRAY);

sprintf(buffer,"D:/1/ImageName%u.jpg",c);

cvSaveImage(buffer,img);

c++; if (cvWaitKey(100)== 27) break; }

cvDestroyWindow("Video"); return 0; }

convert sequentially camera image to gray scale image

hi all,

i am new in programming in OpenCv.

i am not able to do cvCvtcolor command for the sequential images which is captured by cameraCapture command. please do needful.

Thank you in advanced..

my code is here...(I don't get compilation error.. but not get output images..)

//////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int c=1; IplImage* img=0; char buffer[2000]; CvCapture* cv_cap=cvCaptureFromCAM(1); cvNamedWindow("Video",CV_WINDOW_AUTOSIZE); while(1) { img=cvQueryFrame(cv_cap); cvShowImage("Video",img); cvCvtColor(img,img,CV_RGB2GRAY);

sprintf(buffer,"D:/1/ImageName%u.jpg",c);

cvSaveImage(buffer,img);

c++; if (cvWaitKey(100)== 27) break; }

cvDestroyWindow("Video"); return 0; }

click to hide/show revision 3
the "101010" button is your friend ! use it !

updated 2013-06-07 05:04:04 -0600

berak gravatar image

convert sequentially camera image to gray scale image

hi all,

i am new in programming in OpenCv.

i am not able to do cvCvtcolor command for the sequential images which is captured by cameraCapture command. please do needful.

Thank you in advanced..

my code is here...(I don't get compilation error.. but not get output images..)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int c=1;
IplImage* img=0;
char buffer[2000];
CvCapture* cv_cap=cvCaptureFromCAM(1);
cvNamedWindow("Video",CV_WINDOW_AUTOSIZE);
while(1) {
     img=cvQueryFrame(cv_cap);
  cvShowImage("Video",img);
  cvCvtColor(img,img,CV_RGB2GRAY);

cvCvtColor(img,img,CV_RGB2GRAY); sprintf(buffer,"D:/1/ImageName%u.jpg",c);

sprintf(buffer,"D:/1/ImageName%u.jpg",c);

cvSaveImage(buffer,img);

cvSaveImage(buffer,img);

c++; if (cvWaitKey(100)== 27) break; }

}

cvDestroyWindow("Video"); return 0; }

}