CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2022
    Posts
    3

    capture video from 2 webcams

    can you tell me how to make a program in c++ builder 5
    which captures images from 2 or 3 webcams at the same time

  2. #2
    Join Date
    Nov 2018
    Posts
    120

    Re: capture video from 2 webcams

    I'd start here and do lots of reading.
    https://learn.microsoft.com/en-us/wi...-video-capture

    Before you start with 2 or 3 cameras, what do you know about capturing one camera?

    > c++ builder 5
    https://winworldpc.com/product/borland-c-builder/5x
    I'd say get a compiler that wasn't 20 years old.
    Chances are, it's pretty clueless about all the new features in window 7,8,10,11.

  3. #3
    Join Date
    Dec 2022
    Posts
    3

    Re: capture video from 2 webcams

    LRESULT CALLBACK capErrorCallback(HWND hWnd, int nID, LPCSTR lpsz)
    { return 1;}

    LRESULT PASCAL capOnFrameCallback(HWND hWnd, LPVIDEOHDR lpVHdr)
    { return OnFrame(lpVHdr);}

    LRESULT CALLBACK capStatusCallback(HWND hWnd, int nID, LPCSTR lpsz)
    { return 1;}

    LRESULT CALLBACK capVideoStreamCallback(HWND hWnd, LPVIDEOHDR lpVHdr)
    { return 1;}

    LRESULT CALLBACK capWaveStreamCallback(HWND hWnd, LPWAVEHDR lpWHdr)
    { return 1;}


    LRESULT CALLBACK capYieldCallback(HWND hWnd)
    { return 1;}

    LRESULT CALLBACK capControlCallback(HWND hWnd, int nState)
    { return 1;}

    bool InstallCallback(HWND h)
    {
    int res=1;
    res&=capSetCallbackOnCapControl (h, capControlCallback);
    res&=capSetCallbackOnError (h, capErrorCallback);
    res&=capSetCallbackOnFrame (h, capOnFrameCallback);
    res&=capSetCallbackOnStatus (h, capStatusCallback);
    res&=capSetCallbackOnVideoStream(h, capVideoStreamCallback);
    res&=capSetCallbackOnWaveStream (h, capWaveStreamCallback);
    res&=capSetCallbackOnYield (h, capYieldCallback);
    return res;
    }

    HWND ACaptureWindowCreate(void)
    {
    for (int wIndex = 0; wIndex < 10; wIndex++)
    {
    res=capGetDriverDescription(wIndex, szDeviceName [wIndex], 80,
    szDeviceVersion[wIndex], 80);
    if(res) NumberDrivers++, DriverNumber=wIndex;
    }
    res=1;
    if(NumberDrivers==0){ShowMessage("Capture driver not found.");}
    return capCreateCaptureWindow("VideoCap",WS_CHILD/*|WS_VISIBLE*/,
    0,0, 10, 10, Form1->Handle, 0);
    }

  4. #4
    Join Date
    Dec 2022
    Posts
    3

    Re: capture video from 2 webcams

    int SetCaptureParameters(HWND VideoCap)
    {
    res=1;
    Form1->Panel1->Caption=IntToStr(DriverNumber);
    res&=capDriverConnect(VideoCap, DriverNumber);
    res&=capDriverGetCaps(VideoCap, &CapDrvCaps, sizeof (CAPDRIVERCAPS));
    if(CapDrvCaps.fHasOverlay)capOverlay(VideoCap, 1);
    res&=capCaptureGetSetup(VideoCap, &cp, sizeof(CAPTUREPARMS));
    cp.dwRequestMicroSecPerFrame=40000;
    cp.fMakeUserHitOKToCapture=1;
    cp.fCaptureAudio=0;
    cp.fYield=1;
    cp.fAbortLeftMouse=0;
    cp.fAbortRightMouse=0;
    res&=capCaptureSetSetup(VideoCap, &cp, sizeof(CAPTUREPARMS));
    res&=InstallCallback(VideoCap);
    if(res==0){ShowMessage("Video camera not connected to the PC."); return 0; }
    else {DevEnabled=1; return 1; }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured