Skip to content

Commit b556c2a

Browse files
committed
build: migrate to traits::Type / traits::Depth
1 parent 62e77e9 commit b556c2a

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

modules/optflow/src/simpleflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class CrossBilateralFilter : public ParallelLoopBody {
131131
flag(flag_),
132132
spaceWeights(spaceWeights_),
133133
expLut(expLut_) {
134-
CV_DbgAssert(joint.type() == JointVec::type && confidence.type() == CV_32F && src.type() == dst.type() && src.type() == SrcVec::type);
134+
CV_DbgAssert(joint.type() == traits::Type<JointVec>::value && confidence.type() == CV_32F && src.type() == dst.type() && src.type() == traits::Type<SrcVec>::value);
135135
CV_DbgAssert(joint.rows == src.rows && confidence.rows == src.rows && src.rows == dst.rows + 2 * radius);
136136
CV_DbgAssert(joint.cols == src.cols && confidence.cols == src.cols && src.cols == dst.cols + 2 * radius);
137137
}

modules/ximgproc/src/dtfilter_cpu.inl.hpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ DTFilterCPU* DTFilterCPU::create_p_(const Mat& guide, double sigmaSpatial, doubl
6969
template<typename GuideVec>
7070
void DTFilterCPU::init_(Mat& guide, double sigmaSpatial_, double sigmaColor_, int mode_, int numIters_)
7171
{
72-
CV_Assert(guide.type() == cv::DataType<GuideVec>::type);
72+
CV_Assert(guide.type() == traits::Type<GuideVec>::value);
7373

7474
this->release();
7575

@@ -123,7 +123,7 @@ template <typename SrcVec>
123123
void DTFilterCPU::filter_(const Mat& src, Mat& dst, int dDepth)
124124
{
125125
typedef typename DataType<Vec<WorkType, SrcVec::channels> >::vec_type WorkVec;
126-
CV_Assert( src.type() == SrcVec::type );
126+
CV_Assert( src.type() == traits::Type<SrcVec>::value );
127127
if ( src.cols != w || src.rows != h )
128128
{
129129
CV_Error(Error::StsBadSize, "Size of filtering image must be equal to size of guide image");
@@ -139,17 +139,17 @@ void DTFilterCPU::filter_(const Mat& src, Mat& dst, int dDepth)
139139
if (dDepth == -1) dDepth = src.depth();
140140

141141
//small optimization to avoid extra copying of data
142-
bool useDstAsRes = (dDepth == WorkVec::depth && (mode == DTF_NC || mode == DTF_RF));
142+
bool useDstAsRes = (dDepth == traits::Depth<WorkVec>::value && (mode == DTF_NC || mode == DTF_RF));
143143
if (useDstAsRes)
144144
{
145-
dst.create(h, w, WorkVec::type);
145+
dst.create(h, w, traits::Type<WorkVec>::value);
146146
res = dst;
147147
}
148148

149149
if (mode == DTF_NC)
150150
{
151-
Mat resT(src.cols, src.rows, WorkVec::type);
152-
src.convertTo(res, WorkVec::type);
151+
Mat resT(src.cols, src.rows, traits::Type<WorkVec>::value);
152+
src.convertTo(res, traits::Type<WorkVec>::value);
153153

154154
FilterNC_horPass<WorkVec> horParBody(res, idistHor, resT);
155155
FilterNC_horPass<WorkVec> vertParBody(resT, idistVert, res);
@@ -180,7 +180,7 @@ void DTFilterCPU::filter_(const Mat& src, Mat& dst, int dDepth)
180180
}
181181
else if (mode == DTF_RF)
182182
{
183-
src.convertTo(res, WorkVec::type);
183+
src.convertTo(res, traits::Type<WorkVec>::value);
184184

185185
for (int iter = 1; iter <= numIters; iter++)
186186
{
@@ -237,13 +237,13 @@ void DTFilterCPU::integrateSparseRow(const SrcVec *src, const float *dist, SrcWo
237237
template<typename WorkVec>
238238
void DTFilterCPU::prepareSrcImg_IC(const Mat& src, Mat& dst, Mat& dstT)
239239
{
240-
Mat dstOut(src.rows, src.cols + 2, WorkVec::type);
241-
Mat dstOutT(src.cols, src.rows + 2, WorkVec::type);
240+
Mat dstOut(src.rows, src.cols + 2, traits::Type<WorkVec>::value);
241+
Mat dstOutT(src.cols, src.rows + 2, traits::Type<WorkVec>::value);
242242

243243
dst = dstOut(Range::all(), Range(1, src.cols+1));
244244
dstT = dstOutT(Range::all(), Range(1, src.rows+1));
245245

246-
src.convertTo(dst, WorkVec::type);
246+
src.convertTo(dst, traits::Type<WorkVec>::value);
247247

248248
WorkVec *line;
249249
int ri = dstOut.cols - 1;
@@ -270,7 +270,7 @@ template <typename WorkVec>
270270
DTFilterCPU::FilterNC_horPass<WorkVec>::FilterNC_horPass(Mat& src_, Mat& idist_, Mat& dst_)
271271
: src(src_), idist(idist_), dst(dst_), radius(1.0f)
272272
{
273-
CV_DbgAssert(src.type() == WorkVec::type && dst.type() == WorkVec::type && dst.rows == src.cols && dst.cols == src.rows);
273+
CV_DbgAssert(src.type() == traits::Type<WorkVec>::value && dst.type() == traits::Type<WorkVec>::value && dst.rows == src.cols && dst.cols == src.rows);
274274
}
275275

276276
template <typename WorkVec>
@@ -324,12 +324,12 @@ template <typename WorkVec>
324324
DTFilterCPU::FilterIC_horPass<WorkVec>::FilterIC_horPass(Mat& src_, Mat& idist_, Mat& dist_, Mat& dst_)
325325
: src(src_), idist(idist_), dist(dist_), dst(dst_), radius(1.0f)
326326
{
327-
CV_DbgAssert(src.type() == WorkVec::type && dst.type() == WorkVec::type && dst.rows == src.cols && dst.cols == src.rows);
327+
CV_DbgAssert(src.type() == traits::Type<WorkVec>::value && dst.type() == traits::Type<WorkVec>::value && dst.rows == src.cols && dst.cols == src.rows);
328328

329329
#ifdef CV_GET_NUM_THREAD_WORKS_PROPERLY
330-
isrcBuf.create(cv::getNumThreads(), src.cols + 1, WorkVec::type);
330+
isrcBuf.create(cv::getNumThreads(), src.cols + 1, traits::Type<WorkVec>::value);
331331
#else
332-
isrcBuf.create(src.rows, src.cols + 1, WorkVec::type);
332+
isrcBuf.create(src.rows, src.cols + 1, traits::Type<WorkVec>::value);
333333
#endif
334334
}
335335

@@ -384,8 +384,8 @@ template <typename WorkVec>
384384
DTFilterCPU::FilterRF_horPass<WorkVec>::FilterRF_horPass(Mat& res_, Mat& alphaD_, int iteration_)
385385
: res(res_), alphaD(alphaD_), iteration(iteration_)
386386
{
387-
CV_DbgAssert(res.type() == WorkVec::type);
388-
CV_DbgAssert(res.type() == WorkVec::type && res.size() == res.size());
387+
CV_DbgAssert(res.type() == traits::Type<WorkVec>::value);
388+
CV_DbgAssert(res.type() == traits::Type<WorkVec>::value && res.size() == res.size());
389389
}
390390

391391

@@ -421,8 +421,8 @@ template <typename WorkVec>
421421
DTFilterCPU::FilterRF_vertPass<WorkVec>::FilterRF_vertPass(Mat& res_, Mat& alphaD_, int iteration_)
422422
: res(res_), alphaD(alphaD_), iteration(iteration_)
423423
{
424-
CV_DbgAssert(res.type() == WorkVec::type);
425-
CV_DbgAssert(res.type() == WorkVec::type && res.size() == res.size());
424+
CV_DbgAssert(res.type() == traits::Type<WorkVec>::value);
425+
CV_DbgAssert(res.type() == traits::Type<WorkVec>::value && res.size() == res.size());
426426
}
427427

428428

@@ -470,7 +470,7 @@ template <typename GuideVec>
470470
DTFilterCPU::ComputeIDTHor_ParBody<GuideVec>::ComputeIDTHor_ParBody(DTFilterCPU& dtf_, Mat& guide_, Mat& dst_)
471471
: dtf(dtf_), guide(guide_), dst(dst_)
472472
{
473-
dst.create(guide.rows, guide.cols + 1, IDistVec::type);
473+
dst.create(guide.rows, guide.cols + 1, traits::Type<IDistVec>::value);
474474
}
475475

476476
template <typename GuideVec>
@@ -497,8 +497,8 @@ template <typename GuideVec>
497497
DTFilterCPU::ComputeDTandIDTHor_ParBody<GuideVec>::ComputeDTandIDTHor_ParBody(DTFilterCPU& dtf_, Mat& guide_, Mat& dist_, Mat& idist_)
498498
: dtf(dtf_), guide(guide_), dist(dist_), idist(idist_)
499499
{
500-
dist = getWExtendedMat(guide.rows, guide.cols, IDistVec::type, 1, 1);
501-
idist = getWExtendedMat(guide.rows, guide.cols + 1, IDistVec::type);
500+
dist = getWExtendedMat(guide.rows, guide.cols, traits::Type<IDistVec>::value, 1, 1);
501+
idist = getWExtendedMat(guide.rows, guide.cols + 1, traits::Type<IDistVec>::value);
502502
maxRadius = dtf.getIterRadius(1);
503503
}
504504

@@ -535,7 +535,7 @@ template <typename GuideVec>
535535
DTFilterCPU::ComputeA0DTHor_ParBody<GuideVec>::ComputeA0DTHor_ParBody(DTFilterCPU& dtf_, Mat& guide_)
536536
: dtf(dtf_), guide(guide_)
537537
{
538-
dtf.a0distHor.create(guide.rows, guide.cols - 1, DistVec::type);
538+
dtf.a0distHor.create(guide.rows, guide.cols - 1, traits::Type<DistVec>::value);
539539
lna = std::log(dtf.getIterAlpha(1));
540540
}
541541

@@ -565,7 +565,7 @@ template <typename GuideVec>
565565
DTFilterCPU::ComputeA0DTVert_ParBody<GuideVec>::ComputeA0DTVert_ParBody(DTFilterCPU& dtf_, Mat& guide_)
566566
: dtf(dtf_), guide(guide_)
567567
{
568-
dtf.a0distVert.create(guide.rows - 1, guide.cols, DistVec::type);
568+
dtf.a0distVert.create(guide.rows - 1, guide.cols, traits::Type<DistVec>::value);
569569
lna = std::log(dtf.getIterAlpha(1));
570570
}
571571

modules/ximgproc/src/fgs_filter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,16 @@ void FastGlobalSmootherFilterImpl::init(InputArray guide,double _lambda,double _
148148
num_iter = _num_iter;
149149
num_stripes = getNumThreads();
150150
int num_levels = 3*256*256;
151-
weights_LUT.create(1,num_levels,WorkVec::type);
151+
weights_LUT.create(1,num_levels,traits::Type<WorkVec>::value);
152152

153153
WorkType* LUT = (WorkType*)weights_LUT.ptr(0);
154154
parallel_for_(Range(0,num_stripes),ComputeLUT_ParBody(*this,LUT,num_stripes,num_levels));
155155

156156
w = guide.cols();
157157
h = guide.rows();
158-
Chor. create(h,w,WorkVec::type);
159-
Cvert. create(h,w,WorkVec::type);
160-
interD.create(h,w,WorkVec::type);
158+
Chor. create(h,w,traits::Type<WorkVec>::value);
159+
Cvert. create(h,w,traits::Type<WorkVec>::value);
160+
interD.create(h,w,traits::Type<WorkVec>::value);
161161
Mat guideMat = guide.getMat();
162162

163163
if(guide.channels() == 1)
@@ -201,8 +201,8 @@ void FastGlobalSmootherFilterImpl::filter(InputArray src, OutputArray dst)
201201
{
202202
lambda = lambda_ref;
203203
Mat cur_res = src_channels[i].clone();
204-
if(src.depth()!=WorkVec::type)
205-
cur_res.convertTo(cur_res,WorkVec::type);
204+
if(src.depth()!=traits::Type<WorkVec>::value)
205+
cur_res.convertTo(cur_res,traits::Type<WorkVec>::value);
206206

207207
for(int n=0;n<num_iter;n++)
208208
{
@@ -212,7 +212,7 @@ void FastGlobalSmootherFilterImpl::filter(InputArray src, OutputArray dst)
212212
}
213213

214214
Mat dstMat;
215-
if(src.depth()!=WorkVec::type)
215+
if(src.depth()!=traits::Type<WorkVec>::value)
216216
cur_res.convertTo(dstMat,src.depth());
217217
else
218218
dstMat = cur_res;

modules/ximgproc/src/joint_bilateral_filter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class JointBilateralFilter_32f : public ParallelLoopBody
7777
joint(joint_), src(src_), dst(dst_), radius(radius_), maxk(maxk_),
7878
scaleIndex(scaleIndex_), spaceOfs(spaceOfs_), spaceWeights(spaceWeights_), expLUT(expLUT_)
7979
{
80-
CV_DbgAssert(joint.type() == JointVec::type && src.type() == dst.type() && src.type() == SrcVec::type);
80+
CV_DbgAssert(joint.type() == traits::Type<JointVec>::value && src.type() == dst.type() && src.type() == traits::Type<SrcVec>::value);
8181
CV_DbgAssert(joint.rows == src.rows && src.rows == dst.rows + 2*radius);
8282
CV_DbgAssert(joint.cols == src.cols && src.cols == dst.cols + 2*radius);
8383
}
@@ -223,7 +223,7 @@ class JointBilateralFilter_8u : public ParallelLoopBody
223223
joint(joint_), src(src_), dst(dst_), radius(radius_), maxk(maxk_),
224224
spaceOfs(spaceOfs_), spaceWeights(spaceWeights_), expLUT(expLUT_)
225225
{
226-
CV_DbgAssert(joint.type() == JointVec::type && src.type() == dst.type() && src.type() == SrcVec::type);
226+
CV_DbgAssert(joint.type() == traits::Type<JointVec>::value && src.type() == dst.type() && src.type() == traits::Type<SrcVec>::value);
227227
CV_DbgAssert(joint.rows == src.rows && src.rows == dst.rows + 2 * radius);
228228
CV_DbgAssert(joint.cols == src.cols && src.cols == dst.cols + 2 * radius);
229229
}

modules/ximgproc/test/test_domain_transform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Mat getChessMat1px(Size sz, double whiteIntensity = 255)
168168
{
169169
typedef typename DataType<SrcVec>::channel_type SrcType;
170170

171-
Mat dst(sz, DataType<SrcVec>::type);
171+
Mat dst(sz, traits::Type<SrcVec>::value);
172172

173173
SrcVec black = SrcVec::all(0);
174174
SrcVec white = SrcVec::all((SrcType)whiteIntensity);

modules/ximgproc/test/test_joint_bilateral_filter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ template<typename JointVec, typename SrcVec>
113113
void jointBilateralFilterNaive_(InputArray joint_, InputArray src_, OutputArray dst_, int d, double sigmaColor, double sigmaSpace, int borderType)
114114
{
115115
CV_Assert(joint_.size() == src_.size());
116-
CV_Assert(joint_.type() == JointVec::type && src_.type() == SrcVec::type);
116+
CV_Assert(joint_.type() == traits::Type<JointVec>::value && src_.type() == traits::Type<SrcVec>::value);
117117
typedef Vec<float, SrcVec::channels> SrcVecf;
118118

119119
if (sigmaColor <= 0)

modules/ximgproc/test/test_structured_edge_detection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ TEST(ximpgroc_StructuredEdgeDetection, regression)
2222

2323
cv::String previousResultName = dir + cv::format( "results/%02d.png", i + 1 );
2424
cv::Mat previousResult = cv::imread( previousResultName, 0 );
25-
previousResult.convertTo( previousResult, cv::DataType<float>::type, 1/255.0 );
25+
previousResult.convertTo( previousResult, CV_32F, 1/255.0 );
2626

27-
src.convertTo( src, cv::DataType<float>::type, 1/255.0 );
27+
src.convertTo( src, CV_32F, 1/255.0 );
2828

2929
cv::Mat currentResult( src.size(), src.type() );
3030
pDollar->detectEdges( src, currentResult );

0 commit comments

Comments
 (0)