wavefrontshaping / ALP4lib

Python control module for Vialux DMDs based on ALP4.X API.
MIT License
58 stars 41 forks source link

“ImgToBitPlane” costs too much time(~500 ms), how to convert an captured image array(dytype:unit8, dimension:(1024*768),value(0 or 1))) to bitplane fast? #10

Closed ningjingzhiwei closed 5 months ago

ningjingzhiwei commented 4 years ago

I captured an image with an camera, and want to display this image on the DMD quickly(less than 3 ms). For example, the dimension of the image is 1024*768(the same with the DMD size) , the value of the image array is 0 or 1, but the data type is unit8. I used "ImgToBitPlane" to change the image array to bitplane, but this command cost too much time, how to solve this probelm, and display the image quickly on the DMD?

wavefrontshaping commented 4 years ago

Hi,

As far as I remember, this function was not optimized at all, it was designed to be used occasionally, as I assumed an optimized code would directly generate the images as bitPlane. I think it can be optimized a lot, but I would not have time in a near future to dive into that.

It is in my todo list. If you find/found a solution, I would welcome a pull request.

wavefrontshaping commented 5 months ago

Has been improved using np.packbits 50+ times faster!