In [28]:
import numpy as np
import cv2 as cv
import Queue

In [2]:
def readImage(self, fileName, key):
    success = False
    msg = 'No Image Available'

    #########################################
    ## PLACE YOUR CODE BETWEEN THESE LINES ##
    #########################################

    try:
        self._images[key] = cv.imread(fileName, -1)
        if self._images[key] is not None:
            success = True
        else:
            msg = 'Wrong file ' + fileName
    except IOError:
        msg = "can\'t read file: " + fileName

    #########################################
    return success, msg

def imshow(img):
    cv.imshow('image', img)
    cv.waitKey(0)
    cv.destroyAllWindows()

In [3]:
source = cv.imread('./test_images/input-color.jpg', -1)
alpha = cv.imread('./test_images/input-alpha.bmp', -1)
filled = np.uint8(alpha > 0)*255
inpainted = source.copy()

In [4]:
for i in range(0,3):
    inpainted[:,:,i] *= (filled > 0)

In [5]:
unfilled = np.uint8(filled == 0)

In [6]:
_, boundaries, _ = cv.findContours(unfilled, cv.RETR_LIST, cv.CHAIN_APPROX_NONE)

In [7]:
confidence = (filled > 0) * 255.0

In [8]:
channels = 1

In [9]:
w = 10

In [10]:
validRows = source.shape[0]-2*w

In [11]:
validCols = source.shape[1]-2*w

In [12]:
rowVec = np.arange(-w,w+1)[:,None]

In [13]:
rowIndices = np.dot(rowVec, np.ones((1, 21), dtype=np.int32))

In [14]:
rowIndicesVec = rowIndices.reshape((1,-1))

In [15]:
colVec = np.arange(-w,w+1)[None,:]

In [16]:
colIndices = np.dot(np.ones((colVec.size,1),dtype=np.int32),colVec)

In [17]:
colIndicesVec = colIndices.reshape((1,-1))

In [18]:
_patches = np.zeros((rowIndices.size, validRows*validCols, channels), dtype=np.uint8)

In [19]:
_rindices = np.dot(np.arange(w,validRows+w)[:,None],np.ones((1,validCols), dtype=np.int32)).reshape((1,-1))

In [ ]:


In [22]:
fillFront = np.zeros_like(filled, dtype=np.uint8)

In [25]:
fillFront = cv.drawContours(fillFront, boundaries, -1, 255)

In [27]:
imshow(fillFront)

In [29]:
_deltaOmegapyt = Queue.PriorityQueue()

In [30]:
_deltaOmegapyt


Out[30]:
<Queue.PriorityQueue instance at 0x0000000002E9D108>

In [39]:
np.array(boundaries).shape


Out[39]:
(1L, 737L, 1L, 2L)

In [ ]: