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
13185ad8
Commit
13185ad8
authored
Aug 04, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented read/write methods for BriefDescriptorExtractor class
parent
28732d43
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
19 deletions
+33
-19
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+3
-0
brief.cpp
modules/features2d/src/brief.cpp
+25
-0
BRIEFDescriptorExtractorTest.java
.../opencv/test/features2d/BRIEFDescriptorExtractorTest.java
+4
-12
SURFDescriptorExtractorTest.java
...g/opencv/test/features2d/SURFDescriptorExtractorTest.java
+1
-7
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
13185ad8
...
...
@@ -2052,6 +2052,9 @@ public:
// bytes is a length of descriptor in bytes. It can be equal 16, 32 or 64 bytes.
BriefDescriptorExtractor
(
int
bytes
=
32
);
virtual
void
read
(
const
FileNode
&
);
virtual
void
write
(
FileStorage
&
)
const
;
virtual
int
descriptorSize
()
const
;
virtual
int
descriptorType
()
const
;
...
...
modules/features2d/src/brief.cpp
View file @
13185ad8
...
...
@@ -188,6 +188,31 @@ int BriefDescriptorExtractor::descriptorType() const
return
CV_8UC1
;
}
void
BriefDescriptorExtractor
::
read
(
const
FileNode
&
fn
)
{
int
descriptorSize
=
fn
[
"descriptorSize"
];
switch
(
descriptorSize
)
{
case
16
:
test_fn_
=
pixelTests16
;
break
;
case
32
:
test_fn_
=
pixelTests32
;
break
;
case
64
:
test_fn_
=
pixelTests64
;
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"descriptorSize must be 16, 32, or 64"
);
}
bytes_
=
descriptorSize
;
}
void
BriefDescriptorExtractor
::
write
(
FileStorage
&
fs
)
const
{
fs
<<
"descriptorSize"
<<
bytes_
;
}
void
BriefDescriptorExtractor
::
computeImpl
(
const
Mat
&
image
,
std
::
vector
<
KeyPoint
>&
keypoints
,
Mat
&
descriptors
)
const
{
// Construct integral image for fast smoothing (box filter)
...
...
modules/java/android_test/src/org/opencv/test/features2d/BRIEFDescriptorExtractorTest.java
View file @
13185ad8
...
...
@@ -69,27 +69,20 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
}
public
void
testRead
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asList
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filename
,
"%YAML:1.0\n
nOctaves: 4\nnOctaveLayers: 2\nextended: 1\nupright: 0
\n"
);
writeFile
(
filename
,
"%YAML:1.0\n
descriptorSize: 64
\n"
);
extractor
.
read
(
filename
);
extractor
.
compute
(
img
,
keypoints
,
descriptors
);
assertEquals
(
128
,
descriptors
.
cols
());
assertEquals
(
64
,
extractor
.
descriptorSize
());
}
public
void
testWrite
()
{
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"xml"
);
extractor
.
write
(
filename
);
//OpenCVTestRunner.Log("!!!!!!!" + readFile(filename));
String
truth
=
"<?xml version=\"1.0\"?>\n<opencv_storage>
!!!!
\n</opencv_storage>\n"
;
String
truth
=
"<?xml version=\"1.0\"?>\n<opencv_storage>
\n<descriptorSize>32</descriptorSize>
\n</opencv_storage>\n"
;
assertEquals
(
truth
,
readFile
(
filename
));
}
...
...
@@ -97,9 +90,8 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
extractor
.
write
(
filename
);
//OpenCVTestRunner.Log("!!!!!!!" + readFile(filename));
String
truth
=
"%YAML:1.0\n
!!!
"
;
String
truth
=
"%YAML:1.0\n
descriptorSize: 32\n
"
;
assertEquals
(
truth
,
readFile
(
filename
));
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
View file @
13185ad8
...
...
@@ -72,18 +72,12 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
}
public
void
testRead
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asList
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filename
,
"%YAML:1.0\nnOctaves: 4\nnOctaveLayers: 2\nextended: 1\nupright: 0\n"
);
extractor
.
read
(
filename
);
extractor
.
compute
(
img
,
keypoints
,
descriptors
);
assertEquals
(
128
,
descriptors
.
cols
());
assertEquals
(
128
,
extractor
.
descriptorSize
());
}
public
void
testWrite
()
{
...
...
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