From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

usb camera bit depth/gamma

Hi,

I am a bit new to Labview, so bear with me if this is a bit of a silly question. I recently built a little VI that captures the interference pattern produced by a pair of slits illuminated by a He:Ne laser. I used a standard USB webcam to do this. The VI runs fine.

My question regards the image produced. I expected to see a reasonably smooth curve. If you look at the attachment to this question, the screen-grab of the front panel, the fringe pattern looks a bit "clipped" at the bottom: the lower values of the interference pattern are all equal to 0, rather than showing a smoothish pattern as at the peak of the signal. 

 

I think this is something going on in Labview, not displaying the pattern as I expected, rather than an problem with the physics of my set up.

 

Do you think it's the case that the bit depth, by that I mean the number of discrete intensity levels of the camera is too small to resolve the trough in the signal, or rather that the gamma factor is a bit off?

 

Any suggestions that would help me image a smoother fringe pattern, especially at intensity low values, would be appreciated.

 

Thanks,

David

p.s  I also included the VI block diagram as well so you can have a little snigger at my cack-handed Labview skills 🙂

Download All
0 Kudos
Message 1 of 3
(2,339 Views)

Hi dtlloyd,

 

Firstly having looked at the coding you did, I've made some amendments to this. As you only sent a screenshot, the final SubVI that you used isn't included, but the coding I've attached looks like:

Snippet.png

 

There were two main reasons for editing the code. Firstly, by forcing a sequence using a sequence structure, you don't allow the coding to stop until each frame of the sequence has completed; and secondly you do not handle for any potential errors that may occur. In the amended coding (above) you only initialise the camera and close the reference to it once, i.e. outside of the loop. Therefore this allows much more time to your processor as you're not having to open a reference to the camera, acquire an image, and then close the reference to the camera every time you go round the loop as it just does the acquisition within the loop.

 

With reference to your minimum value appearing as 0, I believe this stems from the convert Image to Array VI. If you use context help (Ctrl+H) on this VI, you can see that the output Image Pixels is outputted as a U8 i.e. an unsigned integer and therefore this doesn't allow any negative values, hence there are no values below 0.

 

If you're acquiring an image, why are certain values of the image less than 0? Surely your image pixels should always be above 0 as you can't have a negative number of pixels?

 

I've attached the edited VI both for LabVIEW 2011, and LabVIEW 8.6 to account for different versions you may have.

 

Let me know if this helps!

 

Kind regards,

Tori
Student
Download All
0 Kudos
Message 2 of 3
(2,307 Views)

Hi Tori,

 

Thanks very much for helping me with this. The VI you provided works well and makes sense to me, I can see why my original effort was not the right way of going about viewing an image from the webcam.

I think I wasn't very clear with my first question, about what it was about the image that didn't seem right to me. I was expecting that the low values of the plot would look like a smooth curve. As can be seen from the original image I attached, many pixel values are displayed as zero, giving a "squared-off" look to the bottom of the plot. For clarity I have attached an image of what I was expecting to see (idealised somewhat).

 

I was trying to ask whether someone recognised this problem, and what was causing it. Even with the 8 bit camera I am using I expect to have enough depth to resolve the whole pattern fairly smoothly, and not have the squaring off of the lowest value pixels, so badly at least. My original enquiry refered to the gamma factor - as this dictates the spacing between the discritised intensity levels - the plot produced seems not to resolve small intensity values. Although I am not sure if this is relevant it could explain the issue I am having.

Does that make sense?

Thanks,
David 

0 Kudos
Message 3 of 3
(2,299 Views)