Order of indexes when using rgb2ind
Show older comments
Hi there,
I have some classified images in tif format (usually 3-4 classes), which I need to import to Matlab as an indexed image. Currently I am using
img = imread(<image name>.tif);
lbl = rgb2ind(img);
Which works fine, except for one slight issue. The order of the indexes (classes) seems somewhat random. This means that I cannot compare multiple images. Even if they are all classified the same way, using the same colors for the same classes. When they are imported to Matlab, it all gets mixed up.
So my questions are:
- Is there a (simple) way to control the order of the classes?
- How does rgb2ind() decide the order of the classes?
Any help which could help clarify this randomization mystery is much appreciated, thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!