I am not getting the correct value for rblush in this code. here, red is a matrix consisting of only the r of rcb values of an image. If the value of red_pixel is greater than 200, i want to add the pixel values in rblush but im getting the wrong val
2 ビュー (過去 30 日間)
古いコメントを表示
for x=1:rows
for y=1:columns
red_pixel= red(x,y);
if(red_pixel>=200)
if(red_pixel> rmean)
blush= blush+1;
rblush =sum(red_pixel);
end
end
end
end
%the value of rblush should be a big number but it only goes upto 255, how do i modify the code to achieve this
2 件のコメント
David Hill
2019 年 10 月 19 日
I don't understand what you are trying to do. You need to explain more. What is rmean? What is blush (a counter)? What do you want to do with all the pixels >=200? Tell us exactly what you want done.
回答 (1 件)
Divya Gaddipati
2019 年 10 月 21 日
Since “red” is your red-channel image, you can directly find the pixel values that are greater than 200 and “rmean” in the following way:
pxls = red(red > 150 & red >= 200); % “mask” will have the required pixel values
pixels_sum = sum(pxls); % required sum which is "rblush" in your code
no_of_pixels = length(pxls) % number of required pixels which is "blush" in your case
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Marine and Underwater Vehicles についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!