构建根据RGB强度分类的图像矩阵

时间:2014-08-26 15:53:26

标签: image matlab

我有一组像这样的图像:

enter image description here

我希望用类似的矩阵对它们进行排序:

Colour squares

我如何在Matlab中执行此操作?

1 个答案:

答案 0 :(得分:1)

您可以遵循的步骤。

1.Store the values as a matrix

2. Convert the rgb values to hsv colorspace using rgb2hsv function.

Example: C = rgb2hsv(C);

3. Then sort by hue first then by value

Example: C = sortrows(C, [-1 -3 2]);  %# sort first by Hue, then by value

4. Convert it back to rgb

Exmaple : C = hsv2rgb(C);