-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhog multiple
52 lines (38 loc) · 1.43 KB
/
hog multiple
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
44
45
46
47
48
49
50
51
52
import os
from skimage.io import imread, imshow
from skimage.transform import resize
from skimage.feature import hog
from skimage import exposure
import matplotlib.pyplot as plt
#%matplotlib inline
# folder path
dir_path = r'C:\Users\Hamza\Desktop\dataset46k\0'
count = []
a="\"
# Iterate directory
for path in os.listdir(dir_path)[0:1]:
# check if current path is a file
if os.path.isfile(os.path.join(dir_path, path)):
print(dir_path + a + path)
# for i in count[0:1]:
# print(i)
# # #reading the image
# img = imread("G:\bowl dtst\DSB3\DS\dataset10k\0\" + i + ".jpg")
# imshow(img)
# print(img.shape)
# #resizing image
# resized_img = resize(img, (128,64))
# imshow(resized_img)
# print(resized_img.shape)
# #creating hog features
# fd, hog_image = hog(resized_img, orientations=9, pixels_per_cell=(8, 8),
# cells_per_block=(2, 2), visualize=True, multichannel=False)
# fd.shape
# fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 8), sharex=True, sharey=True)
# ax1.imshow(resized_img, cmap=plt.cm.gray)
# ax1.set_title('Input image')
# # Rescale histogram for better display
# hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 10))
# ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
# ax2.set_title('Histogram of Oriented Gradients')
# plt.show()