Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring the 1411 using CVI

I am testing Video in PAL and NTSC formats.  How can you programatically cheange the 1411 to switch between the two signal types in CVI?  I can not find documenation on CVI functions for this card.
0 Kudos
Message 1 of 9
(4,843 Views)
Good afternoon TheSpecialist,
 
In order to programmatically change your interface between PAL and NTSC, you will need to programmatically change the camera file that is associated with your camera.  I found the following KnowledgeBase by searching our on-line help at www.ni.com/support,
 
 
This KnowledgeBase describes that process and attaches a LabVIEW VI that shows an example of this, if you have a copy of LabVIEW handy!
 
I hope this information is helpful.  If there is any more specific information that you need, please post back!
 
Respectfully,
0 Kudos
Message 2 of 9
(4,825 Views)
I am not familiar with labview, we use CVI only.  I am switching between cameras constantly.  Is it necessary to configure the card for a specific camera?  Ideally I would like to auto detect the video type (NTSC or PAL) and have it switch automatically.
 
 
0 Kudos
Message 3 of 9
(4,814 Views)
TheSpecialist,
 
Unfortunately, programmatically switching between camera files is not a feature as the card requires to be configured by the camera file upon initialization.  This means that in order to swtich camera files, the current task must by stopped, so that the card can then reinitialize with a different camera file. 
 
If there is any other information that I can offer, please don't hesitate to ask.
 
Respectfully,
0 Kudos
Message 4 of 9
(4,810 Views)
The Specialist,
 
Well there are a few ways in which we can do this depending on how your system is set up.:
 
Do you have the two cameras connected and have a physical switch to chose which camera is directly connected to the card?
Are you using a colour image?
 
1) If the cameras are not physically connected and you are switching between them by removing the cable and replacing with the second cameras cable, then you will instantly get a timeout error (the pixel clock on the card will time out and stop the acquisition)
From here it would be necessary to start the acquisition again.  So you could in this case add a switch on the front panel (or a dialog box) that askes you for the video type before you proceed.
2) If you are not using a colour image then it's going to be very difficult to detect the change from PAL to NTSC without some user input. As the only main differences are the colour decoding. Although the heights are different and the frame rates are different also, it is very difficult to detect these changes progromatically. (the card is unable to do this in hardware and simply sends back a scrambled image)
 
HOWEVER
 
If you ARE using colour AND using two physically connected cameras then it may be possible to do this progromatically in the following way:
 
Firstly as I explained the colour decoding is very different. PAL uses 4.43MHz as it's colour information carrier and NTSC uses 3.58MHz.
Therefore if you performed a simple colour saturation test on your colour image, you will find that when you switch from PAL to NTSC (and vice versa) the colour saturation will drop to 0 (or a very low number)
Therefore you can then detect the change in camera.  This however is where we need to stop the acquisition.
When we stop the acquisition we then need to change the img0.iid file. (this is the file that selects the correct camera file to load up in the initialization of the camera.)
 
Below is it's location on your harddrive:........Program Files\National Instruments\NI-IMAQ\data\img0.iid
 
And it looks like this:
 
[NIIMAQ_HEADER]
Type = 1
Version = 15
[INTERFACE_DATA]
InterfaceName = "img0.iid"
InterfaceTypeEx = 128
SerialNumber = 13781046
[PORT0]
Channel0 = "Pulnix TMC-6700.icd"
Channel1 = ""
Channel2 = ""
Channel3 = ""
DefaultChannel = 0
[PORT1]
Channel0 = ""
Channel1 = ""
Channel2 = ""
Channel3 = ""
DefaultChannel = 0
 
......What you need to do is open this file and alter the channel0 line to read either Channel0 = "PAL.icd" or Channel0 = "NTSC".
(you will need to actually check which files you use for each camera depending on the video link (S video etc))... another option is to have the two already formatted files in seperate folders and just replace the file in that directory with the correct iid file.
 
Then you need to initialise the acquisition again (so that the iid file is loaded and the icd file settings are applied to the card) and you will be acquiring the image data as needed.
 
Hopefully this will give you a good starting ground?
Post back if you need any more information and I'll gladly see what I can do
 
Thanks
 
AdamB
 

Message Edited by AdamB on 06-30-2006 09:05 AM

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 5 of 9
(4,807 Views)
The 1411 I am using is set to its default configuration.  I use MAX to set it to PAL/NTSC when required.  I am using a thread to acquire the live video.  When I unplug the cable or shut the camera off I have a default video loss image appear on the screen.  If I forget to switch the 1411 to NTSC/PAL the video loss image appears.  The images currently being tested are color but B+W video will be tested in the future.   I am trying to remove all user input from the test to reduce test time.  How would you perform a color saturation test?  Currently I am reading RGB values to determine if the image is color or B+W.  The camera I am testing has a color filter and can switch into B+W.  I sample pixels on an image and compare the RGB values.  If they are equal the image is monochrome.  The problem is the pixel values are not exactly equal, they are off by a few points because the video is not truely B+W.  I sample enough points to take an average value.  This test only works if the image being tested has bright colors.  Dull/gray images fail this test.  If I can read the color carrier frequency I can simply my B+W test and hopefully detect PAL/NTSC images.  Is there any other way to swtich the video type of the card without changing the camera file?    


0 Kudos
Message 6 of 9
(4,790 Views)

Hi,

Below is a small snippit of code to extract the saturation plane in LabWindows CVI:

 

static int IVA_CLRExtractSaturation(Image* image)
{
    int success = 1;
    Image* plane;


    //-------------------------------------------------------------------//
    //                         Extract Color Plane                       //
    //-------------------------------------------------------------------//

    // Creates an 8 bit image that contains the extracted plane.
    VisionErrChk(plane = imaqCreateImage(IMAQ_IMAGE_U8, 7));

    // Extracts the saturation plane
    VisionErrChk(imaqExtractColorPlanes(image, IMAQ_HSL, NULL, plane, NULL));

    // Copies the color plane in the main image.
    VisionErrChk(imaqDuplicate(image, plane));

Error:
    imaqDispose(plane);

    return success;
}

 

If you then run a histogram on this greyscale image (the result) you will find that on a black and white image that is in PAL format while the card is set to NTSC will have 0 (zero) saturation (and should be black) while a filtered black and white image (as you say has SOME colour) with the correct video format will have some saturation values.

This might work?

Do you have a few sample images I could look at (try and save them in RGB format so I can extract the image data)  if you post up an image of the filtered black and white, against the incorrect video format image I can have a look for you.

" Is there any other way to swtich the video type of the card without changing the camera file?"

No there isn't (as Jeffrey P said in an earlier post)

I hope this helps

AdamB

 

Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 7 of 9
(4,774 Views)
I'll try the code when I get to work tomorrow.  Is there a default camera file I can use to switch back and forth between NTSC and PAL?
0 Kudos
Message 8 of 9
(4,759 Views)
Hi,
 
Yes there is. (as I said earlier)In this folder:
 
....Program Files\National Instruments\NI-IMAQ\data\
 
And to quote myself again:
 
"What you need to do is open this file and alter the channel0 line to read either Channel0 = "PAL.icd" or Channel0 = "NTSC.iid".
(you will need to actually check which files you use for each camera depending on the video link (S video etc))..."
 
So this means that in the NI-IMAQ\data folder, there are a number of default iid files (PAL.iid and NTSC.iid) that you can use.
If you just check the img0.iid file once you have run each of the PAL and NTSC setups, you will find out which one is used in each instance. This information will be in the line:
 
"Channel0 = "PAL.iid""
 
Give this a go and get back to me if you have any further questions
 
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 9 of 9
(4,752 Views)