In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

In [2]:
PATH = 'lilacsat1-data/'

In [3]:
yy = np.fromfile(PATH + '654_dk3wn.jpg', dtype='uint8')[:0x3b72]
y = np.fromfile(PATH + '654.jpg', dtype='uint8')[:0x3b72]
x = np.fromfile(PATH + '654_dk3wn_2.jpg', dtype='uint8')[:0x3b72]

In [4]:
plt.imshow((x==0)[:x.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[4]:
<matplotlib.image.AxesImage at 0x7fa7edab5908>

In [5]:
plt.imshow((yy==0)[:yy.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[5]:
<matplotlib.image.AxesImage at 0x7fa7ed9cf400>

In [6]:
missing = np.all((x==0)[:x.size//64*64].reshape((-1,64)), axis=1)

In [7]:
plt.imshow((y==0)[:y.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[7]:
<matplotlib.image.AxesImage at 0x7fa7ed9aceb8>

In [8]:
z = x.copy()
z[:z.size//64*64].reshape((-1,64))[missing,:] = y[:y.size//64*64].reshape((-1,64))[missing,:]

In [9]:
missing = np.all((z==0)[:z.size//64*64].reshape((-1,64)), axis=1)
z[:z.size//64*64].reshape((-1,64))[missing,:] = yy[:yy.size//64*64].reshape((-1,64))[missing,:]

In [10]:
plt.imshow((z==0)[:z.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[10]:
<matplotlib.image.AxesImage at 0x7fa7ed90e080>

In [11]:
z.tofile(PATH + '654_fixed.jpg')

In [12]:
x = np.fromfile(PATH + '653.jpg', dtype='uint8')[:0x4324]
y = np.fromfile(PATH + '653_dk3wn.jpg', dtype='uint8')[:0x4324]
yy = np.fromfile(PATH + '653_2.jpg', dtype='uint8')[:0x4324]

In [13]:
plt.imshow((x==0)[:x.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[13]:
<matplotlib.image.AxesImage at 0x7fa7eee44128>

In [14]:
missing = np.all((x==0)[:x.size//64*64].reshape((-1,64)), axis=1)

In [15]:
plt.imshow((y==0)[:y.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[15]:
<matplotlib.image.AxesImage at 0x7fa7eee1e668>

In [16]:
z = x.copy()
z[:z.size//64*64].reshape((-1,64))[missing,:] = y[:y.size//64*64].reshape((-1,64))[missing,:]


/usr/lib64/python3.6/site-packages/ipykernel_launcher.py:2: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 206 but corresponding boolean dimension is 268
  

In [17]:
plt.imshow((z==0)[:z.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[17]:
<matplotlib.image.AxesImage at 0x7fa7eed81a58>

In [18]:
plt.imshow((yy==0)[:yy.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[18]:
<matplotlib.image.AxesImage at 0x7fa7eed65160>

In [19]:
missing = np.all((z==0)[:z.size//64*64].reshape((-1,64)), axis=1)
z[:z.size//64*64].reshape((-1,64))[missing,:] = yy[:yy.size//64*64].reshape((-1,64))[missing,:]

In [20]:
plt.imshow((z==0)[:z.size//64*64].reshape((-1,64)), aspect = 0.2)


Out[20]:
<matplotlib.image.AxesImage at 0x7fa7eecc0518>

In [21]:
plt.imshow((z!=yy)[:z.size//64*64].reshape((-1,64))[105:140,:], aspect = 1)


Out[21]:
<matplotlib.image.AxesImage at 0x7fa7eec96b00>

In [22]:
z[:z.size//64*64].reshape((-1,64))[105:107,:] = y[:y.size//64*64].reshape((-1,64))[105:107,:]
z[:z.size//64*64].reshape((-1,64))[129,:] = yy[:y.size//64*64].reshape((-1,64))[129,:]

In [23]:
plt.imshow((z!=yy)[:z.size//64*64].reshape((-1,64))[129:135,:], aspect = 1)


Out[23]:
<matplotlib.image.AxesImage at 0x7fa7eebfa518>

In [24]:
z.tofile(PATH + '653_fixed.jpg')