|
![]() |
|
Registriert seit: 2. Feb 2009 Ort: Varel 70 Beiträge RAD-Studio 2009 Pro |
#1
So, einige erste Funktionen (wie Initialize und Versionsinfos) bekomme ich inzwischen aus der DLL.
Allerdings sind da noch diverse offene Fragen bezüglich der Übersetzung. Ich habe den C Code:
Delphi-Quellcode:
Quasi folgendermassen übersetzt:
#define PVDECL __stdcall
typedef void* tPvHandle; // Camera handle typedef enum { ePvErrSuccess = 0, // No error ePvErrCameraFault = 1, // Unexpected camera fault ePvErrInternalFault = 2, // Unexpected fault in PvApi or driver ePvErrBadHandle = 3, // Camera handle is invalid ePvErrBadParameter = 4, // Bad parameter to API call ePvErrBadSequence = 5, // Sequence of API calls is incorrect ePvErrNotFound = 6, // Camera or attribute not found ePvErrAccessDenied = 7, // Camera cannot be opened in the specified mode ePvErrUnplugged = 8, // Camera was unplugged ePvErrInvalidSetup = 9, // Setup is invalid (an attribute is invalid) ePvErrResources = 10, // System/network resources or memory not available ePvErrBandwidth = 11, // 1394 bandwidth not available ePvErrQueueFull = 12, // Too many frames on queue ePvErrBufferTooSmall= 13, // Frame buffer is too small ePvErrCancelled = 14, // Frame cancelled by user ePvErrDataLost = 15, // The data for the frame was lost ePvErrDataMissing = 16, // Some data in the frame is missing ePvErrTimeout = 17, // Timeout during wait ePvErrOutOfRange = 18, // Attribute value is out of the expected range ePvErrWrongType = 19, // Attribute is not this type (wrong access function) ePvErrForbidden = 20, // Attribute write forbidden at this time ePvErrUnavailable = 21, // Attribute is not available at this time ePvErrFirewall = 22, // A firewall is blocking the traffic (Windows only) __ePvErr_force_32 = 0xFFFFFFFF } tPvErr; typedef enum { ePvAccessMonitor = 2, // Monitor access: no control, read & listen only ePvAccessMaster = 4, // Master access: full control __ePvAccess_force_32 = 0xFFFFFFFF } tPvAccessFlags; typedef struct { unsigned long StructVer; // Version of this structure //---- Version 1 ---- unsigned long UniqueId; // Unique value for each camera char CameraName[32]; // People-friendly camera name (usually part name) char ModelName[32]; // Name of camera part char PartNumber[32]; // Manufacturer's part number char SerialNumber[32]; // Camera's serial number char FirmwareVersion[32]; // Camera's firmware version unsigned long PermittedAccess; // A combination of tPvAccessFlags unsigned long InterfaceId; // Unique value for each interface or bus tPvInterface InterfaceType; // Interface type; see tPvInterface } tPvCameraInfoEx; unsigned long PVDECL PvCameraListEx(tPvCameraInfoEx* pList, unsigned long ListLength, unsigned long* pConnectedNum, unsigned long StructSize); tPvErr PVDECL PvCameraOpen(unsigned long UniqueId, tPvAccessFlags AccessFlag, tPvHandle* pCamera);
Delphi-Quellcode:
Leider möchte das bereits an dieser frühen Stelle nicht kompilieren. Bin recht zuversichtlich, aber es kommt ja noch die Extraktion der Bilder aus dem Datenstream...{MINENUMSIZE 4} // stimmt diese Größe??? tPvHandle = Pointer; vErr = (ePvErrSuccess = 00, // No error ePvErrCameraFault = 01, // Unexpected camera fault ePvErrInternalFault = 02, // Unexpected fault in PvApi or driver ePvErrBadHandle = 03, // Camera handle is invalid ePvErrBadParameter = 04, // Bad parameter to API call ePvErrBadSequence = 05, // Sequence of API calls is incorrect ePvErrNotFound = 06, // Camera or attribute not found ePvErrAccessDenied = 07, // Camera cannot be opened in the specified mode ePvErrUnplugged = 08, // Camera was unplugged ePvErrInvalidSetup = 09, // Setup is invalid (an attribute is invalid) ePvErrResources = 10, // System/network resources or memory not available ePvErrBandwidth = 11, // 1394 bandwidth not available ePvErrQueueFull = 12, // Too many frames on queue ePvErrBufferTooSmall = 13, // Frame buffer is too small ePvErrCancelled = 14, // Frame cancelled by user ePvErrDataLost = 15, // The data for the frame was lost ePvErrDataMissing = 16, // Some data in the frame is missing ePvErrTimeout = 17, // Timeout during wait ePvErrOutOfRange = 18, // Attribute value is out of the expected range ePvErrWrongType = 19, // Attribute is not this type (wrong access function) ePvErrForbidden = 20, // Attribute write forbidden at this time ePvErrUnavailable = 21, // Attribute is not available at this time ePvErrFirewall = 22, // A firewall is blocking the traffic (Windows only) __ePvErr_force_32 = $FFFFFFFF ) ; tPvAccessFlags = (ePvAccessMonitor = 2, // Monitor access: no control, read & listen only ePvAccessMaster = 4, // Master access: full control __ePvAccess_force_32 = $FFFFFFFF ); tPvCameraInfoEx = Packed Record StructVer : Cardinal; // Version of this structure //---- Version 1 ---- UniqueId : Cardinal; // Unique value for each camera CameraName : Array [0..32] of Char; // People-friendly camera name (usually part name) ModelName : Array [0..32] of Char; // Name of camera part PartNumber : Array [0..32] of Char; // Manufacturer's part number SerialNumber : Array [0..32] of Char; // Camera's serial number FirmwareVersion : Array [0..32] of Char; // Camera's firmware version PermittedAccess : Cardinal; // A combination of tPvAccessFlags InterfaceId : Cardinal; // Unique value for each interface or bus InterfaceType : tPvInterface; // Interface type; see tPvInterface end; Function PvCameraListEx (pList : Array of tPvCameraInfoEx; ListLength : Cardinal; pConnectedNum : Cardinal; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; Function PvCameraOpen (UNiqueID : Cardinal; AccessFlag : tPvAccessFlags; pCamera : tPvHandle) : tPvErr; stdcall; external 'PvAPI.dll'; Ich denke, daß Cardinal dem unsigned long entsprechen sollte. Die Frage ist allerdings, ob die Array-Grenzen so richtig sind, ob es tatsächlich ein Packed Record ist und vor allem wie die Pointereien im Aufruf umzusetzen sind. Oder hab ich hier noch ganz andere Fehler drin? Jan Aufrufen würde ich das später etwa so:
Delphi-Quellcode:
Var listAVTGigECams : Array [0..20] of tPvCameraInfoEx;
valNumberOfCams : Cardinal; valAvailableCams : Cardinal; aHandle : tPvHandle; begin valNumberOfCams := PvCameraListEx (listAVTGigECameras, High (listAVTGigECams), valAvailableCameras, SizeOf (tPvCameraInfoEx)); PvCameraOpen (listAVTGigECameras[0].UniqueID, aHandle); end; Geändert von BoolString (11. Jul 2012 um 20:07 Uhr) Grund: Falschen Code im C-Teil reinkopiert |
![]() |
Registriert seit: 2. Feb 2009 Ort: Varel 70 Beiträge RAD-Studio 2009 Pro |
#2
Ohne pushen zu wollen, aber wie würde man denn dies Konstrukt:
Delphi-Quellcode:
wohl korrekt übersetzen und aufrufen? Ich glaube ich hab nicht wirklich die Essenz der Zeiger. Einer meiner verschiedenen Versuche war:
unsigned long PVDECL PvCameraListEx(tPvCameraInfoEx* pList,
unsigned long ListLength, unsigned long* pConnectedNum, unsigned long StructSize);
Delphi-Quellcode:
Mal davon abgesehen, daß meine Arrays im obigen Posting noch alle einen zu lang waren...
Function PvCameraListEx (pList : Array of tPvCameraInfoEx; ListLength : Cardinal; pConnectedNum : Cardinal; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll';
type tlistAVTGigECams = Array [0..15] of tPvCameraInfoEx; Var listAVTGigECams : tlistAVTGigECams; valNumberOfCams := PvCameraListEx (listAVTGigECams, High (listAVTGigECams), valAvailableCams, SizeOf (tPvCameraInfoEx)); jan Geändert von BoolString (11. Jul 2012 um 21:03 Uhr) |
![]() |
Registriert seit: 30. Jan 2004 823 Beiträge |
#4
Du darfst es nicht als "array of byte" uebersetzen, da dann zwei intern die Laenge+Groesse des Array uebergeben wird, woduch die Parameter nicht mehr mit dem C header uebereinstimmen. Unter der UniversaAPI koennen maximal 64 Kameras angesprochen werden. Also versuchs mal mit:
Delphi-Quellcode:
oder
type
tPvCameraInfoExList = array[0..63] of tPvCameraInfoEx; PPvCameraInfoEx = ^tPvCameraInfoEx; Function PvCameraListEx (pList : PPvCameraInfoEx; ListLength: Cardinal; pConnectedNum : Cardinal; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; Var listAVTGigECams : tPvCameraInfoExList ; valNumberOfCams := PvCameraListEx (@listAVTGigECams, Length(listAVTGigECams), valAvailableCams, SizeOf (tPvCameraInfoEx));
Delphi-Quellcode:
type
tPvCameraInfoExList = array of tPvCameraInfoEx; PPvCameraInfoEx = ^tPvCameraInfoEx; Function PvCameraListEx (pList : PPvCameraInfoEx; ListLength: Cardinal; pConnectedNum : Cardinal; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; Var listAVTGigECams : tPvCameraInfoExList ; setLength(listAVTGigECams , 10); if Length(listAVTGigECams) > 0 then valNumberOfCams := PvCameraListEx (@listAVTGigECams[0], Length(listAVTGigECams), valAvailableCams, SizeOf (tPvCameraInfoEx)); |
![]() |
Registriert seit: 2. Feb 2009 Ort: Varel 70 Beiträge RAD-Studio 2009 Pro |
#5
@horst0815: Danke, aber das sind Punkte, die kommen erst noch deutlich später. Wen ich mal bis zu diesem Schritt gekommen bin, werd ich da sicherlich auch Infos rausziehen können...
@brechi: Der Bezugspunkt bezüglich deiner 'Array of Byte' Anmerkung ist nicht ganz klar geworden. Hatte in den bisherigen Postings keine solche Struktur. Die Funktion PvCameraListEx der DLL kann ich erstmal fehlerfrei anrufen. Allerdings erzeugt der Aufruf :
Delphi-Quellcode:
tPvInterface =
(ePvInterfaceFirewire = 1, // Firewire interface ePvInterfaceEthernet = 2, // Ethernet interface __ePvInterface_force_32 = $FFFFFFFF ); tPvCameraInfoEx = Packed Record StructVer : Cardinal; // Version of this structure //---- Version 1 ---- UniqueId : Cardinal; // Unique value for each camera CameraName : Array [0..31] of Byte; // People-friendly camera name (usually part name) ModelName : Array [0..31] of Byte; // Name of camera part PartNumber : Array [0..31] of Byte; // Manufacturer's part number SerialNumber : Array [0..31] of Byte; // Camera's serial number FirmwareVersion : Array [0..31] of Byte; // Camera's firmware version PermittedAccess : Cardinal; // A combination of tPvAccessFlags InterfaceId : Cardinal; // Unique value for each interface or bus InterfaceType : tPvInterface; // Interface type; see tPvInterface end; tPvCameraInfoExList = array of tPvCameraInfoEx; pPvCameraInfoExList = ^tPvCameraInfoExList; tConnectedCams = Cardinal; pConnectedCams = ^tConnectedCams; Function PvCameraListEx (pList : pPvCameraInfoExList; ListLength : Cardinal; pConnectedNum : pConnectedCams; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; auf folgende Weise:
Delphi-Quellcode:
ein merkwürdiges Verhalten. wenn man das ganze im Debugger beobachtet, dann beinhaltet das Array listAVTGigECams nach SetLength genau einmal den Record. Nachdem die Funktion PvCameraListEx aufgerufen wurde, besitzen die Variablen valNumberOfCams und valAvailableCams die korrekten Werte (eine Kamera) in der Liste der lokalen Variablen des Dubuggers.
Var listAVTGigECams : tPvCameraInfoExList;
valNumberOfCams : Cardinal; valAvailableCams : Cardinal; i: Integer; begin SetLength (listAVTGigECams, 1); valNumberOfCams := PvCameraListEx (@listAVTGigECams, Length (listAVTGigECams), @valAvailableCams, SizeOf (tPvCameraInfoEx)); Sleep (100); memo1.Lines.Add ('High value : ' + IntToStr(High (listAVTGigECams))); memo1.Lines.add ('Number of cams in list : ' + IntToStr (valNumberOfCams)); memo1.Lines.add ('Number of cams available: ' + IntToStr (valAvailableCams)); For i := 00 to valNumberofCams-1 do Begin Memo1.Lines.Add (IntToStr (listAVTGigECams[i].UniqueID)); Memo1.Lines.Add (Chr(listAVTGigECams[i].CameraName[0])); end; end; Das Array listAVTGigECams besitzt allerdings plötzlich 131072 (0..131071) Elemente, wovon die ersten 365 (0..364) leer sind. Das Element 366 (Index 365) beinhaltet die erwartete Record Struktur; wenn auch mit komplett unherleitbaren Werten. Gleiches gilt für die folgenden Elemente. Element 752-1093 (Index 751-1092) ist wieder leer und so weiter. Nach dem Aufruf der Funktion PvCameraListEx kann man auch nicht mehr auf die anderen Variablen zugreifen (oben z.B. in den Memo1.lines.Add); hier werden vermutlich Speicherzuweisungen überschrieben. Ich habe momentan die Vermutung, daß es an der Definition von tPvCameraInfoEx liegt. Das SizeOf zeigt mit 180 den Wert an, den ich erwarten würde. Allerdings ist mir die Indizierungs des Arrays auffällig mit 2*180+5 verknüpft. Es sind 5 Arrays of Byte da drin. Ich hab versucht an diversen Stelen nachzulesen (unter anderem Asserbads DLL Manual) und hab eine Übersetzungsempfehlung für char CameraName[32] mit CameraName : Array [00..31] of Byte gefunden. Ein Char geht nicht mehr, da es unter DelphiXE dem WideChar entspricht; obgleich man dann ja wohl auch AnsiChar verwenden könnte. Die Größe von tPvInterface scheint durch den $FFFFFFFF Wert korrekt auf 4 Byte aliniert zu werden. Wenn die Kamera abgezogen ist, wird das Array nicht bestückt und man kann auch auf die Variablen valNumberOfCams und valAvailableCams zugreifen. [...] |
![]() |
Registriert seit: 30. Jan 2004 823 Beiträge |
#6
Ich meinte auch array of tPvCameraInfoEx;
Wenn du dynamische Arrays verwendest und diese als Pointer uebergeben willst musst du immmer @Array[0] uebergeben, niemals @Array, denn vor dem 1. Element sind noch andere Daten gespeichert (Laenge).
Also entweder du verwendest ein statisches Array (dann geh @Array aber auch dort ist @Array[0] erlaubt) oder ein dynamisches mit @Array[0].
Delphi-Quellcode:
tPvInterface =
(ePvInterfaceFirewire = 1, // Firewire interface ePvInterfaceEthernet = 2, // Ethernet interface __ePvInterface_force_32 = $FFFFFFFF ); tPvCameraInfoEx = Packed Record StructVer : Cardinal; // Version of this structure //---- Version 1 ---- UniqueId : Cardinal; // Unique value for each camera CameraName : array[0..31] of char; // People-friendly camera name (usually part name) ModelName : array[0..31] of char; // Name of camera part PartNumber : array[0..31] of char; // Manufacturer's part number SerialNumber : array[0..31] of char; // Camera's serial number FirmwareVersion : array[0..31] of char; // Camera's firmware version PermittedAccess : Cardinal; // A combination of tPvAccessFlags InterfaceId : Cardinal; // Unique value for each interface or bus InterfaceType : tPvInterface; // Interface type; see tPvInterface end; tPvCameraInfoExList = array of tPvCameraInfoEx; tConnectedCams = Cardinal; Function PvCameraListEx (pList : pPvCameraInfoExList; ListLength : Cardinal; out pConnectedNum : pConnectedCams; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; Var listAVTGigECams : tPvCameraInfoExList; valNumberOfCams : Cardinal; valAvailableCams : Cardinal; i: Integer; begin SetLength (listAVTGigECams, 1); valNumberOfCams := PvCameraListEx (@listAVTGigECams[0], Length (listAVTGigECams), valAvailableCams, SizeOf (tPvCameraInfoEx)); Sleep (100); memo1.Lines.Add ('High value : ' + IntToStr(High (listAVTGigECams))); memo1.Lines.add ('Number of cams in list : ' + IntToStr (valNumberOfCams)); memo1.Lines.add ('Number of cams available: ' + IntToStr (valAvailableCams)); For i := 0 to valNumberofCams-1 do Begin Memo1.Lines.Add (IntToStr (listAVTGigECams[i].UniqueID)); Memo1.Lines.Add (listAVTGigECams[i].CameraName)); end; end; |
![]() |
Registriert seit: 2. Feb 2009 Ort: Varel 70 Beiträge RAD-Studio 2009 Pro |
#7
Theoretisch hätte mir das wohl klar sein sollen; aber praktisch...
Ich hab zumindest über das Wocheende ein wenig weiter dran gearbeitet und komme inzwischen auch an diverse Attribute der Kamera heran. Ich kann die Kamera inzwischen auch sauber öffnen. Allerdings bekomme ich dabei den PermittedAccess Status 6 zurückgeliefert. Laut SDK Unterlagen sollen aber nur die Statuswerte 2 und 4 (und nicht deren addierte Bitsumme) valide sein. Was könnte das denn wohl bedeuten? Ich glaube, daß ich schon ein großes Stück weiter bin. Habe mir aus diversen C-Samples jetzt etwas zusammengebastelt. Das muss alles noch in einzelne Procs/Funcs ausgelagert werden, aber für eine Version zum Debuggen ist es ganz praktisch. Derzeit hängt es aber an der Struktur des pFrame (?). Ich versuche das so ähnlich zu machen wie in den C-Samples und im Quellcode, den horst0815 gepostet hat. aber hier stimt irgendwas noch nicht. Ich komme derzeit an kein Bild. Der PvCaptureQueueFrame wirft eine Exception, die ich nicht richtig verfolgt bekomme. Ich habe derzeit die Header-Datei folgendermassen übersetzt (Ausschnitte):
Delphi-Quellcode:
Auf der anderen seite steckt erst einmal alles in einem ButtonClick:
tPvImageFormat =
(ePvFmtMono8 = 0, // Monochrome, 8 bits ePvFmtMono16 = 1, // Monochrome, 16 bits, data is LSB aligned ePvFmtBayer8 = 2, // Bayer-color, 8 bits ePvFmtBayer16 = 3, // Bayer-color, 16 bits, data is LSB aligned ePvFmtRgb24 = 4, // RGB, 8 bits x 3 ePvFmtRgb48 = 5, // RGB, 16 bits x 3, data is LSB aligned ePvFmtYuv411 = 6, // YUV 411 ePvFmtYuv422 = 7, // YUV 422 ePvFmtYuv444 = 8, // YUV 444 ePvFmtBgr24 = 9, // BGR, 8 bits x 3 ePvFmtRgba32 = 10, // RGBA, 8 bits x 4 ePvFmtBgra32 = 11, // BGRA, 8 bits x 4 ePvFmtMono12Packed = 12, // Monochrome, 12 bits, ePvFmtBayer12Packed = 13, // Bayer-color, 12 bits, packed __ePvFmt_force_32 = $FFFFFFFF ); // // Bayer pattern. Applicable when a Bayer-color camera is sending raw bayer // data. // tPvBayerPattern = (ePvBayerRGGB = 0, // First line RGRG, second line GBGB... ePvBayerGBRG = 1, // First line GBGB, second line RGRG... ePvBayerGRBG = 2, // First line GRGR, second line BGBG... ePvBayerBGGR = 3, // First line BGBG, second line GRGR... __ePvBayer_force_32 = $FFFFFFFF ); tPvFrame = Packed Record //----- In ----- ImageBuffer : Pointer; // Buffer for image/pixel data. ImageBufferSize : Cardinal; // Size of ImageBuffer in bytes AncillaryBuffer : Pointer; // Camera Firmware >= 1.42 Only. // Buffer to capture ancillary chunk mode data. See ChunkModeActive attr. // This MUST be 0 if not in use. // Chunk mode format: // [Bytes 1 - 4] acquisition count. // [Bytes 5 - 8] user value. Not currently implemented. 0. // [Bytes 9 - 12] exposure value. // [Bytes 13 - 16] gain value. // [Bytes 17 - 18] sync in levels. // [Bytes 19 - 20] sync out levels. // [Bytes 21 - 40] not implemented. 0. // [Bytes 41 - 44] chunk ID. 1000. // [Bytes 45 - 48] chunk length. AncillaryBufferSize : Cardinal; // Size of your ancillary buffer in bytes. See NonImagePayloadSize attr. // Set to 0 for no buffer. Context : Array [0..3] of Pointer; // For your use. Possible application: unique ID // of tPvFrame for frame-done callback. _reserved1 : Array [0..7] of Cardinal; //----- Out ----- Status : tPvErr; // Status of this frame ImageSize : Cardinal; // Image size, in bytes AncillarySize : Cardinal; // Ancillary data size, in bytes Width : Cardinal; // Image width Height : Cardinal; // Image height RegionX : Cardinal; // Start of readout region (left) RegionY : Cardinal; // Start of readout region (top) Format : tPvImageFormat; // Image format BitDepth : Cardinal; // Number of significant bits BayerPattern : tPvBayerPattern; // Bayer pattern, if bayer format FrameCount : Cardinal; // Frame counter. Uses 16bit GigEVision BlockID. Rolls at 65535. TimestampLo : Cardinal; // Time stamp, lower 32-bits TimestampHi : Cardinal; // Time stamp, upper 32-bits _reserved2 : Array [0..31] of Cardinal; end; tPvCameraInfoExList = array of tPvCameraInfoEx; pPvCameraInfoExList = ^tPvCameraInfoExList; tConnectedCams = Cardinal; pConnectedCams = ^tConnectedCams; pPvFrame = ^tPvFrame; Const PVINFINITE = $FFFFFFFF; // Never timeout //------------------------------------------------------------------------------------- // define DLL-calls: Function PvAttrEnumSet (pCamera: tPvHandle; Name: PAnsiChar; Value: PAnsiChar): tPvErr; stdcall; external 'PvAPI.dll'; Function PvAttrUint32Get (pCamera: tPvHandle; Name: PAnsiChar; Out pValue: Cardinal) : tPvErr; stdcall; external 'PvAPI.dll'; Function PvCameraListEx (pList: pPvCameraInfoExList; ListLength : Cardinal; Out ConnectedNum : tConnectedCams; Size : Cardinal) : Cardinal; stdcall; external 'PvAPI.dll'; Function PvCameraClose (pCamera: tPvHandle) : tPvErr; stdcall; external 'PvAPI.dll'; Function PvCameraOpen (UniqueID: Cardinal; AccessFlag: tPvAccessFlags; Out pCamera: tPvHandle) : tPvErr; stdcall; external 'PvAPI.dll'; Function PvCaptureStart (pCamera: tPvHandle) : tPvErr; stdcall; external 'PvAPI.dll'; Function PvCaptureQueueFrame (pCamera: tPvHandle; pFrame: pPvFrame; FrameCallBack: Pointer ): tPvErr; stdcall; external 'PvAPI.dll'; Function PvCaptureWaitForFrameDone (pCamera: tPvHandle; pFrame: pPvFrame; Timeout: Cardinal): tPvErr; stdcall; external 'PvAPI.dll'; Function PvCommandRun (pCamera: tPvHandle; Name : PAnsiChar): tPvErr; stdcall; external 'PvAPI.dll'; Function PvInitialize : tPvErr; stdcall; external 'PvAPI.dll'; Function PvInitializeNoDiscovery : tPvErr; stdcall; external 'PvAPI.dll'; Procedure PvUnInitialize; stdcall; external 'PvAPI.dll'; Procedure PvVersion (Var Major, Minor: Cardinal); stdcall; external 'PvAPI.dll';
Delphi-Quellcode:
Soweit ich es der SDK-Doku entnehme sollte so eine Aufrufreihenfolge zum Erfolg führen. Aber momentan ist dem noch nicht so...
procedure TForm1.Button6Click(Sender: TObject);
Var aFrame : tPvFrame; aFrameBuffer : Array of Byte; aBitMap : tBitmap; aErrValue : tPvErr; Begin aErrValue := PvAttrUint32Get (CamHandle, 'TotalBytesPerFrame', aFrame.ImageBufferSize); If aErrValue = ePvErrSuccess then Begin SetLength (aFrameBuffer, aFrame.ImageBufferSize); aFrame.ImageBuffer := @aFrameBuffer[0]; end Else Begin Exit; end; aErrValue := PvCaptureStart (CamHandle); If aErrValue = ePvErrSuccess THen Begin aErrValue := PvAttrEnumSet (CamHandle, 'FrameStartTriggerMode', 'Freerun'); If aErrValue = ePvErrSuccess Then Begin aErrValue := PvCommandRun (CamHandle, 'AcquisitionStart'); If aErrValue = ePvErrSuccess Then Begin aErrValue := PvCaptureQueueFrame (CamHandle, @aFrame, 0) ; If aErrValue = ePvErrSuccess Then Begin aErrValue := PvCaptureWaitForFrameDone (CamHandle, @aFrame, PVINFINITE); If aErrValue = ePvErrSuccess Then Begin // CreateDIBitmap (@aBitmap,...?????) Beep;Beep;Beep; end; end; end; end; end; end; Jan PS: Was sind denn wohl erfahrungsgemäß gute Werte für ein TimeOut der Kamera im Debugmodus? |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.
BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus. Trackbacks are an
Pingbacks are an
Refbacks are aus
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |