Any ideas on how to remove small abandoned pixel in a png using OpenCV or other algorithm? -
i got png image this:

the blue color represent transparent. , circle pixel group. so, find biggest one, , remove small pixel, not group biggest one. in example, biggest 1 red colour circle, , retain it. green , yellow small, remove them. after that, have this:
ideas? thanks.
if consider size of objects, use following algorithm: labellize connex components of mask image of objects (all object pixels white, transparent ones black). compute areas of connex components, , filter them. @ step, have label map , list of authorized labels. can read label map , overwrite mask image setting every pixel white if has authorized label.
opencv not seem have labelling function, cvfloodfill can same thing several calls: each unlabeled white pixel, call floodfill pixel marker. can store result of step in array (of size of image) assigning each newly assigned pixel label. repeat long have unlabellized pixels.
else can recode connex component function binary images, algorithm known , easy implement (maybe start matlab's bwlabel).
Comments
Post a Comment