Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Mathlookup function - Flaky results using Log operator

Maybe I'm incorrect in assuming that the Log operator will replace pixels in the source image with the log or log(10) values, but I am getting flaky results.

 

For example, in my type single image, I choose two pixels:

 

Original values

   - 1904 and 16112

 

after MathLookUp, Log function

   -  22910.81, 30508.17

 

I would have expected 7.55, 9.69 (or 3.28, 4.21 if it is log10).

 

Can someone tell me what is going on?

 

Thanks!

0 Kudos
Message 1 of 7
(3,645 Views)

Hey Steve,

 

What is the Mathlookup function that you are using?

 

for  input of 1904

 

log2 = 10.8948

log10 = 3.27967

 

which does not seem to be consistent with 7.55 that you were expecting

Andy Chang
National Instruments
0 Kudos
Message 2 of 7
(3,630 Views)

Algorithms.MathLookup(imageViewer.Image, imageViewer.Image, MathLookupOperator.Log)

 

0 Kudos
Message 3 of 7
(3,628 Views)

Hello Steve,

 

The Mathlookup function has an Operator in which you can specify the remapping procedure to use. By default, it is set to 0 which is a linear remappin. Here's the list of option that you have for the operator.

 

Linear (0)

(Default) Linear remapping.

Log (1)

A logarithmic remapping operation that gives extended contrast for small pixel values and less contrast for large pixel values.

Exp (2)

An exponential remapping operation that gives extended contrast for large pixel values and less contrast for small pixel values.

Square (3)

Similar to exponential but with a more gradual effect.

Square Root (4)

Similar to logarithmic but with a more gradual effect.

Power X (5)

Gives variable effects depending on the value of X. The default value of X is 1.5.

Power 1/X (6)

Gives variable effects depending on the value of X. The default value of X is 1.5.

 

Andy Chang
National Instruments
0 Kudos
Message 4 of 7
(3,597 Views)

Thanks, Andy. I am aware that these are the various lookup tables available, but it still doesn't explain why I am getting the result that I do.

 

Certainly someone in the big ol' NI World knows the answer.  Yes?

 

 

 

 

0 Kudos
Message 5 of 7
(3,590 Views)

Steve,

 

This is just a guess, but I'd imagine it does not simply take a direct log of the pixel value. It might take the original max range of pixel values of the image type (say 0-4095 for a 12-bit image) and map it to the exact same range (0-4095) but with a logarithmic scale rather than linear. So the real-world intensity difference between each pixel value would no longer be constant over the entire range but the actual possible range of pixel values would still be the same. If it were a direct log of each pixel value then the end range would not be the same.

 

Eric 

0 Kudos
Message 6 of 7
(3,587 Views)

Thanks, Blue Cheese -

 

I had actually thought of that, and it may be that it works that way. It's fine if one is only concerned about displaying the image, but it seems to be kind of worthless if one wants to do actual calculations, e.g., densitometry.

0 Kudos
Message 7 of 7
(3,585 Views)