Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Image info tool

I am working on a college project involving a thermographic (infrared) camera, I am using a NI PCI-1405 card and the vision software bundled with it, along with Visual Basic 6. I can get the video signal from the camera with ease through its composite port. I am now trying to extract the pixel intensity value from the image (just the greyscale). The IMAQ vision image information tool gives me exactly what I need, but after searching through the help I cant seem to find how to do this programatically in VB6. What I would like to do is to extract the intensity value for a pixel at the center of the image for example.
 
Another related question I have is, is it possible to send video to the light metering function of IMAQ machine vision ? I seem to get an invalid image error when I try to send either a one shot image, or a continuous acquistion to CWmachinevision.lightmeterrectangle.
 
Finally, my goal in this project is to extract temperature information from the cameras video out (lets say the average temperature in a rectangle in the center of the frame). I am not too sure if this is possible with just a composite frame. I am planning on using OCR as a fall back to read the temperature values directly from the video (I know, I am a cheat !).If anybody has done something like this before examples would be greatly appreciated. VB6 is my only option for coding this.
 
Thanks for your time
A Geary
0 Kudos
Message 1 of 4
(3,795 Views)
Hi A Geary,

To read the intensity of a pixel at a certain location in the image, have a go at using the GetPixel method as described in the cwimaq.chm help file (C:\Program Files\National Instruments\Vision\Documentation\cwimaq.chm). This will return the value that you're looking for, I hope this is the sort of thing you had in mind!

The example code from the help file is as follows:

Private Sub Run_Click()
Dim point As New CWIMAQPoint
Dim value

' Initialize the point alpha planes
point.Initialize 10, 10

' Get the pixel from the image in Viewer1
CWIMAQVision1.GetPixel CWIMAQViewer1.Image, point, value

' Set the pixel value at a different location
' into the image in Viewer1.
point.Initialize 40, 40
CWIMAQVision1.SetPixel CWIMAQViewer1.Image, point, value
End Sub

With regard to your issues with the LightMeterRectangle method, please note that the method can only be used with U8, I16 and single-precision floating point images. U64 RGB images, for example, as not compatible. You can cast the image to another type if necessary to ensure compatibility with the method. After you have done this, you should be able to use the method on continuous and one-shot acquisitions.

I hope this helps!

Regards,

Tom

Applications Engineering, NI UK
0 Kudos
Message 2 of 4
(3,724 Views)
Hey, thanks for your reply, getpixel looks just like what I wanted. However after further thought I realised the image im acquiring is so noisy that the value of one pixel could become badly distorted. I tried plugging the image directly into the lightmeter example supplied with vision, I was having no sucess as it was an RBG image and the light meter doesnt support this. Changing to oneshot acquistion and using CWIMAQ1.ImageRep = cwimaqRepNone to change the imagetype however resulted in success.
 
As for my project in general I managed to acquire the current temperature range from the camera via the serial port. Using a simple calcution I then multiply the intensity of a selected rectange by the ratio of the range to get a pretty accurate temperature measurement.
0 Kudos
Message 3 of 4
(3,707 Views)
Hi A Geary,

It sounds like you're meeting success with the project now, excellent! Good luck with it for the future.

Best regards,
Tom

Applications Engineering, NI UK
0 Kudos
Message 4 of 4
(3,702 Views)