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
a28f5a89
Commit
a28f5a89
authored
Jan 10, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move preprocessor to objdetect
parent
8672ae58
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
67 deletions
+71
-67
fpool.cpp
apps/sft/fpool.cpp
+1
-0
fpool.hpp
apps/sft/include/sft/fpool.hpp
+2
-66
objdetect.hpp
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
+11
-1
icf.cpp
modules/objdetect/src/icf.cpp
+57
-0
No files found.
apps/sft/fpool.cpp
View file @
a28f5a89
...
...
@@ -120,6 +120,7 @@ void sft::ICFFeaturePool::fill(int desired)
if
(
std
::
find
(
pool
.
begin
(),
pool
.
end
(),
f
)
==
pool
.
end
())
{
pool
.
push_back
(
f
);
std
::
cout
<<
f
<<
std
::
endl
;
}
}
}
...
...
apps/sft/include/sft/fpool.hpp
View file @
a28f5a89
...
...
@@ -48,73 +48,9 @@
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/objdetect/objdetect.hpp>
namespace
sft
{
class
Preprocessor
{
public
:
Preprocessor
()
{}
void
apply
(
cv
::
InputArray
_frame
,
cv
::
OutputArray
_integrals
)
const
//const cv::Mat& frame, cv::Mat& integrals
{
CV_Assert
(
_frame
.
type
()
==
CV_8UC3
);
cv
::
Mat
frame
=
_frame
.
getMat
();
cv
::
Mat
&
integrals
=
_integrals
.
getMatRef
();
int
h
=
frame
.
rows
;
int
w
=
frame
.
cols
;
cv
::
Mat
channels
,
gray
;
channels
.
create
(
h
*
BINS
,
w
,
CV_8UC1
);
channels
.
setTo
(
0
);
cvtColor
(
frame
,
gray
,
CV_BGR2GRAY
);
cv
::
Mat
df_dx
,
df_dy
,
mag
,
angle
;
cv
::
Sobel
(
gray
,
df_dx
,
CV_32F
,
1
,
0
);
cv
::
Sobel
(
gray
,
df_dy
,
CV_32F
,
0
,
1
);
cv
::
cartToPolar
(
df_dx
,
df_dy
,
mag
,
angle
,
true
);
mag
*=
(
1.
f
/
(
8
*
sqrt
(
2.
f
)));
cv
::
Mat
nmag
;
mag
.
convertTo
(
nmag
,
CV_8UC1
);
angle
*=
6
/
360.
f
;
for
(
int
y
=
0
;
y
<
h
;
++
y
)
{
uchar
*
magnitude
=
nmag
.
ptr
<
uchar
>
(
y
);
float
*
ang
=
angle
.
ptr
<
float
>
(
y
);
for
(
int
x
=
0
;
x
<
w
;
++
x
)
{
channels
.
ptr
<
uchar
>
(
y
+
(
h
*
(
int
)
ang
[
x
]))[
x
]
=
magnitude
[
x
];
}
}
cv
::
Mat
luv
,
shrunk
;
cv
::
cvtColor
(
frame
,
luv
,
CV_BGR2Luv
);
std
::
vector
<
cv
::
Mat
>
splited
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
splited
.
push_back
(
channels
(
cv
::
Rect
(
0
,
h
*
(
7
+
i
),
w
,
h
)));
split
(
luv
,
splited
);
float
shrinkage
=
static_cast
<
float
>
(
integrals
.
cols
-
1
)
/
channels
.
cols
;
CV_Assert
(
shrinkage
==
0.25
);
cv
::
resize
(
channels
,
shrunk
,
cv
::
Size
(),
shrinkage
,
shrinkage
,
CV_INTER_AREA
);
cv
::
integral
(
shrunk
,
integrals
,
cv
::
noArray
(),
CV_32S
);
}
enum
{
BINS
=
10
};
};
struct
ICF
{
ICF
(
int
x
,
int
y
,
int
w
,
int
h
,
int
ch
)
:
bb
(
cv
::
Rect
(
x
,
y
,
w
,
h
)),
channel
(
ch
)
{}
...
...
@@ -184,7 +120,7 @@ private:
static
const
unsigned
int
seed
=
0
;
Preprocessor
preprocessor
;
cv
::
ICF
Preprocessor
preprocessor
;
enum
{
N_CHANNELS
=
10
};
};
...
...
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
View file @
a28f5a89
...
...
@@ -488,6 +488,16 @@ protected:
Ptr
<
MaskGenerator
>
maskGenerator
;
};
class
CV_EXPORTS_W
ICFPreprocessor
{
public
:
CV_WRAP
ICFPreprocessor
();
CV_WRAP
void
apply
(
cv
::
InputArray
_frame
,
cv
::
OutputArray
_integrals
)
const
;
protected
:
enum
{
BINS
=
10
};
};
// Implementation of soft (stageless) cascaded detector.
class
CV_EXPORTS_W
SCascade
:
public
Algorithm
{
...
...
@@ -560,7 +570,7 @@ public:
virtual
void
detect
(
InputArray
image
,
InputArray
rois
,
std
::
vector
<
Detection
>&
objects
)
const
;
// Param rects is an output array of bounding rectangles for detected objects.
// Param confs is an output array of confidence for detected objects. i-th bounding rectangle corresponds i-th configence.
CV_WRAP
virtual
void
detect
(
InputArray
image
,
InputArray
rois
,
CV_OUT
OutputArray
rects
,
CV_OUT
OutputArray
confs
)
const
;
CV_WRAP
virtual
void
detect
(
InputArray
image
,
InputArray
rois
,
OutputArray
rects
,
OutputArray
confs
)
const
;
private
:
void
detectNoRoi
(
const
Mat
&
image
,
std
::
vector
<
Detection
>&
objects
)
const
;
...
...
modules/objdetect/src/icf.cpp
View file @
a28f5a89
...
...
@@ -42,6 +42,63 @@
#include "precomp.hpp"
cv
::
ICFPreprocessor
::
ICFPreprocessor
()
{}
void
cv
::
ICFPreprocessor
::
apply
(
cv
::
InputArray
_frame
,
cv
::
OutputArray
_integrals
)
const
{
CV_Assert
(
_frame
.
type
()
==
CV_8UC3
);
cv
::
Mat
frame
=
_frame
.
getMat
();
cv
::
Mat
&
integrals
=
_integrals
.
getMatRef
();
int
h
=
frame
.
rows
;
int
w
=
frame
.
cols
;
cv
::
Mat
channels
,
gray
;
channels
.
create
(
h
*
BINS
,
w
,
CV_8UC1
);
channels
.
setTo
(
0
);
cvtColor
(
frame
,
gray
,
CV_BGR2GRAY
);
cv
::
Mat
df_dx
,
df_dy
,
mag
,
angle
;
cv
::
Sobel
(
gray
,
df_dx
,
CV_32F
,
1
,
0
);
cv
::
Sobel
(
gray
,
df_dy
,
CV_32F
,
0
,
1
);
cv
::
cartToPolar
(
df_dx
,
df_dy
,
mag
,
angle
,
true
);
mag
*=
(
1.
f
/
(
8
*
sqrt
(
2.
f
)));
cv
::
Mat
nmag
;
mag
.
convertTo
(
nmag
,
CV_8UC1
);
angle
*=
6
/
360.
f
;
for
(
int
y
=
0
;
y
<
h
;
++
y
)
{
uchar
*
magnitude
=
nmag
.
ptr
<
uchar
>
(
y
);
float
*
ang
=
angle
.
ptr
<
float
>
(
y
);
for
(
int
x
=
0
;
x
<
w
;
++
x
)
{
channels
.
ptr
<
uchar
>
(
y
+
(
h
*
(
int
)
ang
[
x
]))[
x
]
=
magnitude
[
x
];
}
}
cv
::
Mat
luv
,
shrunk
;
cv
::
cvtColor
(
frame
,
luv
,
CV_BGR2Luv
);
std
::
vector
<
cv
::
Mat
>
splited
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
splited
.
push_back
(
channels
(
cv
::
Rect
(
0
,
h
*
(
7
+
i
),
w
,
h
)));
split
(
luv
,
splited
);
float
shrinkage
=
static_cast
<
float
>
(
integrals
.
cols
-
1
)
/
channels
.
cols
;
CV_Assert
(
shrinkage
==
0.25
);
cv
::
resize
(
channels
,
shrunk
,
cv
::
Size
(),
shrinkage
,
shrinkage
,
CV_INTER_AREA
);
cv
::
integral
(
shrunk
,
integrals
,
cv
::
noArray
(),
CV_32S
);
}
cv
::
SCascade
::
Channels
::
Channels
(
int
shr
)
:
shrinkage
(
shr
)
{}
void
cv
::
SCascade
::
Channels
::
appendHogBins
(
const
cv
::
Mat
&
gray
,
std
::
vector
<
cv
::
Mat
>&
integrals
,
int
bins
)
const
...
...
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