2017-05-16 17 views
0

으로 인해 opencv에서 런타임 오류가 발생했습니다. 카메라에서 원형 영역을 감지하려고했습니다. 또한 문서에있는 그대로 코드를 복사했지만 여전히 런타임 오류가 발생합니다. 어설 션이 실패 "(반경> = 0 & & 두께 < = MAX_THICKNESS & & 0 < = 이동 & & 변화 < = XY_SHIFT) CV : 원, 파일 C : \ 빌드 \의 master_winpack-구축하는 Win64-vc14 \ OpenCV의 \ modules \ imgproc \ src \ drawing.cpp, 줄 1877 " 더하기 "opencv_trial.exe의 0x00007FF913AB3C58에서 처리되지 않은 예외 : Microsoft C++ 예외 : 메모리 위치 0x00000070F96EEF30의 cv :: 예외. "opencv를 처음 사용하면서 houghCircles()

내 코드는 다소 같다 : (waitKey (5) == 27) {

break; 
} 
} 
return 0; 

}

내가 houghcircle을 제거하면 경우

int main() { 
Mat image;  //matrice for original image 
Mat image_hsv; //matrice for hsv image 
Mat image_gray; 
Mat red_hue_image; //matrice for binary image 
VideoCapture cap; 
int camOpen = cap.open(CV_CAP_ANY); 

vector<Vec3f> circles; 

while (true) { 
cap >> image;   //intake the input of camera 
if(!image.empty()) //check if camera is working 
{ 
    imshow("window", image);   //showing of image 
    cvtColor(image,image_hsv,CV_RGB2HSV);  // conversion of rgbimage to hsv 
    cvtColor(image,image_gray,CV_RGB2GRAY); 
    GaussianBlur(image_hsv,image_hsv,Size(9,9),2,2); 
    imshow("hsv",image_hsv);     //showing of hsv image  
    imshow("gray",image_gray); 
    inRange(image_hsv,Scalar(110,100,100),Scalar(130,255,255),red_hue_image);   //binary-ing for red color to be white, all others black  
    imshow("processed image",red_hue_image); 
    /////////////////////////////////////////////////// 

    HoughCircles(image_gray,circles,CV_HOUGH_GRADIENT,1.0,image_gray.rows/8,100,100,0,1000); 
    for(size_t i=0; i<circles.size();i++) 
    { 
     Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); 
    int radius = cvRound(circles[i][2]); 
    // draw the circle center 
    circle(image_gray, center, 3, Scalar(0,255,0), -1, 8, 0); 
    // draw the circle outline 
    circle(image_gray, center, radius, Scalar(0,0,255), 3, 8, 0); 

    Vec3i c = circles[i]; 
    circle(image, Point(c[0], c[1]), c[2], Scalar(0,0,255), 3, LINE_AA); 
    circle(image, Point(c[0], c[1]), 2, Scalar(0,255,0), 3, LINE_AA); 
    } 
    imshow("circles", image); 
} 

가 //이 33ms 지연 라인, 나는 어떤 런타임 오류를 얻지 않으며 내 camerea 열어 볼 수 있습니다. 그 행과 함께 프로그램이 충돌합니다. 제발, 아무도 도와 줄 수 있습니까?

답변

0

HoughCircles(image_gray,circles,CV_HOUGH_GRADIENT,1.0,image_gray.rows/8,100,100,0,1000); 

구체적 마지막 2 개 파라미터 ... 최소 반경과 최대 반경

이 값 노력이 함수는 작은 같은

HoughCircles(image_gray,circles,CV_HOUGH_GRADIENT,1.0,image_gray.rows/8,100,20,0,0); 
+0

I, 즉도 시도 하지만 만약 내가 파라 미터에서 동그라미를 제거하고 추가 할 수 있습니다 (즉, 논리적으로 잘못 알고) image_gray 말할 수있는, 어떤 런타임 오류를주지 않습니다. 그래서 저는 서클 때문에 오류가오고 있다고 생각합니다. 그러나 내가 말했듯이, 나는 새로운 것이므로 많은 생각이 없습니다. 대답 해줘서 고마워 :) –