웹캠의 라이브 비디오에서 opencv의 가장자리 감지 기능을 구현하려고합니다. 그러나이 오류가 발생합니다 :라이브 비디오의 OpenCV Canny Edge
OpenCV 오류 : 알 수없는 함수, 파일 ........ \ ocv \ opencv \ src \ cv \ cvcanny.cpp 줄에 <>없는 형식 또는 형식 조합 66
이것이 형식 문제라고 생각합니다. 3 채널 8 비트 RGB 이미지를 1 채널 회색조 이미지 프레임으로 변환 한 다음 결과에서 가장자리 감지를 수행 할 수 있습니다. 그러나 이미지에 rgb2grayscale 변환도 구현할 수 없습니다. <이 전환 코드의 채널 수가 잘못되었습니다.>
아래 코드는 VS2008에서 구현 한 코드입니다. 이 오류를 해결하는 방법에 대한 의견이 있으십니까?
IplImage* gray_out = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);
IplImage* canny_out = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);
과에서 사용 :
#pragma once
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <conio.h>
#include <iomanip>
#include <cv.h>
#include <cvaux.h>
#include <cxcore.h>
#include <highgui.h>
#include <math.h>
#include <string.h>
#include <cxtypes.h>
using namespace std;
using namespace cv;
int main(int, char**)
{
cvNamedWindow("Edges", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCaptureFromCAM(0);
IplImage* frame;
while(1) {
frame = cvQueryFrame(capture);
int depth_img =frame->depth;
int height_img =frame->height;
int width_img =frame->width;
int size_img =frame->imageSize;
int nchan_img =frame->nChannels;
int nsize_img =frame->nSize;
cout << setw(15) << "depth" << depth_img << endl;
cout << setw(15) << "height" << height_img << endl;
cout << setw(15) << "width" << width_img << endl;
cout << setw(15) << "size" << size_img << endl;
cout << setw(15) << "nchan" << nchan_img << endl;
cout << setw(15) << "nsize" << nsize_img << endl;
IplImage* out = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvSmooth(frame, out, CV_GAUSSIAN, 11, 11);
cvCvtColor(out ,out, CV_RGB2GRAY);
cvCanny(out, out, 10, 10, 3);
if(!frame) break;
cvShowImage("Edge", out);
char c = cvWaitKey(33);
if(c == 27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Edge");
return 0;
}