https://kotlinlang.org logo
Title
h

Hampus Londögård

05/01/2021, 9:46 AM
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

Ilya Muradyan

05/01/2021, 9:58 AM
One of the ways to go is
%use lib-ext
Image("path/to/image")
👍 1
h

Hampus Londögård

05/01/2021, 10:05 AM
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

Ilya Muradyan

05/01/2021, 10:22 AM
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

Hampus Londögård

05/01/2021, 10:23 AM
A huge thanks! 🤗
i

Igor Alshannikov

05/03/2021, 1:00 AM
@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

Hampus Londögård

05/03/2021, 5:54 AM
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 🙂
:tnx: 1