What we do today uses several functions of OPENCV, and summarizes them in turn. (1) OpenCV to the area of interest in particular, I would like to mosaic two images into an image, it is easy to imagine the method is to create a large image (height of two original height of the larger, width of two original width of the sum), Then copy the two image contents to the corresponding area of the larger map. It is easy to think of the ROI method with OpenCV. Online a lot of summary methods are used OPENCV C-style code, with the Iplimage, but I use C + + style, code is not compatible, looked for a period of time to find a solution, the specific code is as follows:
void Siftfeature::imagejoin (Cv::mat &src1, Cv::mat &src2, Cv::mat &dest)
{
Cv::rect roi1 = Cv::Rect (0, 0, Src1.cols, src1.rows);
Cv::mat matchImage1 = dest (ROI1);
Src1.convertto (MatchImage1, Matchimage1.type ());
Cv::rect roi2 = cv::rect (src1.cols, 0, Src2.cols, src2.rows);
Cv::mat matchImage2 = dest (ROI2);
Src2.convertto (MatchImage2, Matchimage2.type ());
}
This is one of the things I do, obviously, Src1 and Src2 is the original, dest is a big picture of the stitching. First select a rectangular area of interest, then select the area of the destination image, and use the Converto method of the original to convert it. The code is simple, here is only a backup, estimated next time will forget ... The results are as follows: The Yellow line here is the result of my SIFT feature matching, which is irrelevant to the image stitching.
(2) OpenCV draw pointsNot much to say, directly on the code, actually drawing a small circle
CV::P oint pointinterest;//feature point, used to draw in an image
Pointinterest.x = keys[i][k].x;//feature points in the image axis
Pointinterest.y = Keys[i] [k].y;//feature points in the image are ordinate
cv::circle (image, Pointinterest, 2, cv::scalar (0, 0, 255));//Draw a feature point in the image, 2 is the radius of the circle
(3) OpenCV drawing line
CV::P oint start = CV::P oint (x1, y1);
CV::P oint end = CV::P oint (x2, y2);
Cv::line (image, start, end, Cv::scalar (0, 255, 255));