PDA

View Full Version : Converter DFG/USB2-lt does not detect properly the signal



vdaanen
July 26, 2007, 19:12:29
Hi,

My grabber is a DFG/USB2-lt.
It is said to allow the signal detection (Grabber::signalDetectedAvailable returns true) but Grabber::getSignalDetected always returns false, even if I can grab an image.

Thus, I have to use a ruse to detect if a signal is present (try to grab an images with snapImages(1,25) and check that the return if not an error).
It works but I'm spending time with this way !

Does someone havs the same problem and found a solution ?

V

Stefan Geissler
July 27, 2007, 10:53:49
Hi Vincent,

Unfortunately the chip on the DFG/USB2-lt does not detect correctly whether video signal is available or not. It delivers frames every time, even if there is no camera connected.

Thus your solution is the only way I would use too.

vdaanen
July 27, 2007, 11:35:35
argh ...
I'm dire !!

A functionnality of the video grabbing system I have to create is a 'continuous
grabbing' which must warn if no image is available (e.g video cable unplugged)

The grabber seems to allow that : continuous acquisition in a buffercollection) and 'sending' of the last image if one is available !

Well, I will search for a way to do so witout using a continuous grabbing :(

V

Stefan Geissler
July 27, 2007, 17:15:18
Vincent,

We will investigate on Monday in this and try to present a solution for you. I guess, we will add a listener and check some pixels whether they are black or something like this.

vdaanen
July 27, 2007, 17:46:48
Stefan,

I thought to a solution with a listener (because I have already one in my class) but when doing continuous grab without video cable connected, the image is sometimes black, sometimes blue, sometimes b&b:D.

I don't investigate further because I think I won't be able to robustly detect a disconnected video cable.

Are you sure that when a grab is performed without video signal, the image pixels are all 0 ( or (0,0,0,0) ??) ?

V

Stefan Geissler
July 27, 2007, 17:48:35
Vincent,


Are you sure that when a grab is performed without video signal, the image pixels are all 0 ( or (0,0,0,0) ??) ?

No, quite not. But this is to be tested...

Sascha Schmidt
July 31, 2007, 13:22:30
Hallo Vincent,

here is an simple solution that works fine in my tests.
It based on the idea, that no noise occurs, if no video signal is received.
In this case nearby pixels must have the same color.


void CListener::frameReady( Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
{

int width = caller.getAcqSizeMaxX();
int height = caller.getAcqSizeMaxY();

BYTE* buffer = pBuffer->getPtr();
int count = 0;

for ( int i = 0; i < 10 ; i++ )
{
int x = (int)((width/10)*i);
int y = (int)((height/10)*i);

int color1 = *(buffer+y*height+x) + *(buffer+y*height+x+1) + *(buffer+y*height+x+2);
int color2 = *(buffer+y*height+x+3) + *(buffer+y*height+x+4) + *(buffer+y*height+x+5);

if( color1 == color2 )
count++;
}

if( count == 10 && !noDevice)
{
noDevice = !noDevice;
MessageBox ( NULL, "VideoSignal Lost", "Info", MB_OK);

}
else if ( count < 10 && noDevice )
{
noDevice = !noDevice;
MessageBox ( NULL, "VideoSignal Found", "Info", MB_OK);
}

}

vdaanen
July 31, 2007, 14:34:35
Hi Sacha,

thanks for the code, I will try this asap.
Did you make your tests with images of size (640x480) or (768x576 ) or on small ROI of image ?

V

Stefan Geissler
July 31, 2007, 17:26:32
Hi Vincent,

The size of the video does not matter, because it is queried from the grabber object.

vdaanen
August 23, 2007, 11:36:26
argh ... I'm cursed :(:(

I used the solution Sasha proposed and it seems to work fine but ... my first project in which I have to used the grabber requires to receive black images and the solution Sasha proposed assumes that a black image arrives when there is no video cable connected !!

Sasha may be you have another solution in your bag ....

V

Sascha Schmidt
August 23, 2007, 12:45:11
Hi Vincent,

as described above, my code based on the idea, that no noise occurs, if no video signal is received. In this case nearby pixels must have the same color.
So the device detection is independent from the image color, when no video signal is received. Also at my tests, the color is black and sometimes blue...but it is irrelevant which color occurs. ;)

vdaanen
August 23, 2007, 14:07:54
Hi Sasha,

The problem is that sometimes, the apparatus sending the image (we are working in the field of medical imaging) send a totally black image. Our software needs to be notify this black image but with the solution you proposed, we detect a lack of video signal ...

I will try to find a solution.

V

Btw, does the DFG/USB2-It FDA approved ?