Detección de la mancha más grande en una imagen binaria
Frecuentes
Visto 1,636 veces
1
I want to detect the largest BLOB in a binary image for my project. can you please guide me on how can I do this?
Muchas Gracias
3 Respuestas
5
Utilice las findContours
to find all blobs in image and using contourArea
you can calculate blob's area. So just find contour (blob) with biggest area.
Respondido 28 ago 12, 12:08
hi Astor, Thanks Alot for your advice. It really helped a lot. I used the find contours method and found out the largest contour for the image of a person in a uniform background. But instead of the person being the largest contour it considers the background as the largest contour. and for some images it leaves out some empty blobs. Can you please help me figure out why this is happening and how can i fill in those holes which are inside the persons body. Sorry for bad xplanation. I hope you understand my problem. - user1606191
0
I don't know what is the best practice here, but I'd do it somehow like this:
- First find all blobs. You could use cvBlobslib or cvBlob or findContours etc.
Then store all blobs in vector. Sort your vector by blobs' area. And then get the last blob.
bool sortBlobsASC(CBlob first, CBlob second) { return first.Area() < second.Area(); }
std::sort(myvec.begin(), myvec.end(), sortBlobsASC);
Respondido 28 ago 12, 12:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c image-processing opencv or haz tu propia pregunta.
A good point of start would be the CVBloblib opencv.willowgarage.com/wiki/cvBlobsLib - jlengrand