mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
renamed cuda namespace to cudev
This commit is contained in:
@@ -61,7 +61,7 @@ __host__ __device__ __forceinline__ int divUp(int total, int grain)
|
||||
return (total + grain - 1) / grain;
|
||||
}
|
||||
|
||||
namespace cv { namespace softcascade { namespace cuda
|
||||
namespace cv { namespace softcascade { namespace cudev
|
||||
{
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned short ushort;
|
||||
|
||||
@@ -62,7 +62,7 @@ static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int
|
||||
#define CV_PI 3.1415926535897932384626433832795
|
||||
#endif
|
||||
|
||||
namespace cv { namespace softcascade { namespace cuda {
|
||||
namespace cv { namespace softcascade { namespace cudev {
|
||||
|
||||
typedef unsigned char uchar;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
namespace cv { namespace softcascade { namespace cuda {
|
||||
namespace cv { namespace softcascade { namespace cudev {
|
||||
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
|
||||
@@ -64,7 +64,7 @@ cv::Ptr<cv::softcascade::ChannelsProcessor> cv::softcascade::ChannelsProcessor::
|
||||
|
||||
# include "cuda_invoker.hpp"
|
||||
|
||||
cv::softcascade::cuda::Level::Level(int idx, const Octave& oct, const float scale, const int w, const int h)
|
||||
cv::softcascade::cudev::Level::Level(int idx, const Octave& oct, const float scale, const int w, const int h)
|
||||
: octave(idx), step(oct.stages), relScale(scale / oct.scale)
|
||||
{
|
||||
workRect.x = (unsigned char)cvRound(w / (float)oct.shrinkage);
|
||||
@@ -83,7 +83,7 @@ cv::softcascade::cuda::Level::Level(int idx, const Octave& oct, const float scal
|
||||
}
|
||||
}
|
||||
|
||||
namespace cv { namespace softcascade { namespace cuda {
|
||||
namespace cv { namespace softcascade { namespace cudev {
|
||||
|
||||
void fillBins(cv::gpu::PtrStepSzb hogluv, const cv::gpu::PtrStepSzf& nangle,
|
||||
const int fw, const int fh, const int bins, cudaStream_t stream);
|
||||
@@ -140,9 +140,9 @@ struct cv::softcascade::SCascade::Fields
|
||||
FileNode fn = root[SC_OCTAVES];
|
||||
if (fn.empty()) return 0;
|
||||
|
||||
std::vector<cuda::Octave> voctaves;
|
||||
std::vector<cudev::Octave> voctaves;
|
||||
std::vector<float> vstages;
|
||||
std::vector<cuda::Node> vnodes;
|
||||
std::vector<cudev::Node> vnodes;
|
||||
std::vector<float> vleaves;
|
||||
|
||||
FileNodeIterator it = fn.begin(), it_end = fn.end();
|
||||
@@ -158,7 +158,7 @@ struct cv::softcascade::SCascade::Fields
|
||||
size.x = (unsigned short)cvRound(origWidth * scale);
|
||||
size.y = (unsigned short)cvRound(origHeight * scale);
|
||||
|
||||
cuda::Octave octave(octIndex, nweaks, shrinkage, size, scale);
|
||||
cudev::Octave octave(octIndex, nweaks, shrinkage, size, scale);
|
||||
CV_Assert(octave.stages > 0);
|
||||
voctaves.push_back(octave);
|
||||
|
||||
@@ -227,7 +227,7 @@ struct cv::softcascade::SCascade::Fields
|
||||
rect.w = saturate_cast<uchar>(r.height);
|
||||
|
||||
unsigned int channel = saturate_cast<unsigned int>(feature_channels[featureIdx]);
|
||||
vnodes.push_back(cuda::Node(rect, channel, th));
|
||||
vnodes.push_back(cudev::Node(rect, channel, th));
|
||||
}
|
||||
|
||||
intfns = octfn[SC_LEAF];
|
||||
@@ -239,13 +239,13 @@ struct cv::softcascade::SCascade::Fields
|
||||
}
|
||||
}
|
||||
|
||||
cv::Mat hoctaves(1, (int) (voctaves.size() * sizeof(cuda::Octave)), CV_8UC1, (uchar*)&(voctaves[0]));
|
||||
cv::Mat hoctaves(1, (int) (voctaves.size() * sizeof(cudev::Octave)), CV_8UC1, (uchar*)&(voctaves[0]));
|
||||
CV_Assert(!hoctaves.empty());
|
||||
|
||||
cv::Mat hstages(cv::Mat(vstages).reshape(1,1));
|
||||
CV_Assert(!hstages.empty());
|
||||
|
||||
cv::Mat hnodes(1, (int) (vnodes.size() * sizeof(cuda::Node)), CV_8UC1, (uchar*)&(vnodes[0]) );
|
||||
cv::Mat hnodes(1, (int) (vnodes.size() * sizeof(cudev::Node)), CV_8UC1, (uchar*)&(vnodes[0]) );
|
||||
CV_Assert(!hnodes.empty());
|
||||
|
||||
cv::Mat hleaves(cv::Mat(vleaves).reshape(1,1));
|
||||
@@ -272,7 +272,7 @@ struct cv::softcascade::SCascade::Fields
|
||||
|
||||
int createLevels(const int fh, const int fw)
|
||||
{
|
||||
std::vector<cuda::Level> vlevels;
|
||||
std::vector<cudev::Level> vlevels;
|
||||
float logFactor = (::log(maxScale) - ::log(minScale)) / (totals -1);
|
||||
|
||||
float scale = minScale;
|
||||
@@ -285,7 +285,7 @@ struct cv::softcascade::SCascade::Fields
|
||||
float logScale = ::log(scale);
|
||||
int fit = fitOctave(voctaves, logScale);
|
||||
|
||||
cuda::Level level(fit, voctaves[fit], scale, width, height);
|
||||
cudev::Level level(fit, voctaves[fit], scale, width, height);
|
||||
|
||||
if (!width || !height)
|
||||
break;
|
||||
@@ -299,7 +299,7 @@ struct cv::softcascade::SCascade::Fields
|
||||
scale = ::std::min(maxScale, ::expf(::log(scale) + logFactor));
|
||||
}
|
||||
|
||||
cv::Mat hlevels = cv::Mat(1, (int) (vlevels.size() * sizeof(cuda::Level)), CV_8UC1, (uchar*)&(vlevels[0]) );
|
||||
cv::Mat hlevels = cv::Mat(1, (int) (vlevels.size() * sizeof(cudev::Level)), CV_8UC1, (uchar*)&(vlevels[0]) );
|
||||
CV_Assert(!hlevels.empty());
|
||||
levels.upload(hlevels);
|
||||
downscales = dcs;
|
||||
@@ -342,8 +342,8 @@ struct cv::softcascade::SCascade::Fields
|
||||
|
||||
cvCudaSafeCall( cudaGetLastError());
|
||||
|
||||
cuda::CascadeInvoker<cuda::GK107PolicyX4> invoker
|
||||
= cuda::CascadeInvoker<cuda::GK107PolicyX4>(levels, stages, nodes, leaves);
|
||||
cudev::CascadeInvoker<cudev::GK107PolicyX4> invoker
|
||||
= cudev::CascadeInvoker<cudev::GK107PolicyX4>(levels, stages, nodes, leaves);
|
||||
|
||||
cudaStream_t stream = cv::gpu::StreamAccessor::getStream(s);
|
||||
invoker(mask, hogluv, objects, downscales, stream);
|
||||
@@ -366,19 +366,19 @@ struct cv::softcascade::SCascade::Fields
|
||||
}
|
||||
|
||||
cudaStream_t stream = cv::gpu::StreamAccessor::getStream(s);
|
||||
cuda::suppress(objects, overlaps, ndetections, suppressed, stream);
|
||||
cudev::suppress(objects, overlaps, ndetections, suppressed, stream);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typedef std::vector<cuda::Octave>::const_iterator octIt_t;
|
||||
static int fitOctave(const std::vector<cuda::Octave>& octs, const float& logFactor)
|
||||
typedef std::vector<cudev::Octave>::const_iterator octIt_t;
|
||||
static int fitOctave(const std::vector<cudev::Octave>& octs, const float& logFactor)
|
||||
{
|
||||
float minAbsLog = FLT_MAX;
|
||||
int res = 0;
|
||||
for (int oct = 0; oct < (int)octs.size(); ++oct)
|
||||
{
|
||||
const cuda::Octave& octave =octs[oct];
|
||||
const cudev::Octave& octave =octs[oct];
|
||||
float logOctave = ::log(octave.scale);
|
||||
float logAbsScale = ::fabs(logFactor - logOctave);
|
||||
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
// cv::gpu::GpuMat collected;
|
||||
|
||||
|
||||
std::vector<cuda::Octave> voctaves;
|
||||
std::vector<cudev::Octave> voctaves;
|
||||
|
||||
// DeviceInfo info;
|
||||
|
||||
@@ -485,7 +485,7 @@ void integral(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& sum, cv::gpu::GpuMat&
|
||||
{
|
||||
ensureSizeIsEnough(((src.rows + 7) / 8) * 8, ((src.cols + 63) / 64) * 64, CV_32SC1, buffer);
|
||||
|
||||
cv::softcascade::cuda::shfl_integral(src, buffer, stream);
|
||||
cv::softcascade::cudev::shfl_integral(src, buffer, stream);
|
||||
|
||||
sum.create(src.rows + 1, src.cols + 1, CV_32SC1);
|
||||
if (s)
|
||||
@@ -526,7 +526,7 @@ void cv::softcascade::SCascade::detect(InputArray _image, InputArray _rois, Outp
|
||||
|
||||
flds.mask.create( rois.cols / shr, rois.rows / shr, rois.type());
|
||||
|
||||
cuda::shrink(rois, flds.mask);
|
||||
cudev::shrink(rois, flds.mask);
|
||||
//cv::gpu::transpose(flds.genRoiTmp, flds.mask, s);
|
||||
|
||||
if (type == CV_8UC3)
|
||||
@@ -594,12 +594,12 @@ struct SeparablePreprocessor : public cv::softcascade::ChannelsProcessor
|
||||
setZero(channels, s);
|
||||
|
||||
gray.create(bgr.size(), CV_8UC1);
|
||||
cv::softcascade::cuda::transform(bgr, gray); //cv::gpu::cvtColor(bgr, gray, CV_BGR2GRAY);
|
||||
cv::softcascade::cuda::gray2hog(gray, channels(cv::Rect(0, 0, bgr.cols, bgr.rows * (bins + 1))), bins);
|
||||
cv::softcascade::cudev::transform(bgr, gray); //cv::gpu::cvtColor(bgr, gray, CV_BGR2GRAY);
|
||||
cv::softcascade::cudev::gray2hog(gray, channels(cv::Rect(0, 0, bgr.cols, bgr.rows * (bins + 1))), bins);
|
||||
|
||||
cv::gpu::GpuMat luv(channels, cv::Rect(0, bgr.rows * (bins + 1), bgr.cols, bgr.rows * 3));
|
||||
cv::softcascade::cuda::bgr2Luv(bgr, luv);
|
||||
cv::softcascade::cuda::shrink(channels, shrunk);
|
||||
cv::softcascade::cudev::bgr2Luv(bgr, luv);
|
||||
cv::softcascade::cudev::shrink(channels, shrunk);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user