How to trace the surface area as well as smoothen a specific region in an image using MATLAB

♀尐吖头ヾ 提交于 2019-12-13 08:26:21

问题


I have an image with 6 colors each indicating a value. I had obtained an image as shown below.

I need to smoothen the edges and then find out the area as well as the surface area of that region. The second image shows a black line drawn in the edges which indicates that I need to smoothen the edges in such a way.

I had used segmentation to create a mask as shown in the third image, and then obtain a segmented image using the code following the image.

I have used the following code for generating till the masked image. Source : How to segment

 imshow(Out1)  
 str = 'Click to select initial contour location. Double-click to confirm    and proceed.';
 title(str,'Color','b','FontSize',12);
 disp(sprintf('\nNote: Click close to object boundaries for more accurate   result.'));
 mask = roipoly;
 figure, imshow(mask)
 title('Initial MASK');
 maxIterations = 3000; 
 bw = activecontour(Out1, mask, maxIterations, 'Chan-Vese');

 % Display segmented image
 figure, imshow(bw)
 title('Segmented Image');

In order to use the 'activecontour' function my image needs to be a grey-scale image, which I'm not being able to convert to greyscale and back. Also to find out surface area/ area of the region is there any inbuilt function. Please help thanks.


回答1:


use im2double, im2uint8, etc. to convert binary image to grayscale.

use bwarea or regionprops to find the region area.



来源:https://stackoverflow.com/questions/43179988/how-to-trace-the-surface-area-as-well-as-smoothen-a-specific-region-in-an-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!