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
7919bcef
Commit
7919bcef
authored
Aug 16, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Aug 16, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1277 from NCBee:2.4
parents
e8f85903
230bc03d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
3 deletions
+88
-3
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+52
-0
test_io.cpp
modules/core/test/test_io.cpp
+35
-1
copyMakeBorder_demo.cpp
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
+1
-2
No files found.
modules/core/include/opencv2/core/operations.hpp
View file @
7919bcef
...
@@ -3001,6 +3001,58 @@ static inline void read(const FileNode& node, string& value, const string& defau
...
@@ -3001,6 +3001,58 @@ static inline void read(const FileNode& node, string& value, const string& defau
value
=
!
node
.
node
?
default_value
:
CV_NODE_IS_STRING
(
node
.
node
->
tag
)
?
string
(
node
.
node
->
data
.
str
.
ptr
)
:
string
(
""
);
value
=
!
node
.
node
?
default_value
:
CV_NODE_IS_STRING
(
node
.
node
->
tag
)
?
string
(
node
.
node
->
data
.
str
.
ptr
)
:
string
(
""
);
}
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Point_
<
_Tp
>&
value
,
const
Point_
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
2
?
default_value
:
Point_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]));
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Point3_
<
_Tp
>&
value
,
const
Point3_
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
3
?
default_value
:
Point3_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]),
saturate_cast
<
_Tp
>
(
temp
[
2
]));
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Size_
<
_Tp
>&
value
,
const
Size_
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
2
?
default_value
:
Size_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]));
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Complex
<
_Tp
>&
value
,
const
Complex
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
2
?
default_value
:
Complex
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]));
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Rect_
<
_Tp
>&
value
,
const
Rect_
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
4
?
default_value
:
Rect_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]),
saturate_cast
<
_Tp
>
(
temp
[
2
]),
saturate_cast
<
_Tp
>
(
temp
[
3
]));
}
template
<
typename
_Tp
,
int
cn
>
static
inline
void
read
(
const
FileNode
&
node
,
Vec
<
_Tp
,
cn
>&
value
,
const
Vec
<
_Tp
,
cn
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
cn
?
default_value
:
Vec
<
_Tp
,
cn
>
(
&
temp
[
0
]);
}
template
<
typename
_Tp
>
static
inline
void
read
(
const
FileNode
&
node
,
Scalar_
<
_Tp
>&
value
,
const
Scalar_
<
_Tp
>&
default_value
)
{
vector
<
_Tp
>
temp
;
FileNodeIterator
it
=
node
.
begin
();
it
>>
temp
;
value
=
temp
.
size
()
!=
4
?
default_value
:
Scalar_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
temp
[
0
]),
saturate_cast
<
_Tp
>
(
temp
[
1
]),
saturate_cast
<
_Tp
>
(
temp
[
2
]),
saturate_cast
<
_Tp
>
(
temp
[
3
]));
}
static
inline
void
read
(
const
FileNode
&
node
,
Range
&
value
,
const
Range
&
default_value
)
{
Point2i
temp
(
value
.
start
,
value
.
end
);
const
Point2i
default_temp
=
Point2i
(
default_value
.
start
,
default_value
.
end
);
read
(
node
,
temp
,
default_temp
);
value
.
start
=
temp
.
x
;
value
.
end
=
temp
.
y
;
}
CV_EXPORTS_W
void
read
(
const
FileNode
&
node
,
Mat
&
mat
,
const
Mat
&
default_mat
=
Mat
()
);
CV_EXPORTS_W
void
read
(
const
FileNode
&
node
,
Mat
&
mat
,
const
Mat
&
default_mat
=
Mat
()
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
SparseMat
&
mat
,
const
SparseMat
&
default_mat
=
SparseMat
()
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
SparseMat
&
mat
,
const
SparseMat
&
default_mat
=
SparseMat
()
);
...
...
modules/core/test/test_io.cpp
View file @
7919bcef
...
@@ -390,7 +390,6 @@ protected:
...
@@ -390,7 +390,6 @@ protected:
try
try
{
{
string
fname
=
cv
::
tempfile
(
".xml"
);
string
fname
=
cv
::
tempfile
(
".xml"
);
FileStorage
fs
(
fname
,
FileStorage
::
WRITE
);
vector
<
int
>
mi
,
mi2
,
mi3
,
mi4
;
vector
<
int
>
mi
,
mi2
,
mi3
,
mi4
;
vector
<
Mat
>
mv
,
mv2
,
mv3
,
mv4
;
vector
<
Mat
>
mv
,
mv2
,
mv3
,
mv4
;
Mat
m
(
10
,
9
,
CV_32F
);
Mat
m
(
10
,
9
,
CV_32F
);
...
@@ -398,24 +397,59 @@ protected:
...
@@ -398,24 +397,59 @@ protected:
randu
(
m
,
0
,
1
);
randu
(
m
,
0
,
1
);
mi3
.
push_back
(
5
);
mi3
.
push_back
(
5
);
mv3
.
push_back
(
m
);
mv3
.
push_back
(
m
);
Point_
<
float
>
p1
(
1.1
f
,
2.2
f
),
op1
;
Point3i
p2
(
3
,
4
,
5
),
op2
;
Size
s1
(
6
,
7
),
os1
;
Complex
<
int
>
c1
(
9
,
10
),
oc1
;
Rect
r1
(
11
,
12
,
13
,
14
),
or1
;
Vec
<
int
,
5
>
v1
(
15
,
16
,
17
,
18
,
19
),
ov1
;
Scalar
sc1
(
20.0
,
21.1
,
22.2
,
23.3
),
osc1
;
Range
g1
(
7
,
8
),
og1
;
FileStorage
fs
(
fname
,
FileStorage
::
WRITE
);
fs
<<
"mi"
<<
mi
;
fs
<<
"mi"
<<
mi
;
fs
<<
"mv"
<<
mv
;
fs
<<
"mv"
<<
mv
;
fs
<<
"mi3"
<<
mi3
;
fs
<<
"mi3"
<<
mi3
;
fs
<<
"mv3"
<<
mv3
;
fs
<<
"mv3"
<<
mv3
;
fs
<<
"empty"
<<
empty
;
fs
<<
"empty"
<<
empty
;
fs
<<
"p1"
<<
p1
;
fs
<<
"p2"
<<
p2
;
fs
<<
"s1"
<<
s1
;
fs
<<
"c1"
<<
c1
;
fs
<<
"r1"
<<
r1
;
fs
<<
"v1"
<<
v1
;
fs
<<
"sc1"
<<
sc1
;
fs
<<
"g1"
<<
g1
;
fs
.
release
();
fs
.
release
();
fs
.
open
(
fname
,
FileStorage
::
READ
);
fs
.
open
(
fname
,
FileStorage
::
READ
);
fs
[
"mi"
]
>>
mi2
;
fs
[
"mi"
]
>>
mi2
;
fs
[
"mv"
]
>>
mv2
;
fs
[
"mv"
]
>>
mv2
;
fs
[
"mi3"
]
>>
mi4
;
fs
[
"mi3"
]
>>
mi4
;
fs
[
"mv3"
]
>>
mv4
;
fs
[
"mv3"
]
>>
mv4
;
fs
[
"empty"
]
>>
empty
;
fs
[
"empty"
]
>>
empty
;
fs
[
"p1"
]
>>
op1
;
fs
[
"p2"
]
>>
op2
;
fs
[
"s1"
]
>>
os1
;
fs
[
"c1"
]
>>
oc1
;
fs
[
"r1"
]
>>
or1
;
fs
[
"v1"
]
>>
ov1
;
fs
[
"sc1"
]
>>
osc1
;
fs
[
"g1"
]
>>
og1
;
CV_Assert
(
mi2
.
empty
()
);
CV_Assert
(
mi2
.
empty
()
);
CV_Assert
(
mv2
.
empty
()
);
CV_Assert
(
mv2
.
empty
()
);
CV_Assert
(
norm
(
mi3
,
mi4
,
CV_C
)
==
0
);
CV_Assert
(
norm
(
mi3
,
mi4
,
CV_C
)
==
0
);
CV_Assert
(
mv4
.
size
()
==
1
);
CV_Assert
(
mv4
.
size
()
==
1
);
double
n
=
norm
(
mv3
[
0
],
mv4
[
0
],
CV_C
);
double
n
=
norm
(
mv3
[
0
],
mv4
[
0
],
CV_C
);
CV_Assert
(
n
==
0
);
CV_Assert
(
n
==
0
);
CV_Assert
(
op1
==
p1
);
CV_Assert
(
op2
==
p2
);
CV_Assert
(
os1
==
s1
);
CV_Assert
(
oc1
==
c1
);
CV_Assert
(
or1
==
r1
);
CV_Assert
(
ov1
==
v1
);
CV_Assert
(
osc1
==
sc1
);
CV_Assert
(
og1
==
g1
);
}
}
catch
(...)
catch
(...)
{
{
...
...
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
View file @
7919bcef
...
@@ -15,7 +15,6 @@ using namespace cv;
...
@@ -15,7 +15,6 @@ using namespace cv;
Mat
src
,
dst
;
Mat
src
,
dst
;
int
top
,
bottom
,
left
,
right
;
int
top
,
bottom
,
left
,
right
;
int
borderType
;
int
borderType
;
Scalar
value
;
const
char
*
window_name
=
"copyMakeBorder Demo"
;
const
char
*
window_name
=
"copyMakeBorder Demo"
;
RNG
rng
(
12345
);
RNG
rng
(
12345
);
...
@@ -64,7 +63,7 @@ int main( int, char** argv )
...
@@ -64,7 +63,7 @@ int main( int, char** argv )
else
if
(
(
char
)
c
==
'r'
)
else
if
(
(
char
)
c
==
'r'
)
{
borderType
=
BORDER_REPLICATE
;
}
{
borderType
=
BORDER_REPLICATE
;
}
value
=
Scalar
(
rng
.
uniform
(
0
,
255
),
rng
.
uniform
(
0
,
255
),
rng
.
uniform
(
0
,
255
)
);
Scalar
value
(
rng
.
uniform
(
0
,
255
),
rng
.
uniform
(
0
,
255
),
rng
.
uniform
(
0
,
255
)
);
copyMakeBorder
(
src
,
dst
,
top
,
bottom
,
left
,
right
,
borderType
,
value
);
copyMakeBorder
(
src
,
dst
,
top
,
bottom
,
left
,
right
,
borderType
,
value
);
imshow
(
window_name
,
dst
);
imshow
(
window_name
,
dst
);
...
...
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