Counting objects in an binary image of olympic logo

Illustration
camillajoy - 2021-01-05T13:10:04+00:00
Question: Counting objects in an binary image of olympic logo

I try lot of algo and matlab code to count the object in olympic logo i should get 5 object but my count only one how i should count an binary image of olympic logo and get 5 object need code  

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

try this :

 

% Convert the image from rgb into hsv color space:
hsvImage = rgb2hsv(rgbImage);
% Extract the hue image
h = hsvImage(:,:,1);
% Get the histogram
counts = histcounts(h, 1000);
% Find peaks in the histogram
[peaks, indexes] = findpeaks(counts);
% count the number of peaks
numberOfHues = length(peaks)
Requires Image Processing  Toolbox for rgb2hsv() and Signal Processing Toolbox  for findpeaks().

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!