how to find large curvature location
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
michael scheinfeild
am 2 Mär. 2018
Kommentiert: John BG
am 3 Mär. 2018
i want to detect the curve point in the lines the lines themselves not straight
0 Kommentare
Akzeptierte Antwort
John BG
am 2 Mär. 2018
Bearbeitet: John BG
am 3 Mär. 2018
Hi Michael
There's an easy way to encircle the points you want, with a high degree of accuracy.
The areas of the image you want to spot are inflection points with change of derivative sign: geometric vertices.
If we look for high degree of Curvature only, it has to do with the radius only, and very small circles would give false detections.
You are precisely asking for a sudden change of sign of the direction of the trace.
1.
Image acquisition:
I tried with your original image, that includes a grey trace, but it complicates the processing.
Allow me to show a solution for black traces only:
clear all;clc;close all
A=imread('011.jpg');
.
.
sz1=size(A,1);
sz2=size(A,2);
hf1=figure(1);imshow(A);
ax1=hf1.CurrentAxes;
cp1=campos;
.
do not apply imbinarize here, it removes the grey line
% A2=imbinarize(A1)
% th1=200;
% A(A>th1)=255;
% A(A<=th1)=0;
% A=255-A;
% figure(2);imshow(A)
2.-
The 2D variance of the images points straight to the areas of interest
D=var(double(A),0,3);
hf=figure(3);hs=surf(D);
hs.EdgeColor='none';
hs.FaceAlpha=.5;
ax=hf.CurrentAxes;
ax.DataAspectRatio=[50 50 1];
ax.CameraPosition= [cp1(1) cp1(2) -cp1(3)];
3.-
Now with Natan's function FastPeakFind
the coordinates of a 2D surface are readily available, note that the supplied coordinates are interleaved.
p=FastPeakFind(D)
pxy=[p(2:2:end) p(1:2:end)]; % deinterleave peaks coordinates
hold(ax1,'on');plot(ax1,p(1:2:end),p(2:2:end),'r+') % variance peaks
[idx,C] = kmeans(pxy,4);
hold all;viscircles(ax1, flip(uint32(C),2),10*ones(1,4),'Color','green')
.
.
Michael
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
2 Kommentare
John BG
am 3 Mär. 2018
Hi Michael
I was also considering the approach of focusing on the white points only, after obtaining the skeleton, so I did the following:
clear all;clc;close all
A=imread('010.jpg');
figure(1);imshow(A);
% cp1=campos;
th1=200;
A(A>th1)=255;
A(A<=th1)=0;
A=255-A;
figure(2);imshow(A)
A1=A(:,:,1); % just one layer
A2=imbinarize(A1) ;
A3 = bwmorph(A2,'skel',Inf);
figure(3);imshow(A3)
[n1,n2,v]=find(A3==1);
but there are 3 problems:
1.-
there is no longer sharp derivative sign, the sudden way-backs all look like a small radius but more a turn than a 180º sharp thrust inversion.
2.-
right on 2 sharp bents, the 2 on the left hand side, with black ink, now show a short shoot each that is not supposed to be there, but bwmorph shrinks these trace around the points of interest in a way that an apparent bifurcation is added, that doesn't really exist.
3.-
the top left trace now has again a short shoot that looks like as if there's a three way intersection.
.
.
I have also had a look into the change of sign of the derivatives of the variance:
A4=del2(double(A(:,:,1)+A(:,:,2)+A(:,:,3)));
figure(4);imshow(A4);
W1=var(A4,0,1);
figure;plot(W1)
figure;plot(diff(W1.*W1))
W2=var(A4,0,2);
figure;plot(diff(W2.*W2))
W2=var(A4,0,2);
V=diff(W2.*W2);
nV=[1:1:numel(V)];
figure;plot(-V([end:-1:1]),nV);
.
.
The overlaps get solved if isolating each trace.
John BG
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Environment and Clutter finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!