kl3m3n's blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Homography mapping calculation (Labview code)

Klemen
Active Participant

Hello,

I am posting Labview code to calculate the perspective projective mapping between two planes (homography), assuming that locations of at least 4 corresponding points are known. This can be used for pixel-to-real world mapping by eliminating perspective distortion, after which the measurements of a real world object can be performed. For example, the previous post describes the practical application of this (https://decibel.ni.com/content/blogs/kl3m3n/2015/03/13/optical-water-level-measurements-with-automat...).

Or you can just do some cool stuff like this :

destination_resized.png

base image

Koala_resized.jpgPenguins_resized.jpg

images of koala and penguins (obviously ).

final.png

final image (koala and penguins subjected to perspective distortion and inserted into both base image frames).

I am attaching the Labview program to calculate the homography and perform a simple check of the result. The calculated homography can then be used for example to map the pixel-to-real world or pixel-to-pixel coordinates.

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Comments
Ale914
Member

Hello Klemen, good work as usual.

One question: is it possible to adapt your example to 3D points (adding Z coordinate)?

Thanks.

Alessandro.

Alessandro Ricco
Klemen
Active Participant

Hello,

what are you trying to achieve? You can extract the rotation and translation parameters (object pose) based on the camera matrix and homography. Homography is basically a plane to plane mapping (perspective transformation), considering the pinhole camera model.

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
alexderjuengere
Active Participant

Thanks for sharing! May I ask you, how did you visualize the cube?

I plan to figure out the difference of your approach towards this approach shown here, using LV 3d picture control:

http://forums.ni.com/t5/LabVIEW/3D-Picture-Applying-Different-Textures-to-Faces-of-a-Cube/m-p/150050...

Klemen
Active Participant

Hello,

this is actually not 3d visualization, but a 2d image - I used IMAQ display indicator.

Best regards,K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
FilipeFontana
Member

Hello, K

could you please post the koala-penguins code?

I could not found a way to implement Homography matrix in my images.

Best regards,

Filipe

Spalabuser
Member
Hello everyone, after seeing the related transformation made by klemen, I wanted to know if someone had made a transformation of this type ...
any portion you see, especially those on the left, must be brought to a rectangle (dx-dy)
the final goal is to bring each portion from the most distorted to the least distorted ones all on each rectangle (dx-dy)mesh.jpg