I would like to do a very simple thing: copy an area inside an image into a new area in a new image. In the OpenCV 2.3 cheatsheet, they suggest the following solution:
"Example 3. Copy image ROI to another image with conversion"
Rect r(1, 1, 10, 20);
Mat dstroi = dst(Rect(0,10,r.width,r.height));
src(r).convertTo(dstroi, dstroi.type(), 1, 0);
My code is the following:
Mat frameO, frameS;
original >> frameO;
stabilized >> frameS;
Mat output(frameO.rows+40, frameO.cols*2+60, CV_32FC3);
output.setTo(0);
Rect r(0,0, frameO.cols, frameO.rows);
Mat destROI = output(Rect(20,20, frameO.cols, frameO.rows));
frameO(r).copyTo(destROI);
I just want to copy the image frameO
in output at the location Rect(20,20, frameO.cols, frameO.rows)
.
Anyone can tell me why this is not working?
To copy an image to another AWS Region, launch the AppStream 2.0 console and select the region that contains your existing image. In the navigation pane, choose Images, select your existing image, click Actions, select Copy, and then pick your target AWS Region.
Simple and Consistent Multi-Region Deployment – You can copy an AMI from one region to another, enabling you to easily launch consistent instances based on the same AMI into different regions.
Actually these commands were not working in OpenCV 2.3 but now the following works fine with the 2.4 release:
Mat frame1 = imread(nameReading1);
Mat output(frame1.rows*2, frame1.cols*2, frame1.type());
output.setTo(0);
frame1.copyTo(output(Rect(0, 0, frame1.cols, frame1.rows)));
This will copy frame1
in output as long as the type agree so be careful when you create output. frame1
will be copied in a ROI in output defined by Rect(0, 0, frame1.cols, frame1.rows)
.
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