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

조회 수: 2 (최근 30일)
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

답변 (1개)

Yatharth
Yatharth 2024년 5월 29일
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
Surendra Ratnu
Surendra Ratnu 2024년 5월 29일
@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 ??

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by