How can specific positions in the below image?

1 Ansicht (letzte 30 Tage)
Amir Torabi
Amir Torabi am 12 Dez. 2019
Kommentiert: Image Analyst am 15 Dez. 2019
Hello Friends.
I am looking for to find the positions(i,j) of light green boundaries in the below images.
A needed m.file for loading the required data is attached. In the below code, etas and eta are matrix with predefined size.
%code
load Etas
Nx=128;
eta2=zeros(Nx,Nx);
ncount=0;
%original code
for igrain=1:25
ncount=0;
for i=1:Nx
for j=1:Nx
ii =(i-1)*Nx+j;
eta2(i,j) =eta2(i,j)+etas(ii,igrain)^2;
if(etas(ii,igrain) >= 0.5)
ncount=ncount+1;
end
%
ncount=ncount/(Nx*Nx);
end
end
end
%Display
figure
imagesc(eta2)

Akzeptierte Antwort

Image Analyst
Image Analyst am 13 Dez. 2019
Threshold eta2 then skeletonize to get single pixel wide lines. Then call find to get the rows and columns of every white pixel.
binaryImage = bwmorph(eta2 < 0.6, 'skel', inf);
[rows, columns] = find(binaryImage);
  2 Kommentare
Amir Torabi
Amir Torabi am 15 Dez. 2019
Bearbeitet: Amir Torabi am 15 Dez. 2019
Thanks for your assist. It works great. I have another question. How can i only show the above points that greater a specific value on the image?
Image Analyst
Image Analyst am 15 Dez. 2019
I don't know what that means. What do you mean by the "above points"? Do you mean the points (row, column pairs) that I used find() to get in my above Answer? They are binary so they don't have values other than 1. Do you mean the gray scale values from the original image that lie in the same location as the skeleton? If so, you can just multiply the gray scale image by the skeleton image, like
graySkel = grayImage .* uint8(binaryImage);
or use indexing like
graySkel = grayImage; % Initialize
graySkel(~binaryImage) = 0; % Set non-skeleton points to black (0).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by