[英]Remove optical disk image of the retina, setting the color of the optical disk as background color
I've been working with the retina image, currently I am submitting to the wavelet, but I have noticed that I have two problems are: 我一直在处理视网膜图像,目前我正在提交小波,但我注意到我有两个问题:
The original image is the next 原始图像是下一个
My plan is to establish the bottom of the tone of the optical disk in order not to lose any detail of the blood vessels of the retina (I post a code with which I played but still do not understand much as I know the tone of the optical disc and how to set it to the image without altering the blood vessels) 我的计划是建立光盘底部的音调,以免丢失视网膜血管的任何细节(我发布了一个我玩的代码,但仍然不太了解,因为我知道的音调光盘以及如何在不改变血管的情况下将其设置为图像
And with respect to the outer circle of the retina, I don´t know that you recommend me (I do not know about masks, I would appreciate if they have to consult my literature can provide) 而对于视网膜的外圈,我不知道你推荐我(我不知道面具,我会很感激,如果他们必须咨询我的文献可以提供)
c = [242 134 72];% Background to change
thresh = 50;
A = imread('E:\Prueba.jpg');
B = zeros(size(A));
Ar = A(:,:,1);
Ag = A(:,:,2);
Ab = A(:,:,3);
Br = B(:,:,1);
Bg = B(:,:,2);
Bb = B(:,:,3);
logmap = (Ar > (c(1) - thresh)).*(Ar < (c(1) + thresh)).*...
(Ag > (c(2) - thresh)).*(Ag < (c(2) + thresh)).*...
(Ab > (c(3) - thresh)).*(Ab < (c(3) + thresh));
Ar(logmap == 1) = Br(logmap == 1);
Ag(logmap == 1) = Bg(logmap == 1);
Ab(logmap == 1) = Bb(logmap == 1);
A = cat(3 ,Ar,Ag,Ab);
imshow(A);
courtesy of the question How can I change the background color of the image? 礼貌的问题如何更改图像的背景颜色?
The image I get is the following 我得到的图像如下
I need a picture like this where the optical disc does not cause me noise when segmenting the blood vessels of the retina. 我需要一张这样的照片,光盘在分割视网膜的血管时不会引起噪音。
I want to be uniform background ... and only the veins are perceived 我想成为统一的背景......只有静脉被感知到
I continued to work and have obtained the following image As you can realize the optical disk removes some parts of the blood vessels (veins) that are above him, so I require eliminating or make uniform the entire bottom of the image. 我继续工作并获得了以下图像您可以意识到光盘会移除他上方的血管(静脉)的某些部分,因此我需要消除或使图像的整个底部均匀。
As Wouter said , you should first correct the inhomogeneity of the image. 正如Wouter所说 ,你应该首先纠正图像的不均匀性。 I would do it in my own way: 我会以自己的方式做到这一点:
First, the parameters you can adjust to optimize the output: 首先,您可以调整参数以优化输出:
gfilt = 3;
thresh = 0.4;
erode = 3;
brighten = 20;
You will see how they are used in the code. 您将看到它们在代码中的使用方式。
This is the main step: to apply a Gaussian filter to the image to make it smooth and then subtract the result from the original image. 这是主要步骤:对图像应用高斯滤镜使其平滑,然后从原始图像中减去结果。 This way you end up with the sharp changes in your data, which happens to be the vessels: 通过这种方式,您最终会得到数据的急剧变化,而这些变化恰好是船只:
A = imread('Prueba.jpg');
B = imgaussfilt(A, gfilt) - A; % Gaussian filter and subtraction
% figure; imshow(B)
Then I create a binary mask to remove the unwanted area of the image: 然后我创建一个二进制掩码来删除图像中不需要的区域:
% the 'imadjust' makes sure that you get the same result even if you ...
% change the intensity of illumination. "thresh" is the threshold of ...
% conversion to black and white:
circ = im2bw(imadjust(A(:,:,1)), thresh);
% here I am shrinking the "circ" for "erode" pixels:
circ = imerode(circ, strel('disk', erode));
circ3 = repmat(circ, 1, 1, 3); % and here I extended it to 3D.
% figure; imshow(circ)
And finally, I remove everything on the surrounding dark area and show the result: 最后,我删除周围黑暗区域的所有内容并显示结果:
B(~circ3) = 0; % ignore the surrounding area
figure; imshow(B * brighten) % brighten and show the output
Morphological operations are good for working with sphagetti images. 形态操作适用于使用sphagetti图像。
Original image: 原始图片:
Convert to grayscale: 转换为灰度:
original = rgb2gray(gavrF);
Estimate the background via morphological closing: 通过形态学关闭估算背景:
se = strel('disk', 3);
background = imclose(original, se);
Estimate of the background: 估计背景:
You could then for example subtract this background from the original grayscale image. 然后,您可以从原始灰度图像中减去此背景。 You can do this straight by doing a bottom hat transform on the grayscale image: 您可以通过对灰度图像执行底部变换来直接执行此操作:
flatImage = imbothat(original, strel('disk', 4));
With a output: 输出:
Noisy, but now you got access to global thresholding methods. 吵,但现在你可以访问全局阈值方法了。 Remember to change the datatypes to double if you wish to do some subtraction or division manually. 如果您希望手动进行减法或除法,请记住将数据类型更改为double。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.