In [1]:
GPU_NUMBER = 3
root = '/data/vision/torralba/health-habits/other/enes/'

%matplotlib inline
import matplotlib.pyplot as plt

import os
import sys
import random
import json
import math
sys.path.append( root + 'Utils/')

import pandas as pd
import numpy as np
import tensorflow as tf

from PIL import Image
from IPython.display import display
from pprint import pprint
from notebook_utils import *
from skimage import color, io

os.environ['CUDA_VISIBLE_DEVICES'] = str(GPU_NUMBER);

In [82]:
quantized = {}
s = 220 / 23.
m = 0

for i in range(len(u)):
  for k in range(u[i][0], 23-u[i][1]):
    
    quantized[m] = (s*k + s/2. - 110., -s*i - s/2. + 110.)
    m += 1

print len(quantized)


313

In [85]:
with open('quantized_colors.json', 'w') as f:
  json.dump(quantized, f)

In [2]:
img = Image.open('/afs/csail.mit.edu/u/k/kocabey/Desktop/messi.jpg')

In [16]:
img = io.imread('/afs/csail.mit.edu/u/k/kocabey/Desktop/messi.jpg')

In [17]:
img = color.rgb2lab(img)

In [18]:
img = color.lab2rgb(img)

In [19]:
img *= 255
display(Image.fromarray(img.astype(np.uint8)))



In [ ]: