简体   繁体   中英

2D Pattern Searching

What would be a good algorithm for searching through 2D arrays of data and creating borders around data of the same sort? The data would be random so there wouldn't be any prior knowledge of the data available, other than that it'd contain numeric values.

Otherwise are there any good articles/books on the subject?

Edit

Here is an example of what I'm trying to achieve:

在此输入图像描述

And the same for the two's

Breadth First Search could help you here.First construct the graph G as follows:

Graph G has edge (u,v) is and only if value of u-th cell=value of v-th cell.

Then carrying out BFS gives nice pieces of the graph that you can conveniently mark as visited using the value of the cell.

This is a complex problem which I think is equivalent to finding the concave hull of a set of points.

You would first have to define an equality operation for the data points so that you can determine the set of "same sort" data points.

Having identified a set of points in that way, you then need to find the concave hull for that set of points.

(I'm assuming you want the concave hull and not the convex hull ).

Finding the concave hull is a non-trivial task.

See here for details: https://gis.stackexchange.com/questions/1200/concave-hull-definition-algorithms-and-practical-solutions

If it's actually the convex hull you want, see here for an implementation in C#:

http://miconvexhull.codeplex.com/

一个天真的解决方案(适用于小数据集)是定义一个带有两个参数的比较运算符,如果它们相等则返回true,否则返回false然后简单地比较所有相邻值对(水平和垂直)和绘图如果比较返回false,则为边框。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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