LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is NI-Vision 16-bit BCG subvi incorrect?

I am attempting to do a BCG adjustment on a 16-bit image. I downloaded the 16-bit version of the NI-vision BCG adjust subvi, but I believe it to be working incorrectly. From the documentation, it seems that values of 0,45, and 1 for brightness, contrast, and gamma respectively should yield the exact same image as previously. This does not happen.

I have attached a little library containing an example of this and the BCG subvi. I picked a random image from my data and threw it in there. Also, I'm sure I could find some BCG values to make the output image the same as the input image, however these values do not stay constant from image to image.
0 Kudos
Message 1 of 15
(4,900 Views)
To whom it may concern:

I would first like to apologize for taking a little longer to get back to you on this one. We had to look into this one for awhile before we stumbled onto a problem with that example program.

In the IMAQ BCG Lookup 16bit sub-vi had an issue with the Lookup Table input to the IMAQ User Lookup.vi. The array needed to be rearranged so that index 0-32767 per KnowledgeBase http://digital.ni.com/public.nsf/websearch/8E00902D3196B9C1862568C000628449?OpenDocument. Then index 32768-65535 will be -32767-(-1) respectively. With this change, things are up and going. Go ahead and use the attached altered sub-vi and you should be good to go. Thanks again for your patience and my apologies for the oversight on our end with this
example program.

Best of luck,

Jim Laudie
Applications Engineer, National Instruments
Download All
0 Kudos
Message 2 of 15
(4,893 Views)
Hi:

Are you going to correct the download on developer zone?

Thanks,

Don
0 Kudos
Message 3 of 15
(4,893 Views)
Don,

Actually, I've just made the change. It's pending an approval before we push it back live on the website. Thanks for getting our attention on that one. And apologies for any inconvenience.

Best of luck,

Jim Laudie
Applications Engineer, National Instruments
0 Kudos
Message 4 of 15
(4,893 Views)
Hi, I tried to use the 16bit BCG subvi but it doesn't look correct to me, i am working with Unsigned 16 bit images and the controllers are not working as they are supposed to work.
0 Kudos
Message 5 of 15
(4,846 Views)
Christos,

I'm not quite sure what you mean by "it doesn't look correct." I'd be happy to offer what help I can if you can detail what appears to be the problem.

Thanks,

Jim Laudie
Applications Engineer, National Instruments
0 Kudos
Message 6 of 15
(4,834 Views)
In my program i am using images that are unsigned 16.
The program you have is working with signed 16bit images. I tried to modify it but the range is still not correct. The zero value on brigthness does not correspond to black and the controller increases the brigthness of the image up to 28000 pixel value. What i would like the program to do is to load my image and when i decrease the brightness to go up to totally black 0 and when i increase to brightness to go up to white 65535
I am attaching u the program i modified, with an image i am using
0 Kudos
Message 7 of 15
(4,820 Views)
Christos,

Just a couple of things that I'd like to clarify...

At issue are two points:

1) Whether or not your acquired image is unsigned 16-bit, IMAQ only supports a signed 16-bit format. You'll see that the IMAQ buffer you're passing into the LUT VI in your code is actually a signed 16-bit image buffer.

2) It seems that you'd like to redefine "brightness" in a different way in which it was "defined" in the previous VI. This is fine, but we have to change the formulas a little bit.


Notes:

If I understand you correctly, you'd like to input a brightness of 0 and have your image be entirely dark. And you'd like to input a brightness of 65,535 and have the image be entirely light. That is not the way the VI has currently been set up. (Right now, the VI accepts a brightness input such that an input of 0 corresponds to a normal distribution of pixel values. Meaning that a 0 pixel value comes through the LUT as 0. If you increase the brightness to 1, at the input pixel value of 0 the output of the LUT is 1. Hence, the image is brighter. If you set the brightness to 32,767, then the input pixel value of 0 has an output of the LUT of 32,767. This is the brightest value in the signed 16-bit format. Every pixel value greater than 0 would rail at the 32,767 value.)

So if you're wanting to adjust the "definition" of brightness per my interpretation above (0=totally dark and 65,535=totally bright), you'd need to do the following:

* Brightness=65,535: The darkest pixel value (0 in the unsigned 16-bit format) would need to get the lightest LUT output (32,767 in the signed 16-bit format) for a brightness of 65,535. This would correspond to the lightest pixel value (65,535 in your unsigned 16-bit format) getting an LUT output value of 98,302. Values greater than 32,767 are coerced to 32,767 in the signed 16-bit format. Hence all pixel values would be the most bright possible.

* Brightness=0: The lightest pixel value (65,535 in your unsigned 16-bit) needs to get the darkest LUT output (-32,768 for signed 16-bit) at a brightness of 0. This would make the darkest pixel value (0 in your unsigned 16-bit) get an LUT output of -98,303. As above, pixel values less than -32,768 are coerced to -32,768 in the signed 16-bit format.


Code:

I've gone through your code as attached in your previous message and altered it slightly to where it will now exhibit the brightness behavior as described above. I've included some new text notes on the block diagram that kind of explain what's going on.

I hope this is helpful to you. And I hope this explanation is somewhere close to clear. It's a little involved, but ultimately do-able. Best of luck in getting this implemented...

Jim Laudie
Applications Engineer, National Instruments
0 Kudos
Message 8 of 15
(4,810 Views)
Hi, I am still having problems with the 16bit controller, do u have any updated controller in the new version or update of labview?
I am attaching the demo VI i am using, the controller VI and the raw image i am trying to adjust the contrast and brigthness.
The brightness seems to be working, the contrast though is not working correctly. I will appreciate it if you have a look at it.
Thank you,
Christos
0 Kudos
Message 9 of 15
(4,718 Views)
I forgot the attachment. Here it is
0 Kudos
Message 10 of 15
(4,715 Views)