Average location
Posted: 2015-03-20T05:28:06-07:00
I'm trying to use ImageMagick to find the location of a calibration target in an image. I've written enough code to output a b&w (i.e. bilevel, not grayscale) image, which looks like a small black square on a giant white background. I've used the following code to find the location of the all of the black pixels:
which gives me a text file with <1000 coordinates (the sqaure is about 30x30). However, I'd ideally like the x coordinates average and the y coordinates average to tell me "average location" of the square (i.e. its centre). Is there any way to get IM to output these two coordinates? Thanks!
Code: Select all
identify -precision 5 -define identify:locate=minimum -define identify:limit=1000 calibrationtarget.png 2>results.txt