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
2a2590ba
Commit
2a2590ba
authored
Dec 03, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced filter (from the nearest to linear) mode when resizing image in gpu::HOGDescriptor
parent
3dd0e319
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
hog.cu
modules/gpu/src/cuda/hog.cu
+9
-4
No files found.
modules/gpu/src/cuda/hog.cu
View file @
2a2590ba
...
@@ -696,8 +696,8 @@ void compute_gradients_8UC1(int nbins, int height, int width, const DevMem2D& im
...
@@ -696,8 +696,8 @@ void compute_gradients_8UC1(int nbins, int height, int width, const DevMem2D& im
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Resize
// Resize
texture<uchar4, 2> resize8UC4_tex;
texture<uchar4, 2
, cudaReadModeNormalizedFloat
> resize8UC4_tex;
texture<unsigned char, 2> resize8UC1_tex;
texture<unsigned char, 2
, cudaReadModeNormalizedFloat
> resize8UC1_tex;
extern "C" __global__ void resize_8UC4_kernel(float sx, float sy, DevMem2D dst)
extern "C" __global__ void resize_8UC4_kernel(float sx, float sy, DevMem2D dst)
...
@@ -706,7 +706,10 @@ extern "C" __global__ void resize_8UC4_kernel(float sx, float sy, DevMem2D dst)
...
@@ -706,7 +706,10 @@ extern "C" __global__ void resize_8UC4_kernel(float sx, float sy, DevMem2D dst)
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
if (x < dst.cols && y < dst.rows)
if (x < dst.cols && y < dst.rows)
((uchar4*)dst.ptr(y))[x] = tex2D(resize8UC4_tex, x * sx, y * sy);
{
float4 val = tex2D(resize8UC4_tex, x * sx, y * sy);
((uchar4*)dst.ptr(y))[x] = make_uchar4(val.x * 255, val.y * 255, val.z * 255, val.w * 255);
}
}
}
...
@@ -714,6 +717,7 @@ void resize_8UC4(const DevMem2D& src, DevMem2D dst)
...
@@ -714,6 +717,7 @@ void resize_8UC4(const DevMem2D& src, DevMem2D dst)
{
{
cudaChannelFormatDesc desc = cudaCreateChannelDesc<uchar4>();
cudaChannelFormatDesc desc = cudaCreateChannelDesc<uchar4>();
cudaBindTexture2D(0, resize8UC4_tex, src.data, desc, src.cols, src.rows, src.step);
cudaBindTexture2D(0, resize8UC4_tex, src.data, desc, src.cols, src.rows, src.step);
resize8UC4_tex.filterMode = cudaFilterModeLinear;
dim3 threads(32, 8);
dim3 threads(32, 8);
dim3 grid(div_up(dst.cols, threads.x), div_up(dst.rows, threads.y));
dim3 grid(div_up(dst.cols, threads.x), div_up(dst.rows, threads.y));
...
@@ -732,7 +736,7 @@ extern "C" __global__ void resize_8UC1_kernel(float sx, float sy, DevMem2D dst)
...
@@ -732,7 +736,7 @@ extern "C" __global__ void resize_8UC1_kernel(float sx, float sy, DevMem2D dst)
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
if (x < dst.cols && y < dst.rows)
if (x < dst.cols && y < dst.rows)
((unsigned char*)dst.ptr(y))[x] = tex2D(resize8UC1_tex, x * sx, y * sy);
((unsigned char*)dst.ptr(y))[x] = tex2D(resize8UC1_tex, x * sx, y * sy)
* 255
;
}
}
...
@@ -740,6 +744,7 @@ void resize_8UC1(const DevMem2D& src, DevMem2D dst)
...
@@ -740,6 +744,7 @@ void resize_8UC1(const DevMem2D& src, DevMem2D dst)
{
{
cudaChannelFormatDesc desc = cudaCreateChannelDesc<unsigned char>();
cudaChannelFormatDesc desc = cudaCreateChannelDesc<unsigned char>();
cudaBindTexture2D(0, resize8UC1_tex, src.data, desc, src.cols, src.rows, src.step);
cudaBindTexture2D(0, resize8UC1_tex, src.data, desc, src.cols, src.rows, src.step);
resize8UC1_tex.filterMode = cudaFilterModeLinear;
dim3 threads(32, 8);
dim3 threads(32, 8);
dim3 grid(div_up(dst.cols, threads.x), div_up(dst.rows, threads.y));
dim3 grid(div_up(dst.cols, threads.x), div_up(dst.rows, threads.y));
...
...
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