how do i select only a certain area of ​​an image and then use it to get the mean pixel value?

조회 수: 2 (최근 30일)
How can i select only the central red area of ​​the star and then get the mean pixel value of the red channel?

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021년 3월 7일
편집: KALYAN ACHARJYA 2021년 3월 7일
This is all about how you can correctly segregate ROI, what the red fields refer to, as there is no clear boundary in the area of interest items, the easiest way-
red_channel=rgbImage(:,:,1);
bwimage=imbinarize(rgbImage(:,:,1),0.3);
% Get the largest blob only
bwimage=bwareafilt(bwimage,1);
% Get data for mean
sum_pix=sum(bwimage(:));
mask=uint8(cat(3,bwimage,bwimage,bwimage)); % Just for display purpose
% Mask operation on Red Channel
red_seg=red_channel(bwimage);
fprintf('The Mean is: %f',sum(red_seg)/sum_pix);
imshow([rgbImage,mask.*rgbImage;])
  댓글 수: 7
Giuseppe Ronci
Giuseppe Ronci 2021년 3월 11일
편집: Giuseppe Ronci 2021년 3월 12일
@KALYAN ACHARJYA i have another question. Could you tell me how to change your code to give me also the standard deviation of the mean pixel value of the red channel?
if i tried to enter this command could it be ok? the command is: std (red_seg)
Giuseppe Ronci
Giuseppe Ronci 2021년 3월 14일
@Image Analyst Can you help me? I tried to insert in various ways the command to do the standard deviation to add to the mean pixel value so as to have the error beyond the average but the code gives me an error. Do you know how I can change the code?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by