首页 文章

MATLAB中的感兴趣区域提取

提问于
浏览
-3

我正在编写一个MATLAB代码,用于在由静脉组成的前臂图像的选定(来自自动ROI)灰度区域上实现特定滤波器 . 我还上传了一个主题的前臂(在前景已经提取之后) .

基本上,我有不同方向的不同主体的前臂的近红外相机图像 . 我编写的代码提取了手臂的前景灰度图像,这给了我前臂的白色背景 . 我使用Sobel边缘找到边缘 . 我还使用 find 函数找到了非零索引 . 我得到了行和col索引 . 我需要一个关于如何提取前臂两侧检测到的边缘(近10个像素)的图像(黑白边缘图像 - 也上传) .

Sobel-edge:

sobel-edge

Foreground image:

Foreground image

ROI image that I need to extract:

roi image that I need to extract

clear all
close all
clc

image= rgb2gray(imread('Subj1.jpg'));
image1=~im2bw(image,0.1);
image1=im2uint8(image1);
foreground=imadd(image1,image);
imshow(foreground);
edgesmooth=medfilt2(foreground);
sobeledge= edge(edgesmooth,'sobel');
sobeledge=im2uint8(sobeledge);
figure 

imshow(sobeledge);
[col,row]=find(sobeledge~=0);

1 回答

  • 0

    从您在此处制作的蒙版图像开始:

    image1=~im2bw(image,0.1);
    

    但是反转,使得掩码对于背景为零,对于前景为非零:

    image1 = im2bw(image,0.1);
    

    你可以使用imdilate将它扩展一个固定的距离:

    se = strel('disk',20); % This will extend by 20/2=10 pixels
    image2 = imdilate(image1,se);
    

    image2 将像 image1 ,但在所有方向上扩展了10个像素 .

    imerode 恰恰相反,它缩小了区域 .

相关问题