def gen_layers_for_image(i, img): """ Generate laplacian pyramids and normalize every channel of every pyramid. """ img = resize(img[:, :, :], requested_shape) new_imgs = yuv_laplacian_norm(img, requested_shape, 3) return i, new_imgs
def gen_layers_for_image_hog(i, img): """ Generate laplacian pyramids and normalize every channel of every pyramid of RGB. Calc HOG of depth at every scale. """ img = resize(img[:, :, :], requested_shape) rgb_img = img[:, :, 0:3] depth_img = img[:, :, 3] # transform rgb_imgs = yuv_laplacian_norm(rgb_img, requested_shape, n_layers=3) # depth_img = calc_hog(depth_img) depth_img = depth_img.astype('float32') / 255.0 new_imgs = [] for img in rgb_imgs: shp = (img.shape[1], img.shape[2]) new_img = np.concatenate( (img, resize(depth_img, shp).reshape((1, shp[0], shp[1]))), axis=0) new_imgs.append(new_img) return i, new_imgs
def gen_layers_for_image(i, img): layers = yuv_laplacian_norm(img, requested_shape, n_layers) return i, layers
from dataset.loader_msrc import load_dataset from preprocessing.transform_in import yuv_laplacian_norm from preprocessing.transform_out import process_out # load one sample sample = None l = load_dataset("/home/student/Downloads/MSRC_ObjCategImageDatabase_v2/") print(l) for s in load_dataset("/home/student/Downloads/MSRC_ObjCategImageDatabase_v2/"): print(s) sample = s break shape = (216, 320) # process input image x = yuv_laplacian_norm(s.image, shape) print "x shape", x[0].shape print x pylab.imshow(x[0][0]) pylab.show() # process output image cc = ClassCounter() y = process_out(s.marked_image, cc, shape) print "y shape", y.shape print y pylab.imshow(y) pylab.show()
def gen_layers_for_image(i, img): # 3 layers, lapacian pyramid layers = yuv_laplacian_norm(img, requested_shape, 3) return i, layers
import pylab from preprocessing.class_counter import ClassCounter from dataset.loader_msrc import load_dataset from preprocessing.transform_in import yuv_laplacian_norm from preprocessing.transform_out import process_out # load one sample sample = None for s in load_dataset("/media/Win/Data/MSRC_images"): sample = s break shape = (216, 320) # process input image x = yuv_laplacian_norm(s.image, shape) print "x shape", x[0].shape print x pylab.imshow(x[0][0]) pylab.show() # process output image cc = ClassCounter() y = process_out(s.marked_image, cc, shape) print "y shape", y.shape print y pylab.imshow(y) pylab.show()