def histogram3DResult(image_file, num_bins=32, image=None, tile=None): image_name = os.path.basename(image_file) if image is None: image_name = os.path.basename(image_file) image_name = os.path.splitext(image_name)[0] image = loadRGB(image_file) if tile is None: tile = image fig_w = 10 fig_h = 6 fig = plt.figure(figsize=(fig_w, fig_h)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95, wspace=0.02, hspace=0.2) font_size = 15 fig.suptitle("Hisotogram 3D", fontsize=font_size) h, w = image.shape[:2] fig.add_subplot(231) plt.title("Original Image: %s x %s" % (w, h), fontsize=font_size) plt.imshow(tile) plt.axis('off') color_spaces = ["rgb", "Lab", "hsv"] plot_id = 234 for color_space in color_spaces: ax = fig.add_subplot(plot_id, projection='3d') plotHistogram3D(image, num_bins, color_space, ax) plot_id += 1 result_name = image_name + "_hist3D" result_file = resultFile(result_name) plt.savefig(result_file, transparent=True)
def histogram3DResult(image_file, num_bins=32, image=None, tile=None): image_name = os.path.basename(image_file) if image is None: image_name = os.path.basename(image_file) image_name = os.path.splitext(image_name)[0] image = loadRGB(image_file) if tile is None: tile = image fig_w = 10 fig_h = 6 fig = plt.figure(figsize=(fig_w, fig_h)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95, wspace=0.02, hspace=0.2) font_size = 15 fig.suptitle("Hisotogram 3D", fontsize=font_size) h, w = image.shape[:2] fig.add_subplot(231) plt.title("Original Image: %s x %s" % (w, h), fontsize=font_size) plt.imshow(tile) plt.axis('off') color_spaces = ["rgb", "Lab", "hsv"] plot_id = 234 for color_space in color_spaces: ax = fig.add_subplot(plot_id, projection='3d') plotHistogram3D(image, num_bins, color_space, ax) plot_id += 1 result_name = image_name + "_hist3D" result_file = resultFile(result_name) plt.savefig(result_file, transparent=True)
def histogram1DResult(image_file, num_bins=32, image=None, tile=None): image_name = os.path.basename(image_file) if image is None: image_name = os.path.basename(image_file) image_name = os.path.splitext(image_name)[0] image = loadRGB(image_file) if tile is None: tile = image fig_w = 10 fig_h = 6 fig = plt.figure(figsize=(fig_w, fig_h)) fig.subplots_adjust(left=0.1, bottom=0.1, right=0.9, top=0.95, wspace=0.3, hspace=0.2) font_size = 15 fig.suptitle("Hisotogram 1D", fontsize=font_size) h, w = image.shape[:2] fig.add_subplot(231) plt.title("Original Image: %s x %s" % (w, h), fontsize=font_size) plt.imshow(tile) plt.axis('off') color_targets = [["Lab", 0], ["hsv", 0], ["hsv", 2]] plot_id = 234 for color_target in color_targets: ax = fig.add_subplot(plot_id) color_space, channel = color_target plotHistogram1D(image, num_bins, color_space, channel, ax) plot_id += 1 result_name = image_name + "_hist1D" result_file = resultFile(result_name) plt.savefig(result_file, transparent=True)