필터 지우기
필터 지우기

How to count area under given surface ?

조회 수: 2 (최근 30일)
MMSAAH
MMSAAH 2020년 4월 30일
댓글: Ameer Hamza 2020년 5월 4일
Hello,
I want to count areas limited by green lines.
So, for my image the result is three areas.
Can anyone help me please.
  댓글 수: 1
darova
darova 2020년 4월 30일
do you have coordinates of green lines?

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 30일
편집: Ameer Hamza 2020년 4월 30일
Try this. It gives the area of three regions in number of pixels
im = im2double(imread('area.jpeg'));
im(:,end-5:end,:) = 0; % remove the white line at right and bottom of image
im(end-5:end,:,:) = 0;
mask = (im(:,:,1)>0.75) & (im(:,:,2)>0.75) & (im(:,:,3)>0.75);
regions = bwconncomp(mask);
areas = cellfun(@(x) numel(x), regions.PixelIdxList);
required_areas = maxk(areas, 3);
  댓글 수: 4
MMSAAH
MMSAAH 2020년 5월 4일
I'm using R2016a.
I've changed maxk() by :
[val ind] = sort(areas,'descend');
required_areas=val(1:3);
Now, it works.
Is it possible to transform the number of pixels to cm ?
Ameer Hamza
Ameer Hamza 2020년 5월 4일
You will need to specify the pixel per cm to find out the area.

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by