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
11367e2c
Commit
11367e2c
authored
Oct 02, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added GpuMat support to OutputArray
parent
b2bf90e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
23 deletions
+55
-23
core.hpp
modules/core/include/opencv2/core/core.hpp
+26
-23
matrix.cpp
modules/core/src/matrix.cpp
+29
-0
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
11367e2c
...
@@ -1372,6 +1372,7 @@ public:
...
@@ -1372,6 +1372,7 @@ public:
template
<
typename
_Tp
>
_OutputArray
(
Mat_
<
_Tp
>&
m
);
template
<
typename
_Tp
>
_OutputArray
(
Mat_
<
_Tp
>&
m
);
template
<
typename
_Tp
,
int
m
,
int
n
>
_OutputArray
(
Matx
<
_Tp
,
m
,
n
>&
matx
);
template
<
typename
_Tp
,
int
m
,
int
n
>
_OutputArray
(
Matx
<
_Tp
,
m
,
n
>&
matx
);
template
<
typename
_Tp
>
_OutputArray
(
_Tp
*
vec
,
int
n
);
template
<
typename
_Tp
>
_OutputArray
(
_Tp
*
vec
,
int
n
);
_OutputArray
(
gpu
::
GpuMat
&
d_mat
);
_OutputArray
(
const
Mat
&
m
);
_OutputArray
(
const
Mat
&
m
);
template
<
typename
_Tp
>
_OutputArray
(
const
vector
<
_Tp
>&
vec
);
template
<
typename
_Tp
>
_OutputArray
(
const
vector
<
_Tp
>&
vec
);
...
@@ -1381,11 +1382,13 @@ public:
...
@@ -1381,11 +1382,13 @@ public:
template
<
typename
_Tp
>
_OutputArray
(
const
Mat_
<
_Tp
>&
m
);
template
<
typename
_Tp
>
_OutputArray
(
const
Mat_
<
_Tp
>&
m
);
template
<
typename
_Tp
,
int
m
,
int
n
>
_OutputArray
(
const
Matx
<
_Tp
,
m
,
n
>&
matx
);
template
<
typename
_Tp
,
int
m
,
int
n
>
_OutputArray
(
const
Matx
<
_Tp
,
m
,
n
>&
matx
);
template
<
typename
_Tp
>
_OutputArray
(
const
_Tp
*
vec
,
int
n
);
template
<
typename
_Tp
>
_OutputArray
(
const
_Tp
*
vec
,
int
n
);
_OutputArray
(
const
gpu
::
GpuMat
&
d_mat
);
virtual
bool
fixedSize
()
const
;
virtual
bool
fixedSize
()
const
;
virtual
bool
fixedType
()
const
;
virtual
bool
fixedType
()
const
;
virtual
bool
needed
()
const
;
virtual
bool
needed
()
const
;
virtual
Mat
&
getMatRef
(
int
i
=-
1
)
const
;
virtual
Mat
&
getMatRef
(
int
i
=-
1
)
const
;
virtual
gpu
::
GpuMat
&
getGpuMatRef
()
const
;
virtual
void
create
(
Size
sz
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
virtual
void
create
(
Size
sz
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
virtual
void
create
(
int
rows
,
int
cols
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
virtual
void
create
(
int
rows
,
int
cols
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
virtual
void
create
(
int
dims
,
const
int
*
size
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
virtual
void
create
(
int
dims
,
const
int
*
size
,
int
type
,
int
i
=-
1
,
bool
allowTransposed
=
false
,
int
fixedDepthMask
=
0
)
const
;
...
@@ -2257,10 +2260,10 @@ CV_EXPORTS_W bool solve(InputArray src1, InputArray src2,
...
@@ -2257,10 +2260,10 @@ CV_EXPORTS_W bool solve(InputArray src1, InputArray src2,
enum
enum
{
{
SORT_EVERY_ROW
=
0
,
SORT_EVERY_ROW
=
0
,
SORT_EVERY_COLUMN
=
1
,
SORT_EVERY_COLUMN
=
1
,
SORT_ASCENDING
=
0
,
SORT_ASCENDING
=
0
,
SORT_DESCENDING
=
16
SORT_DESCENDING
=
16
};
};
//! sorts independently each matrix row or each matrix column
//! sorts independently each matrix row or each matrix column
...
@@ -2283,12 +2286,12 @@ CV_EXPORTS_W bool eigen(InputArray src, bool computeEigenvectors,
...
@@ -2283,12 +2286,12 @@ CV_EXPORTS_W bool eigen(InputArray src, bool computeEigenvectors,
enum
enum
{
{
COVAR_SCRAMBLED
=
0
,
COVAR_SCRAMBLED
=
0
,
COVAR_NORMAL
=
1
,
COVAR_NORMAL
=
1
,
COVAR_USE_AVG
=
2
,
COVAR_USE_AVG
=
2
,
COVAR_SCALE
=
4
,
COVAR_SCALE
=
4
,
COVAR_ROWS
=
8
,
COVAR_ROWS
=
8
,
COVAR_COLS
=
16
COVAR_COLS
=
16
};
};
//! computes covariation matrix of a set of samples
//! computes covariation matrix of a set of samples
...
@@ -4509,15 +4512,15 @@ template<> struct ParamType<float>
...
@@ -4509,15 +4512,15 @@ template<> struct ParamType<float>
{
{
typedef
float
const_param_type
;
typedef
float
const_param_type
;
typedef
float
member_type
;
typedef
float
member_type
;
enum
{
type
=
Param
::
FLOAT
};
enum
{
type
=
Param
::
FLOAT
};
};
};
template
<>
struct
ParamType
<
unsigned
>
template
<>
struct
ParamType
<
unsigned
>
{
{
typedef
unsigned
const_param_type
;
typedef
unsigned
const_param_type
;
typedef
unsigned
member_type
;
typedef
unsigned
member_type
;
enum
{
type
=
Param
::
UNSIGNED_INT
};
enum
{
type
=
Param
::
UNSIGNED_INT
};
};
};
...
@@ -4525,7 +4528,7 @@ template<> struct ParamType<uint64>
...
@@ -4525,7 +4528,7 @@ template<> struct ParamType<uint64>
{
{
typedef
uint64
const_param_type
;
typedef
uint64
const_param_type
;
typedef
uint64
member_type
;
typedef
uint64
member_type
;
enum
{
type
=
Param
::
UINT64
};
enum
{
type
=
Param
::
UINT64
};
};
};
...
@@ -4556,20 +4559,20 @@ public:
...
@@ -4556,20 +4559,20 @@ public:
getByIndex
(
index
,
space_delete
,
ParamType
<
T
>::
type
,
(
void
*
)
&
val
);
getByIndex
(
index
,
space_delete
,
ParamType
<
T
>::
type
,
(
void
*
)
&
val
);
return
val
;
return
val
;
}
}
bool
has
(
const
string
&
name
)
const
;
bool
has
(
const
string
&
name
)
const
;
bool
check
()
const
;
bool
check
()
const
;
void
about
(
const
string
&
message
);
void
about
(
const
string
&
message
);
void
printMessage
()
const
;
void
printMessage
()
const
;
void
printErrors
()
const
;
void
printErrors
()
const
;
protected
:
protected
:
void
getByName
(
const
string
&
name
,
bool
space_delete
,
int
type
,
void
*
dst
)
const
;
void
getByName
(
const
string
&
name
,
bool
space_delete
,
int
type
,
void
*
dst
)
const
;
void
getByIndex
(
int
index
,
bool
space_delete
,
int
type
,
void
*
dst
)
const
;
void
getByIndex
(
int
index
,
bool
space_delete
,
int
type
,
void
*
dst
)
const
;
struct
Impl
;
struct
Impl
;
Impl
*
impl
;
Impl
*
impl
;
};
};
...
@@ -4595,11 +4598,11 @@ public:
...
@@ -4595,11 +4598,11 @@ public:
~
Mutex
();
~
Mutex
();
Mutex
(
const
Mutex
&
m
);
Mutex
(
const
Mutex
&
m
);
Mutex
&
operator
=
(
const
Mutex
&
m
);
Mutex
&
operator
=
(
const
Mutex
&
m
);
void
lock
();
void
lock
();
bool
trylock
();
bool
trylock
();
void
unlock
();
void
unlock
();
struct
Impl
;
struct
Impl
;
protected
:
protected
:
Impl
*
impl
;
Impl
*
impl
;
...
@@ -4607,10 +4610,10 @@ protected:
...
@@ -4607,10 +4610,10 @@ protected:
class
CV_EXPORTS
AutoLock
class
CV_EXPORTS
AutoLock
{
{
public
:
public
:
AutoLock
(
Mutex
&
m
)
:
mutex
(
&
m
)
{
mutex
->
lock
();
}
AutoLock
(
Mutex
&
m
)
:
mutex
(
&
m
)
{
mutex
->
lock
();
}
~
AutoLock
()
{
mutex
->
unlock
();
}
~
AutoLock
()
{
mutex
->
unlock
();
}
protected
:
protected
:
Mutex
*
mutex
;
Mutex
*
mutex
;
};
};
...
...
modules/core/src/matrix.cpp
View file @
11367e2c
...
@@ -1284,9 +1284,11 @@ _OutputArray::_OutputArray() {}
...
@@ -1284,9 +1284,11 @@ _OutputArray::_OutputArray() {}
_OutputArray
::~
_OutputArray
()
{}
_OutputArray
::~
_OutputArray
()
{}
_OutputArray
::
_OutputArray
(
Mat
&
m
)
:
_InputArray
(
m
)
{}
_OutputArray
::
_OutputArray
(
Mat
&
m
)
:
_InputArray
(
m
)
{}
_OutputArray
::
_OutputArray
(
vector
<
Mat
>&
vec
)
:
_InputArray
(
vec
)
{}
_OutputArray
::
_OutputArray
(
vector
<
Mat
>&
vec
)
:
_InputArray
(
vec
)
{}
_OutputArray
::
_OutputArray
(
gpu
::
GpuMat
&
d_mat
)
:
_InputArray
(
d_mat
)
{}
_OutputArray
::
_OutputArray
(
const
Mat
&
m
)
:
_InputArray
(
m
)
{
flags
|=
FIXED_SIZE
|
FIXED_TYPE
;}
_OutputArray
::
_OutputArray
(
const
Mat
&
m
)
:
_InputArray
(
m
)
{
flags
|=
FIXED_SIZE
|
FIXED_TYPE
;}
_OutputArray
::
_OutputArray
(
const
vector
<
Mat
>&
vec
)
:
_InputArray
(
vec
)
{
flags
|=
FIXED_SIZE
;}
_OutputArray
::
_OutputArray
(
const
vector
<
Mat
>&
vec
)
:
_InputArray
(
vec
)
{
flags
|=
FIXED_SIZE
;}
_OutputArray
::
_OutputArray
(
const
gpu
::
GpuMat
&
d_mat
)
:
_InputArray
(
d_mat
)
{
flags
|=
FIXED_SIZE
|
FIXED_TYPE
;}
bool
_OutputArray
::
fixedSize
()
const
bool
_OutputArray
::
fixedSize
()
const
...
@@ -1309,6 +1311,13 @@ void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, int
...
@@ -1309,6 +1311,13 @@ void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, int
((
Mat
*
)
obj
)
->
create
(
_sz
,
mtype
);
((
Mat
*
)
obj
)
->
create
(
_sz
,
mtype
);
return
;
return
;
}
}
if
(
k
==
GPU_MAT
&&
i
<
0
&&
!
allowTransposed
&&
fixedDepthMask
==
0
)
{
CV_Assert
(
!
fixedSize
()
||
((
gpu
::
GpuMat
*
)
obj
)
->
size
()
==
_sz
);
CV_Assert
(
!
fixedType
()
||
((
gpu
::
GpuMat
*
)
obj
)
->
type
()
==
mtype
);
((
gpu
::
GpuMat
*
)
obj
)
->
create
(
_sz
,
mtype
);
return
;
}
int
sizes
[]
=
{
_sz
.
height
,
_sz
.
width
};
int
sizes
[]
=
{
_sz
.
height
,
_sz
.
width
};
create
(
2
,
sizes
,
mtype
,
i
,
allowTransposed
,
fixedDepthMask
);
create
(
2
,
sizes
,
mtype
,
i
,
allowTransposed
,
fixedDepthMask
);
}
}
...
@@ -1323,6 +1332,13 @@ void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransp
...
@@ -1323,6 +1332,13 @@ void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransp
((
Mat
*
)
obj
)
->
create
(
rows
,
cols
,
mtype
);
((
Mat
*
)
obj
)
->
create
(
rows
,
cols
,
mtype
);
return
;
return
;
}
}
if
(
k
==
GPU_MAT
&&
i
<
0
&&
!
allowTransposed
&&
fixedDepthMask
==
0
)
{
CV_Assert
(
!
fixedSize
()
||
((
gpu
::
GpuMat
*
)
obj
)
->
size
()
==
Size
(
cols
,
rows
));
CV_Assert
(
!
fixedType
()
||
((
gpu
::
GpuMat
*
)
obj
)
->
type
()
==
mtype
);
((
gpu
::
GpuMat
*
)
obj
)
->
create
(
rows
,
cols
,
mtype
);
return
;
}
int
sizes
[]
=
{
rows
,
cols
};
int
sizes
[]
=
{
rows
,
cols
};
create
(
2
,
sizes
,
mtype
,
i
,
allowTransposed
,
fixedDepthMask
);
create
(
2
,
sizes
,
mtype
,
i
,
allowTransposed
,
fixedDepthMask
);
}
}
...
@@ -1536,6 +1552,12 @@ void _OutputArray::release() const
...
@@ -1536,6 +1552,12 @@ void _OutputArray::release() const
return
;
return
;
}
}
if
(
k
==
GPU_MAT
)
{
((
gpu
::
GpuMat
*
)
obj
)
->
release
();
return
;
}
if
(
k
==
NONE
)
if
(
k
==
NONE
)
return
;
return
;
...
@@ -1594,6 +1616,13 @@ Mat& _OutputArray::getMatRef(int i) const
...
@@ -1594,6 +1616,13 @@ Mat& _OutputArray::getMatRef(int i) const
}
}
}
}
gpu
::
GpuMat
&
_OutputArray
::
getGpuMatRef
()
const
{
int
k
=
kind
();
CV_Assert
(
k
==
GPU_MAT
);
return
*
(
gpu
::
GpuMat
*
)
obj
;
}
static
_OutputArray
_none
;
static
_OutputArray
_none
;
OutputArray
noArray
()
{
return
_none
;
}
OutputArray
noArray
()
{
return
_none
;
}
...
...
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