Video Capture Problem

G

Guest

Guest
Archived from groups: microsoft.public.win2000.hardware,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.hardware (More info?)

Hi all,

I have written an application in which i have used capXXXX() functions like
capCreateCaptureWindow() and many others etc to capture video frame from
web-cam attached to USB port of my PC. The problem is that right now in
order to grab each frame I have to call capGrabFramNoStop() function, after
calling which my callback function is called with a pointer to videostream
buffer. So I have to call capGrabFrameNoStop() function each time to get the
pointer of the captured frame. I dont want to do this. How can I make my
application to automatically called the callback function whenever a new
frame is captured by my camera, so that there is no need for me to call the
capGrabFraeNoStop() function every time in a timer? Here I would like to
mention that I need the pointer to the captured video buffer.

Thanks,

Arsalan Ahmad
 
Archived from groups: microsoft.public.win2000.hardware,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.hardware (More info?)

"Arsalan Ahmad" <arsal__@hotmail.com> wrote:
>
>I have written an application in which i have used capXXXX() functions like
>capCreateCaptureWindow() and many others etc to capture video frame from
>web-cam attached to USB port of my PC. The problem is that right now in
>order to grab each frame I have to call capGrabFramNoStop() function, after
>calling which my callback function is called with a pointer to videostream
>buffer. So I have to call capGrabFrameNoStop() function each time to get the
>pointer of the captured frame. I dont want to do this. How can I make my
>application to automatically called the callback function whenever a new
>frame is captured by my camera, so that there is no need for me to call the
>capGrabFraeNoStop() function every time in a timer?

You want capCaptureSequence to enable streaming capture. Your OnFrame
callback will be called with each frame.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
 
Archived from groups: microsoft.public.win2000.hardware,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.hardware (More info?)

Hi,

Below is the code of my camera class init function.

CMyCamera::Init()
{
// Some code here...

hWnd = capCreateCaptureWindow(_T("MyCamera"), WS_CHILD|WS_CLIPSIBLINGS, x,
y, 320, 240, pParentWnd?pParentWnd->GetSafeHwnd():NULL, 0xffff);
capDriverConnect (hWnd, 0);
memset( &m_caps, 0, sizeof(m_caps));
capDriverGetCaps( hWnd, &m_caps, sizeof(m_caps));
capSetUserData( hWnd, (long)this );
capSetCallbackOnVideoStream( hWnd, Camera_CallbackProc);
::MoveWindow( hWnd, 0, 0, 1, 1, TRUE );
CAPTUREPARMS p;
capCaptureGetSetup(hWnd,&p,sizeof(CAPTUREPARMS));
p.dwRequestMicroSecPerFrame = 33333; // For 30 fps
capCaptureSetSetup(hWnd,&p,sizeof(CAPTUREPARMS));

//capCaptureSequenceNoStop(); // I have used capCaptureSequenceNoStop()
before or after Subclass() but no use
SubclassWindow(hWnd);
capCaptureSequenceNoStop();

return true;
}

I have omitted some portion to make it simple. Now after that init function
I assume that my callback function Camera_CallbackProc() will be called at
every frame but this is not happening. Is there anything I am missing.

Thanks,

Arsalan
"Tim Roberts" <timr@probo.com> wrote in message
news:jas3g0l66d6tjrgflod0r35ds5rgnv5c21@4ax.com...
> "Arsalan Ahmad" <arsal__@hotmail.com> wrote:
> >
> >I have written an application in which i have used capXXXX() functions
like
> >capCreateCaptureWindow() and many others etc to capture video frame from
> >web-cam attached to USB port of my PC. The problem is that right now in
> >order to grab each frame I have to call capGrabFramNoStop() function,
after
> >calling which my callback function is called with a pointer to
videostream
> >buffer. So I have to call capGrabFrameNoStop() function each time to get
the
> >pointer of the captured frame. I dont want to do this. How can I make my
> >application to automatically called the callback function whenever a new
> >frame is captured by my camera, so that there is no need for me to call
the
> >capGrabFraeNoStop() function every time in a timer?
>
> You want capCaptureSequence to enable streaming capture. Your OnFrame
> callback will be called with each frame.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc
 
Archived from groups: microsoft.public.win2000.hardware,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.hardware (More info?)

Hi,

Is there any other way of capturing the video from a cameara apart from
using VFW. I am looking for any other method(DirectShow or any other etc).
Any Idea...

Thanks,

Arsalan

"Tim Roberts" <timr@probo.com> wrote in message
news:jas3g0l66d6tjrgflod0r35ds5rgnv5c21@4ax.com...
> "Arsalan Ahmad" <arsal__@hotmail.com> wrote:
> >
> >I have written an application in which i have used capXXXX() functions
like
> >capCreateCaptureWindow() and many others etc to capture video frame from
> >web-cam attached to USB port of my PC. The problem is that right now in
> >order to grab each frame I have to call capGrabFramNoStop() function,
after
> >calling which my callback function is called with a pointer to
videostream
> >buffer. So I have to call capGrabFrameNoStop() function each time to get
the
> >pointer of the captured frame. I dont want to do this. How can I make my
> >application to automatically called the callback function whenever a new
> >frame is captured by my camera, so that there is no need for me to call
the
> >capGrabFraeNoStop() function every time in a timer?
>
> You want capCaptureSequence to enable streaming capture. Your OnFrame
> callback will be called with each frame.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc
 
Archived from groups: microsoft.public.win2000.hardware,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.hardware (More info?)

"Arsalan Ahmad" <arsal__@hotmail.com> wrote:
>
>Is there any other way of capturing the video from a cameara apart from
>using VFW. I am looking for any other method(DirectShow or any other etc).

Absolutely. Even if there is no DirectShow driver for the device,
DirectShow can provide a wrapper around a VFW driver.

However, it isn't going to be easier in DirectShow. DS is incredibly
flexible (my admiration for the original design grows every year), but it
is a lot more work than a VFW app.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc