I have Emgu image :
Image<Bgr,byte> image = new Image<Bgr,byte>("image.jpg");
Here is how the file(image.jpg) looks like:
All pixels that inside red-yellow triangle I want to copy to the new image called:
Image<Bgr,byte> copiedSegment;
Any idea how to implement it if I have coordinates all coordinates of the triangle contour.
Thank you in advance.
In the opencv c++ api you can just use the matrix copy function with a mask composed of your triangular components.
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);
You should beable to write some similar code in emgu based on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With