Answer the question
In order to leave comments, you need to log in
What is wrong in my c++ (opencv) code?
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
IplImage* frame=0;
CvCapture* CAMERA_VIEW = cvCreateCameraCapture(0);
assert( CAMERA_VIEW );
cvSetCaptureProperty(CAMERA_VIEW, CV_CAP_PROP_FRAME_WIDTH, 720);
cvSetCaptureProperty(CAMERA_VIEW, CV_CAP_PROP_FRAME_HEIGHT, 640);
cvNamedWindow("С камеры", CV_WINDOW_AUTOSIZE);
while(true){
frame = cvQueryFrame( CAMERA_VIEW );
cvShowImage("С камеры", frame);
char c = cvWaitKey(33);
if (c == 27) {
break;
}
}
cvReleaseCapture( &CAMERA_VIEW );
cvDestroyWindow("С камеры");
return 0;
}
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
IplImage* frame=0;
CvCapture* CAMERA_VIEW = cvCreateCameraCapture(0);
assert( CAMERA_VIEW );
cvSetCaptureProperty(CAMERA_VIEW, CV_CAP_PROP_FRAME_WIDTH, 720);
cvSetCaptureProperty(CAMERA_VIEW, CV_CAP_PROP_FRAME_HEIGHT, 640);
cvNamedWindow("С камеры", CV_WINDOW_AUTOSIZE);
while(true){
frame = cvQueryFrame( CAMERA_VIEW );
IplImage* frame_hsv=0;
frame_hsv = cvCvtColor( frame, CV_BGR2HSV );
cvShowImage("С камеры", frame);
char c = cvWaitKey(33);
if (c == 27) {
break;
}
}
cvReleaseCapture( &CAMERA_VIEW );
cvDestroyWindow("С камеры");
return 0;
}
Answer the question
In order to leave comments, you need to log in
frame_hsv = cvCvtColor( frame, CV_BGR2HSV );
should be like this:
Dock:
docs.opencv.org/2.4/modules/imgproc/doc/miscellane...
The C prototype of this function is --
void cvCvtColor(const CvArr* src, CvArr* dst, int code)
-- what to convert, where to put the result and how to convert. For C++ --void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0 )
, the meaning of the required parameters is the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question