Histogram from mono compare output
Posted: 2012-04-22T17:40:12-07:00
I am comparing two images using
This works great when I look at the output, but I want to read the value of the difference into a program by counting the number of white pixels / calculating ratio of white to black.
When I get the histogram of the compare output file, it isn't pure black and white. There are a number of nearly black and nearly white pixels:
I've tried using -threshold, -black-threshold, -contrast-stretch, -fill, but I can't convert it to be just black and white.
Is there something I've done in the compare function that makes it impossible to reduce to B&W? Or is that correct and I should do a second conversion to get to B&W - if so, how?
Thanks.
Code: Select all
compare -metric AE -fuzz 35% f1.jpg f2.jpg -highlight-color white -lowlight-color black -compose src im_compare.jpg
When I get the histogram of the compare output file, it isn't pure black and white. There are a number of nearly black and nearly white pixels:
Code: Select all
38325: ( 0, 0, 0) #000000 black
1169: ( 1, 1, 1) #010101 rgb(1,1,1)
763: ( 2, 2, 2) #020202 rgb(2,2,2)
395: ( 3, 3, 3) #030303 grey1
139: ( 4, 4, 4) #040404 rgb(4,4,4)
62: ( 5, 5, 5) #050505 grey2
21: ( 6, 6, 6) #060606 rgb(6,6,6)
5: ( 7, 7, 7) #070707 rgb(7,7,7)
1: (248,248,248) #F8F8F8 rgb(248,248,248)
4: (249,249,249) #F9F9F9 rgb(249,249,249)
29: (250,250,250) #FAFAFA grey98
63: (251,251,251) #FBFBFB rgb(251,251,251)
143: (252,252,252) #FCFCFC grey99
324: (253,253,253) #FDFDFD rgb(253,253,253)
551: (254,254,254) #FEFEFE rgb(254,254,254)
2006: (255,255,255) #FFFFFF white
Is there something I've done in the compare function that makes it impossible to reduce to B&W? Or is that correct and I should do a second conversion to get to B&W - if so, how?
Thanks.