Frage

I need help related to following matlab code

[labelMap_1,num] = bwlabel(labelMap == 1);

labelMap1Stat = imfeature(labelMap_1,'Area','Centroid');

Inside opencv i found few threads that i must use bloblib for it.

But suppose if i dont want to use it for the sake of code because i need to port this code into android and i am concern about the size. How can i achieve the same thing without using blob library overhead.

If there is no solution then what are the methods inside bloblib that will produce the same result as these two functions??

Thanks in advance.

War es hilfreich?

Lösung

Try using functions related to contours like cvFindContours() .

This article provides some insights on how to use opencv for blobs.

You can calculate centroid information my using cvMoments() function. Then the center of mass is given by yc = M01 / M00, where M01 and M00 are fields in the structure returned by the Moments call.

Use cvContourArea() to find area.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top