def get_features(self, img, cell_size): hog_feature = extract_hog_feature(img.astype(np.uint8), cell_size) #resized_img=cv2.resize(img,(hog_feature.shape[1],hog_feature.shape[0]),cv2.INTER_CUBIC).astype(np.uint8) #cn_feature=extract_cn_feature(resized_img,1) cn_feature = extract_cn_feature(img, cell_size) return np.concatenate((hog_feature, cn_feature), axis=2)
def get_sub_window(self, im, pos, sz): patch = cv2.getRectSubPix(im, patchSize=sz, center=pos).astype(np.uint8) feature = extract_cn_feature(patch, cell_size=1) #这里用查表,提取cn特征 return feature