You are here

Gimp for image analysis

First time around here, and I'm hoping you guys can help me out.

I have a bunch (512) images like the attached file. If you don't care to look, It's just a set of vertical (or horizontal) lines of varying length.

I need to measure the length of each line in pixels and export that to a text file, spreadsheet, etc. If there is an existing plugin for Gimp (or ImageJ, or anything else) that would be F A N T A S T I C. If not, how difficult would it be to craft a plugin that does this, for someone with a small (very small) amount of programming knowledge?

Thanks in advance-

38-4b.jpg62.94 KB

Plugin for Gimp for image analysis is not easy, another program pixcavator ia can give you one good example.

There is a measure tool (the toolbar button has a divider image on it), but measuring by hand is lots of work for hundreds of images. To automate a measurement there is also the gimp_selection_bounds giving you rectangular bounds of a selection, which might help. Find it under Xtns -> Procedure Browser. The gimp_by_color_select might help select the lines, but then you have to figure out how to reduce the selection down to just one of the many lines in the image. There are probably other built-in proceedures than those two for what you want to do. To save the data to a file, then don't use Script-fu (the Scheme language) because it has limitations, like not being able to write to a file. Learn at least the basics of one of the other languages. It will take some real work to sort everything out. Post a message with your thoughts about this.

I have written a crude script which somewhat accomplishes this task: The script appears under "Filters->Misc->Count Dashes..." and produces a text output file which is a list of the lengths of the dashes. For the sample image, the output would appear as: (14.5 15.5 13 9 11.5 10.5 8.333333333 12 11 10.5 8.666666667 12.5 23.5 16.5 10 13 18.5 19 12.66666667 10.5 11.33333333 12 11 12 12 12 11 14 11 9.5 15 13.5 12 11.5 10.5 13 11 12 14 11 15 13 10.5 14 13.5 15.5 14 13.5 13.5 11 13 14 14.5 16.5 11.66666667 15.5 12.5 15 15 17.5 13.5 14 14.5 17 14.5 15.5 15.33333333) The script assumes black dashes on a white background and that each dash is separated from the next by at least one row (or column, if the "Vertical?" option is checked) of white pixels. The value for a dash is the average of the black pixel count for the vertical strip of pixels -- this value can be confused by dashes that are not precisely horizontal (or vertical, with Vertical? option). JPEG files should be avoided because their compression algorithm introduces artifacts along the dashes' edges. I would recommend using PNG files.
Subscribe to Comments for "Gimp for image analysis"