Mic*_*ael 3 c# opencv image-processing emgucv
我有Emgu图片:
Image<Bgr,byte> image = new Image<Bgr,byte>("image.jpg");
Run Code Online (Sandbox Code Playgroud)
这是文件(image.jpg)的样子:

我要复制到新图像的红黄三角内的所有像素称为:
Image<Bgr,byte> copiedSegment;
Run Code Online (Sandbox Code Playgroud)
如果我有坐标三角形轮廓的所有坐标,任何想法如何实现它.
先感谢您.
在opencv c ++ api中,您可以使用矩阵复制功能和由三角形组件组成的掩码.
Mat image = imread("image.jpg",CV_LOAD_IMAGE_COLOR);
vector<Point> triangleRoi;
Mat mask;
//draw your trianlge on the mask
cv::fillConvexPoly(mask, triangleRoi, 255);
Mat copiedSegment;
image.copyTo(copiedSegment,mask);
Run Code Online (Sandbox Code Playgroud)
您应该能够基于此在emgu中编写一些类似的代码.
| 归档时间: |
|
| 查看次数: |
1398 次 |
| 最近记录: |