import cv2
import base64
import numpy as np
_viewer_html = '''
'''
image_url_marker = '{{{image_url_marker}}}'
depth_url_marker = '{{{depth_url_marker}}}'
def depthviewer2html(image,depth):
image_rgb = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2RGB)
_, buffer = cv2.imencode('.jpg',image_rgb)
image_data_url = 'data:image/jpeg;base64,'+base64.b64encode(buffer).decode('utf-8')
_, buffer = cv2.imencode('.png',np.array(depth))
mask_data_url = 'data:image/png;base64,'+base64.b64encode(buffer).decode('utf-8')
vhtml = str(_viewer_html).replace(image_url_marker,image_data_url).replace(depth_url_marker,mask_data_url)
e = base64.b64encode(bytes(vhtml,'utf-8')).decode('utf-8')
url = f'data:text/html;base64,{e}'
h = f''
return h