2012-04-28 1 views
0

참고 : StackOverflow는 내 자신의 질문에 답할 수 없으므로 여기에 응답하고 있습니다. 내 대답을 보려면 아래로 스크롤하십시오.OpenCV : cvContourBoundingRect는 "심볼을 찾을 수 없음"을 제공합니다. 다른 윤곽선 함수는 잘 작동합니다.

QUESTION 이진 이미지가 주어지면 어떤 영역이 가장 큰 y 좌표를 갖고 있는지, 즉 어떤 영역이 가장 가까운 영역에 가장 가까운지를 식별 할 수 있기를 원합니다. 아래 함수에서 윤곽선과 경계 사각형을 사용하여 필요한 답변을 얻으려고합니다. 그러나, 기능 cvContourBOundingRect 내 사용 컴파일하는 동안 다음과 같은 오류 메시지를 일으킨다 :

"_cvContourBoundingRectemphasized", referenced from: 
GetLowestContourBoundingRectangle(_IplImage * img, bool) 
in main.o. Symbol(s) not found. Collect2: Id returned 1 exit status. 
Build Failed. 

이 내가 성공적으로 아무 문제없이 cvFindContours 및 cvContourArea 같은 다른 윤곽선 기능을 사용하고 있기 때문에, 아주 이상하다. Google에서 일부 검색을 실행했지만 아무 것도 나타나지 않았습니다. 누군가가 올바른 방향으로 나를 가리킬 수 있다면 나는 그것을 감사 할 것입니다.

미리 감사드립니다.

CvRect GetLowestContourBoundingRectangle(IplImage *img, bool invertFlag) { 
    // NOTE: CONTOURS ARE DRAWN AROUND WHITE AREAS 
    IplImage *output = invertFlag ? cvCloneImage(InvertImage(img)) : cvCloneImage(img); // this goes into find contours and is consequently modified 

    // find contours 
    CvMemStorage *contourstorage = cvCreateMemStorage(0); 
    CvSeq* contours = NULL; 
    cvFindContours(output, contourstorage, &contours, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); 

    // analyze each contour 
    int lowestRectangleCoordinate = 0; 
    CvRect currentBoundingRectangle; 
    CvRect lowestBoundingRectangle; 

    while (contours) { 
     currentBoundingRectangle = cvContourBoundingRect(contours); 
     if (currentBoundingRectangle.y + currentBoundingRectangle.height > lowestRectangleCoordinate) { 
      lowestRectangleCoordinate = currentBoundingRectangle.y + currentBoundingRectangle.height; 
      lowestBoundingRectangle = currentBoundingRectangle; 
     } 

     contours = contours->h_next; 
    } 

    cvReleaseMemStorage(&contourstorage); 
    return lowestBoundingRectangle; 
} 

답변 : 좋아, 아이러니하게도 나는 그것이 (공정성에 나는이 시점에서 몇 시간 동안이 씨름 한 적이 있지만) 내 원래의 질문에 초안을 작성 직후 깨고 이유를 발견했다. - imgproc_c.h

  • cvContourArea - imgproc_c.h
  • cvContourBoundingRect -의 compat

    1. cvFindContours :

      나는 다음과 같은 세 가지 기능을 각각 정의 된있는 헤더 파일을 보였다. hpp

    compat.hpp는 이전 버전과의 호환성을 위해 유지되는 비표준 함수에 대한 것 같습니다. 여기에 헤더로 작성 내용은 다음과 같습니다 말했다와

    /* 
        A few macros and definitions for backward compatibility 
        with the previous versions of OpenCV. They are obsolete and 
        are likely to be removed in future. To check whether your code 
        uses any of these, define CV_NO_BACKWARD_COMPATIBILITY before 
        including cv.h. 
    */ 
    

    을, 사람이 실제로 비 사용되지 않는 정의가이 기능을 쓰기에 대해 갈 수있는 방법을 알고 있습니까?

  • 답변

    1

    "OpenCV : cvContourBoundingRect"는 "기호를 찾을 수 없음" "을 제공합니다.

    +1

    하고 "새로운"libopencv_legacy.so이 하나 다음과 같습니다 :

    도서관이 (사용되지 않음) 방법으로 연결하는 데 사용하는이 하나입니다 boundingRect (InputArray 점) ¶ –