How can i seperate the extruded are from portion from original boundary line ??

2 vues (au cours des 30 derniers jours)
Surendra Ratnu
Surendra Ratnu le 18 Mai 2024
Commenté : Surendra Ratnu le 29 Mai 2024
I has two boundaries M and N which are extract from image. I measured the gap between the these two boundaries at each point, but there are some part is extruded in N boundary. I want to extract the that extruded portion from the N boundary. I tried this by given the angle and distance condition, but i could not able to do this.I attached the image and orange circle show the extruded portion. I also attached the code. Give some valuable suggestion for this. Thank You

Réponses (1)

Yatharth
Yatharth le 29 Mai 2024
Hi Surendra,
To measure the gap between the two boundaries, you can calculate the distance from each point on one boundary to the nearest point on the other boundary. This is computationally intensive but provides a detailed gap measurement.
Assuming the extruded portions of the boundary N are characterized by a larger gap to boundary M than the rest, you can identify these by finding where the gap exceeds a certain threshold.
Appending an updated version of the code you submitted:
M = readmatrix("M.xlsx"); N = readmatrix("N.xlsx");
xv = 506; yv = 115; pm = 16.167; ip = [xv, yv];
v = (81:1:710).';
figure(1)
set(gcf,'units','points','position',[400,150,700,510]);
plot(N(:,1), N(:,2),'g',M(:,1), M(:,2),'r');
set(gca,'XGrid','on','YGrid','on','YDir','reverse'); axis equal
hold on
plot([xv*ones(size(v)) M(v,1)].', [yv*ones(size(v)) M(v,2)].', '--r',xv, yv,'r+',[1 1]*xv, [0 yv], '-r');
hold off
% New code starts here
distances = zeros(size(N,1),1);
for i = 1:size(N,1)
dists = sqrt((M(:,1) - N(i,1)).^2 + (M(:,2) - N(i,2)).^2);
% Find the minimum distance for the current point
distances(i) = min(dists);
end
threshold = 10; % Define a threshold for the gap size that indicates an extrusion
extrudedIndices = find(distances > threshold);
% using the extrudedInces to get the points to plot
extrudedPoints = N(extrudedIndices, :);
figure();
plot(M(:,1), M(:,2), 'r-', N(:,1), N(:,2), 'b-', extrudedPoints(:,1), extrudedPoints(:,2), 'g*');
legend('Boundary M', 'Boundary N', 'Extruded Points');
xlabel('X-axis');
ylabel('Y-axis');
title('Identified Extruded Portions');
  1 commentaire
Surendra Ratnu
Surendra Ratnu le 29 Mai 2024
@Yatharth Thank you for your answer, but i cant apply the same thresholding for all points, thresholding shoulod be locally. If dist(i+1) is 40% more than the dist(i), then it called as extrusion and also there is the slop change at the point where extruded part starts. Can i apply the these condition to identify the first point of the extruded point and for end point of extruded portion is the dist(i) is 40% more than the dist(i+1) and slope change and then join the first and last point and seperate the extruded part? Can you give me suggestion to do this ??

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by