imgplot is a non-blocking image viewer for Python 3.
- C++14 (gcc-6)
- OpenGL 4
- Python 3
GLFW
sudo apt install libglfw3-dev
pybind11
pip3 install pybind11 --user
imgplot
make
import numpy as np
import imgplot
figure = imgplot.figure()
data_rect = np.array(...)
axis = imgplot.image(data_rect)
figure.add(axis, x=0, y=0, width=1, height=1)
window = imgplot.window(figure, size=(400, 200), title="Lena")
window.show()
while True:
if window.closed():
exit()
... some computation
data = np.array(...)
axis.update(data)
axis = imgplot.image(data_square)
figure.add(axis, x=0, y=0, width=1, height=1)
window = imgplot.window(figure, size=(400, 400), title="Lena")
axis1 = imgplot.image(data_rect)
figure.add(axis1, x=0, y=0, width=1, height=0.5)
axis2 = imgplot.image(data_rect)
figure.add(axis2, x=0, y=0.5, width=1, height=0.5)
axis1 = imgplot.image(data_rect)
figure.add(axis1, x=0, y=0, width=1, height=1.0 / 3.0)
axis2 = imgplot.image(data_rect)
figure.add(axis2, x=0, y=1.0 / 3.0, width=1, height=1.0 / 3.0)
axis3 = imgplot.image(data_rect)
figure.add(axis3, x=0, y=2.0 / 3.0, width=1, height=1.0 / 3.0)
window = imgplot.window(figure, size=(400, 600), title="Lena")
axis1 = imgplot.image(data_rect)
figure.add(axis1, x=0, y=0, width=1, height=0.5)
axis2 = imgplot.image(data_square)
figure.add(axis2, x=0, y=0.5, width=0.5, height=0.5)
axis3 = imgplot.image(data_square)
figure.add(axis3, x=0.5, y=0.5, width=0.5, height=0.5)
window = imgplot.window(figure, size=(400, 400), title="Lena")
axis1 = imgplot.image(data_rect)
figure.add(axis1, x=0, y=0.0, width=2.0 / 3.0, height=1)
axis2 = imgplot.image(data_square)
figure.add(axis2, x=2.0 / 3.0, y=0, width=1.0 / 3.0, height=1)
window = imgplot.window(figure, size=(600, 200), title="Lena")
for n in range(16):
axis = imgplot.image(data_square)
x = n % 4 / 4.0
y = n // 4 / 4.0
figure.add(axis, x=x, y=y, width=1.0 / 4.0, height=1.0 / 4.0)
window = imgplot.window(figure, size=(400, 400), title="Lena")
axis1 = imgplot.image(data_rect)
figure.add(axis1, x=0, y=0, width=1, height=0.5)
axis2 = imgplot.image(data_rect)
figure.add(axis2, x=0, y=0.5, width=1, height=0.5)
window = imgplot.window(figure, size=(400, 400), title="Lena")
window.show()
for loop in range(1000):
if window.closed():
exit()
data = np.uint8(data_rect * abs(math.cos(0.05 * loop * math.pi)))
axis1.update(data)
time.sleep(0.1)