PDA

View Full Version : Problem with IC_OpenVideoCaptureDevice()



hmrhmr
December 18, 2015, 11:46:09
Hej,
Camera DMK 23G274
Windows 7
IC Imaging Control C (TIS_Grabber_DLL)
Compliler: MinGW, gcc

Call to IC_OpenVideoCaptureDevice() does not work. Function does not return IC_SUCCESS.
Call to IC_ShowDeviceSelectionDialog() works.

How to call IC_OpenVideoCaptureDevice() correctly?

See the following test code based on AnsiC.c example from the TIS_GRABBER installation:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <tisgrabber.h>
#include "windows.h"


void OpenDeviceAndShowLiveVideo()
{
HGRABBER hGrabber; // The handle of the grabber object.

printf("ANSI C Grabber Sample: Devices and Serial Numbers\n");

hGrabber = IC_ShowDeviceSelectionDialog(NULL);
if( hGrabber )
{
IC_StartLive(hGrabber,1);
printf("Press any key to stop the live video\n" );
_getch();
IC_StopLive(hGrabber);

IC_ReleaseGrabber(&hGrabber);
}
}

void OpenDeviceAndShowLiveVideo2()
{
HGRABBER hGrabber; // The handle of the grabber object.

printf("ANSI C Grabber Sample: Devices and Serial Numbers\n");
hGrabber = IC_CreateGrabber();
if( IC_OpenVideoCaptureDevice(hGrabber,"DMK 23G274") == IC_SUCCESS )
{
IC_StartLive(hGrabber,1);
printf("Press any key to stop the live video\n" );
_getch();
IC_StopLive(hGrabber);
IC_CloseVideoCaptureDevice( hGrabber );
IC_ReleaseGrabber(&hGrabber);
}
}

/*
*
*/
void main()
{
if( IC_InitLibrary(0) )
{
OpenDeviceAndShowLiveVideo2();
printf("Press any key to continue!\n");
_getch();
}
else
{
IC_MsgBox("InitLibrary failed.","Initialize");
}
}

Thanks for help
Helmut

Stefan Geissler
December 21, 2015, 11:28:40
Please check following: The yellow LED on the camera blinks. - If not, the cameras do not have power. Power the camera either by PoE switch / injector or an external power supply.
The green LED does not glow, the yellow one glows - The camera is not connected to a Gigabit ethernet network. If you use a PoE injector or switch, check, whether it supports GigE/1000mBit

Sometimes Virus Scanners and "Safety Software" install network hooks. The "Panda" software is such a candidate. They can block the complete image data transfer. If you find something like this in the network properties, disable or remove it.
Install IC Capture and see what happens. If you receive a black screen and *not* the error message "The camera is started, but does not deliver frames", then - camera is in trigger mode, but no triggers come. Disable trigger mode - camera uses extremely short exposure times - camera uses extremely long exposure times. However, after 30 seconds the image should be white then.
IP addresses should be:
If DHCP enabled and the camera is connected directly to the computer:
NIC: 169.254.a.b : 255.255.0.0
cam: 169.254.c.d : 255.255.0.0

a,b,c and d will have random values between 0 and 255.
NIC = Network Interface Controller
cam = camera.
If DHCP enabled and the camera is connected through a network with DHCP server:
NIC: 192.168.0.a : 255.255.255.0
cam: 192.168.0.b : 255.255.255.0

a and b will have random values between 0 and 255. Also the 192.168.0 depends on your DHCP server, but the three numbers should be the same on NIC and camera.
If persistant IP is enabled:
NIC: 192.168.1.a : 255.255.255.0
cam: 192.168.1.b : 255.255.255.0

a and b will have random values between 0 and 255. Also the 192.168.1 depends on your network setup, but the three numbers should be the same on NIC and camera.
Something like
If persistant IP is enabled:
NIC: 192.168.0.a : 255.255.255.0
cam: 169.254.b.c : 255.255.0.0

a,b and c have random values between 0 and 255. This wont work, because 192.168.0 is not equal to 169.254.b. The GigECamera IP config program will show a warning sign and you must assign a new, valid IP address, that matches the NIC's IP address, starting with 192.168.0 in this sample case.

hmrhmr
December 22, 2015, 06:41:26
Please check following: The yellow LED on the camera blinks. - If not, the cameras do not have power. Power the camera either by PoE switch / injector or an external power supply.
The green LED does not glow, the yellow one glows - The camera is not connected to a Gigabit ethernet network. If you use a PoE injector or switch, check, whether it supports GigE/1000mBit

Sometimes Virus Scanners and "Safety Software" install network hooks. The "Panda" software is such a candidate. They can block the complete image data transfer. If you find something like this in the network properties, disable or remove it.
Install IC Capture and see what happens. If you receive a black screen and *not* the error message "The camera is started, but does not deliver frames", then - camera is in trigger mode, but no triggers come. Disable trigger mode - camera uses extremely short exposure times - camera uses extremely long exposure times. However, after 30 seconds the image should be white then.
IP addresses should be:
If DHCP enabled and the camera is connected directly to the computer:
NIC: 169.254.a.b : 255.255.0.0
cam: 169.254.c.d : 255.255.0.0

a,b,c and d will have random values between 0 and 255.
NIC = Network Interface Controller
cam = camera.
If DHCP enabled and the camera is connected through a network with DHCP server:
NIC: 192.168.0.a : 255.255.255.0
cam: 192.168.0.b : 255.255.255.0

a and b will have random values between 0 and 255. Also the 192.168.0 depends on your DHCP server, but the three numbers should be the same on NIC and camera.
If persistant IP is enabled:
NIC: 192.168.1.a : 255.255.255.0
cam: 192.168.1.b : 255.255.255.0

a and b will have random values between 0 and 255. Also the 192.168.1 depends on your network setup, but the three numbers should be the same on NIC and camera.
Something like
If persistant IP is enabled:
NIC: 192.168.0.a : 255.255.255.0
cam: 169.254.b.c : 255.255.0.0

a,b and c have random values between 0 and 255. This wont work, because 192.168.0 is not equal to 169.254.b. The GigECamera IP config program will show a warning sign and you must assign a new, valid IP address, that matches the NIC's IP address, starting with 192.168.0 in this sample case.

Hej,
both led on the camera are active.

DHCP is not active, the ip address is static.

We are using a 2. Ethernet interface and only the camera is connected to this. Windows firewall is not active on this interface.

By the way: When we use ShowDeviceSelectionDialog() then the image is updating for some seconds on the screen but then the image freezes.
IC Capture works.

We are using default camera parameter. I don't think that a trigger mode is active.

Stefan Geissler
December 22, 2015, 09:58:58
Hello

If IC Capture works, then the sample must work too, because both use the same IC Imaging Control.

I am very sorry, but I have no idea. I am not able to guess, why the sample stops the live video.

Also I do not see a relation to ShowDeviceSelectionDialog().

You may activate the Jumbo Frames on your network controller, but if IC Capture shows the live video, the current setting is ok.

Try to find out, what could stop the live video on your computer.

The only way to continue guessing is seeing this problem on your computer directly.