I need a code for Color co-occurence descriptors considering color information

3 views (last 30 days)
I need a code for Color CO-occurance descriptor (feature) which is used in Content-Based Image Retrieval (CBIR)

Accepted Answer

Walter Roberson
Walter Roberson on 25 May 2015
Call rgb2ind to get unique color indices with quantization. Then call graylevel co-occurrence on the indexed image.
  2 Comments
Walter Roberson
Walter Roberson on 25 May 2015
An indexed image consists of a data matrix, X, and a colormap matrix, map. map is an m-by-3 array of class double containing floating-point values in the range [0, 1]. Each row of map specifies the red, green, and blue components of a single color. An indexed image uses "direct mapping" of pixel values to colormap values. The color of each image pixel is determined by using the corresponding value of X as an index into map. Values of X therefore must be integers. The value 1 points to the first row in map, the value 2 points to the second row, and so on.
Thus, rgb2ind() transforms an RGB array into a pair of arrays, one of which is a list of colors (Nx3) and the other of which lists indices into the color map.
As the graylevel co-occurance routine http://www.mathworks.com/help/images/ref/graycomatrix.html is concerned only with which "gray values" occur beside which others, you can feed the routine arbitrary integers (e.g., representing color numbers) in order to find out which of those integers appear beside each other in the pattern you ask to be checked.
When you are using graycomatrix() to find the GLCM, the entry (J,K) of the result tells you that gray intensity #J occurs beside gray intensity #K the particular number of times. That operation works the same way if the inputs you feed it are arbitrary values. The difference is one of interpretation of the results. If you are feeding the routine with gray intensities then the result at location (J,K) has implications about the relative contrast difference abs(J-K), where the indices imply intensities. But if you pass in an indexed image to graycomatrix() then the location (J,K) has no direct implication about the relative contrast difference, and abs(J-K) will probably have no meaning. The location at (J,K) would simply be the count of the times that the RGB color colormap(J,:) appeared beside the RGB color colormap(K,:). If you want to interpret that in terms of (for example) "difference in purpleness" then you will need to define a linear "purpleness" measure (and then you could apply that to your original RGB image to produce a "purpleness" image that you could then put through graycomatrix())

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!