필터 지우기
필터 지우기

I need to write a script extracts the average intensity of each object in the rice.png. My use of regionprops has failed.

조회 수: 1 (최근 30일)
I = imread('Rice.png'); %imports the image
Background = imopen(I,strel('disk',15)); %removes the rice and displays the background as its own entity
I2=I-Background; %removes the background from the image
I3 = imadjust(I2); %increases the contrast of the image
bw = im2bw(I3); %creats a binary image
bw2= bwareaopen(bw, 50); %removes the noise from the image
cc = bwconncomp(bw2, 4); %finds the connected part of the image and determins if they are the same or different
cc.NumObjects % counts the objects
bw3=bwlabel(bw2,4); %converts the image into a labeled bw code
bwlabel2rgb=label2rgb(bw3); %converts above into rgb, without above the image is the same colour
imshow(bwlabel2rgb); %displays image
gray = rgb2gray(bwlabel2rgb);
measurements = regionprops( bw,gray, 'MeanIntensity');
Here is my current code but I have no idea what the issue is, could someone please point me in the right direction?
  댓글 수: 4
Walter Roberson
Walter Roberson 2018년 6월 7일
Please show the complete error message. Also, which MATLAB release are you using?
Bradley Cory
Bradley Cory 2018년 6월 7일
Attempt to execute SCRIPT regionprops as a function: \\student\USR\Vol4\bc\Documents\MATLAB\regionprops.m Error in test (line 13) props = regionprops(bw,gray, 'MeanIntensity');
Matlab r2015b I think in the version?

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 7일
You have your own regionprops.m file in \\student\USR\Vol4\bc\Documents\MATLAB\regionprops.m that is interfering with using the MATLAB regionprops.m

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by