使用增强图进行图像分割

发布于 2024-10-26 13:23:58 字数 314 浏览 1 评论 0原文

我最近发现了 boost::graph。 由于我之前从未使用过图论,所以我想知道如何使用 boost graph 解决以下问题。

假设我有一个简单的(灰度)2D 图像,我想从中提取满足特定标准的区域,例如像素值> 。临界点。 上面是白色,下面是黑色。

我将如何实施?

我的第一个线索是为图像中的每个像素添加一个顶点到图表中。 然后将每个像素顶点与其具有相同颜色(白色/黑色)的邻居连接。 然后我可以使用 Connected_Components() 函数提取区域。

或者连接所有相邻像素并将边界信息编码到边缘(边界边缘,非边界边缘)中更有效?

I recently discovered boost::graph.
Since I have never used Graph theory before I was wondering how i would solve the following problem with boost graph.

Lets say I've got a simple(greyscale) 2D Image and I'd like to extract Regions from it which suffice a specific criterion, e.g. pixel value > threshold.
Lets above is white, below is black.

How would I implement that?

My first clue was adding one single Vertex to the graph for every pixel in the image.
And then connect every pixel Vertex to its neighbours with the same colour(white/black).
And then I could extract regions with the connected_components() function.

Or is it more effective to connect all neighbouring pixels and encode the border information into the edge(border edge, nonborder edge)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼泪都笑了 2024-11-02 13:23:58

实际上有一些有趣的基于图论的分割算法,称为图割分割。他们使用彩色边缘来编码相邻像素之间的差异信息。

对于您非常简单的分割,尽管使用图表对我来说似乎有点过分了。

Actually there are some interesting graph-theory based segmentation algorithms out there, called graph-cut segmentation. They use colored edges to encode differential information between neighboring pixels.

For your very simple segmentation though using graphs at all seems overkill to me.

粉红×色少女 2024-11-02 13:23:58

我肯定会做前者,为每个像素创建一个顶点,然后连接共享您的标准的像素(或相邻像素,具体取决于您要执行的操作)。这样,您就可以进行“像素行走”来查找图像中满足特定标准的所有区域(或至少是相邻区域)。

为了找到符合您标准的第一个像素以开始行走序列,您可以使用几种方法。 1) 从图像中随机选取像素,2) 保存指向适合不同条件的像素的列表指针(每个条件只需要一个像素),或 3) 在图像上保存某种类型的梯度信息,以便通过从图像中仅选取一个像素,然后您可以沿着梯度流搜索以找到您正在寻找的像素(即,梯度将为您提供方向信息,告诉您需要在哪里选取下一个像素以更接近所需的像素)您正在寻找的标准)。我认为选择 1 或 2 最容易实施。

希望这有帮助,

杰森

I would definitely do the former where you create a vertex for each pixel, and then connect pixels (or adjacent pixels depending on what you are trying to do) that share your criterion. That way you could do a "pixel-walk" to find all the areas of your image (or at least adjacent areas) that satisfy a specific criterion.

In order to find the first pixel that fits your criterion in order to start the walking sequence there are a couple methods you could use. 1) a random pick of pixels from the image, 2) save a list pointers to pixels that fit your different criteria (you only need one pixel for each criteria), or 3) save some type of gradient information on the image so that by picking just one pixel from the image, you can then search along the gradient flows to find the pixel you're looking for (i.e., the gradients would give you directional information on where you need to pick you next pixel to get closer to the desired criterion you're looking for). I would think choices 1 or 2 would be easiest to implement.

Hope this helps,

Jason

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文