ALP4lib icon indicating copy to clipboard operation
ALP4lib copied to clipboard

“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?

Open ningjingzhiwei opened this issue 5 years ago • 1 comments

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?

ningjingzhiwei avatar Aug 20 '20 16:08 ningjingzhiwei

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 avatar Oct 10 '20 07:10 wavefrontshaping

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

wavefrontshaping avatar Jul 01 '24 11:07 wavefrontshaping