如何从图像中复制多边形? [英] How to copy polygon from the image?

查看:116
本文介绍了如何从图像中复制多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Emgu图像:



I have Emgu image:

Image<Bgr,byte> image = new Image<Bgr,byte>("image.jpg"); 





绿色三角形我想复制到名为的新图像:





All pixels that inside green triangle I want to copy to the new image called:

Image<Bgr,byte> copiedSegment;





如果我有绿色三角形轮廓的坐标,请知道如何实现它。



提前谢谢!



Any idea how to implement it if I have coordinates of the green triangle contour.

Thank you in advance!

推荐答案

在看到你的帖子之前,我从来没有听说过用于.NET的Emgu CV库。在不到一分钟的时间内浏览他们的网站,我发现了一个形状检测的代码示例,包括识别三角形的能力[ ^ ]。



所以:为什么可以'你使用Emgu工具来实现你的目标吗?
Before seeing your post, I'd never heard of the Emgu CV library for .NET. In less than one minute browsing their web-site I found a code example of shape detection, including the ability to recognize a triangle [^].

So: why can't you use the Emgu facility to achieve your goal ?


考虑到绿色三角形只会出现你的X射线眼睛。



(一般答复,因为没有三角形)

如果你有三角形的三个点,你可以简单地创建一个位图满足三角形的区域。假设绿色是相同的。您可以过滤掉与三角形颜色不同的所​​有内容,使其变得透明。其余的将是神奇的三角形。
Well considering that the green triangle will only show up with your x-ray eyes.

(GENERAL ANSWER BECAUSE THERE IS NO TRIANGLE)
If you have the three points of the triangle you can simply create a bitmap with an area that will satisfy the triangle. Assumming that the color green is the same. You can filter out everything that isn't the same color of the triangle making it transparent. The rest will be the magical triangle.


这篇关于如何从图像中复制多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆