Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e1955759
Commit
e1955759
authored
Nov 24, 2013
by
Mathieu Barnachon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some warning.
Adding missing credit for a function.
parent
a4ceb7b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
train_HOG.cpp
samples/cpp/train_HOG.cpp
+4
-5
No files found.
samples/cpp/train_HOG.cpp
View file @
e1955759
...
@@ -150,6 +150,7 @@ void sample_neg( const vector< Mat > & full_neg_lst, vector< Mat > & neg_lst, co
...
@@ -150,6 +150,7 @@ void sample_neg( const vector< Mat > & full_neg_lst, vector< Mat > & neg_lst, co
}
}
}
}
// From http://www.juergenwiki.de/work/wiki/doku.php?id=public:hog_descriptor_computation_and_visualization
Mat
get_hogdescriptor_visu
(
Mat
&
color_origImg
,
vector
<
float
>&
descriptorValues
,
const
Size
&
size
)
Mat
get_hogdescriptor_visu
(
Mat
&
color_origImg
,
vector
<
float
>&
descriptorValues
,
const
Size
&
size
)
{
{
const
int
DIMX
=
size
.
width
;
const
int
DIMX
=
size
.
width
;
...
@@ -158,7 +159,6 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
...
@@ -158,7 +159,6 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
Mat
visu
;
Mat
visu
;
resize
(
color_origImg
,
visu
,
Size
(
color_origImg
.
cols
*
zoomFac
,
color_origImg
.
rows
*
zoomFac
));
resize
(
color_origImg
,
visu
,
Size
(
color_origImg
.
cols
*
zoomFac
,
color_origImg
.
rows
*
zoomFac
));
int
blockSize
=
16
;
int
cellSize
=
8
;
int
cellSize
=
8
;
int
gradientBinSize
=
9
;
int
gradientBinSize
=
9
;
float
radRangeForOneBin
=
CV_PI
/
(
float
)
gradientBinSize
;
// dividing 180 into 9 bins, how large (in rad) is one bin?
float
radRangeForOneBin
=
CV_PI
/
(
float
)
gradientBinSize
;
// dividing 180 into 9 bins, how large (in rad) is one bin?
...
@@ -166,7 +166,6 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
...
@@ -166,7 +166,6 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
// prepare data structure: 9 orientation / gradient strenghts for each cell
// prepare data structure: 9 orientation / gradient strenghts for each cell
int
cells_in_x_dir
=
DIMX
/
cellSize
;
int
cells_in_x_dir
=
DIMX
/
cellSize
;
int
cells_in_y_dir
=
DIMY
/
cellSize
;
int
cells_in_y_dir
=
DIMY
/
cellSize
;
int
totalnrofcells
=
cells_in_x_dir
*
cells_in_y_dir
;
float
***
gradientStrengths
=
new
float
**
[
cells_in_y_dir
];
float
***
gradientStrengths
=
new
float
**
[
cells_in_y_dir
];
int
**
cellUpdateCounter
=
new
int
*
[
cells_in_y_dir
];
int
**
cellUpdateCounter
=
new
int
*
[
cells_in_y_dir
];
for
(
int
y
=
0
;
y
<
cells_in_y_dir
;
y
++
)
for
(
int
y
=
0
;
y
<
cells_in_y_dir
;
y
++
)
...
@@ -201,8 +200,8 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
...
@@ -201,8 +200,8 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
for
(
int
cellNr
=
0
;
cellNr
<
4
;
cellNr
++
)
for
(
int
cellNr
=
0
;
cellNr
<
4
;
cellNr
++
)
{
{
// compute corresponding cell nr
// compute corresponding cell nr
int
cellx
=
blockx
;
cellx
=
blockx
;
int
celly
=
blocky
;
celly
=
blocky
;
if
(
cellNr
==
1
)
celly
++
;
if
(
cellNr
==
1
)
celly
++
;
if
(
cellNr
==
2
)
cellx
++
;
if
(
cellNr
==
2
)
cellx
++
;
if
(
cellNr
==
3
)
if
(
cellNr
==
3
)
...
@@ -440,7 +439,7 @@ int main( int argc, char** argv )
...
@@ -440,7 +439,7 @@ int main( int argc, char** argv )
load_images
(
argv
[
1
],
argv
[
2
],
pos_lst
);
load_images
(
argv
[
1
],
argv
[
2
],
pos_lst
);
labels
.
assign
(
pos_lst
.
size
(),
+
1
);
labels
.
assign
(
pos_lst
.
size
(),
+
1
);
const
int
old
=
labels
.
size
();
const
unsigned
int
old
=
labels
.
size
();
load_images
(
argv
[
3
],
argv
[
4
],
full_neg_lst
);
load_images
(
argv
[
3
],
argv
[
4
],
full_neg_lst
);
sample_neg
(
full_neg_lst
,
neg_lst
,
Size
(
96
,
160
)
);
sample_neg
(
full_neg_lst
,
neg_lst
,
Size
(
96
,
160
)
);
labels
.
insert
(
labels
.
end
(),
neg_lst
.
size
(),
-
1
);
labels
.
insert
(
labels
.
end
(),
neg_lst
.
size
(),
-
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment