Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 37

Thread: geometric correction algorithm

  1. #21
    Join Date
    Sep 2016
    Posts
    7
    Blog Entries
    1

    Default

    Quote Originally Posted by trojek View Post
    Hi!

    I write my own software in order to display simple shapes using laser projector. I faced with geometric correction problem while I was trying to display straight vertical lines. I have read in W. R. Benner's book (LASER SCANNERS: Technologies and Applications: How they work, and how they can work for your product) about geometric correction and I know why this problem occurs.
    Do anybody know what it the state of the art method to solve it? I don't want to reinvent the wheel.

    Thanks in advance,
    Tomek
    Okay! I will now walk through the solution using the equation presented in the book mentioned rather than use taylor series approximation. First, I will identify what the specific type of distortion you are probably dealing with looks like.
    ~
    When you project a square on the wall your projection probably looks like ") (" when you really want "| |" where the second geometrically fits inside the first and is tangent at the min and max X values when y=0
    ~
    The equations from the book are y = d tanθy and x = (d / cosθy + e) * tanθx
    ~
    Briefly, as long as you see no curvature along a horizontal line, your y value stays the same. Meanwhile, your X value when y=0 is correct but is flung increasingly further from the center as the magnitude of y increases.
    ~
    What we want to do is calculate our X values such that with the distortion, the X value will be the value we intended. Since the distortion always adds to the X value, we can reason that as the magnitude of Y increases, the magnitude of our corrected X must decrease in order to reach our intended X coordinate. So there is a straightforward way to accomplish this which is using the X formula above to compute your desired tanθx (and consequently your new X value) by plugging in you desired Xvalue on the left side of the equation. We expect the computed tanθx value to be less than original tanθx.
    ~
    Say you want to get to the top right corner of your projection region with a 16-bit projector with a 30 degree FOV. The distortion actually causes your X to go farther than 30 degrees out from center...
    ~
    Step 1) Compute θy using ratios. So if your projector FOV is 30 degrees and with 16 bits your max coordinate is ~32768
    θy = y-coordinate / max-y-coordinate * max-y-angle or in this case 32768 / 32768 * 30 = 30. An important note is that with value 0, your max positive value is actually 32767. Add 1 to any y >= 0 value to prevent undesired consequences.
    ~
    Step 2) if you know or can find your physical d and e values use them. Otherwise, use e=0 and for d use max-y-coordinate / tan(max-y-angle) or in this case that would be 32768 / tan(30) = 56755.84... Note that if you use your own d and e then you have to worry about units but will get a more precise result if you were able to obtain precise measurements.
    ~
    Step 3) Compute tanθx = x-desired / (d / cosθy + e) or in this example 32768 / (56755.84 / cos(30) + 0) = 0.5
    Note that the angle θx is the inverse tangent of 0.5 which is approximately 26.57 degrees
    ~
    Step 4) Compute the X value you need to use to get x-desired. I use the angle to max value ratio like in step 1) so x-needed = θx / max-x-angle * max-x-coordinate or in this case 26.57 / 30 * 32768 = 29016.
    ~
    So if you use the point (29016, 32767) your laser beam will go to the top right corner of your projection region.
    ~
    Hope this helps! As I said I will try to post code later this week but I tried this and it worked very well. I am attempting to attach pictures but we will see if it works. IMG_0527.jpgIMG_0530.jpg

  2. #22

    Default

    Hi,

    I did geometric correction using the equations from Benner's book. My solution is very similar to jbuck1 solution. I tried to face with taylor series but i find it useless or just too hard to understand and implement. After all I would like to thank everyone but jbuck 1 solution was definitely the best in my case.
    If anyone is interested in implementation of this solution in python pleas let me know.

    Thanks,
    Tomek

  3. #23
    Join Date
    Jul 2008
    Location
    My momentum is too precisely determined :S
    Posts
    1,733

    Default

    If the code is open source then yes I'd be very much interested!
    "We thought our liFe by aN allegory with a jOurney, with a pilgRimage, which haD a serious purpose at the end, the thing was to get to that end. Success, or whatever it is, or maybe heaven after your death. But we missed the point the whole way along. It was a musical thing and you were supposed to sing, or dance, while the music was being played."

  4. #24
    Join Date
    Nov 2008
    Location
    Cleveland Ohio
    Posts
    1,508

    Default

    I have two of the hardware boxes. I find myself never using them as the software does a nice job and if I need it it is built in to my Raven Transcoder.
    The op amps to do it are either not available or very expensive. Could not someone clone the function software like they clone the function of chips in DSP?
    So if someone could do this all you need is to program an fpga with the logic solution and upload to the platform. Now everyone can use it without having to be a programmer.
    Someone could just sell the chips. Now its a few rotary encoders and an fpga. DZ I'm calling your name..... (yea it's not as simple as I make it out but could be done)

  5. #25
    Join Date
    Nov 2008
    Location
    Cleveland Ohio
    Posts
    1,508

    Default

    I have two of the hardware boxes. I find myself never using them as the software does a nice job and if I need it it is built in to my Raven Transcoder.
    The op amps to do it are either not available or very expensive. Could not someone clone the function software like they clone the function of chips in DSP?
    So if someone could do this all you need is to program an fpga with the logic solution and upload to the platform. Now everyone can use it without having to be a programmer.
    Someone could just sell the chips. Now its a few rotary encoders and an fpga. DZ I'm calling your name..... (yea it's not as simple as I make it out but could be done)

    https://www.photonlexicon.com/forums...hp/t-8019.html

  6. #26
    Join Date
    Jun 2009
    Location
    St. Louis, MO
    Posts
    549

    Default

    The key is here, "I have two of the hardware boxes. I find myself never using them..." There's something wrong with a community that asks for things that the vast majority of the individual members of the community have no intention of buying.
    "There are painters who transform the sun into a yellow spot, but there are others who, with the help of their art and their intelligence, transform a yellow spot into the sun." Pablo Picasso

  7. #27
    Join Date
    Jan 2014
    Location
    North Carolina, USA
    Posts
    217

    Default

    I believe what you are asking for is referred to as Projective Transformation or Homography - and is a very well studied concept in computer graphics. Simply googling those two terms should get you well on your way to implementing a perspective transform algorithm in your favorite language.

    The easiest and currently most popular method in CG for solving this is using a system of linear equations to solve for the desired projected coordinates (geometric corrected). To really understand this stuff, you basically need a couple semesters of calculus and at least one course in linear algebra and/or Diff EQ.

    But here are some good sources to get started:

    The Wikipedia article on Homography:

    https://en.wikipedia.org/wiki/Homogr...cal_definition

    A really great explanation on math.stackexchange (But again, unless you have a foundation of calculus and linear algebra, this stuff may be a bit confusing).

    http://math.stackexchange.com/questi.../339033#339033

    And lastly, because I love simple javascript examples, here is a direct link to the simple javascript example of projective transformation discussed in the example above... all the source code is right there if you are interested in diving in to seeing how things work. It is all pretty basic matrix transforms / mathematics / solving for linear equations.

    This javascript example is using matrix3d CSS object to do the drawing, but all of the matrix math is included in this example.

    http://jsfiddle.net/dFrHS/1/

  8. #28
    Join Date
    Nov 2008
    Location
    Cleveland Ohio
    Posts
    1,508

    Default

    I would use a box that gave bias and gain on each color line plus the geometric correction. Add in the dz delay line for good measure. Have beam sampling to linearize the colors as well. Now that fpga chip gets a workout and I would use that. Might as well add a dac to it and take adat input as well as USB.

    If someone programs the fpga once they can post the code and problem over for good. Do many want it? Don't care the idea is the idea. Do it don't but don't make people who dream feel bad. The whole idea here is to dream and share. Practicality yes when possible but this isn't a corp think tank and nobody is in competition. That or I missed that memo....

  9. #29
    Join Date
    Jun 2009
    Location
    St. Louis, MO
    Posts
    549

    Default

    Don't dream it - do it. Sure as hell don't "dream it" and ask somebody else to do it and give you the plans for free... Creatives rarely need other people to supply ideas...
    "There are painters who transform the sun into a yellow spot, but there are others who, with the help of their art and their intelligence, transform a yellow spot into the sun." Pablo Picasso

  10. #30
    Join Date
    Nov 2008
    Location
    Cleveland Ohio
    Posts
    1,508

    Default Plus One

    Quote Originally Posted by laserist View Post
    Don't dream it - do it. Sure as hell don't "dream it" and ask somebody else to do it and give you the plans for free... Creatives rarely need other people to supply ideas...

    Plus One! If I had the skill I would do it and I would not worry about what it cost me to do it. Yes I might charge what it cost me to make the chips and ship it but then I would post the code for free so anyone who had the skill could burn a chip. BUT this is purely a hobby to me and I vowed and have kept my vow to never make or take a penny. won't fault those who do it but it is not my choice. Others feel different.

    many people have posted ideas on here I used for my own purposes. Cyl lens, spatial filters, amorphic prisms, diodes and their properties, the list is long. I give back ideas when I can in the same spirit they are given to me.

    I may have a way to get this into reality. Stay tuned I know someone who did it as a product and doesn't make it anymore. They might free up the ability. I shall ask.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •