How would I go ahead and display an image in Kotli...
# datascience
h
How would I go ahead and display an image in Kotlin Jupyter Notebook? Using BoofCV which can output BufferedImage, floatArray/intArray or a swing GUI (doesnt work because no X11 it says on datalore)
i
One of the ways to go is
Copy code
%use lib-ext
Image("path/to/image")
👍 1
h
Straight from a buffered image or bytearray, because i manipulate it a lot. Wiring so many images to file to then read works but is a bit hacky :)
i
I've added a new constructor from `BufferedImage`: https://github.com/Kotlin/kotlin-jupyter/commit/2592e188ddf5bdaadf9eb8d794364363113612e5#diff-d5fb0d9563c7c0819dd6bc3[…]9333d049b1fece4c5bc6fR48-R50 Until it's deployed you may use byte array constructor)
🙃 1
❤️ 2
h
A huge thanks! 🤗
i
@Hampus Londögård Would be great if you share with Lets-Plot (Kotlin) [https://github.com/JetBrains/lets-plot-kotlin] your experience with the image manipulation in Kotlin. In Lets-Plot for Python we provide "geom_image" and "image_matix" - both use numpy's ndarrays as input, but our Kotlin API still lacking this "geometry" because of an uncertency regarding the datastructue to be used for the image encoding. Python examples of image-related plots can be found on this page: https://jetbrains.github.io/lets-plot-docs/pages/features/examples.html#examples-geoms-and-stats Hers are couple of direct links to relevant Datalore notebooks: https://datalore.jetbrains.com/view/notebook/t6pDD02VWaJEtS4j3zBGrO https://datalore.jetbrains.com/view/notebook/BtUbtzOANl61ONovEoswRk
h
Thanks @Igor Alshannikov. The issue is that I’m actually using BoofCV for my image manipulation, which means that I’ve got float/intArray and the internal
GrayX
X = F32, U8, S16… But I’ll make sure to take a look 🙂
🙏 1
213 Views