Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelfarooqui98 committed May 9, 2019
1 parent bcb88d3 commit 5091674
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 96 deletions.
Binary file added dataset/Nobel/face2 (2).jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dataset/person1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 6 additions & 96 deletions project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,7 @@


trackerTypes = ['BOOSTING', 'MIL', 'KCF','TLD', 'MEDIANFLOW', 'GOTURN', 'MOSSE', 'CSRT']
# def getCroppedImage(faceid, img):
# try:

# rec = faceid #FaceID is class where face recognition model is written.

# if img.ndim < 2:
# print('Unable to crop the image.')
# return (None, -402);

# if img.ndim == 2:
# img = rec.to_rgb(img)
# print('to_rgb data dimension: ', img.ndim)

# x,y,_= img.shape

# if(y>500):
# img = cv2.resize( img, (500, x) )

# x,y,_ = img.shape

# if(x>500):
# img = cv2.resize( img, (y, 500) )

# faces = rec.get_face(img)
# if (len(faces)>1):
# return (None,-400); #Found more than one face. Image field is none.

# maxx = 0.9; bestFace = None

# for f in faces:
# if(f[4]>maxx):
# maxx = f[4]
# bestFace = f


# if( bestFace is not None ):
# croppedImage = rec.get_crops2(bestFace, img)[0]

# return (croppedImage,0);

# return (None,-401);
# except:
# cv2.destroyAllWindows();
# raise;


def createTrackerByName(trackerType):
# Create a tracker based on tracker name
Expand Down Expand Up @@ -181,9 +138,11 @@ def yolo():
if i==0:
print("persons bounding box is: ",bboxes[j])
boxes.append(bboxes[j].copy())
print(boxes[i])
#print(boxes[i])
j=j+1

print(boxes) #all faces

############################temp ###########33
#for index,value in enumerate(boxes):
global itr
Expand All @@ -201,65 +160,16 @@ def yolo():
print("I am a detector phewww !")
print(detector.detect_faces(crop_img))
face_cropped = detector.detect_faces(crop_img)
boxes_face = (face_cropped[0]['box'])
y1 = boxes_face[1]
x1 = boxes_face[0]
h1 = boxes_face[3]
w1 = boxes_face[2]
crop_img_2 = crop_img[y1:y1+h1, x1:x1+w1]
name = 'dataset/' + str("face")+ str(itr) + '.jpg'
cv.imwrite(name,crop_img_2)


if(len(face_cropped)>0):

boxes_face = (face_cropped[0]['box'])
y1 = boxes_face[1]
x1 = boxes_face[0]
h1 = boxes_face[3]
w1 = boxes_face[2]
crop_img_2 = crop_img[y1:y1+h1, x1:x1+w1]
name = 'dataset/' + str("face")+ str(itr) + '.jpg'
#cv.imwrite(name,crop_img_2)

#crop_img_2 = cv2.resize(crop_img_2,(100,100),interpolation=cv2.INTER_AREA)

# Matching probabiity
# images = []
# for img in glob.glob("dataset/face*.jpg"):
#img = cv2.resize(img,(100,100),interpolation=cv2.INTER_AREA)
#Sensitive Part


# rec = faceID()
# print("constructor finished")
# # crop_img_2 = getCroppedImage(rec,crop_img_2) accepts image in np arary

# crop_img_2 = rec.prewhiten2(crop_img_2)

# embeds = rec.getEmbed(crop_img_2)



# for itr, em in enumerate(embeds):
# name = rec.search_img_thorough2(em,data)

# print(name)


# n = cv2.imread(img)
# images.append(n)



#for img in images:
# img = cv2.resize(img,(100,100),interpolation=cv2.INTER_AREA)
#if(np.linalg.norm(img-crop_img_2)>=0.9):
# val = np.linalg.norm(img-crop_img_2)
#print("Amir won",val)




cv.imwrite(name,crop_img_2)


##########################temp done#########33
Expand Down

0 comments on commit 5091674

Please sign in to comment.