问题描述
我的图像有6种颜色,每种颜色都表示一个值。我已经获得了如下所示的图像。
I have an image with 6 colors each indicating a value. I had obtained an image as shown below.
I需要使边缘平滑,然后找出该区域以及该区域的表面区域。第二个图像显示边缘绘制的黑线表示我需要以这种方式平滑边缘。
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');
为了使用'activecontour'功能,我的图像需要是灰度图像,我无法转换为灰度和返回。另外,为了找出该区域的表面积/面积,还有任何内置功能。请帮忙谢谢。
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.
推荐答案
使用,等将二进制图像转换为灰度。
use im2double
, im2uint8
, etc. to convert binary image to grayscale.
使用或查找区域区域。
use bwarea
or regionprops
to find the region area.
这篇关于如何使用MATLAB跟踪表面区域以及平滑图像中的特定区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!