bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.45k stars 1.57k forks source link

Converting a byte array to a mat for the first time takes a lot more time than subsequent conversions #1994

Closed CJL6015 closed 1 year ago

CJL6015 commented 1 year ago

When I convert the byte array to mat for the first time it takes more than 3 seconds.And the subsequent conversion of the byte array to mat is even less than 1 millisecond.

saudet commented 1 year ago

You may want to try GraalVM Native Image for that use case...

saudet commented 1 year ago

There's a sample project for that here: https://github.com/bytedeco/sample-projects/tree/master/opencv-stitching-native

CJL6015 commented 1 year ago

Thanks for your reply! Does initialization only need to be done once? Or does it need to be reinitialized after a while?

saudet commented 1 year ago

That's not related to JavaCV. You'll need to ask about that upstream: https://github.com/openjdk/jdk