Problem related to access chain code value [closed]

asked 2013-06-01 21:30:06 -0600

Nihad gravatar image

updated 2020-11-13 03:40:31 -0600

I am trying to extract contour from gray label image. My interest is I want to access/show numerical value of chain code. How can I do this? Here is my code segment.

int main(..)
{
  Mat src_gray;
  //read src_gray;
  Mat canny_output;
  vector<vector<Point> > contours;
  vector<Vec4i> hierarchy;
  int thresh=100; 

  /// Detect edges using canny
  Canny( src_gray, canny_output, thresh, thresh*2, 3 );
  /// Find contours
  findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_CODE, Point(0, 0) );

  ///Want to see chain code of contour here/How to access chain code value?

}
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-13 03:40:51.998511

Comments

Didn't know that CV_CHAIN_CODE even exists, since it's not listed in the docu...

Guanta gravatar imageGuanta ( 2013-06-02 14:15:51 -0600 )edit

Thanks. May be I need to use ApproxChain class.

Nihad gravatar imageNihad ( 2013-06-02 19:34:03 -0600 )edit

@Guanta is there any function in current version which can represent contour as chain code?

Nihad gravatar imageNihad ( 2013-06-04 19:35:05 -0600 )edit

I think a chain-code representation doesn't exist or at least I don't know of it. Is it that important? findContours() gives you all the contours as vector of points which you can then process further.

Guanta gravatar imageGuanta ( 2013-06-05 03:08:59 -0600 )edit

Chain code is a kind of boundary descriptor. We can produce it from contour points. No problem if there is no function available. I need to develop code. Cheers!!

Nihad gravatar imageNihad ( 2013-06-05 05:31:15 -0600 )edit

i am also have the same problem to get the chain code,if you have some solution then plaese post it

sujay gravatar imagesujay ( 2014-03-11 08:27:00 -0600 )edit