c++ - Changing RGB values -
I am trying to replace one part of an image with another image, so I can not find the merge function , So I just
if " change to Change , you can use the
Let's assume that your original image is A
and you make a part of it (a rectangular area) with an image of B
Update: Here the code is
/ **** C **** / // image Get A and B (for example, I'm reading from the disk) IplImage * A = cvL oadImage ("image_A.jpg"); IplImage * B = cVLoadImage ("image_B.jpg"); // Set the interest of the area (ROI) to / as the RO of A and B. Saitiaimjiaraiai (A, Siviarakt (200,200,128,128)) will be handled; CvSetImageROI (b, cvRect (0,0,128,128)); // Copy ROI to RO in a CVCCP (B, A) BO; // Reset ROI (now full picture will be handled) cvResetImageROI (A); CvResetImageROI (b); // Display a cvNamedWindow ("Modified A"); CvShowImage ("Modified A", A); CvWaitKey (); // release images cvReleaseImage (& amp; A); CvReleaseImage (and b);
Use of OpenCV 2.0:
// C ++ // // Image A and B. have already been loaded ..... // The area in the image is one quarter (100,100) wide 200 and the height of 200 rectangles (100,100,200,200); // Area B in (50,50) width 200 and height 200 rts area (50,50,200,200); // No copy, only one reference mat for ROI of the image A_ROI (A, regional); March B_ORI (B, AreaB); // Copy all pixels from Zone B to Regional B. A (A);
Comments
Post a Comment