Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fast way to exchange 3channel (image RGB) 16 bit matrix between Python and Lazarus/FPC (on linux)#480

Unanswered
CorBer asked this question inQ&A
Discussion options

Hi,

Ive studied many of the demo's and had the idea that Demo29 was the best point to start looking for a good entrypoint to exchange image-data (16bit so not bitmap) using python4delphi. I am using P4D in my project to use a set of opencv procedures on a large set of stored images. The reading of the files is done in python. The result of this calculation is a floatingpoint array that I need to push back to the Pascal side. Thusfar I am doing this by simply saving a 16bit representation of that array in python as a png and then loading that back in Lazarus. This works but has he disadvantage of :
A) write/load the image over IO isnt looking "optimized" for speed
B) the floating point becomes a 16bit image loosing quality.

As stated I studied Demo29 as I had the idea I could overcome disadvantage A. I implemented a stream (as shown in the example) that wrote 16 bit data to python and received 16 bit back using that same stream-approach. This is however a slower than simply writeing/reading a PNG.

So I am searching for a "better" solution but have not seen an example where a 3channel 2D-floating point array gets exchanged between python/pascal.

I am not sure if this is the right place to ask, if not please excuse me !

cheers
Cor


waveSharp Free Image sharpen Software
https://github.com/CorBer/waveSharp

TeensyBat Bat Detector
https://github.com/CorBer/teensy_batdetector

RegiStax Free Image Processing Software
http://www.astronomie.be/registax


You must be logged in to vote

Replies: 4 comments

Comment options

Your best bet for speed is the buffer protocol, if it is supported by the python objects. (see Demo 35).
You may get better responses by posting to thesupport forum.

You must be logged in to vote
0 replies
Comment options

Hi,

I looked at Demo35 (we tested that together a few days ago for FPC/Linux) but thusfar have not seen anything that resembles using a large-scale array. But I will check once more, I also looked at the support-forum but it seems I need to register myself and as I am not "delphi-based" I wonder if that will help.

Thanks again for answering swiftly, as stated before I am willing to help you with exploring/improving the demo's for FPC.

regards
Cor

You must be logged in to vote
0 replies
Comment options

The buffer protocol works with small, large and huge arrays of any data type. Please read thedocs.

You must be logged in to vote
0 replies
Comment options

As you might guess I allready checked that, and although the documentation is concise it does not resolve the question. I am looking for a simple example where for instance a array with 3 dimensions (I am sure it will scale) gets moved back/forth. But if its not something that people are doing regularly I am left to work that out myself. I am used to doing that as I have been developing freeware for some time. I am not a professional so I will need time. Thanks

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@CorBer@pyscripter

[8]ページ先頭

©2009-2025 Movatter.jp