LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot grab from cam1

I use logitech webcam plug in to usb it show in Measurement & Automation as cam1

 

when i change cam0 to cam1 it show error massage like the picture.

how can i use cam1

 

 

 

////////////////////////////////////////////////////////////////////////////////
//
// Author : Vision Assistant
// Purpose: This file implements the algorithm prototyped in Vision Assistant.
//
// WARNING: This file was automatically generated.
//          Any changes you make to this file will be lost if you generate the
//          file again.
//
////////////////////////////////////////////////////////////////////////////////

//==============================================================================
//     Includes
//==============================================================================

#include <stdio.h>
#include <nivision.h>
#include <NIIMAQdx.h>
#include "ImageProcessing.h"


//==============================================================================
//  Defines
//==============================================================================

#define DISPLAY_WINDOW 0


//==============================================================================
//  Main Function
//==============================================================================

int main (int argc, char *argv[])
{
    int success = 1,g=2;
    int err = 0;
    SESSION_ID sid;
    unsigned long bytePerPixel;
    ImageType imageType;
    Image* image;


    // IMAQ Vision creates windows in a separate thread
    imaqSetWindowThreadPolicy (IMAQ_SEPARATE_THREAD);

    // Open a session
    IMAQdxOpenCamera ("cam0", IMAQdxCameraControlModeController, &sid);
  
 IMAQdxConfigureGrab (sid);        
     
   
   
  printf ("capture.\n");
    getchar();

    // Create an IMAQ Vision image
    image = imaqCreateImage(IMAQ_IMAGE_U8, 0);
 
 
 
 
 while(g>0)
  
  
  
 {

    // Acquires an image.
   IMAQdxGrab (sid, image,TRUE, 0);

    // Vision Assistant Algorithm
    success = IVA_ProcessImage(image);
    if (!success)
        err = imaqGetLastError();

    // Display the image
    imaqMoveWindow(DISPLAY_WINDOW, imaqMakePoint(0,0));
    imaqSetWindowPalette(DISPLAY_WINDOW, IMAQ_PALETTE_BINARY, NULL, 0);
    imaqDisplayImage(image, DISPLAY_WINDOW, TRUE);

    // Wait for a key press before exiting
    printf ("Press Enter to exit.\n");
 
 
 }
    getchar();

    // Dispose resources
    imaqDispose(image);

    // Close the the session
 IMAQdxCloseCamera(sid);

    return 0;
}

0 Kudos
Message 1 of 4
(3,488 Views)

Hi Unwell,

 

This error appears to stem from a program that uses a kernel debugger like WinIce for Windows NT Users.  Nero Burning Rom 6 (or higher) is one software that is considered by Windows as a kernel debugger. Also other software like anti-virus, intrusion prevention software, some CD/DVD/Blue-ray burning software can cause this as well.

 

Just out of cursoity what version of Windows are you running?

 

 

Joe Daily
National Instruments
Applications Engineer

may the G be with you ....
0 Kudos
Message 2 of 4
(3,448 Views)

win 7

0 Kudos
Message 3 of 4
(3,424 Views)

hi unwell,

 

Does the webcam work in MAX? Have you tried rerunning Vision Assistant, selecting cam1 in the process. What version of NI-IMAQdx do you have installed?

Joe Daily
National Instruments
Applications Engineer

may the G be with you ....
0 Kudos
Message 4 of 4
(3,394 Views)