Commit 6c88d9e2 authored by Andrey Filippov's avatar Andrey Filippov

8-image reports

parent 4b02b283
This diff is collapsed.
...@@ -18,6 +18,7 @@ import imagej_tiffwriter ...@@ -18,6 +18,7 @@ import imagej_tiffwriter
import time import time
import imagej_tiff as ijt import imagej_tiff as ijt
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib.backends.backend_pdf import PdfPages from matplotlib.backends.backend_pdf import PdfPages
import qcstereo_functions as qsf import qcstereo_functions as qsf
import numpy as np import numpy as np
...@@ -156,11 +157,16 @@ def get_fig_params(disparity_ranges): ...@@ -156,11 +157,16 @@ def get_fig_params(disparity_ranges):
extra_path = os.path.join(root_dir, dbg_parameters['extra']) extra_path = os.path.join(root_dir, dbg_parameters['extra'])
eo_width = dbg_parameters['eo_params']['width'] eo_width = dbg_parameters['eo_params']['width']
eo_height = dbg_parameters['eo_params']['height'] eo_height = dbg_parameters['eo_params']['height']
eo_woi = dbg_parameters['eo_params']['woi'] # (x,y,width, height) eo_woi_rel = dbg_parameters['eo_params']['woi'] # (x,y,width, height)
eo_woi={
"x":eo_width * eo_woi_rel['x'],
"y":eo_height * eo_woi_rel['y'],
"width":eo_width * eo_woi_rel['width'],
"height":eo_height * eo_woi_rel['height'],
}
eo_disparity_scale = 1.0/dbg_parameters['eo_params']['disparity_scale'] # 14.2 eo_disparity_scale = 1.0/dbg_parameters['eo_params']['disparity_scale'] # 14.2
image_sets = dbg_parameters['extra_paths'] # list of dictionaries image_sets = dbg_parameters['extra_paths'] # list of dictionaries
pass pass
#temporary: #temporary:
...@@ -251,6 +257,28 @@ for mode in modes: # ['train']: ...@@ -251,6 +257,28 @@ for mode in modes: # ['train']:
fig.canvas.set_window_title(img_pars['title']) fig.canvas.set_window_title(img_pars['title'])
fig.suptitle(img_pars['title']) fig.suptitle(img_pars['title'])
#insert LWIR JPEG image
lwir_rgb = mpimg.imread(os.path.join(extra_path,img_pars['lwir_path']))
ax_lwir = plt.subplot(421)
ax_lwir.set_title("LWIR image (1 of 4)")
plt.imshow(lwir_rgb)
#insert EO JPEG image
eo_rgb = mpimg.imread(os.path.join(extra_path,img_pars['eo_path']))
ax_eo = plt.subplot(422)
ax_eo.set_title("Visible range image (1 of 4)")
plt.imshow(eo_rgb)
if not eo_woi is None:
eo_woi_jpeg={
"x":eo_rgb.shape[1] * eo_woi_rel['x'],
"y":eo_rgb.shape[0] * eo_woi_rel['y'],
"width":eo_rgb.shape[1] * eo_woi_rel['width'],
"height":eo_rgb.shape[0] * eo_woi_rel['height'],
}
xdata=[eo_woi_jpeg['x'], eo_woi_jpeg['x'] + eo_woi_jpeg['width'], eo_woi_jpeg['x'] + eo_woi_jpeg['width'], eo_woi_jpeg['x'], eo_woi_jpeg['x']]
ydata=[eo_woi_jpeg['y'], eo_woi_jpeg['y'], eo_woi_jpeg['y'] + eo_woi_jpeg['height'], eo_woi_jpeg['y'] + eo_woi_jpeg['height'], eo_woi_jpeg['y']]
plt.plot(xdata,ydata,color=WOI_COLOR)
# Create EO DSI image # Create EO DSI image
# load tiff image # load tiff image
...@@ -258,7 +286,7 @@ for mode in modes: # ['train']: ...@@ -258,7 +286,7 @@ for mode in modes: # ['train']:
ds_main = img_ds_main.image[...,img_pars['dsi_slice']] * eo_disparity_scale ds_main = img_ds_main.image[...,img_pars['dsi_slice']] * eo_disparity_scale
ds_main = np.maximum(ds_main, lim_val[0]) ds_main = np.maximum(ds_main, lim_val[0])
ds_main = np.minimum(ds_main, lim_val[1]) ds_main = np.minimum(ds_main, lim_val[1])
ax_conf=plt.subplot(322) ax_conf=plt.subplot(424)
ax_conf.set_title("Hi-res camera disparity map") ax_conf.set_title("Hi-res camera disparity map")
plt.imshow(ds_main, vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp) plt.imshow(ds_main, vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp)
setlimsxy([-0.5, eo_width-0.5, -0.5, eo_height - 0.5]) setlimsxy([-0.5, eo_width-0.5, -0.5, eo_height - 0.5])
...@@ -282,28 +310,28 @@ for mode in modes: # ['train']: ...@@ -282,28 +310,28 @@ for mode in modes: # ['train']:
plt.colorbar(orientation='vertical') # location='bottom') plt.colorbar(orientation='vertical') # location='bottom')
''' '''
ax_gtd=plt.subplot(321) ax_gtd=plt.subplot(423)
ax_gtd.set_title("Ground truth disparity map") ax_gtd.set_title("Ground truth disparity map")
plt.imshow(data[...,qsf.GT_DISP], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp) plt.imshow(data[...,qsf.GT_DISP], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp)
setlimsxy(lim_xy) setlimsxy(lim_xy)
cross_out(plt, cross_out_mask) cross_out(plt, cross_out_mask)
plt.colorbar(orientation='vertical') # location='bottom') plt.colorbar(orientation='vertical') # location='bottom')
ax_hed=plt.subplot(323) ax_hed=plt.subplot(425)
ax_hed.set_title("Heuristic disparity map") ax_hed.set_title("Heuristic disparity map")
plt.imshow(data[...,qsf.HEUR_NAN], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp) plt.imshow(data[...,qsf.HEUR_NAN], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp)
setlimsxy(lim_xy) setlimsxy(lim_xy)
cross_out(plt, cross_out_mask) cross_out(plt, cross_out_mask)
plt.colorbar(orientation='vertical') # location='bottom') plt.colorbar(orientation='vertical') # location='bottom')
ax_nnd=plt.subplot(325) ax_nnd=plt.subplot(427)
ax_nnd.set_title("Network disparity output") ax_nnd.set_title("Network disparity output")
plt.imshow(data[...,qsf.NN_NAN], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp) plt.imshow(data[...,qsf.NN_NAN], vmin=lim_val[0], vmax=lim_val[1], cmap=cmap_disp)
setlimsxy(lim_xy) setlimsxy(lim_xy)
cross_out(plt, cross_out_mask) cross_out(plt, cross_out_mask)
plt.colorbar(orientation='vertical') # location='bottom') plt.colorbar(orientation='vertical') # location='bottom')
ax_hee=plt.subplot(324) ax_hee=plt.subplot(426)
ax_hee.set_title("Heuristic disparity error") ax_hee.set_title("Heuristic disparity error")
cross_out(plt, cross_out_mask) cross_out(plt, cross_out_mask)
plt.imshow(data[...,qsf.HEUR_DIFF], vmin=-ERR_AMPL, vmax=ERR_AMPL, cmap=cmap_diff) plt.imshow(data[...,qsf.HEUR_DIFF], vmin=-ERR_AMPL, vmax=ERR_AMPL, cmap=cmap_diff)
...@@ -311,7 +339,7 @@ for mode in modes: # ['train']: ...@@ -311,7 +339,7 @@ for mode in modes: # ['train']:
cross_out(plt, cross_out_mask) cross_out(plt, cross_out_mask)
plt.colorbar(orientation='vertical') # location='bottom') plt.colorbar(orientation='vertical') # location='bottom')
ax_nne=plt.subplot(326) ax_nne=plt.subplot(428)
ax_nne.set_title("Network disparity error") ax_nne.set_title("Network disparity error")
plt.imshow(data[...,qsf.NN_DIFF], vmin=-ERR_AMPL, vmax=ERR_AMPL, cmap=cmap_diff) plt.imshow(data[...,qsf.NN_DIFF], vmin=-ERR_AMPL, vmax=ERR_AMPL, cmap=cmap_diff)
setlimsxy(lim_xy) setlimsxy(lim_xy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment