php - Cleaning pixels from a map -
we have map, need use php take shades of blue out, percentages. problem is, of percentages in same color borders, , other times, percentages go border. need use image.
there not (afaik) easy ways.
the easiest way doesn't give results: separate channels , delete small components.
the result this:
as can see there few numbers , percent signs remaining because connected delimiting lines , deleting small components doesn't work them.
if need better job, should correlate image template of each number, , once identified, delete it.
here can see result of correlation number "2":
one wrong "2" identified, (see top left), more sophisticated approach may needed general procedure.
anyway, think these kind of manipulation beyond can expect k-12.
hth!
edit
as per request, detail first method.
you first separate 3 channels, , 3 images:
you keep third (the blue channel)
then need delete smaller components. there lot of methods that, easiest derived connectivity detection example in flood-fill algorithm, measure components without filling them.
basic (not optimized) idea travel every pixel in image , count how many pixels "connected" it. if there less specified number (threshold), delete whole set. image manipulation libraries have these functions implemented.
Comments
Post a Comment