You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by gau-nernst April 3, 2024
Typically we can access raw image data from other library as an Uint8List object. Assuming we know the format of the image (e.g. RGB uint8), what is the best (fast and convenient) way to convert it to OpenCV Mat? Some of the approaches I am thinking of:
Create an empty Mat with the required size. Iterate over Uint8List and copy data over. For some formats like YUV_420sp, it might be a bit tricky to copy the data correctly.
Encode in a lossless format (e.g. PNG) and use cv.imdecode() -> seems to be the most convenient, but there is overhead in compression-decompression.
Allocate C memory with Dart FFI, copy data over, create Mat from C pointer. Need to release the memory after use.
The text was updated successfully, but these errors were encountered:
Discussed in #18
Originally posted by gau-nernst April 3, 2024
Typically we can access raw image data from other library as an
Uint8List
object. Assuming we know the format of the image (e.g. RGB uint8), what is the best (fast and convenient) way to convert it to OpenCVMat
? Some of the approaches I am thinking of:Mat
with the required size. Iterate overUint8List
and copy data over. For some formats like YUV_420sp, it might be a bit tricky to copy the data correctly.cv.imdecode()
-> seems to be the most convenient, but there is overhead in compression-decompression.Mat
from C pointer. Need to release the memory after use.The text was updated successfully, but these errors were encountered: