php - Determine if an image is of "blank" paper -


we making tool allow chain of photos taken. mixed in real photos photos of blank sheets of paper. want separate series of photos identifying images of blank pages.

i'm trying find way identify blank sheet. either counting colors, or other method. maybe filesize?

i've got graphicsmagick, maybe there's useful there, , code in php, in if works well.

you may fine number of colours, uneasy working - though hard without more sample images. if run difficulties that, might @ histograms of 2 items - paper , "not paper".

paper

enter image description here

not paper

enter image description here

you can see paper histogram has steep sides , no tails, whereas "not paper" histogram has fatter tails. kurtosis of image measure of - fatness of tails. higher kurtosis means more of variance in image result of infrequent extreme deviations, opposed frequent modestly sized deviations. expect "not paper" have higher kurtosis because has "lumps" of other stuff in image rather uniform paper.

if imagemagick report kurtosis of 2 images can see marked difference.

identify -verbose notpaper.jpg | grep -e "kurtosis:|red:|green:|blue:|overall"     red:       kurtosis: 1.03434     green:       kurtosis: 1.22576     blue:       kurtosis: 0.593927     overall:       kurtosis: 1.49035 

and paper...

identify -verbose paper.jpg | grep -e "kurtosis:|red:|green:|blue:|overall"     red:       kurtosis: -0.953723     green:       kurtosis: -0.980636     blue:       kurtosis: -1.06634     overall:       kurtosis: -0.0151458 

as said, may fine number of colours, maybe consider if run problems.