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
85ef02bc
Commit
85ef02bc
authored
Jan 18, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8023 from sovrasov:fs_add_full_yml_type_heading
parents
474e5f4c
896c34fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
persistence.cpp
modules/core/src/persistence.cpp
+20
-0
test_io.cpp
modules/core/test/test_io.cpp
+17
-0
No files found.
modules/core/src/persistence.cpp
View file @
85ef02bc
...
...
@@ -1475,6 +1475,26 @@ icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
ptr
++
;
value_type
|=
CV_NODE_USER
;
}
if
(
d
==
'<'
)
//support of full type heading from YAML 1.2
{
const
char
*
yamlTypeHeading
=
"<tag:yaml.org,2002:"
;
const
size_t
headingLenght
=
strlen
(
yamlTypeHeading
);
char
*
typeEndPtr
=
++
ptr
;
do
d
=
*++
typeEndPtr
;
while
(
cv_isprint
(
d
)
&&
d
!=
' '
&&
d
!=
'>'
);
if
(
d
==
'>'
&&
(
size_t
)(
typeEndPtr
-
ptr
)
>
headingLenght
)
{
if
(
memcmp
(
ptr
,
yamlTypeHeading
,
headingLenght
)
==
0
)
{
value_type
|=
CV_NODE_USER
;
*
typeEndPtr
=
' '
;
ptr
+=
headingLenght
-
1
;
}
}
}
endptr
=
ptr
++
;
do
d
=
*++
endptr
;
...
...
modules/core/test/test_io.cpp
View file @
85ef02bc
...
...
@@ -996,3 +996,20 @@ TEST(Core_InputOutput, filestorage_vec_vec_io)
remove
((
fileName
+
formats
[
i
]).
c_str
());
}
}
TEST
(
Core_InputOutput
,
filestorage_yaml_advanvced_type_heading
)
{
String
content
=
"%YAML:1.0
\n
cameraMatrix: !<tag:yaml.org,2002:opencv-matrix>
\n
"
" rows: 1
\n
"
" cols: 1
\n
"
" dt: d
\n
"
" data: [ 1. ]"
;
cv
::
FileStorage
fs
(
content
,
cv
::
FileStorage
::
READ
|
cv
::
FileStorage
::
MEMORY
);
cv
::
Mat
inputMatrix
;
cv
::
Mat
actualMatrix
=
cv
::
Mat
::
eye
(
1
,
1
,
CV_64F
);
fs
[
"cameraMatrix"
]
>>
inputMatrix
;
ASSERT_EQ
(
cv
::
norm
(
inputMatrix
,
actualMatrix
,
NORM_INF
),
0.
);
}
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