- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
QImage Classin QT包
展开查看详情
1 .Assignment 2 Creating Panoramas 1
2 .Step 1: (10 pts) Implement the Harris corner detector. Part a. void GaussianBlurImage ( double *image, int w, int h, double sigma) Same as your function for Assignment 1, but the input is a floating point array of size w*h. You can use the full 2D kernel. You can index a pixel ( c,r ) by image[r*w + c] to go with the rest of the code for this assignment. r c 2
3 .Step 1: (10 pts) Implement the Harris corner detector. Part b . void HarrisCornerDetector ( QImage image, double sigma, double thres , CIntPt ** cornerPts , int & numCornerPts , QImage & imageDisplay ) image is the input image sigma is the standard deviation for the Gaussian thres is the threshold for detection corners cornerPts is an array that will contain the returned corner points numCornerPts is the number of points returned imageDisplay – image returned to display for debugging 3
4 .Step 1: (10 pts) Implement the Harris corner detector. Part b . void HarrisCornerDetector ( QImage image, double sigma, double thres , CIntPt ** cornerPts , int & numCornerPts , QImage & imageDisplay ) To do: i . Compute x and y derivatives of the image, use them to produce 3 images (I_x^2, I_y^2, and I_x * I_y ) and smooth each of them with a 5x5 Gaussian. ii. Compute the Harris matrix H in a 5x5 window around each pixel. iii. Compute corner response function R = Det (H)/ Tr (H), and threshold R. Try threshold 50 on the UI. iv. Find local maxima of the response function using nonmaximum suppression. 4 1 . i . n cornerPts [ i ] . m_X , cornerPts [ i ]. m_Y . . .
5 .Step 2: (10 pts) Implement MatchCornerPoints . void MatchCornerPoints ( Qimage image1, Cintpt * corner Pts1, int numCornerPts1, Qimage image2, Cintpt *cornerPts2, int numCornerPts2, CMatches **matches, int & numMatches , Qimage &image1Display, Qimage &image2Display) image1 is the first input image image 2 is the second (match from image 1 to image 2) cornerPts1 is a vector of interest points found in image1 cornerPts2 is a vector of interest points found in image 2 numCornerPts1 is the number of interest points in image1 numCornerPts2 is the number of interest points in Image 2 matches is a vector of matches; each match has X and Y coordinates from each image 5 1 . i . n matches[ i ] .m_X1, matches[ i ].m_Y1, matches[ i ].m_X2, matches[ i ].m_Y2
6 .Step 2: (10 pts) Implement MatchCornerPoints . void MatchCornerPoints ( Qimage image1, Cintpt * corner Pts1, int numCornerPts1, Qimage image2, Cintpt *cornerPts2, int numCornerPts2, CMatches **matches, int & numMatches , Qimage &image1Display, Qimage &image2Display) image1 is the first input image image 2 is the second (match from image 1 to image 2) cornerPts1 is a vector of interest points found in image1 cornerPts2 is a vector of interest points found in image 2 numCornerPts1 is the number of interest points in image1 numCornerPts2 is the number of interest points in Image 2 matches is a vector of matches; each match has X and Y coordinates from each image 5 1 . i . n matches[ i ] .m_X1, matches[ i ].m_Y1, matches[ i ].m_X2, matches[ i ].m_Y2
7 .Step 3: (10 pts) Compute the homography between the images using RANSAC ( Szeliski , Section 6.1.4). You write the helper functions for ComputeHomography . Part a. void Project (double x1 , double y1 , doube & x2 , double & y2 , double h[3][3] ) This should project point (x1, y1) using the homography "h". Return the projected point (x2, y2). See the slides for details on how to project using homogeneous coordinates . Part b . int ComputeInlierCount (double h[3][3] , Cmatches * matches , int numMatches , double inlierThreshold ). This is a helper function for RANSAC to compute thenumber of inlying points for a homography "h". P roject the first point in each match using the function "Project". If the projected point is less than the distance " inlierThreshold " from the second point (in that match), it is an inlier. Return the total number of inliers. 7
8 .c. void RANSAC ( Cmatches *matches , int numMatches , int numIterations , double inlierThreshold , double hom [3][3], double homInv [3][3], Qimage & image1Display, Qimage &image2Display) matches is a set of numMatches matches numIterations is the number of times to iterate inlierThreshold is a real number so that the distance from a projected point to the match is less than its square hom is the homography and homInv its inverse Image1Display and Image2Display hold the matches to display 8
9 .c. void RANSAC ( Cmatches *matches , int numMatches , int numIterations , double inlierThreshold , double hom [3][3], double homInv [3][3], Qimage & image1Display, Qimage &image2Display) a. Iteratively do the following for " numIterations " times: i . Randomly select 4 pairs of potentially matching points from "matches". ii. Compute the homography relating the four selected matches with the function " ComputeHomography . " iii. Using the computed homography , compute the number of inliers using " ComputeInlierCount ". iv. If this homography produces the highest number of inliers, store it as the best homography . b. i . Given the highest scoring homography , once again find all the inliers. ii. Compute a new refined homography using all of the inliers (not just using four points as you did previously. ) iii. Compute an inverse homography as well (the fourth term of the function ComputeHomography should be false), and return their values in " hom ” and " homInv ". c. Display the inlier matches using " DrawMatches ". 9
10 .c. void RANSAC ( Cmatches *matches , int numMatches , int numIterations , double inlierThreshold , double hom [3][3], double homInv [3][3], Qimage & image1Display, Qimage &image2Display) a. Iteratively do the following for " numIterations " times: i . Randomly select 4 pairs of potentially matching points from "matches". ii. Compute the homography relating the four selected matches with the function " ComputeHomography . " iii. Using the computed homography , compute the number of inliers using " ComputeInlierCount ". iv. If this homography produces the highest number of inliers, store it as the best homography . b. i . Given the highest scoring homography , once again find all the inliers. ii. Compute a new refined homography using all of the inliers (not just using four points as you did previously. ) iii. Compute an inverse homography as well (the fourth term of the function ComputeHomography should be false), and return their values in " hom ” and " homInv ". c. Display the inlier matches using " DrawMatches ". 9