- Convert the Image to Indexed Format: This will help in identifying unique colors.
- Identify Unique Colors: Count the unique colors in the indexed image.
i used marker controlled watershed segmentation algorithm to segment the image into diff colors.i want to count the no.of segments in the segmented image
조회 수: 3 (최근 30일)
이전 댓글 표시
i used marker controlled watershed segmentation algorithm to segment the image into diff colors.i want to count the no.of colors in the segmented image
댓글 수: 0
답변 (1개)
Gautam
2024년 10월 24일
Hello @madhuri kalapala
To count the number of distinct colors in a segmented image after using the marker-controlled watershed segmentation algorithm, you can follow these steps in MATLAB:
Here's an expamle
segmentedImg = imread(segmentedImage);
% Convert the segmented image to an indexed image
[~, ~, numColors] = unique(reshape(segmentedImg, [], size(segmentedImg, 3)), 'rows');
% Count the number of unique colors
numUniqueColors = length(unique(numColors));
The variable "numUniqueColors" gives the number of coloured segements
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!