Reputation: 2514
I have two sets of images. In one set, the background and foreground differs significantly in color (either background is dark and foreground is light or vice versa). What would be some useful features for distinguishing between these types of images?
I started with histograms of colors (I am concatenating R/G/B histograms with 8 bins into a 24-dimensional feature vector), but can that be improved? What about using other color spaces?
Here's an example.
The green rectangle shows a region where the colors do not vary much. The magenta rectangle shows a region where they do. I would like to separate these two regions. What I am doing now is calculating the histograms of color channels over these regions and concatenating them.
Upvotes: 2
Views: 120
Reputation: 207465
If you are looking for regions where colours vary, I would suggest averaging colours and subtracting each pixel from the avergae of the pixels in its vicinity. Where the image is homogeneous, the difference between a pixel and the average of its local area will tend to zero - i.e. black.
Here I have done a Gaussian blur with a 5 pixel radius and then differenced relative to the original image, i.e. subtracted the blurred image from the original.
I can achieve a similar result using ImageMagick like this, but in greyscale:
convert VBHC1.png -colorspace gray \( +clone -blur 0x6 \) -compose difference -composite out.jpg
Or maybe an edge detector, such as Canny would tell you if you are in your desired area or not. I made this with ImageMagick using
convert VBHC1.png -canny 0x1+10%+20% out.jpg
Upvotes: 4