Dilate Objects in image

조회 수: 9 (최근 30일)
Nathalie Cauchi
Nathalie Cauchi 2014년 11월 21일
댓글: Nathalie Cauchi 2014년 11월 24일
Hi,
I have an image containing different objects and I would like to dilate each object with a different disk width.
For example I have an image containing 3 circles and I would like to dilate each circle differently depending on their area. A circle having an area (found using regionprops) greater then 1000 is dilated using se = strlen('disk',20) while a circle with a smaller area is dilated using se = strlen('disk',10). How can this be done? please help.
Thanks
Nathalie

채택된 답변

Image Analyst
Image Analyst 2014년 11월 21일
You have to get 2 binary images. Each one containing only the circles of less than, or greater than 100 pixels. See my Image Segmentation Tutorial where I extract out coins of different diameters using find() and ismember(). http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 Let me know if you can't adapt it. If that is the case, attach your image and your best attempt at adapting the code.
Then call imdilate() on each image.
se1 = strlen('disk', 20)
dilated1 = imdilate(binaryImage1, se1);
se2 = strlen('disk', 10)
dilated2 = imdilate(binaryImage2, se2);
  댓글 수: 3
Image Analyst
Image Analyst 2014년 11월 21일
편집: Image Analyst 2014년 11월 21일
"OR" them together:
combinedImage = binaryImage1 | binaryImage2;
Nathalie Cauchi
Nathalie Cauchi 2014년 11월 24일
I followed your tutorial and adapted it and I got it to work as required :) Thanks alot!

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by