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
58e26313
Commit
58e26313
authored
May 10, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in cv::LUT (multi-channel source array and single-channel table)
added missing cudaSafeCall
parent
4c7a8f8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
22 deletions
+23
-22
convert.cpp
modules/core/src/convert.cpp
+21
-20
matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+2
-2
No files found.
modules/core/src/convert.cpp
View file @
58e26313
...
@@ -930,11 +930,11 @@ namespace cv
...
@@ -930,11 +930,11 @@ namespace cv
{
{
template
<
typename
T
>
static
void
template
<
typename
T
>
static
void
LUT8u_
(
const
uchar
*
src
,
const
T
*
lut
,
T
*
dst
,
int
len
,
int
cn
)
LUT8u_
(
const
uchar
*
src
,
const
T
*
lut
,
T
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
if
(
cn
==
1
)
if
(
lut
cn
==
1
)
{
{
for
(
int
i
=
0
;
i
<
len
;
i
++
)
for
(
int
i
=
0
;
i
<
len
*
cn
;
i
++
)
dst
[
i
]
=
lut
[
src
[
i
]];
dst
[
i
]
=
lut
[
src
[
i
]];
}
}
else
else
...
@@ -945,42 +945,42 @@ LUT8u_( const uchar* src, const T* lut, T* dst, int len, int cn )
...
@@ -945,42 +945,42 @@ LUT8u_( const uchar* src, const T* lut, T* dst, int len, int cn )
}
}
}
}
static
void
LUT8u_8u
(
const
uchar
*
src
,
const
uchar
*
lut
,
uchar
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_8u
(
const
uchar
*
src
,
const
uchar
*
lut
,
uchar
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_8s
(
const
uchar
*
src
,
const
schar
*
lut
,
schar
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_8s
(
const
uchar
*
src
,
const
schar
*
lut
,
schar
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_16u
(
const
uchar
*
src
,
const
ushort
*
lut
,
ushort
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_16u
(
const
uchar
*
src
,
const
ushort
*
lut
,
ushort
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_16s
(
const
uchar
*
src
,
const
short
*
lut
,
short
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_16s
(
const
uchar
*
src
,
const
short
*
lut
,
short
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_32s
(
const
uchar
*
src
,
const
int
*
lut
,
int
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_32s
(
const
uchar
*
src
,
const
int
*
lut
,
int
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_32f
(
const
uchar
*
src
,
const
float
*
lut
,
float
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_32f
(
const
uchar
*
src
,
const
float
*
lut
,
float
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
static
void
LUT8u_64f
(
const
uchar
*
src
,
const
double
*
lut
,
double
*
dst
,
int
len
,
int
cn
)
static
void
LUT8u_64f
(
const
uchar
*
src
,
const
double
*
lut
,
double
*
dst
,
int
len
,
int
cn
,
int
lutcn
)
{
{
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
);
LUT8u_
(
src
,
lut
,
dst
,
len
,
cn
,
lutcn
);
}
}
typedef
void
(
*
LUTFunc
)(
const
uchar
*
src
,
const
uchar
*
lut
,
uchar
*
dst
,
int
len
,
int
cn
);
typedef
void
(
*
LUTFunc
)(
const
uchar
*
src
,
const
uchar
*
lut
,
uchar
*
dst
,
int
len
,
int
cn
,
int
lutcn
);
static
LUTFunc
lutTab
[]
=
static
LUTFunc
lutTab
[]
=
{
{
...
@@ -995,8 +995,9 @@ void cv::LUT( const InputArray& _src, const InputArray& _lut, OutputArray _dst,
...
@@ -995,8 +995,9 @@ void cv::LUT( const InputArray& _src, const InputArray& _lut, OutputArray _dst,
Mat
src
=
_src
.
getMat
(),
lut
=
_lut
.
getMat
();
Mat
src
=
_src
.
getMat
(),
lut
=
_lut
.
getMat
();
CV_Assert
(
interpolation
==
0
);
CV_Assert
(
interpolation
==
0
);
int
cn
=
src
.
channels
();
int
cn
=
src
.
channels
();
int
lutcn
=
lut
.
channels
();
CV_Assert
(
(
lut
.
channels
()
==
cn
||
lut
.
channels
()
==
1
)
&&
CV_Assert
(
(
lut
cn
==
cn
||
lutcn
==
1
)
&&
lut
.
total
()
==
256
&&
lut
.
isContinuous
()
&&
lut
.
total
()
==
256
&&
lut
.
isContinuous
()
&&
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_8S
)
);
(
src
.
depth
()
==
CV_8U
||
src
.
depth
()
==
CV_8S
)
);
_dst
.
create
(
src
.
dims
,
src
.
size
,
CV_MAKETYPE
(
lut
.
depth
(),
cn
));
_dst
.
create
(
src
.
dims
,
src
.
size
,
CV_MAKETYPE
(
lut
.
depth
(),
cn
));
...
@@ -1011,7 +1012,7 @@ void cv::LUT( const InputArray& _src, const InputArray& _lut, OutputArray _dst,
...
@@ -1011,7 +1012,7 @@ void cv::LUT( const InputArray& _src, const InputArray& _lut, OutputArray _dst,
int
len
=
(
int
)
it
.
size
;
int
len
=
(
int
)
it
.
size
;
for
(
size_t
i
=
0
;
i
<
it
.
nplanes
;
i
++
,
++
it
)
for
(
size_t
i
=
0
;
i
<
it
.
nplanes
;
i
++
,
++
it
)
func
(
ptrs
[
0
],
lut
.
data
,
ptrs
[
1
],
len
,
cn
);
func
(
ptrs
[
0
],
lut
.
data
,
ptrs
[
1
],
len
,
cn
,
lutcn
);
}
}
...
...
modules/gpu/src/matrix_operations.cpp
View file @
58e26313
...
@@ -590,7 +590,7 @@ void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
...
@@ -590,7 +590,7 @@ void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
bool
cv
::
gpu
::
CudaMem
::
canMapHostMemory
()
bool
cv
::
gpu
::
CudaMem
::
canMapHostMemory
()
{
{
cudaDeviceProp
prop
;
cudaDeviceProp
prop
;
cuda
GetDeviceProperties
(
&
prop
,
getDevice
()
);
cuda
SafeCall
(
cudaGetDeviceProperties
(
&
prop
,
getDevice
())
);
return
(
prop
.
canMapHostMemory
!=
0
)
?
true
:
false
;
return
(
prop
.
canMapHostMemory
!=
0
)
?
true
:
false
;
}
}
...
@@ -625,7 +625,7 @@ void cv::gpu::CudaMem::create(int _rows, int _cols, int _type, int _alloc_type)
...
@@ -625,7 +625,7 @@ void cv::gpu::CudaMem::create(int _rows, int _cols, int _type, int _alloc_type)
if
(
_alloc_type
==
ALLOC_ZEROCOPY
)
if
(
_alloc_type
==
ALLOC_ZEROCOPY
)
{
{
cudaDeviceProp
prop
;
cudaDeviceProp
prop
;
cuda
GetDeviceProperties
(
&
prop
,
getDevice
()
);
cuda
SafeCall
(
cudaGetDeviceProperties
(
&
prop
,
getDevice
())
);
step
=
alignUp
(
step
,
prop
.
textureAlignment
);
step
=
alignUp
(
step
,
prop
.
textureAlignment
);
}
}
int64
_nettosize
=
(
int64
)
step
*
rows
;
int64
_nettosize
=
(
int64
)
step
*
rows
;
...
...
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