GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — FaceTools/retain_max_face.py at master · chenriwei/FaceTools Expand file tree/ Copy pathretain_max_face.pyMore file actions 43 lines (40 loc) · 1.31 KB / Copy pathretain_max_face.pyFile metadata and controls43 lines (40 loc) · 1.31 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 # -*- coding: utf-8 -*- """ Created on Fri May 29 14:17:05 2015 @author: Chenriwei @brief: 用于当一张人脸图像中有张人脸图像的时候,只保留最大的那个。 """ import numpy as np def retain_max_face(line): ''' @param:行内容 @return:返回新的行内容 ''' word=line.split() num_detect=len(word)/4 areas=np.empty((num_detect,),dtype=np.int32)#保留的是图像的面积 for i in range(num_detect): #print int(word[4*i+1]),int(word[4*i+2]),int(word[4*i+3]),int(word[4*i+4]) areas[i]=(int(word[4*i+2])-int(word[4*i+1]))*(int(word[4*i+4])-int(word[4*i+3])) print areas[i] m=np.argmax(areas) newline=word[0]+' '+word[4*m+1]+' '+word[4*m+2]+' '+word[4*m+3]+' '+word[4*m+4]+'\n' return newline def cleanBoxFile(): file0="imageBbox.list" file3="imageBbox_mul_max.list" file0_obj=open(file0,'r') fid3=open(file3,'w') lines=file0_obj.readlines() for line in lines: if line.count(" ")==4: pass else: if line.count(" ")>4:#表明有多个人脸被检测到 newline=retain_max_face(line) fid3.write(newline) file0_obj.close() fid3.close() print 'done!' if __name__ == "__main__" : cleanBoxFile() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |