I want to place an image on a captured video frame at the coordinates which I determined.
I asked that before and I have been told to use cvCopy
and
You will have to copy pixel by pixel from the source to the destination. The code below does precisely that, offseting with coordinates x
and y
. I haven't actually tried this, but am fairly certain it should work more or less as you'd expect.
Just make sure the target image is at least the size of the source plus the offset!
void drawImage(IplImage* target, IplImage* source, int x, int y) {
for (int ix=0; xwidth; x++) {
for (int iy=0; yheight; y++) {
int r = cvGet2D(source, iy, ix).val[2];
int g = cvGet2D(source, iy, ix).val[1];
int b = cvGet2D(source, iy, ix).val[0];
CvScalar bgr = cvScalar(b, g, r);
cvSet2D(target, iy+y, ix+x, bgr);
}
}
}