Skip to content

Commit 0acd5de

Browse files
committed
updated docstrings
1 parent 290e627 commit 0acd5de

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed
Binary file not shown.
Binary file not shown.

pyaesthetics/analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
77
Created on Mon Apr 16 22:40:46 2018
8-
Last edited on Fri Aug 2 09:53:57 2024
8+
Last edited on Fri Sep 13 16:30:00 2024
99
1010
@author: Giulio Gabrieli ([email protected])
1111
"""

pyaesthetics/selfsimilarity.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Frontiers in Psychology, 4, 808.
88
99
Created on Sat Aug 3 11:34:57 2024
10-
Last edited on Sat Aug 3 14:09:43 2024
10+
Last edited on Fri Sep 13 16:30:43 2024
1111
1212
@author: Giulio Gabrieli ([email protected])
1313
"""
@@ -69,11 +69,17 @@ def calculate_hog(image, orientations=16, pixels_per_cell=(16, 16), cells_per_bl
6969
Calculate the Histogram of Oriented Gradients (HOG) for a given image.
7070
7171
:param image: Input image.
72+
:type image: numpy.ndarray
7273
:param orientations: Number of orientation bins.
74+
:type orientation: int
7375
:param pixels_per_cell: Size (in pixels) of a cell.
76+
:type pixels_per_cell: tuple
7477
:param cells_per_block: Number of cells in each block.
78+
type cells_per_block: tuple
7579
:param visualize: Whether to return an image of the HOG.
80+
:type visualize: bool
7681
:return: HOG feature vector and HOG image (if visualize is True).
82+
:rtype: numpy.ndarray
7783
"""
7884
hog_features, hog_image = hog(image, orientations=orientations, pixels_per_cell=pixels_per_cell,
7985
cells_per_block=cells_per_block, visualize=visualize, block_norm='L2-Hys')
@@ -84,8 +90,11 @@ def bin_hog_features(hog_features, n_bins):
8490
Bin the HOG features into n bins.
8591
8692
:param hog_features: HOG feature vector.
93+
:type hog_features: numpy.ndarray
8794
:param n_bins: Number of bins.
95+
:type n_bins: int
8896
:return: Binned HOG feature vector.
97+
:rtype: numpy.ndarray
8998
"""
9099
# Calculate the size of each bin
91100
bin_size = len(hog_features) // n_bins
@@ -103,7 +112,9 @@ def plot_hog_histogram(binned_hog_features, n_bins):
103112
Plot the histogram of the binned HOG features.
104113
105114
:param binned_hog_features: Binned HOG feature vector.
115+
:type hog_features: numpy.ndarray
106116
:param n_bins: Number of bins.
117+
:type n_bins: int
107118
"""
108119
plt.figure(figsize=(10, 6))
109120
plt.bar(range(n_bins), binned_hog_features, align='center', alpha=0.7)
@@ -112,13 +123,16 @@ def plot_hog_histogram(binned_hog_features, n_bins):
112123
plt.title('Histogram of Oriented Gradients (HOG) with 16 Bins')
113124
plt.show()
114125

115-
def get_self_similarity(image, methods=['ground', 'parent', 'neighbors', 'anisotropy']):
126+
def get_self_similarity(image, methods=['ground', 'parent', 'neighbors', 'anisotropy'], resize=True, newsize = (512, 512)):
116127
"""
117128
Calculate the self-similarity and anisotropy of an image using HOG features.
118129
119130
:param image: Input image.
131+
:type image: numpy.ndarray
120132
:param methods: List of methods to calculate self-similarity. Options are 'ground', 'parent', 'neighbors', 'anisotropy'.
133+
:type methods: list
121134
:return: Dictionary of self-similarity measures.
135+
:rtype: dict
122136
"""
123137
results = {}
124138

0 commit comments

Comments
 (0)