0
나는이 질문이 많은 횟수를 물어 봤고 답변을 구현하려고하지만 내 코드에서 예외가 발생하고 있음을 알고 있습니다.opencv C++ HSV 이미지 채널 분리 예외
OS : 윈도우 7 OpenCV의 : TrackColour에 0x62B978C9 (opencv_core249.dll)에서 "처리되지 않은 예외 :
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
VideoCapture cap(0); //capture the video from webcam
if (!cap.isOpened()) // if not success, exit program
{
cout << "Cannot open the web cam" << endl;
return -1;
}
Mat imgHSV;
_sleep(100); //give the camera a chance to wake up
while (true)
{
Mat imgOriginal;
bool success = cap.read(imgOriginal);
if (!success) //if not success, break loop
{
cout << "Cannot read a frame from video stream" << endl;
break;
}
cvtColor(imgOriginal, imgHSV, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
vector<Mat> hsv_planes;
split(imgHSV, hsv_planes);
//hsv_planes[0] // H channel
//hsv_planes[1] // S channel
//hsv_planes[2] // V channel
imshow(thresholded_window, hsg_planes[2]); //show the S channel
if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
return 0;
}
예외가 분할 선에 발생합니다 : 2.4.9 여기
내 코드입니다 .exe : 0xC0000005 : 0xFEEEFEEE 위치를 쓰는 액세스 위반. "