Need to count how many pixels are MORE blue than red
Posted: 2014-12-28T15:29:19-07:00
I need to count how many pixels in an image (I would prefer the answer reduced to a RATIO from 0 to 1) are "MORE blue than yellow." I have a rectangle PNG file. So for example if the file contained 50% blue pixels and 50% green pixels, the result should be 0.5 since green is an equal amount of blue and yellow, but I only want to count when a pixel is MORE blue than yellow.
I know some of you will think "how about just looking at the total amount of blue and yellow in the picture and make a ratio from that?" That is not going to work for me at all. I need the ratio determined from a pixel-by-pixel comparison for each pixel in the image.
I did look though some of the examples pages on this website. I couldn't find anything that solved my problem.
Also, I have a brand new iMac (5K), and the ImageMagick build that I just downloaded doesn't do anything. Here's what happens: (looks like how I used to do it on my Mac Pro)
I know some of you will think "how about just looking at the total amount of blue and yellow in the picture and make a ratio from that?" That is not going to work for me at all. I need the ratio determined from a pixel-by-pixel comparison for each pixel in the image.
I did look though some of the examples pages on this website. I couldn't find anything that solved my problem.
Also, I have a brand new iMac (5K), and the ImageMagick build that I just downloaded doesn't do anything. Here's what happens: (looks like how I used to do it on my Mac Pro)
Code: Select all
$ export MAGICK_HOME="$HOME/Applications/ImageMagick-6.9.0"
$ export PATH="$MAGICK_HOME/bin:$PATH"
$ export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"
$ ./convert
dyld: Library not loaded: /ImageMagick-6.9.0/lib/libMagickCore-6.Q16.2.dylib
Referenced from: /Applications/ImageMagick-6.9.0/bin/./convert
Reason: image not found
Trace/BPT trap: 5
$