Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Painter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Lien
Painter
Commits
c6e13c01
Commit
c6e13c01
authored
3 years ago
by
MichaelK
Browse files
Options
Downloads
Patches
Plain Diff
Update: Added HOG feature extraction with visualization
parent
1183fccc
Branches
Branches containing commit
No related tags found
1 merge request
!2
Merge: Hog feature extraction Added
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Test.m
+21
-3
21 additions, 3 deletions
Test.m
histogramGrayscale.m
+2
-1
2 additions, 1 deletion
histogramGrayscale.m
histogramOrientedGradients.m
+18
-0
18 additions, 0 deletions
histogramOrientedGradients.m
with
41 additions
and
4 deletions
Test.m
+
21
−
3
View file @
c6e13c01
%% Example Title
% Let's use Edvard Munch's - skrik picture
im
age
=
imread
(
"colorHistogram/Edvard_Munch_-_Despair_(1894).jpg"
);
im
g
=
imread
(
"colorHistogram/Edvard_Munch_-_Despair_(1894).jpg"
);
% Let's also display the picture to see how it originally looks
%imshow(image);
%% edgeMap - Test of implementation
edgeImage
=
edgeMap
(
im
age
);
%
edgeImage = edgeMap(im
g
);
imshow
(
edgeImage
);
%
imshow(edgeImage);
%% HOG - Test of implementation
% "hog" contains feature vector based on histogram of oriented gradients
% "visual" contains visualization object that can be used in plot method
[
hog
,
visual
]
=
histogramOrientedGradients
(
img
);
figure
,
imshow
(
img
),
hold
on
,
plot
(
visual
),
title
(
"Hog features of image"
);
% Using Cellsize this time
[
hog2
,
visual2
]
=
histogramOrientedGradients
(
img
,
32
);
figure
,
imshow
(
img
),
hold
on
,
plot
(
visual2
),
title
(
"Hog features using Cellsize"
);
%% Section 2 Title
% Description of second code block
b
=
2
;
This diff is collapsed.
Click to expand it.
histogramGrayscale.m
+
2
−
1
View file @
c6e13c01
%Returns histogram in grayscale
function
[
out
]
=
histogramGrayscale
(
image
)
%image ideally is already grayscaled rbg2gray() if needed
%Converts image into grayscale
image
=
rgb2gray
(
image
);
[
x
,
y
]
=
size
(
image
);
out
=
zeros
(
1
,
255
);
...
...
This diff is collapsed.
Click to expand it.
histogramOrientedGradients.m
0 → 100644
+
18
−
0
View file @
c6e13c01
% Returns histogram of oriented gradients (HOG) feauture vector of an
% image and visualization object that can be used with plot method.
% Useful for training a classifier.
%
% NB! *Requires Computer Vision Toolbox Add-on*
%
function
[
featureVector
,
hogVisualization
]
=
histogramOrientedGradients
(
varargin
)
if
nargin
==
1
img
=
varargin
{
1
};
[
featureVector
,
hogVisualization
]
=
extractHOGFeatures
(
img
);
elseif
nargin
==
2
img
=
varargin
{
1
};
size
=
varargin
{
2
};
[
featureVector
,
hogVisualization
]
=
extractHOGFeatures
(
img
,
"Cellsize"
,[
size
size
]);
else
error
(
'histogramOrientedGradients only accepts up to 2 input arguments!'
)
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment