-
-
Couldn't load subscription status.
- Fork 324
Fast way to exchange 3channel (image RGB) 16 bit matrix between Python and Lazarus/FPC (on linux) #480
-
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
Beta Was this translation helpful? Give feedback.
All reactions
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 the support forum.
Replies: 4 comments
-
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 the support forum.
Beta Was this translation helpful? Give feedback.
All reactions
-
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
Beta Was this translation helpful? Give feedback.
All reactions
-
The buffer protocol works with small, large and huge arrays of any data type. Please read the docs.
Beta Was this translation helpful? Give feedback.
All reactions
-
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
Beta Was this translation helpful? Give feedback.