Skip to content

Do not use = 0 for a cv::Mat. #2987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/bgsegm/src/synthetic_seq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void SyntheticSequenceGenerator::getNextFrame(OutputArray _frame, OutputArray _g

_gtMask.create(sz, CV_8U);
Mat gtMask = _gtMask.getMat();
gtMask = 0;
gtMask.setTo(cv::Scalar::all(0));
gtMask(Rect(Point2i(pos), objSz)) = 255;

pos += dir * objspeed;
Expand Down
4 changes: 2 additions & 2 deletions modules/img_hash/src/radial_variance_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ class RadialVarianceHashImpl CV_FINAL : public ImgHashBase::ImgHashImpl
//Different with PHash, this part reverse the row size and col size,
//because cv::Mat is row major but not column major
projections_.create(numOfAngelLine_, D, CV_8U);
projections_ = 0;
projections_.setTo(cv::Scalar::all(0));
pixPerLine_.create(1, numOfAngelLine_, CV_32S);
pixPerLine_ = 0;
pixPerLine_.setTo(cv::Scalar::all(0));
int const xOff = createOffSet(input.cols);
int const yOff = createOffSet(input.rows);

Expand Down
4 changes: 2 additions & 2 deletions modules/text/src/erfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4030,8 +4030,8 @@ void MSERsToERStats(InputArray image, vector<vector<Point> > &contours, vector<v
mser_regions[1].push_back(cser);
}

mask(cser.rect) = 0;
mtmp(cser.rect) = 0;
mask(cser.rect).setTo(cv::Scalar::all(0));
mtmp(cser.rect).setTo(cv::Scalar::all(0));
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/xfeatures2d/src/pct_signatures/pct_clusterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ namespace cv
{
// Prepare space for new centroid values.
Mat tmpCentroids(clusters.size(), clusters.type());
tmpCentroids = 0;
tmpCentroids.setTo(cv::Scalar::all(0));

// Clear weights for new iteration.
clusters(Rect(WEIGHT_IDX, 0, 1, clusters.rows)) = 0;
clusters(Rect(WEIGHT_IDX, 0, 1, clusters.rows)).setTo(cv::Scalar::all(0));

// Compute affiliation of points and sum new coordinates for centroids.
for (int iSample = 0; iSample < samples.rows; iSample++)
Expand Down
4 changes: 2 additions & 2 deletions modules/ximgproc/src/fast_line_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ void FastLineDetectorImpl::lineDetection(const Mat& src, std::vector<SEGMENT>& s
{
Canny(src, canny, canny_th1, canny_th2, canny_aperture_size);
}
canny.colRange(0,6).rowRange(0,6) = 0;
canny.colRange(src.cols-5,src.cols).rowRange(src.rows-5,src.rows) = 0;
canny.colRange(0,6).rowRange(0,6).setTo(cv::Scalar::all(0));
canny.colRange(src.cols-5,src.cols).rowRange(src.rows-5,src.rows).setTo(cv::Scalar::all(0));

SEGMENT seg, seg1, seg2;

Expand Down