Ask Your Question
0

How to classify Chain codes?

asked 2016-02-24 21:08:36 -0600

bob409 gravatar image

I have already extracted the shape descriptor chain code which is in the format CvChain* now I have to feed that into SVM for training. I need to convert CvChain* into Mat. Any idea on how to do this? Anyone who has used chain code as a feature extraction method can you tell me the approach you have used?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-02-25 02:03:59 -0600

berak gravatar image

updated 2016-02-25 02:08:47 -0600

i don't think, there's a straightforward way to do this at all.

first, you can't simply put a CvChain into a cv::Mat. even if you manage to extract the contents via c-api macros (shudder), this chain consists of a cvPoint, and freeman-chain bytes, so 2 totally different datatypes, which can't go into a single Mat.

then, each of your contours will have a different length, which is not acceptable input for machine learning.

image description

edit flag offensive delete link more

Comments

I have noticed that some people use PCA as an intermediate step between chain code and classification. Do you think this may be the correct way to do this?

bob409 gravatar imagebob409 ( 2016-02-25 02:48:16 -0600 )edit

PCA expects same-length rows, too.

berak gravatar imageberak ( 2016-02-25 03:20:03 -0600 )edit

maybe you can fill the shorter arrays with zeros, until you reach the length of the largest contour, stack them to a matrix, then pca-compress it back to somewhere between the shortest and largest, some sort of procrustes

berak gravatar imageberak ( 2016-02-25 03:25:05 -0600 )edit

hmm, maybe you'd even skip the location point from the data, to make it translation-invariant

berak gravatar imageberak ( 2016-02-25 03:31:04 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-24 21:08:36 -0600

Seen: 339 times

Last updated: Feb 25 '16