Unverified Commit dd3655f6 authored by Claudio's avatar Claudio

Align parameter code style between hog .cu and .cpp files

parent 35f66340
...@@ -52,7 +52,6 @@ namespace cv { namespace cuda { namespace device ...@@ -52,7 +52,6 @@ namespace cv { namespace cuda { namespace device
namespace hog namespace hog
{ {
__constant__ int cnbins; __constant__ int cnbins;
__constant__ int cblock_stride_x; __constant__ int cblock_stride_x;
__constant__ int cblock_stride_y; __constant__ int cblock_stride_y;
...@@ -99,8 +98,10 @@ namespace cv { namespace cuda { namespace device ...@@ -99,8 +98,10 @@ namespace cv { namespace cuda { namespace device
} }
void set_up_constants(int nbins, int block_stride_x, int block_stride_y, void set_up_constants(int nbins,
int nblocks_win_x, int nblocks_win_y, int ncells_block_x, int ncells_block_y, int block_stride_x, int block_stride_y,
int nblocks_win_x, int nblocks_win_y,
int ncells_block_x, int ncells_block_y,
const cudaStream_t& stream) const cudaStream_t& stream)
{ {
cudaSafeCall(cudaMemcpyToSymbolAsync(cnbins, &nbins, sizeof(nbins), 0, cudaMemcpyHostToDevice, stream)); cudaSafeCall(cudaMemcpyToSymbolAsync(cnbins, &nbins, sizeof(nbins), 0, cudaMemcpyHostToDevice, stream));
...@@ -232,10 +233,14 @@ namespace cv { namespace cuda { namespace device ...@@ -232,10 +233,14 @@ namespace cv { namespace cuda { namespace device
} }
//declaration of variables and invoke the kernel with the calculated number of blocks //declaration of variables and invoke the kernel with the calculated number of blocks
void compute_hists(int nbins, int block_stride_x, int block_stride_y, void compute_hists(int nbins,
int height, int width, const PtrStepSzf& grad, int block_stride_x, int block_stride_y,
const PtrStepSzb& qangle, float sigma, float* block_hists, int height, int width,
int cell_size_x, int cell_size_y, int ncells_block_x, int ncells_block_y, const PtrStepSzf& grad, const PtrStepSzb& qangle,
float sigma,
float* block_hists,
int cell_size_x, int cell_size_y,
int ncells_block_x, int ncells_block_y,
const cudaStream_t& stream) const cudaStream_t& stream)
{ {
const int ncells_block = ncells_block_x * ncells_block_y; const int ncells_block = ncells_block_x * ncells_block_y;
...@@ -345,8 +350,13 @@ namespace cv { namespace cuda { namespace device ...@@ -345,8 +350,13 @@ namespace cv { namespace cuda { namespace device
} }
void normalize_hists(int nbins, int block_stride_x, int block_stride_y, void normalize_hists(int nbins,
int height, int width, float* block_hists, float threshold, int cell_size_x, int cell_size_y, int ncells_block_x, int ncells_block_y, int block_stride_x, int block_stride_y,
int height, int width,
float* block_hists,
float threshold,
int cell_size_x, int cell_size_y,
int ncells_block_x, int ncells_block_y,
const cudaStream_t& stream) const cudaStream_t& stream)
{ {
const int nblocks = 1; const int nblocks = 1;
...@@ -576,8 +586,12 @@ namespace cv { namespace cuda { namespace device ...@@ -576,8 +586,12 @@ namespace cv { namespace cuda { namespace device
} }
void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, int block_stride_x, void extract_descrs_by_cols(int win_height, int win_width,
int win_stride_y, int win_stride_x, int height, int width, float* block_hists, int cell_size_x, int ncells_block_x, int block_stride_y, int block_stride_x,
int win_stride_y, int win_stride_x,
int height, int width,
float* block_hists,
int cell_size_x, int ncells_block_x,
PtrStepSzf descriptors, PtrStepSzf descriptors,
const cudaStream_t& stream) const cudaStream_t& stream)
{ {
...@@ -703,8 +717,11 @@ namespace cv { namespace cuda { namespace device ...@@ -703,8 +717,11 @@ namespace cv { namespace cuda { namespace device
} }
void compute_gradients_8UC4(int nbins, int height, int width, const PtrStepSzb& img, void compute_gradients_8UC4(int nbins,
float angle_scale, PtrStepSzf grad, PtrStepSzb qangle, bool correct_gamma, int height, int width, const PtrStepSzb& img,
float angle_scale,
PtrStepSzf grad, PtrStepSzb qangle,
bool correct_gamma,
const cudaStream_t& stream) const cudaStream_t& stream)
{ {
(void)nbins; (void)nbins;
......
...@@ -515,15 +515,25 @@ namespace ...@@ -515,15 +515,25 @@ namespace
GpuMat grad = pool.getBuffer(img.size(), CV_32FC2); GpuMat grad = pool.getBuffer(img.size(), CV_32FC2);
GpuMat qangle = pool.getBuffer(img.size(), CV_8UC2); GpuMat qangle = pool.getBuffer(img.size(), CV_8UC2);
hog::set_up_constants(nbins_, block_stride_.width, block_stride_.height, blocks_per_win.width, blocks_per_win.height, cells_per_block_.width, cells_per_block_.height, StreamAccessor::getStream(stream)); hog::set_up_constants(nbins_,
block_stride_.width, block_stride_.height,
blocks_per_win.width, blocks_per_win.height,
cells_per_block_.width, cells_per_block_.height,
StreamAccessor::getStream(stream));
switch (img.type()) switch (img.type())
{ {
case CV_8UC1: case CV_8UC1:
hog::compute_gradients_8UC1(nbins_, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction_); hog::compute_gradients_8UC1(nbins_, img.rows, img.cols, img,
angleScale, grad, qangle, gamma_correction_);
break; break;
case CV_8UC4: case CV_8UC4:
hog::compute_gradients_8UC4(nbins_, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction_, StreamAccessor::getStream(stream)); hog::compute_gradients_8UC4(nbins_,
img.rows, img.cols, img,
angleScale,
grad, qangle,
gamma_correction_,
StreamAccessor::getStream(stream));
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment