Search code examples
delphiwebcam

Delphi Webcam Simple Program


Can anyone help me to create a simple viewing of cam using just a simple TVideo component in delphi having a vid size of 160x120 only as default (no resize). Just a simple one. Please. Badly needed for my new project.

thanks.


Solution

  • There are many ways to do it , I couldn't understand what do you mean by TVideo component but my solution can show image on a paintbox(any TCanvas)

    use

    http://www.delphibasics.info/home/delphibasicsprojects/directxdelphiwebcamcaptureexample/DirectXDelphiWebcamCapture.rar

    this is a directX conversion to pascal made by michael@grizzlymotion.com

    add VSample.pas and VFrames.pas to your project

    uses  VFrames;
    
    procedure TForm6.Button1Click(Sender: TObject);
    
    var
    cam:TVideoImage;
    strlst:TStringList;
    begin
    
       strlst := TStringList.Create ;
    
       cam := TVideoImage.Create;
       cam.GetListOfDevices(strlst);
    
       cam.SetDisplayCanvas(PaintBox1.Canvas);
       cam.VideoStart(strlst.Strings[0])    ;//specify your cam by number
    end;