# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Re: Vignette effect

@Hawk_se wrote:

This is the solution what i needed... There is only one thing left, multiplying this 2D array with flat grayscale image.

Multiplying two 2D arrays of equal size is trivial. No need for loops.

Well, the center should be derived from the dimension. they are not independent. You don't need "A", because without it, the max is exactly one, i.e. what you need.

Your sigma controls (and their scaling) need to be before the loop. It is expensive to re-read the controls with every iteration of the loop, and if it would get changed during loop execution, all bets are off. (unlikely here, because the loop is so fast!). Carefully check your wiring. You seem to mix CenterX with SigmaY and vice versa. Confusing and probably not right.

As I showed above, you can eliminate a lot of complexity by using arrays.

Another simple method would be to just create two 1D gaussians and then do the outer product to create the 2D array. Now you only have N+M exponentiations instead of MxN, but the outer product is of course not entirely free. Worth thinking about if your arrays are gigantic, but not here. (some duplicate code can still be eliminated, e.g. the Sqrt(2), not shown)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 11 of 13
(92 Views)

## Re: Vignette effect

Multiplying two 2D arrays of equal size is trivial. No need for loops.

- I'll consider this...

Well, the center should be derived from the dimension. they are not independent. You don't need "A", because without it, the max is exactly one, i.e. what you need.

- In real applications, center can be shifted from optical axis that's why i need to define this coordinate for my case. But for A parameter you're right.

Your sigma controls (and their scaling) need to be before the loop. It is expensive to re-read the controls with every iteration of the loop, and if it would get changed during loop execution, all bets are off. (unlikely here, because the loop is so fast!)

- I agree with you, i should define sigma constants before loop!

Thank you for your all effort, i'll consider all suggestions and re-design the solution.

Message 12 of 13
(81 Views)

## Re: Vignette effect

OK, I made a quick draft during breakfast. (Using an 8 bit image of a Corona Virus found on the internet). You simply need to adapt it for 16bit greyscale (which plain LabVIEW does not support. I don't have the vision toolkit installed).

Some suggestions (not implemented):

• It might be easier to have controls for "1/sigma" instead. This way 0 mean "no vignette". Currently you would need to set the sigma=Inf for that. With controls proportional to 1/Sigma, A larger value would mean a larger effect. More intuitive.
• I would probably implement an event structure so things only recalculate when controls change.
• Note that the array controls are currently sorted Y,X You can easily modify.
• etc.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 13 of 13
(54 Views)