-
Notifications
You must be signed in to change notification settings - Fork 14
/
demo.py
37 lines (27 loc) · 1.04 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from logging import FileHandler
from vlogging import VisualRecord
if __name__ == '__main__':
import cv2
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
# evenly sampled time at 200ms intervals
t = np.arange(0., 5., 0.2)
fig1 = plt.figure()
plt.plot(t, t, 'r--', t, t ** 2, 'bs', t, t ** 3, 'g^')
cv_image = cv2.imread('vlogging/tests/lenna.jpg')
pil_image = Image.open('vlogging/tests/lenna.jpg')
import logging
logger = logging.getLogger("demo")
fh = FileHandler('test.html', mode="w")
logger.setLevel(logging.DEBUG)
logger.addHandler(fh)
logger.debug(VisualRecord(
"Hello from OpenCV", cv_image, "This is openCV image", fmt="png"))
logger.info(VisualRecord(
"Hello from PIL", pil_image, "This is PIL image", fmt="jpeg"))
logger.info(VisualRecord(
"Hello from pylab", fig1, "This is PyLab graph", fmt="png"))
logger.warning(
VisualRecord("Hello from all", [cv_image, pil_image, fig1],
fmt="png"))