Recent

Author Topic: webcam frame capture to Timage  (Read 3984 times)

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
webcam frame capture to Timage
« on: July 26, 2011, 08:10:44 pm »
http://lazarus.freepascal.org/index.php/topic,9548.msg46907.html#msg46907
based on that post, copying buffer to clipboard then to image is not good,
How do we use that using TMemoryStream/OR with capGrabFrameNoStop(FCapHandle);
to
Timage?

I think this code is for?
Code: [Select]
var hd:Thandle;
    jpg:TJpegImage;
    memStream :TMemoryStream;
    Bitmap:TBitmap;
    begin
    Bitmap:=TBitmap.Create;
    Bitmap.Width :=BMPINFO.bmiHeader.biWidth;
    // New size of Bitmap
    Bitmap.Height:=BMPINFO.bmiHeader.biHeight;
    hd:= DrawDibOpen; DrawDibDraw(hd,Bitmap.canvas.handle,0,0,_
    BMPINFO.BmiHeader.biwidth,BMPINFO.bmiheader.biheight,_
    @BMPINFO.bmiHeader,lpVHdr^.lpData,0,0,BMPINFO.bmiHeader.biWidth,_
    BMPINFO.bmiHeader.biheight,0);
    DrawDibClose(hd);
    memStream := TMemoryStream.Create;
    jpg := TJpegImage.Create;
    jpg.Assign(Bitmap);
    jpg.CompressionQuality := 10;
    jpg.JPEGNeeded;
    jpg.Compress;
    jpg.SaveToStream(memStream);
    jpg.Free;
http://develop.csai.cn/delphi/200611101317511617.htm


thanks
« Last Edit: July 27, 2011, 07:44:11 am by xenblaise »

 

TinyPortal © 2005-2018