Skip to content
Merged
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
8 changes: 4 additions & 4 deletions modules/ximgproc/src/find_ellipses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1301,12 +1301,12 @@ void EllipseDetectorImpl::preProcessing(Mat1b &src, Mat1b &dp, Mat1b &dn) {
// 2 - the pixel does belong to an edge
for (int i = 0; i <= imgSize.height; i++) {
int *tmpMag = magBuffer[(i > 0) + 1] + 1;
const short *tmpDx = dx.ptr<short>(i);
const short *tmpDy = dy.ptr<short>(i);
uchar *tmpMap;
int prevFlag = 0;

if (i < imgSize.height) {
const short *tmpDx = dx.ptr<short>(i);
const short *tmpDy = dy.ptr<short>(i);
tmpMag[-1] = tmpMag[imgSize.width] = 0;
for (int j = 0; j < imgSize.width; j++)
tmpMag[j] = abs(tmpDx[j]) + abs(tmpDy[j]);
Expand All @@ -1322,8 +1322,8 @@ void EllipseDetectorImpl::preProcessing(Mat1b &src, Mat1b &dp, Mat1b &dn) {
tmpMap[-1] = tmpMap[imgSize.width] = 1;

tmpMag = magBuffer[1] + 1; // take the central row
tmpDx = (short *) (dx[i - 1]);
tmpDy = (short *) (dy[i - 1]);
const short *tmpDx = dx.ptr<short>(i - 1);
const short *tmpDy = dy.ptr<short>(i - 1);

ptrdiff_t magStep1, magStep2;
magStep1 = magBuffer[2] - magBuffer[1];
Expand Down