I have coloured images, some may be just clipart, some may be artwork, both could be with or without gradients.

Before i run a colour counting algorithm on them, i want to detect if the image has only solid block colours, or gradients in it.(Technically all compressed images will have small gradients in the form of anti aliasing, but i want to detect the gradients that were there in the original image)

I'm thinking of an approach in which i could plot a historam(of rgb or hsl values, or even grayscale) and if it has peaks that are smooth and not steep, then that indicates that the image may have an area with a gradual colour shift, with all colours of one hue appearing more or less equally(like the image of a sky would have gradual changes from blue to lighter blue to white). Does this sound right? Any other approaches for doing this? Thank you.

  • $\begingroup$ I might be missing something, but shouldn't you just compute the image gradient? $\endgroup$ – Andrey Rubshtein Dec 21 '14 at 14:16
  • $\begingroup$ Sorry i'm new to this. i checked that opencv has a function called gradient, which when i ran on an image, gave results similar to what an edge detector would, ie, sharp changes in colour. What i need is to get a 0/1-yes or no result on the input image telling me if it has a gradient(in the form of shading in colours) or not. Is there a way to do that with that function? thanks. $\endgroup$ – Gunshi Dec 24 '14 at 13:07
  • $\begingroup$ for example, for the first image i should be able to extract a negative result, and for the second, a positive one. encrypted-tbn0.gstatic.com/… encrypted-tbn2.gstatic.com/… $\endgroup$ – Gunshi Dec 24 '14 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.