-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function cvImage2Bitmap() didn't work, i wrote a new one #134
Comments
How can I reproduce the error? |
Hello Laentir,
sorry, i can't give you more details. It's 10 month ago, i really can't remember. The original cvImage2Bitmap produced an exception. My Delphi-Version is always up to date, i suppose it was 10.3.3 Rio or maybe 10.4 Sydney.
Best regards,
Oliver
|
Same on my side. Sample of code that create the error : type Environnement : Delphi 10.4.2, windows 32 plateform. It seams it has to see with the line I commented out, no more error... but of course, no more image translation. |
Works for me... except I have to remove the IfDef and else, as the ifdef clause is not recognized by 10.4... for a reason I don't know. |
Array out range PByteArray = ^TByteArray; function cvImage2Bitmap(img: PIplImage): {$IFDEF DELPHIXE2_UP}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF};
// data := Pointer(img^.ImageData);
// for j := 0 to img^.Width - 1 do |
Vielen Dank für Ihre E-Mail.
Frohe Weihnachten und einen guten Rutsch ins neue Jahr!
In der Zeit vom 22.12.2023 - 03.01.2024 bin ich im Urlaub.
Ihr Anliegen wird in dieser Zeit nicht bearbeitet.
In dringenden Fällen wenden Sie sich bitte telefonisch an die 040 - 6737020.
Mit freundlichen Grüßen
Oliver Dahlmann, Dipl. Ing. (FH)
…-------------------------------------------------------------------
Oliver Dahlmann, Dipl. Ing. (FH)
Ernst Sicherheits- und Kommunikationstechnik GmbH
Eiffestraße 74
20537 Hamburg
Fax 040 - 673702-5030
Email ***@***.***
Web http://www.ernst-sicherheitstechnik.de
Geschäftsführer: Arne Ernst
Gerichtsstand Hamburg
Zuständige Handelskammer: Handelskammer Hamburg
Handelsregister: HRB23339
Steuer-Nr. 46/718/03340
-------------------------------------------------------------------
array out range
PByteArray = ^TByteArray;
TByteArray = array[0..32767] of Byte;
--
Reply to this email directly or view it on GitHub:
#134 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
function cvImage2Bitmap didn't work for me, it produced an exception.
this code instead works:
function cvImage2Bitmap(img: PIplImage): {$IFDEF DELPHIXE2_UP}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF}; var bmp: {$IFDEF DELPHIXE2_UP}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF}; deep: Integer; y, x, c, wStep, Channels: Integer; srcPtr: PByte; destPtr: PByte; wAdd: Integer; begin Result := nil; if (img <> nil) then begin bmp := {$IFDEF DELPHIXE2_UP}Vcl.Graphics.TBitmap.Create{$ELSE}Graphics.TBitmap.Create{$ENDIF}; bmp.SetSize(img^.Width, img^.Height); deep := img^.nChannels * img^.depth; case deep of 8: bmp.PixelFormat := pf8bit; 16: bmp.PixelFormat := pf16bit; 24: bmp.PixelFormat := pf24bit; 32: bmp.PixelFormat := pf32bit; end; wStep := img^.WidthStep; Channels := img^.nChannels; srcPtr := Pointer(img^.ImageData); wAdd := wStep - (img^.width * Channels); for y := 0 to img^.Height - 1 do begin destPtr := bmp.Scanline[y]; for x := 0 to img^.Width - 1 do begin for c := 0 to Channels - 1 do begin destPtr^ := srcPtr^; Inc(destPtr); Inc(srcPtr); end; end; srcPtr := Pointer(NativeUint(srcPtr) + NativeUInt(wAdd)); end; Result := bmp; end; end;
The text was updated successfully, but these errors were encountered: