Affichage des résultats 1 à 44 sur 44
Discussion: ED-SDK 2.7 En Delphi
Vue hybride
-
11/10/2015, 22h49 #1
- Inscription
- octobre 2015
- Localisation
- Denmark
- Âge
- 65
- Messages
- 2
- Boîtier
- Canon EOS 1000D
- Objectif(s)
- Skilled in Optics and Delphi programming
Avoiding the flickering and speed up things
Next problem in PixelKs code from 09/04/2014 17h 14 is the annoying flickering and bad timing while in zooming in liveView.
I did fix this by downloading the fast jpeg decoder unit jpegdec.pas from http://synopse.info/files/jpegdec.zip
I did include jpegdec in the uses clause of the CanonCamera.pas
Code:unit CanonCamera; interface uses Windows, Messages, Classes, Sysutils, Graphics, Jpeg, EDSDKApi, EDSDKType, EDSDKError, ExtCtrls, jpegdec; //FabInSpace did add reference to jpegdec.pas on 11-10-2015
Code:function TCanonCamera.DownloadLiveViewImage(Image : TImage) : Boolean; var MemStream: TMemoryStream; Stream : EdsStreamRef; evfImage : EdsEvfImageRef; JPG: TJPEGImage; ImageData : Pointer; ImageSize : EdsUInt32; BMP: TBitMap; //Added 11-10-2015 begin Result := False; stream := nil; evfImage := nil; try Self.LastError := EdsCreateMemoryStream( 0, Stream ); if Self.LastError <> EDS_ERR_OK then Exit; try Self.LastError := EdsCreateEvfImageRef( Stream, evfImage ); if Self.LastError <> EDS_ERR_OK then Exit; Self.LastError := EdsDownloadEvfImage(Self.FRef , evfImage); if Self.LastError <> EDS_ERR_OK then begin EdsRelease(stream); Exit; end; Self.LastError := EdsGetPointer(Stream, ImageData); if Self.LastError <> EDS_ERR_OK then begin EdsRelease(evfImage); EdsRelease(stream); Exit; end; Self.LastError := EdsGetLength(Stream, ImageSize); if Self.LastError <> EDS_ERR_OK then begin EdsRelease(evfImage); EdsRelease(stream); Exit; end; MemStream := TMemoryStream.Create; try MemStream.WriteBuffer(ImageData^, ImageSize); MemStream.position := 0; {Old lines from before 11-10-2015 JPG := TJPEGImage.Create; // The Stream is a JPEG Image try JPG.LoadFromStream(MemStream); //JPG.SaveToFile('LVSteam.jpg'); if not Assigned(Image.Picture.Bitmap) then Image.Picture.Bitmap := TBitmap.Create; Image.Picture.Bitmap.Assign(JPG); Result := True; Finally JPG.Free; end; } //New lines elliminating flickering with TMemoryStream.Create do try LoadFromstream(MemStream); BMP := JpegDecode(memory, Size); if BMP <> nil then try Image.Picture.Bitmap := Bmp; finally BMP.free; end; finally Free; end; //end of new lines from 11-10-2015 finally MemStream.Free; end; finally EdsRelease(evfImage); end; finally EdsRelease(stream); end; end;
Informations de la discussion
Utilisateur(s) sur cette discussion
Il y a actuellement 1 utilisateur(s) naviguant sur cette discussion. (0 utilisateur(s) et 1 invité(s))