affinetransform

Homography and Affine Transformation

微笑、不失礼 提交于 2019-12-03 05:59:12
Hi i am a beginner in computer vision and i wish to know what exactly is the difference between a homography and affine tranformation, if you want to find the translation between two images which one would you use and why?. From papers and definitions I found online, I am yet to find the difference between them and where one is used instead of the other. Thanks for your help. I have set it down in the terms of a layman. Homography A homography, is a matrix that maps a given set of points in one image to the corresponding set of points in another image. The homography is a 3x3 matrix that maps

How to estimate 2D similarity transformation (linear conformal, nonreflective similarity) in OpenCV?

放肆的年华 提交于 2019-12-03 03:52:53
I'm trying to search a specific object in input images by matching SIFT descriptors and finding the transformation matrix by RANSAC. The object can only be modified in scene by similarity transform in 2D space (scaled, rotated, translated), so I need to estimate 2x2 transform matrix instead of 3x3 homography matrix in 3D space. How can I achieve this in OpenCV? You can use estimateRigidTransform (I do not know whether it is RANSAC, the code at http://code.opencv.org/projects/opencv/repository/revisions/2.4.4/entry/modules/video/src/lkpyramid.cpp says RANSAC in its comment), the third parameter

affine transform in PIL python

馋奶兔 提交于 2019-12-03 03:48:49
I have problems with the im.transform method in PIL python library. I thought I figured out the logic of parameters, A to F, however, the resulting image gets rotated in the wrong direction and cut off although all four corners calculated by the bellow function have correct positive values. Could anybody give me formulas to calculate affine parameters (A to F) from three identical points in both coordinate systems? def tran (x_pic, y_pic, A, B, C, D, E, F): X = A * x_pic + B * y_pic + C Y = D * x_pic + E * y_pic + F return X, Y transform works fine for me. As an example we'll rotate an image

custom shape rotation issue

不问归期 提交于 2019-12-02 17:46:20
问题 I am trying to rotate a custom shape around its center, but can not get the result as expected. what i want is * shape should be rotated around its center without moving itself. * what my solution is currently doing is rotating a whole shape around its center , by every rotation its changing its position. I have multiple shapes so i have created a class to encapsulate a shape with its transform in following class public abstract class Shoe implements Shape, ShoeShape { // variable declaration

Rotate a moving shape around its center

穿精又带淫゛_ 提交于 2019-12-02 16:33:24
问题 I'm making a 2D game in Java where the player guides a polygon through obstacles. The polygon moves up and down and the game world scrolls left and right. I need the polygon to rotate around its center, but since it is constantly being translated the point it is being rotated around moves. Trying to translate it back to the original center, rotate it, and translate it back doesn't work. How do I get the center of the shape? Here are my motion calculations on a 2ms timer: @Override public void

Draw an Image in arbitrary corners

妖精的绣舞 提交于 2019-12-02 12:35:34
问题 So i have a normal image. I defined Click- and Drag-Listeners on each corner of the rectangular image. I want to freely transform each of the corners and paint it on the screen. The AffineTransform class provides transformation possibilities but i couldn't find a way to realize this. I have implemented the same function in android with the Matrix.setPolytoPoly method. However there is no equivalent in java swing. Thanks! Edit: I would like to illustrate this process with the following image:

How to 'Get' a Specific Point From A Shape Object Derived from AffineTransform

丶灬走出姿态 提交于 2019-12-02 10:29:55
问题 As a self-project, I'm trying to make the game 'Asteroids'. Currently, I'm stuck on trying to figure out how to make it so the lasers fired from my ship appear from the tip of the ship. So far, I've tried experimenting with using the Shape object's .getBounds2D().getX() methods, but because getBounds2D() draws a rectangle around the polygon, the lasers end up appearing from the corner of the imaginary 'box' around my Polygon ship . Here's a gif of what I have so far. Is there a way to 'get' a

custom shape rotation issue

邮差的信 提交于 2019-12-02 08:42:15
I am trying to rotate a custom shape around its center, but can not get the result as expected. what i want is * shape should be rotated around its center without moving itself. * what my solution is currently doing is rotating a whole shape around its center , by every rotation its changing its position. I have multiple shapes so i have created a class to encapsulate a shape with its transform in following class public abstract class Shoe implements Shape, ShoeShape { // variable declaration /** * */ public Shoe() { position = new Point(); lastPosition = new Point(); } public void draw

Rotate a moving shape around its center

孤街浪徒 提交于 2019-12-02 08:24:32
I'm making a 2D game in Java where the player guides a polygon through obstacles. The polygon moves up and down and the game world scrolls left and right. I need the polygon to rotate around its center, but since it is constantly being translated the point it is being rotated around moves. Trying to translate it back to the original center, rotate it, and translate it back doesn't work. How do I get the center of the shape? Here are my motion calculations on a 2ms timer: @Override public void actionPerformed(ActionEvent e) { double theta = angleRad+90; if (up == true) { if (accelerating ==

How to 'Get' a Specific Point From A Shape Object Derived from AffineTransform

妖精的绣舞 提交于 2019-12-02 06:56:51
As a self-project, I'm trying to make the game 'Asteroids'. Currently, I'm stuck on trying to figure out how to make it so the lasers fired from my ship appear from the tip of the ship. So far, I've tried experimenting with using the Shape object's .getBounds2D().getX() methods, but because getBounds2D() draws a rectangle around the polygon, the lasers end up appearing from the corner of the imaginary 'box' around my Polygon ship . Here's a gif of what I have so far. Is there a way to 'get' a specific point from a Shape object; where, in this case, that specific point is the tip of the ship.