Get coordinates (x, y) all pixels of a particular column in the area above the boundary line ?
1 view (last 30 days)
Show older comments
I have extracted the NFL layer of retina OCT image as shown below: Now I am doing macular hole depth mining, but in depth extraction algorithm I need to get coordinates (x, y) all pixels of a particular column in the area above the red boundary line. So how to do that? Help me please
This is the algorithm I'm working on:
% Initialization Steps.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
markerSize = 4;
%[filename, pathname] = uigetfile({'*.*'},'File Selector');
%if ~isequal(filename,0)
%fullname = strcat(pathname,filename);
I=imread('MH2.jpeg');
%else
% msgbox('Ban chua chon anh?')
%end
Id = size(I);
if length(Id) == 3
B0 = rgb2gray(I);
else
B0 = I;
end
B0 = imadjust(B0);
k1 = fspecial('gaussian', [5 5], 2.5);
Ic = imfilter(B0,k1);
figure(1),subplot(3,3,1), imshow(I);
title('anh goc');
figure(1), subplot(3,3,2), imshow(B0);
title('anh tang tuong phan');
figure(1), subplot(3,3,3), imshow(Ic);
title('anh loc gaussian');
%loc trung vi
I_m = medfilt2(B0,[3 3]);
figure(1),subplot(3,3,4), imshow(Ic);
title('anh loc trung vi');
%anh nhi phan
thresholdValue = 60;
bw = Ic > thresholdValue;
bw = bwareafilt(bw, 1);
figure(1),subplot(3,3,5), imshow(bw);
title('anh nhi phan');
%dong hinh thai
se = strel("disk",10);
C1 = imclose(bw, se);
figure(1),subplot(3,3,6), imshow(C1);
title('dong hinh thai');
%khai thac ranh gioi
[A,L,N] = bwboundaries(C1);
figure(1);
subplot(3,3,7);
imshow(C1); hold on;
title('khai thac ranh gioi');
for k=1:length(A)
boundary = A{k};
len(k) = (max(boundary(:,2))-min(boundary(:,2))).^2+(max(boundary(:,1))-min(boundary(:,1))).^2;
if(k > N)
plot(boundary(:,2), boundary(:,1), 'g','LineWidth',1.5);
else
plot(boundary(:,2), boundary(:,1), 'r','LineWidth',1.5);
end
end
%lựa chon ranh gioi
[~,ind] = max(len);
Boundary = A{ind};
figure(1);
subplot(3,3,8);
imshow(C1); hold on;
plot(Boundary(:,2), Boundary(:,1), 'r','LineWidth',1.5);
title('Lua chon ranh gioi dai nhat');
%trich xuat lop NFL
b1 = bwperim(C1);
b1(:,[1:2 end-2:end]) = 0;
b1 = logical(b1);
[B,M,N] = bwboundaries(b1);
for k=1:length(B)
boundary = B{k};
len(k) = (max(boundary(:,2))-min(boundary(:,2))).^2+(max(boundary(:,1))-min(boundary(:,1))).^2;
end
[~,ind] = max(len);
Boundary = B{ind};
figure(1);
subplot(3,3,9);
imshow(C1); hold on;
plot(Boundary(:,2), Boundary(:,1), 'r','LineWidth',1.5);
title('trich xuat lop NFL');
%trich xuat dac trung do sau
1 Comment
Image Analyst
on 15 Apr 2022
OK, but do you have a specific question? Or error message? Anything wrong with your code?
Answers (0)
See Also
Categories
Find more on Zernike Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!