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
d352db7e
Commit
d352db7e
authored
Jul 23, 2010
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imgproc_gpu - minor refactoring
parent
2d36ba21
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
25 deletions
+29
-25
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+1
-0
imgproc.cu
modules/gpu/src/cuda/imgproc.cu
+13
-9
imgproc_gpu.cpp
modules/gpu/src/imgproc_gpu.cpp
+15
-16
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
d352db7e
...
...
@@ -64,6 +64,7 @@ namespace cv
CV_EXPORTS
int
getNumberOfSMs
(
int
device
);
//////////////////////////////// GpuMat ////////////////////////////////
class
CudaStrem
;
//! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
class
CV_EXPORTS
GpuMat
...
...
modules/gpu/src/cuda/imgproc.cu
View file @
d352db7e
...
...
@@ -64,22 +64,25 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace impl {
extern "C" void remap_gpu(const DevMem2D& src, const DevMem2D_<float>& xmap, const DevMem2D_<float>& ymap, DevMem2D dst, size_t width, size_t height)
namespace cv { namespace gpu { namespace impl
{
using namespace imgproc;
extern "C" void remap_gpu(const DevMem2D& src, const DevMem2D_<float>& xmap, const DevMem2D_<float>& ymap, DevMem2D dst)
{
dim3 block(16, 16, 1);
dim3 grid(1, 1, 1);
grid.x = divUp(
width
, block.x);
grid.y = divUp(
height
, block.y);
grid.x = divUp(
dst.cols
, block.x);
grid.y = divUp(
dst.rows
, block.y);
::imgproc::
tex.filterMode = cudaFilterModeLinear;
::imgproc::tex.addressMode[0] = ::imgproc::
tex.addressMode[1] = cudaAddressModeWrap;
tex.filterMode = cudaFilterModeLinear;
tex.addressMode[0] =
tex.addressMode[1] = cudaAddressModeWrap;
cudaChannelFormatDesc desc = cudaCreateChannelDesc<unsigned char>();
cudaSafeCall( cudaBindTexture2D(0,
::imgproc::tex, src.ptr, desc, width, height
, src.step) );
cudaSafeCall( cudaBindTexture2D(0,
tex, src.ptr, desc, dst.cols, dst.rows
, src.step) );
::imgproc::kernel_remap<<<grid, block>>>(xmap.ptr, ymap.ptr, xmap.step, dst.ptr, dst.step, width, height
);
kernel_remap<<<grid, block>>>(xmap.ptr, ymap.ptr, xmap.step, dst.ptr, dst.step, dst.cols, dst.rows
);
cudaSafeCall( cudaThreadSynchronize() );
cudaSafeCall( cudaUnbindTexture(
::imgproc::
tex) );
cudaSafeCall( cudaUnbindTexture(tex) );
}
}}}
\ No newline at end of file
modules/gpu/src/imgproc_gpu.cpp
View file @
d352db7e
...
...
@@ -47,29 +47,27 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA)
namespace
cv
{
namespace
gpu
{
remap
(
const
GpuMat
&
/*src*/
,
const
GpuMat
&
/*xmap*/
,
const
GpuMat
&
/*ymap*/
,
GpuMat
&
/*dst*/
)
{
throw_nogpu
();
}
}
}
cv
::
gpu
::
remap
(
const
GpuMat
&
/*src*/
,
const
GpuMat
&
/*xmap*/
,
const
GpuMat
&
/*ymap*/
,
GpuMat
&
/*dst*/
)
{
throw_nogpu
();
}
#else
/* !defined (HAVE_CUDA) */
namespace
cv
{
namespace
gpu
{
namespace
impl
{
extern
"C"
void
remap_gpu
(
const
DevMem2D
&
src
,
const
DevMem2D_
<
float
>&
xmap
,
const
DevMem2D_
<
float
>&
ymap
,
DevMem2D
dst
,
size_t
width
,
size_t
height
);
}}}
namespace
cv
{
namespace
gpu
{
namespace
impl
{
extern
"C"
void
remap_gpu
(
const
DevMem2D
&
src
,
const
DevMem2D_
<
float
>&
xmap
,
const
DevMem2D_
<
float
>&
ymap
,
DevMem2D
dst
);
}
}}
void
cv
::
gpu
::
remap
(
const
GpuMat
&
src
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
,
GpuMat
&
dst
)
{
CV_Assert
((
!
xmap
.
data
||
xmap
.
size
()
==
ymap
.
size
()));
dst
.
create
(
xmap
.
size
(),
src
.
type
());
CV_Assert
(
dst
.
data
!=
src
.
data
);
CV_DbgAssert
(
xmap
.
data
&&
xmap
.
cols
==
ymap
.
cols
&&
xmap
.
rows
==
ymap
.
rows
);
CV_Assert
(
xmap
.
type
()
==
CV_32F
&&
ymap
.
type
()
==
CV_32F
);
impl
::
remap_gpu
(
src
,
xmap
,
ymap
,
dst
,
dst
.
cols
,
dst
.
rows
);
dst
.
create
(
xmap
.
size
(),
src
.
type
());
CV_Assert
(
dst
.
data
!=
src
.
data
);
impl
::
remap_gpu
(
src
,
xmap
,
ymap
,
dst
);
}
#endif
/* !defined (HAVE_CUDA) */
\ No newline at end of file
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