Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

image statistics

by vacant (Pilgrim)
on Dec 04, 2004 at 03:28 UTC ( [id://412339]=perlquestion: print w/replies, xml ) Need Help??

vacant has asked for the wisdom of the Perl Monks concerning the following question:

Your humble servant begs the Learned Monks to cast a pearl or two in answer to the following:

My current project requires collecting a few standard statistical values about the pixels in an image. Typical values are the mean, average, mode, and variation of the population of pixels in a particular region of the image, such as the whole image, the border, the center region, and so on.

I have done most of the needed calculations by converting the image to a ".txt" format with ImageMagick and operating on the resulting text file. It seems likely there is a more efficient way to do this, but I have not been able to find (or, maybe, understand) a better already-invented method. Is there a Perl module that can handle an image as a complex array of integer values? Is there some better way of using ImageMagick for this? Also, is there a Perl module that can do standard statistical operations on a three-dimensional matrix?

Best regards

Replies are listed 'Best First'.
Re: image statistics
by Fletch (Bishop) on Dec 04, 2004 at 03:37 UTC

    You might can get PDL to do what you want as far as multi-dimensional arrays, but it's probably going to take some conversions with ImageMagick to get things into a format that PDL will understand.

      You don't need ImageMagick; the supplied NetPBM interface in PDL::IO::Pic should be able to do anything ImageMagick can.
Re: image statistics
by dondelelcaro (Monk) on Dec 04, 2004 at 05:49 UTC
    Is there a Perl module that can handle an image as a complex array of integer values? Is there some better way of using ImageMagick for this?
    Assuming the image you're using is supported by imlib2, you're probably better off using Image::Imlib2 and it's query_pixel function.

    As far as statistics go, PDL is a common choice, or you could use Statistics::Basic or go even more complex, and send the data to R.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://412339]
Approved by Yendor
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found