简体   繁体   中英

ipython.display.display not showing image in Jupyter Notebook

I am trying to display an image data on Jupyter Notebook but it is showing only data array.

import ipywidgets
from IPython.display import display
from jetcam.utils import bgr8_to_jpeg

image_widget = ipywidgets.Image(format='jpeg')

image_widget.value = bgr8_to_jpeg(image)

display(image_widget)

Output:

Image(value=b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x02\x01\x0…

Full Jupyter Notebook can find in here - https://github.com/NVIDIA-AI-IOT/jetcam/blob/master/notebooks/usb_camera/usb_camera.ipynb

How to solve this error?

I found a solution to this problem, which is available on the Nvidia Developer Forums , but I will share here as well, just in case someone else comes across the same issue when trying to run jetcam usb_camera.ipynb notebook.

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension
jupyter labextension install @jupyter-widgets/jupyterlab-manager

Note: A reboot may be required, also you need to install node.js on your device, run node -v to see if it's installed. In my case I had to install node.js on the Nvidia Jetson Nano to get the last command to process.

source: https://forums.developer.nvidia.com/t/hello-camera-displayed-nothing/81475/3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM