LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to distort an image (IMAQ or otherwise)

Solved!
Go to solution

Hello, I have a printer system that creates a distorted image. I would like to pre-distort the image so that after I print it, it looks normal.

 

I can characterize the distortion at some number of points (say 100 or 200). But the image will have over 1 million pixels, so I'll have to interpolate in between the measured points. The actual image is binary (0 or 1), I'm just printing in black. I have the full Vision Development Module, so if there are some useful functions in there that I'm missing, please let me know. But I'm certainly open to other approaches as well.

 

I do some other image manipulation by using IMAQ ReadFile and Image2Array. I don't really know where to start on this one but I figure people do the reverse pretty often. That is, they take a distorted image and make it look normal, while I want to take a normal image and make it look distorted (or pre-distorted).

 

Below is a visual description of what I want to do. Instead of starting with image 1, I'd like to convert to image 2 and then run it through my printer system.

 

Picture1.png

0 Kudos
Message 1 of 8
(1,243 Views)

take a lens distortion model like the polynomial / tangential and calculate the undistorted position for each pixxel or vice versa. Google for image rectification.

0 Kudos
Message 2 of 8
(1,206 Views)
Solution
Accepted by Gregory

I wrote code to add a certain type of distortion to photographic images.

Where it needs to fill in a pixel, it just picks an adjacent one.

Where it needs to blend pixels, it just picks one.

I do it this way for 3 reasons.

  1. To save processing time.
  2. Interpolating/blending pixels properly would be complicated by the fact that the grading is non-linear (agrivating item 1 above).
  3. The images that I'm dealing with are of such high resolution, that with ordinary content, artifacts introduced are not noticeable.
"If you weren't supposed to push it, it wouldn't be a button."
Message 3 of 8
(1,181 Views)

Hi Paul, my images are also pretty high contrast. I want to make sure I understand the idea correctly.

Below, the color of the cell (black or white) indicates the pixel value. The image is distorted by by moving each pixel a certain amount determined by my distortion measurement. In the example below, some are moved up, some left, and some up and left. Then I find the holes in the image and pick some method to fill them in. Is this along the lines of what you mentioned?

 

Screenshot 2024-01-12 101646.png

 

0 Kudos
Message 4 of 8
(1,170 Views)

What is actually a printer that distorts the image?

0 Kudos
Message 5 of 8
(1,120 Views)

@Gregory wrote:

Hi Paul, my images are also pretty high contrast. I want to make sure I understand the idea correctly.

Below, the color of the cell (black or white) indicates the pixel value. The image is distorted by by moving each pixel a certain amount determined by my distortion measurement. In the example below, some are moved up, some left, and some up and left. Then I find the holes in the image and pick some method to fill them in. Is this along the lines of what you mentioned?

 

Screenshot 2024-01-12 101646.png

 


That's pretty much how I did it.  But with high contrast content, you may see some clumping and/or gaps.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 8
(1,112 Views)

@Quiztus2 wrote:

What is actually a printer that distorts the image?


Hi Quiztus, our system uses a laser that is scanned using galvo mirrors and an f-theta lens. Often, the distortion correction is done with the galvo mirrors, but our system is a little more complex so that doesn't work. 

0 Kudos
Message 7 of 8
(1,065 Views)

@paul_cardinale wrote:


That's pretty much how I did it.  But with high contrast content, you may see some clumping and/or gaps.


Thanks Paul. The holes that are left after the first step have an interesting pattern (white lines in the image below). It ends up being <3% of the pixels which need to be filled. So far the results are looking promising.

Screenshot 2024-01-15 074823.png

0 Kudos
Message 8 of 8
(1,061 Views)