Re: [Imtoolkit-users] im_capture doubt
Brought to you by:
scuri
From: cykt <cy...@aj...> - 2010-07-29 15:23:36
|
Hi, Scuri Now, it works. My webcam takes two loops to capture the image. For color mode parameter, I have changed to IM_BYTE|IM_RGB|IM_PACKED. Thanks a lot, for your prompt answer and valuable information. Id like to congratulate for your initiative to publish this great job. Best regards Luiz From: Antonio Scuri [mailto:sc...@te...] Sent: quarta-feira, 28 de julho de 2010 20:18 To: 'IM discussion list.' Subject: Re: [Imtoolkit-users] im_capture doubt Hi, The problem could be related to a hardware delay. Maybe you have to wait some time before trying to capture a frame right after you connect, in other words between imVideoCaptureConnect and imVideoCaptureOneFrame you should delay some time. Another option is to try to capture a few times before giving up. I mean, call imVideoCaptureOneFrame inside a small loop until it returns a non zero value, then break the loop. If all attempts failed then print the error. By the way, dont use 1 as a parameter, use the definitions in im.h that describes a color mode. Best, scuri From: cykt [mailto:cy...@aj...] Sent: quarta-feira, 28 de julho de 2010 18:23 To: imt...@li... Subject: [Imtoolkit-users] im_capture doubt Hi, Im trying to use im_capture library in order to capture one frame from USB 2.0 webcam (640x480 resolution). I have followed capture guide basic program exactly the same way is written in the document. I mean: void capturaCamera(unsigned char *pImage) { imVideoCapture* vc = imVideoCaptureCreate(); if (vc == NULL) printf ("\nCreation error"); if (!imVideoCaptureConnect(vc, 0)){ printf ("\nConnection Error"); } int width=0, height=0; imVideoCaptureGetImageSize(vc, &width, &height); printf ("\n width = %d, height = %d", width, height ); if (!imVideoCaptureOneFrame(vc, pImage, 1)) printf ("\nCapture Error"); imVideoCaptureDisconnect(vc); imVideoCaptureDestroy(vc); } It works until imVideoCaptureOneFrame() procedure. But here, it returns a NULL value. Im using Windows Vista Home, Eclipse CDT, MingW 3.4.5. The program is written in C language. I have already tested imVideoCaptureLive() and imVideoCaptureFrame() functions, but the results was the same. Also, I have tested imVideoCaptureReloadDevices(), aiming to clear device, but no result. I have tested webcam using the following applications: AMcap and ÑAUSA (which uses im library). And it works well. What is wrong ? Thanks in advance Luiz Nenhum vírus encontrado nessa mensagem recebida. Verificado por AVG - www.avgbrasil.com.br Versão: 9.0.851 / Banco de dados de vírus: 271.1.1/3035 - Data de Lançamento: 07/28/10 14:38:00 |