简体   繁体   English

二维数据的外部和内部边界 plot

[英]Exterior and interior bounds for 2D data plot

https://dropmefiles.com/kIe16 - this contains two matrices from Matlab https://dropmefiles.com/kIe16 - 这包含来自 Matlab 的两个矩阵

With the code below, I'm building the following plot:使用下面的代码,我正在构建以下 plot:

n = 1:1:(51);
plot(Xm(n,:)',Rm(n,:)','b.','MarkerSize',8)
grid on
grid minor

在此处输入图像描述

What I need to do: build the exterior and interior bounds for this 2D data plot, like here.我需要做的:为这个 2D 数据 plot 构建外部和内部边界,就像这里一样。 This is very approximate.这是非常近似的。

在此处输入图像描述

My considerations: I roughly understand how to build the upper and lower exterior boundaries.我的考虑:我大致了解如何构建上下外部边界。 Since the data is divided into vertical lines, we can simply find their min and max, and then connect them with straight lines.由于数据被分成垂直线,我们可以简单地找到它们的最小值和最大值,然后用直线将它们连接起来。 But I have absolutely no ideas about interior boundaries.但我对内部边界完全没有想法。

This is contour-from-image extraction problem.这是图像轮廓提取问题。

There is well-known Suzuki algorithm to extract whole hierarchy of contours from bw images.有著名的 Suzuki 算法可以从黑白图像中提取轮廓的整个层次结构。

Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following. Suzuki, S. 和 Abe, K.,通过边界跟踪对数字化二进制图像进行拓扑结构分析。 CVGIP 30 1, pp 32-46 (1985). CVGIP 30 1,第 32-46 页(1985 年)。

It is implemented in the OpenCV library (I used it from C++ and Python), and looks like it is accessible/available from MATLAB, https://www.mathworks.com/discovery/matlab-opencv.html它在 OpenCV 库中实现(我从 C++ 和 Python 使用它),看起来它可以从MATLAB、https://www.mathworks.com/discovery/matlab-opencv.html访问/可用

1.- Use diff(..,1,1) and diff(..,1,2) to obtain 1st derivatives along x and along y respectively. 1.-使用diff(..,1,1)diff(..,1,2)分别获得沿x和沿y的一阶导数。

diff(..,1,1) is 1st derivative along x axis and diff(..,1,2) is 1st derivative along y axis. diff(..,1,1)是沿x轴的一阶导数, diff(..,1,2)是沿y轴的一阶导数。

Display origin is located on top left corner and y increases downwards.显示原点位于左上角, y向下增加。

2.- The obtained 2D 1st derivative shows the points where the shape starts and stops, for each row and column, including the inner gaps. 2.-获得的二维一阶导数显示形状开始和停止的点,对于每一行和每一列,包括内部间隙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM