Place an image on an image

前端 未结 4 1751
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 14:34

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

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 15:04

    Unfortunately the "Paul Lammertsma" code has mixed up indexes here you have fixed code:

    void drawImage(IplImage* target, IplImage* source, int x, int y) {
    
        for (int ix=0; ixwidth; ix++) {
            for (int iy=0; iyheight; iy++) {
                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);
            }
        }
    }
    

提交回复
热议问题