#loading the standard header files
import numpy as np
import pandas as pd
import os
import sys
import cv2
from matplotlib import pyplot as plt
from skimage.feature import hog
#loading the python file
#link->
import image_feature_extraction
def loadFilePaths(image_directory):
files=os.listdir(image_directory)
files_path=[os.path.join(image_directory,file) for file in files ]
return files_path
files_path=loadFilePaths('D://Himani-work/gsoc2020/dataset/ideology_extra200ms/ideology_image_dataset/')
img=cv2.imread(files_path[0])
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(img_gray,cmap="gray")
features=image_feature_extraction.getGrayScaleFeatures(['hims.jpg'])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
features=image_feature_extraction.getGrayScaleFeatures(files_path[0:1])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
features=image_feature_extraction.getCannyFeatures(['hims.jpg'])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
img=cv2.imread('hims.jpg')
width = 164
height = 128
dim = (width, height)
resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
fd, hog_image = hog(resized, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(2, 2), visualize=True,multichannel=True)
plt.imshow(hog_image,cmap="gray")
features=image_feature_extraction.getCannyFeatures(files_path[0:1])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
features=image_feature_extraction.getPrewittyFeatures(files_path[0:1])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
features=image_feature_extraction.getSobelyFeatures(files_path[0:1])
img=features[0].reshape(120,120)
plt.imshow(img,cmap="gray")
img=cv2.imread(files_path[0])
width = 164
height = 128
dim = (width, height)
resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
fd, hog_image = hog(resized, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(2, 2), visualize=True,multichannel=True)
plt.imshow(hog_image,cmap="gray")
img=cv2.imread(files_path[0],0)
fast = cv2.FastFeatureDetector_create()
# find and draw the keypoints
width = 164
height = 128
dim = (width, height)
resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
kp = fast.detect(resized,None)
img2 = cv.drawKeypoints(resized, kp, None, color=(255,0,0))
plt.imshow(img2)
img=cv2.imread('Briefdetector.png')
plt.imshow(img)
img=cv2.imread('orbdetector.png')
plt.imshow(img)