Beispiel #1
0
def convolute(img, kernel):
    output = oc.conv2(img, kernel, 'same')
    # output = cv2.filter2D(img, cv2.CV_64F, kernel)
    #plt.imsave(str(i)+str(j),output, cmap = plt.cm.gray)
    return output / 18
Beispiel #2
0
                        image,
                        scaleFactor = 1.1,
                        minNeighbors = 5,
                        minSize = (30, 30),
                        flags = cv2.cv.CV_HAAR_SCALE_IMAGE
                        )

                #Draw a rectangle around the faces
for (x, y, w, h) in face:
  roi = image[y:y+h, x:x+w]
  roi = cv2.resize(roi,(157,157))

result = []

for k in [kernels]:
  output = oc.conv2(roi,k,'same')
  result.append(output)

print result[0].shape
total = result[0]
np.savez('tempwavelet',result[0].reshape((1,total.shape[0]*total.shape[1])))
'''
total = np.zeros(result[0].shape)
for i in range(18):
  plt1 = plt.gca()
  plt1.axes.get_xaxis().set_ticks([])
  plt1.axes.get_yaxis().set_ticks([])
  plt.subplot(6,3,i+1)
  total += result[i]
  plt.imshow(result[i],'gray')
'''
Beispiel #3
0
face = faceCascade.detectMultiScale(image,
                                    scaleFactor=1.1,
                                    minNeighbors=5,
                                    minSize=(30, 30),
                                    flags=cv2.cv.CV_HAAR_SCALE_IMAGE)

#Draw a rectangle around the faces
for (x, y, w, h) in face:
    roi = image[y:y + h, x:x + w]
    roi = cv2.resize(roi, (157, 157))

result = []

for k in [kernels]:
    output = oc.conv2(roi, k, 'same')
    result.append(output)

print result[0].shape
total = result[0]
np.savez('tempwavelet', result[0].reshape(
    (1, total.shape[0] * total.shape[1])))
'''
total = np.zeros(result[0].shape)
for i in range(18):
  plt1 = plt.gca()
  plt1.axes.get_xaxis().set_ticks([])
  plt1.axes.get_yaxis().set_ticks([])
  plt.subplot(6,3,i+1)
  total += result[i]
  plt.imshow(result[i],'gray')
Beispiel #4
0
def convolute(img,kernel):
  output = oc.conv2(img,kernel,'same')
  # output = cv2.filter2D(img, cv2.CV_64F, kernel)
  #plt.imsave(str(i)+str(j),output, cmap = plt.cm.gray)
  return output/18