フィルターのクリア

count and plot red and blue colors from the pic

1 回表示 (過去 30 日間)
Avia Lavon
Avia Lavon 2022 年 11 月 24 日
コメント済み: Avia Lavon 2022 年 12 月 6 日
I have a flourescence image (in tif format) with blue and red coloros
and i whant to quantify the amnmount of red and blue color in the picture
and draw/plot the recognized red and blue, to be able to check that I had choose a good range for recognizing red and blue colors.
I have this code to count the colors but i have not succeded to draw it
I would very appriciate your help.
RGB = imread('pic1.tif');
HSV = rgb2hsv(RGB);
[h,s,v] = imsplit(HSV);
hue = h*360;
[rows,cols] = size(hue);
num_pixels = rows*cols;
% red range: 0-20, 340-360
[red_ind, ~] = find(hue<=20 | hue>=340);
red_percentage = (length(red_ind)/num_pixels)*100;
fprintf('The red percentage of the image is : %.2f \n', red_percentage);
% blue range: 200-260
[blue_ind, ~] = find(hue<=260 & hue>=200);
blue_percentage = (length(blue_ind)/num_pixels)*100;
fprintf('The blue percentage of the image is : %.2f \n', blue_percentage);

採用された回答

Ishan
Ishan 2022 年 12 月 1 日
Hi Avia,
I ran your code for this image, and it gave a reading of 55.38 for red and 33.35 for blue. However, by plotting the recognized red and blue I believe you are trying to highlight certain sections of the image which lie in that range of hue which you desire. If that is the case, you can refer to the numerous colour segmentation methods listed on File exchange: -
Hope this helps resolve your problem!
  1 件のコメント
Avia Lavon
Avia Lavon 2022 年 12 月 6 日
Hi Ishan.
Thank you for your reply.
I am not the segmentation is what i am looking for.
By ploting recognized pixeles i just want to compare to original image by eye and check that my recognition was good enough.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by