Discussion:
Regarding pixel values
Khader Shameer
2011-05-20 18:11:50 UTC
Permalink
ImageMagicians:

Is there any routine to get the entire pixel values for a given image using
ImageMagick ?
I would like to find the various (say 99th, 1st percentile) for images.

Please let me know,
Thanks,
Shameer
Fred Weinhaus
2011-05-20 19:09:13 UTC
Permalink
try

convert image txt:

or

convert image textfile.txt

see http://www.imagemagick.org/Usage/files/#txt
Post by Khader Shameer
Is there any routine to get the entire pixel values for a given image using
ImageMagick ?
I would like to find the various (say 99th, 1st percentile) for images.
Please let me know,
Thanks,
Shameer
Fred Weinhaus
2011-05-20 19:12:29 UTC
Permalink
Can you clarify what you mean by:

"I would like to find the various (say 99th, 1st percentile) for images."

Are you talking about percentile from a histogram or pixel with those
graylevel values from the image?

If the latter, you an make masks by thresholding at those percentages
and use that to mask the image so that ony those percentiles are
showing and the rest are transparent, for example.
Post by Khader Shameer
Is there any routine to get the entire pixel values for a given image using
ImageMagick ?
I would like to find the various (say 99th, 1st percentile) for images.
Please let me know,
Thanks,
Shameer
Khader Shameer
2011-05-21 04:03:11 UTC
Permalink
Thanks a lot Fred. I will check the options you have suggested.

I want to calculate 99th percentile value of the image and the 1st
percentile of the image using the pixels and use these percentiles to level
the image using black, white, and gamma. I will use 99th percentile as
black, 1st percentile as white and gamma =1.

Do you know about any alternative method which can do this ?

Please let me know,
Thanks,
Shameer
Post by Fred Weinhaus
"I would like to find the various (say 99th, 1st percentile) for images."
Are you talking about percentile from a histogram or pixel with those
graylevel values from the image?
If the latter, you an make masks by thresholding at those percentages
and use that to mask the image so that ony those percentiles are
showing and the rest are transparent, for example.
Post by Khader Shameer
Is there any routine to get the entire pixel values for a given image
using
Post by Khader Shameer
ImageMagick ?
I would like to find the various (say 99th, 1st percentile) for images.
Please let me know,
Thanks,
Shameer
_______________________________________________
Magick-users mailing list
http://studio.imagemagick.org/mailman/listinfo/magick-users
Wolfgang Hugemann
2011-05-21 08:41:33 UTC
Permalink
Post by Khader Shameer
Do you know about any alternative method which can do this ?
Sounds like you are trying to do something that is already built into
IM, try something like:

convert MyPhoto.jpg -contrast-stretch 2,2% -auto-gamma MyBetterPhoto.jpg

Wolfgang
Fred Weinhaus
2011-05-21 16:42:30 UTC
Permalink
The function you want is called -contrast-stretch. You can provide
percentile values to clip either end of the histogram and then it
stretches the histogram and image linearly between those values
converted to graylevels. You can stretch the image channels together
or separately. The latter is done by using -channels rgb prior to
-contrast-stretch.

To stretch the image linearly and all channels together by 1% on the
low side and 1% (at the 99% percent) on the high side, it would be

convert image -contrast-stretch 1,1% resultimage

see
http://www.imagemagick.org/Usage/color_mods/#contrast-stretch

http://www.imagemagick.org/script/command-line-options.php?ImageMagick=4dk567trius4djjoe7fimpst40#contrast-stretch

Fred
Post by Khader Shameer
Thanks a lot Fred. I will check the options you have suggested.
I want to calculate 99th percentile value of the image and the 1st
percentile of the image using the pixels and use these percentiles to level
the image using black, white, and gamma. I will use 99th percentile as
black, 1st percentile as white and gamma =1.
Do you know about any alternative method which can do this ?
Please let me know,
Thanks,
Shameer
Khader Shameer
2011-05-22 02:55:15 UTC
Permalink
Dear Fred / Wolfgang:
Thanks a lot.

I was looking for -contrast-stretch option.
That worked perfectly for me.

Thanks,
Shameer
Post by Fred Weinhaus
The function you want is called -contrast-stretch. You can provide
percentile values to clip either end of the histogram and then it
stretches the histogram and image linearly between those values
converted to graylevels. You can stretch the image channels together
or separately. The latter is done by using -channels rgb prior to
-contrast-stretch.
To stretch the image linearly and all channels together by 1% on the
low side and 1% (at the 99% percent) on the high side, it would be
convert image -contrast-stretch 1,1% resultimage
see
http://www.imagemagick.org/Usage/color_mods/#contrast-stretch
http://www.imagemagick.org/script/command-line-options.php?ImageMagick=4dk567trius4djjoe7fimpst40#contrast-stretch
Fred
Post by Khader Shameer
Thanks a lot Fred. I will check the options you have suggested.
I want to calculate 99th percentile value of the image and the 1st
percentile of the image using the pixels and use these percentiles to
level
Post by Khader Shameer
the image using black, white, and gamma. I will use 99th percentile as
black, 1st percentile as white and gamma =1.
Do you know about any alternative method which can do this ?
Please let me know,
Thanks,
Shameer
_______________________________________________
Magick-users mailing list
http://studio.imagemagick.org/mailman/listinfo/magick-users
Continue reading on narkive:
Loading...