hellonico / origami

Lowest barrier of entry to Image Processing, Computer Vision and Neural Networks on the JavaVM
https://hellonico.github.io/origami-docs/#/
Eclipse Public License 1.0
122 stars 7 forks source link

to image bitmap #66

Closed hellonico closed 3 years ago

hellonico commented 3 years ago
fun asImageAsset(image: Mat): ImageBitmap {
    val bytes = MatOfByte()
    Imgcodecs.imencode(".jpg", image, bytes)
    val byteArray = ByteArray((image.total() * image.channels()).toInt())
    bytes.get(0, 0, byteArray)
    return org.jetbrains.skija.Image.makeFromEncoded(byteArray).asImageBitmap()
}
hellonico commented 3 years ago

skija is of version class 55( jdk 11) and for now we still want to be compatible with jdk8 (since most of our code is in clojure)