def batchResults(data_names, data_ids, batch_func, batch_name): for data_name in data_names: print("%s: %s" % (batch_name, data_name)) for data_id in data_ids: print("Data ID: %s" % data_id) image_file = dataFile(data_name, data_id) batch_func(image_file)
def createMultiImagePixels(data_name, data_ids): rgb_pixels = [] num_cols = 3 num_rows = (len(data_ids) + 2) / num_cols fig = plt.figure(figsize=(10, 7)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95, wspace=0.1, hspace=0.1) font_size = 15 plot_id = 1 for data_id in data_ids: image_file = dataFile(data_name, data_id) image = loadRGB(image_file) rgb_pixels.extend(ColorPixels(image).rgb()) fig.add_subplot(num_rows, num_cols, plot_id) plt.imshow(image) plt.axis("off") plot_id += 1 rgb_pixels = np.array(rgb_pixels) multi_image = np.array(rgb_pixels).reshape(1, -1, 3) multi_tile = figure2numpy(fig) return multi_image, multi_tile
def batchResults(data_names, data_ids, batch_func, batch_name): for data_name in data_names: print "%s: %s" % (batch_name, data_name) for data_id in data_ids: print "Data ID: %s" % data_id image_file = dataFile(data_name, data_id) batch_func(image_file)
def createMultiImagePixels(data_name, data_ids): rgb_pixels = [] num_cols = 3 num_rows = (len(data_ids) + 2) / num_cols fig = plt.figure(figsize=(10, 7)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95, wspace=0.1, hspace=0.1) font_size = 15 plot_id = 1 for data_id in data_ids: image_file = dataFile(data_name, data_id) image = loadRGB(image_file) rgb_pixels.extend(ColorPixels(image).rgb()) fig.add_subplot(num_rows, num_cols, plot_id) plt.imshow(image) plt.axis('off') plot_id += 1 rgb_pixels = np.array(rgb_pixels) multi_image = np.array(rgb_pixels).reshape(1, -1, 3) multi_tile = figure2numpy(fig) return multi_image, multi_tile
# -*- coding: utf-8 -*- # # @package color_histogram.examples.hist_1d # # Minimal example of 1D color histograms. # @author tody # @date 2015/08/29 from color_histogram.io_util.image import loadRGB from color_histogram.core.hist_1d import Hist1D import matplotlib.pyplot as plt from color_histogram.datasets.datasets import dataFile image_file = dataFile("flower", 0) # Load image. image = loadRGB(image_file) # 16 bins, Lab color space, target channel L ('Lab'[0]) hist1D = Hist1D(image, num_bins=16, color_space='Lab', channel=0) fig = plt.figure() ax = fig.add_subplot(111) hist1D.plot(ax) plt.show()
from color_histogram.io_util.image import loadRGB from color_histogram.core.hist_1d import Hist1D import matplotlib.pyplot as plt from color_histogram.datasets.datasets import dataFile image_file = dataFile("messi", 0) image = loadRGB(C:/Users/penak/Music/messi.jpg') hist1D = Hist1D(image, num_bins=16, color_space='Lab', channel=0) fig = plt.figure() ax = fig.add_subplot(111) hist1D.plot(ax) plt.show()