def gera_GABOR_GLCM_LPB_features(sujeito): lstImagens = input.load_image('./Publication_Dataset/' + sujeito + '/TIFFs/8bitTIFFs/') volumeFeatures = [] for imagem in lstImagens: frame_denoise = input.apply_filter(imagem, 'anisotropic') bdValue, new = flatten.flat_image(frame_denoise) crop = cropping.croppy_mona(new, bdValue) image_features = [] image_features += features_extraction.apply_gabor(crop).tolist() crop2 = crop.astype(int) image_features += features_extraction.apply_glcm(crop2) image_features += features_extraction.apply_lbp(crop).tolist() volumeFeatures += image_features # features_extraction.apply_sift(crop) # lstSIFTFeatures.append(features_extraction.apply_sift(crop)) print('gabor', len(volumeFeatures)) # dictionary = features_extraction.apply_BOW(lstSIFTFeatures) fileObject = open('./gabor_glcm_lbp_repLine/' + sujeito, 'wb') if (fileObject != None): print('salvando...') pickle.dump(volumeFeatures, fileObject) fileObject.close
def testarEnquadramento(): lstImagens = input.load_image( './Publication_Dataset/AMD6/TIFFs/8bitTIFFs/') for imagem in lstImagens: # frame_gauss = input.apply_filter(imagem,'gauss') frame_dif = input.apply_filter(imagem, 'anisotropic') bdValue, new = flatten.flat_image(frame_dif) crop = cropping.croppy_mona(new, bdValue)
def extractFeatures(sujeito): lstImagens = input.load_image('./base_interpol/' + sujeito) lstGeoFeatures = [] for imagem in lstImagens: imagem = np.asarray(imagem) frame_denoise = input.apply_filter(imagem, 'anisotropic') bdValue, new = flatten.flat_image(frame_denoise) crop = cropping.croppy_mona(new, bdValue) lstGeoFeatures.append(geo.run((crop), [crop.shape[0], crop.shape[1]])) print('geo', len(lstGeoFeatures), len(lstGeoFeatures[0])) # dictionary = features_extraction.apply_BOW(lstSIFTFeatures) fileObject = open('./geo_features/' + sujeito, 'wb') if (fileObject != None): print('salvando...') pickle.dump(lstGeoFeatures, fileObject) fileObject.close
def geraGABORFeatures(sujeito): lstImagens = input.load_image('./Publication_Dataset/' + sujeito + '/TIFFs/8bitTIFFs/') lstGABORFeatures = [] for imagem in lstImagens: frame_denoise = input.apply_filter(imagem, 'anisotropic') bdValue, new = flatten.flat_image(frame_denoise) crop = cropping.croppy_mona(new, bdValue) lstGABORFeatures.append(features_extraction.apply_gabor(crop).tolist()) # features_extraction.apply_sift(crop) # lstSIFTFeatures.append(features_extraction.apply_sift(crop)) print('gabor', len(lstGABORFeatures), len(lstGABORFeatures[0])) # dictionary = features_extraction.apply_BOW(lstSIFTFeatures) fileObject = open('./gabor_features/' + sujeito, 'wb') if (fileObject != None): print('salvando...') pickle.dump(lstGABORFeatures, fileObject) fileObject.close
print('tam:', len(volumeInLine)) featuresGeo.append(volumeInLine) vetLabelsGeo.append(getClass(vol)) print('Gerando arff file for glcm', len(vetLabelsGeo), len(featuresGeo)) arffGenerator.createArffFile('./geo_features/GEODATASET', featuresGeo, vetLabelsGeo, 'DME,NORMAL', len(featuresGeo[0])) # getBaseFeatures() # extractFeatures("DME7") # loadFeatures() # import math lstImagens = input.load_image('./base_interpol/DME7') imagem = lstImagens[2] # print lstImagens[3][79][1] # print lstImagens[3][76][0] # map(lambda x: x if x<255 else 0, imagem) imagem = np.asarray(imagem) frame_denoise = input.apply_filter(imagem, 'anisotropic') bdValue, new = flatten.flat_image(frame_denoise) crop = cropping.croppy_mona(new, bdValue) plt.figure() plt.subplot(121) plt.imshow(crop, 'gray') plt.show()