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
a702e5b2
Commit
a702e5b2
authored
Jun 02, 2010
by
Ilya Lysenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Storing PCA components and One Way descriptors in one yml file.
parent
08c377cb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
12 deletions
+34
-12
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+28
-6
descriptors.cpp
modules/features2d/src/descriptors.cpp
+4
-6
oneway.cpp
modules/features2d/src/oneway.cpp
+0
-0
one_way_sample.cpp
samples/c/one_way_sample.cpp
+0
-0
one_way_train_images.txt
samples/c/one_way_train_images.txt
+2
-0
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
a702e5b2
...
...
@@ -1024,6 +1024,12 @@ public:
const
char
*
pca_hr_config
=
0
,
const
char
*
pca_desc_config
=
0
,
int
pyr_levels
=
1
,
int
pca_dim_high
=
100
,
int
pca_dim_low
=
100
);
OneWayDescriptorBase
(
CvSize
patch_size
,
int
pose_count
,
const
string
&
pca_filename
,
const
string
&
train_path
=
string
(),
const
string
&
images_list
=
string
(),
int
pyr_levels
=
1
,
int
pca_dim_high
=
100
,
int
pca_dim_low
=
100
);
~
OneWayDescriptorBase
();
// Allocate: allocates memory for a given number of descriptors
...
...
@@ -1111,6 +1117,15 @@ public:
// - filename: output filename
void
SavePCADescriptors
(
const
char
*
filename
);
// SavePCADescriptors: saves PCA descriptors to a file storage
// - fs: output file storage
void
SavePCADescriptors
(
CvFileStorage
*
fs
);
// GeneratePCA: calculate and save PCA components and descriptors
// - img_path: path to training PCA images directory
// - images_list: filename with filenames of training PCA images
void
GeneratePCA
(
const
char
*
img_path
,
const
char
*
images_list
);
// SetPCAHigh: sets the high resolution pca matrices (copied to internal structures)
void
SetPCAHigh
(
CvMat
*
avg
,
CvMat
*
eigenvectors
);
...
...
@@ -1129,6 +1144,8 @@ public:
void
ConvertDescriptorsArrayToTree
();
// Converting pca_descriptors array to KD tree
// GetPCAFilename: get default PCA filename
static
string
GetPCAFilename
()
{
return
"pca.yml"
;
}
protected
:
CvSize
m_patch_size
;
// patch size
...
...
@@ -1151,7 +1168,6 @@ protected:
int
m_pca_dim_low
;
int
m_pyr_levels
;
};
class
CV_EXPORTS
OneWayDescriptorObject
:
public
OneWayDescriptorBase
...
...
@@ -1168,6 +1184,11 @@ public:
OneWayDescriptorObject
(
CvSize
patch_size
,
int
pose_count
,
const
char
*
train_path
,
const
char
*
pca_config
,
const
char
*
pca_hr_config
=
0
,
const
char
*
pca_desc_config
=
0
,
int
pyr_levels
=
1
);
OneWayDescriptorObject
(
CvSize
patch_size
,
int
pose_count
,
const
string
&
pca_filename
,
const
string
&
train_path
=
string
(),
const
string
&
images_list
=
string
(),
int
pyr_levels
=
1
);
~
OneWayDescriptorObject
();
// Allocate: allocates memory for a given number of features
...
...
@@ -1690,19 +1711,20 @@ public:
Params
(
int
_poseCount
=
POSE_COUNT
,
Size
_patchSize
=
Size
(
PATCH_WIDTH
,
PATCH_HEIGHT
),
string
_pcaFilename
=
string
(),
string
_trainPath
=
string
(),
string
_pcaConfig
=
string
(),
string
_pcaHrConfig
=
string
(),
string
_pcaDescConfig
=
string
(),
string
_trainImagesList
=
string
(),
float
_minScale
=
GET_MIN_SCALE
(),
float
_maxScale
=
GET_MAX_SCALE
(),
float
_stepScale
=
GET_STEP_SCALE
()
)
:
poseCount
(
_poseCount
),
patchSize
(
_patchSize
),
trainPath
(
_trainPath
),
pcaConfig
(
_pcaConfig
),
pcaHrConfig
(
_pcaHrConfig
),
pcaDescConfig
(
_pcaDescConfig
),
poseCount
(
_poseCount
),
patchSize
(
_patchSize
),
pcaFilename
(
_pcaFilename
),
trainPath
(
_trainPath
),
trainImagesList
(
_trainImagesList
),
minScale
(
_minScale
),
maxScale
(
_maxScale
),
stepScale
(
_stepScale
)
{}
int
poseCount
;
Size
patchSize
;
string
pcaFilename
;
string
trainPath
;
string
pcaConfig
,
pcaHrConfig
,
pcaDescConfig
;
string
trainImagesList
;
float
minScale
,
maxScale
,
stepScale
;
};
...
...
modules/features2d/src/descriptors.cpp
View file @
a702e5b2
...
...
@@ -203,9 +203,8 @@ void OneWayDescriptorMatch::initialize( const Params& _params)
void
OneWayDescriptorMatch
::
add
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
)
{
if
(
base
.
empty
()
)
base
=
new
OneWayDescriptorObject
(
params
.
patchSize
,
params
.
poseCount
,
params
.
trainPath
.
c_str
(),
params
.
pcaConfig
.
c_str
(),
params
.
pcaHrConfig
.
c_str
(),
params
.
pcaDescConfig
.
c_str
());
base
=
new
OneWayDescriptorObject
(
params
.
patchSize
,
params
.
poseCount
,
params
.
pcaFilename
,
params
.
trainPath
,
params
.
trainImagesList
);
size_t
trainFeatureCount
=
keypoints
.
size
();
...
...
@@ -225,9 +224,8 @@ void OneWayDescriptorMatch::add( const Mat& image, vector<KeyPoint>& keypoints )
void
OneWayDescriptorMatch
::
add
(
KeyPointCollection
&
keypoints
)
{
if
(
base
.
empty
()
)
base
=
new
OneWayDescriptorObject
(
params
.
patchSize
,
params
.
poseCount
,
params
.
trainPath
.
c_str
(),
params
.
pcaConfig
.
c_str
(),
params
.
pcaHrConfig
.
c_str
(),
params
.
pcaDescConfig
.
c_str
());
base
=
new
OneWayDescriptorObject
(
params
.
patchSize
,
params
.
poseCount
,
params
.
pcaFilename
,
params
.
trainPath
,
params
.
trainImagesList
);
size_t
trainFeatureCount
=
keypoints
.
calcKeypointCount
();
...
...
modules/features2d/src/oneway.cpp
View file @
a702e5b2
This diff is collapsed.
Click to expand it.
samples/c/one_way_sample.cpp
View file @
a702e5b2
This diff is collapsed.
Click to expand it.
samples/c/one_way_train_images.txt
0 → 100644
View file @
a702e5b2
one_way_train_0000.jpg
one_way_train_0001.jpg
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