avoid Ptr<> == NULL checks
This commit is contained in:
parent
64b3c1e691
commit
df8b057b44
@ -384,21 +384,14 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
if (_src.dims() <= 2)
|
||||
{
|
||||
bool ok = false;
|
||||
Ptr<ParallelLoopBody> body;
|
||||
|
||||
if (body == NULL || ok == false)
|
||||
{
|
||||
ok = false;
|
||||
ParallelLoopBody* p = new LUTParallelBody(src, lut, dst, &ok);
|
||||
body.reset(p);
|
||||
}
|
||||
if (body != NULL && ok)
|
||||
LUTParallelBody body(src, lut, dst, &ok);
|
||||
if (ok)
|
||||
{
|
||||
Range all(0, dst.rows);
|
||||
if (dst.total()>>18)
|
||||
parallel_for_(all, *body, (double)std::max((size_t)1, dst.total()>>16));
|
||||
if (dst.total() >= (size_t)(1<<18))
|
||||
parallel_for_(all, body, (double)std::max((size_t)1, dst.total()>>16));
|
||||
else
|
||||
(*body)(all);
|
||||
body(all);
|
||||
if (ok)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
|
||||
return;
|
||||
}
|
||||
Ptr<CvSparseMat> m((CvSparseMat*)cvRead((CvFileStorage*)node.fs, (CvFileNode*)*node));
|
||||
CV_Assert(CV_IS_SPARSE_MAT(m));
|
||||
CV_Assert(CV_IS_SPARSE_MAT(m.get()));
|
||||
m->copyToSparseMat(mat);
|
||||
}
|
||||
|
||||
|
||||
@ -288,9 +288,9 @@ protected:
|
||||
fs["test_sparse_mat"] >> m_s2;
|
||||
Ptr<CvSparseMat> _m_s2(cvCreateSparseMat(m_s2));
|
||||
|
||||
if( !m_s || !CV_IS_SPARSE_MAT(m_s) ||
|
||||
!cvTsCheckSparse(m_s, _test_sparse, 0) ||
|
||||
!cvTsCheckSparse(_m_s2, _test_sparse, 0))
|
||||
if( !m_s || !CV_IS_SPARSE_MAT(m_s.get()) ||
|
||||
!cvTsCheckSparse(m_s.get(), _test_sparse.get(), 0) ||
|
||||
!cvTsCheckSparse(_m_s2.get(), _test_sparse.get(), 0))
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "the read sparse matrix is not correct\n" );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
|
||||
|
||||
@ -1820,7 +1820,7 @@ void OCL4DNNConvSpatial<Dtype>::prepareKernel(const UMat &bottom, UMat &top,
|
||||
std::string previous_key = key_;
|
||||
|
||||
generateKey();
|
||||
if (key_.compare(previous_key) == 0 && bestKernelConfig != NULL)
|
||||
if (key_.compare(previous_key) == 0 && bestKernelConfig)
|
||||
return;
|
||||
|
||||
if (bestKernelConfig)
|
||||
|
||||
@ -237,7 +237,7 @@ TEST(ML_ANN, ActivationFunction)
|
||||
x->save(dataname + activationName[i] + ".yml");
|
||||
#else
|
||||
Ptr<ml::ANN_MLP> y = Algorithm::load<ANN_MLP>(dataname + activationName[i] + ".yml");
|
||||
ASSERT_TRUE(y != NULL) << "Could not load " << dataname + activationName[i] + ".yml";
|
||||
ASSERT_TRUE(y) << "Could not load " << dataname + activationName[i] + ".yml";
|
||||
Mat testSamples = tdata->getTestSamples();
|
||||
Mat rx, ry, dst;
|
||||
x->predict(testSamples, rx);
|
||||
@ -330,7 +330,7 @@ TEST_P(ML_ANN_METHOD, Test)
|
||||
#endif
|
||||
ASSERT_FALSE(r_gold.empty());
|
||||
Ptr<ml::ANN_MLP> y = Algorithm::load<ANN_MLP>(filename);
|
||||
ASSERT_TRUE(y != NULL) << "Could not load " << filename;
|
||||
ASSERT_TRUE(y) << "Could not load " << filename;
|
||||
Mat rx, ry;
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
|
||||
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
|
||||
vector<Rect> zone;
|
||||
vector<vector <Point> > region;
|
||||
Mat desc, result(img.rows, img.cols, CV_8UC3);
|
||||
if (b.dynamicCast<SimpleBlobDetector>() != NULL)
|
||||
if (b.dynamicCast<SimpleBlobDetector>().get())
|
||||
{
|
||||
Ptr<SimpleBlobDetector> sbd = b.dynamicCast<SimpleBlobDetector>();
|
||||
sbd->detect(img, keyImg, Mat());
|
||||
|
||||
@ -500,7 +500,7 @@ int main(int argc, char *argv[])
|
||||
vector<vector <Point> > region;
|
||||
Mat desc;
|
||||
|
||||
if (b.dynamicCast<MSER>() != NULL)
|
||||
if (b.dynamicCast<MSER>().get())
|
||||
{
|
||||
Ptr<MSER> sbd = b.dynamicCast<MSER>();
|
||||
sbd->detectRegions(img, region, zone);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user