homography

Detecting garbage homographies from findHomography in OpenCV?

最后都变了- 提交于 2019-11-28 04:24:12
I'm using findHomography on a list of points and sending the result to warpPerspective . The problem is that sometimes the result is complete garbage and the resulting image is represented by weird gray rectangles. How can I detect when findHomography sends me bad results? There are several sanity tests you can perform on the output. On top of my head: Compute the determinant of the homography, and see if it's too close to zero for comfort. Even better, compute its SVD, and verify that the ratio of the first-to-last singular value is sane (not too high). Either result will tell you whether the

Calculate camera world position with OpenCV Python

断了今生、忘了曾经 提交于 2019-11-28 03:30:26
I want to calculate my camera's position in world coordinates. This should be fairly easy, but I don't get the results I expect. I believe I've read everything on this topic, but my code isn't working. Here's what I do: I have a camera looking at an area. 1) I drew a map of the area. 2) I calculated the homography by matching 4 image points to 4 points on my map using cv2.getPerspectiveTransform 3) The H homography transforms every world coordinate to camera coordinate; this is working properly 4) To calculate the camera matrix I followed this : translation = np.zeros((3,1)) translation[:,0] =

OpenCV 2.4.3 - warpPerspective with reversed homography on a cropped image

左心房为你撑大大i 提交于 2019-11-27 15:21:19
问题 When finding a reference image in a scene using SURF, I would like to crop the found object in the scene, and "straighten" it back using warpPerspective and the reversed homography matrix. Meaning, let's say I have this SURF result: Now, I would like to crop the found object in the scene: and "straighten" only the cropped image with warpPerspective using the reversed homography matrix. The result I'm aiming at is that I'll get an image containing, roughly, only the object, and some distorted

Android OpenCV Find Largest Square or Rectangle

一世执手 提交于 2019-11-27 11:43:58
This might have been answered but I desperately need an answer for this. I want to find the largest square or rectangle in an image using OpenCV in Android. All of the solutions that I found are C++ and I tried converting it but it doesn't work and I do not know where I'm wrong. private Mat findLargestRectangle(Mat original_image) { Mat imgSource = original_image; Imgproc.cvtColor(imgSource, imgSource, Imgproc.COLOR_BGR2GRAY); Imgproc.Canny(imgSource, imgSource, 100, 100); //I don't know what to do in here return imgSource; } What I am trying to accomplish in here is to create a new image that

How to check if obtained homography matrix is good?

我的未来我决定 提交于 2019-11-27 11:36:05
This question was already asked , but I still don't get it. I obtain a homography matrix by calling cv::findHomography from a set of points. I need to check whether it's relevant or not. The proposed method is to calculate maximum reprojection error for inliers and compare it with a threshold. But after such filtration I keep getting insane transformations with object bounding box transforming to almost a straight line or some strange non-convex quadrangle, with self-intersections etc. What constraints can be used to check if the homography matrix itself is adequate? DanielHsH Your question is

Calculate camera world position with OpenCV Python

此生再无相见时 提交于 2019-11-27 05:08:58
问题 I want to calculate my camera's position in world coordinates. This should be fairly easy, but I don't get the results I expect. I believe I've read everything on this topic, but my code isn't working. Here's what I do: I have a camera looking at an area. 1) I drew a map of the area. 2) I calculated the homography by matching 4 image points to 4 points on my map using cv2.getPerspectiveTransform 3) The H homography transforms every world coordinate to camera coordinate; this is working

How to get rotation, translation, shear from a 3x3 Homography matrix in c#

六眼飞鱼酱① 提交于 2019-11-27 03:39:22
问题 I calculated the 3x3 homography matrix and I need to get rotation, translation, shear and scale to use them as parameters in the windows8 media element attributes ?! 回答1: see https://math.stackexchange.com/questions/78137/decomposition-of-a-nonsquare-affine-matrix def getComponents(normalised_homography): '''((translationx, translationy), rotation, (scalex, scaley), shear)''' a = normalised_homography[0,0] b = normalised_homography[0,1] c = normalised_homography[0,2] d = normalised_homography

Warping an image using control points

99封情书 提交于 2019-11-27 02:43:26
问题 I want to convert an image using control points according to this scheme extracted from here: A and B contains the coordinates of the source an target vertices. I am computing the transformation matrix as: A = [51 228; 51 127; 191 127; 191 228]; B = [152 57; 219 191; 62 240; 92 109]; X = imread('rectangle.png'); info = imfinfo('rectangle.png'); T = cp2tform(A,B,'projective'); Up to here it seems to properly work, because (using normalized coordinates) a source vertex produces its target

Extract transform and rotation matrices from homography?

不羁的心 提交于 2019-11-27 01:29:43
问题 I have 2 consecutive images from a camera and I want to estimate the change in camera pose: I calculate the optical flow: Const MAXFEATURES As Integer = 100 imgA = New Image(Of [Structure].Bgr, Byte)("pic1.bmp") imgB = New Image(Of [Structure].Bgr, Byte)("pic2.bmp") grayA = imgA.Convert(Of Gray, Byte)() grayB = imgB.Convert(Of Gray, Byte)() imagesize = cvGetSize(grayA) pyrBufferA = New Emgu.CV.Image(Of Emgu.CV.Structure.Gray, Byte) _ (imagesize.Width + 8, imagesize.Height / 3) pyrBufferB =

Opencv virtually camera rotating/translating for bird's eye view

会有一股神秘感。 提交于 2019-11-26 17:44:00
I've a calibrated camera where I exactly know the intrinsic and extrinsic data. Also the height of the camera is known. Now I want to virtually rotate the camera for getting a Bird's eye view, such that I can build the Homography matrix with the three rotation angles and the translation. I know that 2 points can be transformed from one image to another via Homography as x=K*(R-t*n/d)K^-1 * x' there are a few things I'd like to know now: if I want to bring back the image coordinate in ccs, I have to multiply it with K^-1, right? As Image coordinate I use (x',y',1) ? Then I need to built a