LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Contrast

Hi,
I am using a 16 bit "raw" image as my input data. The data can be a single image or a volume data. The program load a single or all the images in the memory and with the help of slider I can view these images in a sequence without any jerks (slow file operations). Now I have applied contrast to image by creating an image array and multiply this array with the contrast constant. But in a 16 bit signed image the value varies from -32768 to 32767 and when I multiply this image with a constant the value exceeds the limits.

Now I converted the image array to I32 so that the value wouldn't exceed the limit and with a loop I am clipping the value within -32768 to 32767 and it works fine but its too slow especially with a slider because for each image this loop runs for 256x256 times and I have above 450 images simultaneously in the memory.

Any efficient solution......?

Thanks in advance
Bilal
0 Kudos
Message 1 of 4
(2,969 Views)
Hi Bilal,

do as much as possible outside of loops. Almost all math operations also work on arrays...

But nevertheless: doing math on 256×256×2 = 131072 bytes takes time...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,959 Views)
I am just doing comparison inside the loop ....
for each pixel I just check if the value resides within the limits or not.
I cannot take it out as well

Bilal
0 Kudos
Message 3 of 4
(2,956 Views)
Hi Bilal,

two more points:
1) can you attach your vi (or a stripped down version)? Even comparisons can work on arrays...
2) you can check the user actions on the slider by using event structure. This way you can do calculations only when the user isn't moving the slider (value change, mouse up/down, time between events) to reduce computation time...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,936 Views)