Skip to content

Commit

Permalink
Fix various warnings detected with msvc17
Browse files Browse the repository at this point in the history
  • Loading branch information
fspindle committed Mar 11, 2024
1 parent df52602 commit 2c238c6
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 64 deletions.
31 changes: 24 additions & 7 deletions modules/core/include/visp3/core/vpArray2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,25 @@ template <class Type> class vpArray2D

// Reallocation of this->data array
this->dsize = nrows * ncols;
this->data = (Type *)realloc(this->data, this->dsize * sizeof(Type));
if (this->data) {
Type *tmp = (Type*)realloc(this->data, this->dsize * sizeof(Type));
if (tmp) {
this->data = tmp;
}
}
if ((nullptr == this->data) && (0 != this->dsize)) {
if (copyTmp != nullptr) {
delete[] copyTmp;
}
throw(vpException(vpException::memoryAllocationError, "Memory allocation error when allocating 2D array data"));
}

this->rowPtrs = (Type **)realloc(this->rowPtrs, nrows * sizeof(Type *));
if (this->rowPtrs) {
Type **tmp = (Type**)realloc(this->rowPtrs, nrows * sizeof(Type*));
if (tmp) {
this->rowPtrs = tmp;
}
}
if ((nullptr == this->rowPtrs) && (0 != this->dsize)) {
if (copyTmp != nullptr) {
delete[] copyTmp;
Expand Down Expand Up @@ -389,11 +399,18 @@ template <class Type> class vpArray2D

rowNum = nrows;
colNum = ncols;
rowPtrs = reinterpret_cast<Type **>(realloc(rowPtrs, nrows * sizeof(Type *)));
// Update rowPtrs
Type **t_ = rowPtrs;
for (unsigned int i = 0; i < dsize; i += ncols) {
*t_++ = data + i;
if (rowPtrs) {
Type **tmp = reinterpret_cast<Type**>(realloc(rowPtrs, nrows * sizeof(Type*)));
if (tmp) {
this->rowPtrs = tmp;
}
}
if (rowPtrs) {
// Update rowPtrs
Type** t_ = rowPtrs;
for (unsigned int i = 0; i < dsize; i += ncols) {
*t_++ = data + i;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion modules/core/include/visp3/core/vpImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,9 @@ vpImage<Type>::vpImage(const vpImage<Type> &I)
: bitmap(nullptr), display(nullptr), npixels(0), width(0), height(0), row(nullptr), hasOwnership(true)
{
resize(I.getHeight(), I.getWidth());
memcpy(static_cast<void *>(bitmap), static_cast<void *>(I.bitmap), I.npixels * sizeof(Type));
if (bitmap) {
memcpy(static_cast<void*>(bitmap), static_cast<void*>(I.bitmap), I.npixels * sizeof(Type));
}
}

#if ((__cplusplus >= 201103L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L))) // Check if cxx11 or higher
Expand Down
8 changes: 4 additions & 4 deletions modules/core/include/visp3/core/vpImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class VISP_EXPORT vpImageFilter
}
else {
// Need to reset the image because some points will not be computed
I.resize(height, width, static_cast<ImageType>(0.));
I.resize(height, width, static_cast<ImageType>(0));
}
}

Expand Down Expand Up @@ -227,7 +227,7 @@ class VISP_EXPORT vpImageFilter
cv::Mat cv_I, cv_dIx, cv_dIy;
vpImageConvert::convert(I, cv_I);
computePartialDerivatives(cv_I, cv_dIx, cv_dIy, computeDx, computeDy, normalize, gaussianKernelSize,
gaussianStdev, apertureGradient, filteringType);
static_cast<float>(gaussianStdev), apertureGradient, filteringType);
if (computeDx) {
vpImageConvert::convert(cv_dIx, dIx);
}
Expand Down Expand Up @@ -796,9 +796,9 @@ class VISP_EXPORT vpImageFilter
FilterType result = static_cast<FilterType>(0.);

for (unsigned int i = 1; i <= stop; ++i) {
result += filter[i] * static_cast<double>(I[r][c + i] + I[r][c - i]);
result += filter[i] * static_cast<FilterType>(I[r][c + i] + I[r][c - i]);
}
return result + filter[0] * static_cast<double>(I[r][c]);
return result + filter[0] * static_cast<FilterType>(I[r][c]);
}

#ifndef DOXYGEN_SHOULD_SKIP_THIS
Expand Down
5 changes: 3 additions & 2 deletions modules/core/include/visp3/core/vpImageTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <iostream>
#include <math.h>
#include <string.h>
#include <cmath>

#if defined(_OPENMP)
#include <omp.h>
Expand Down Expand Up @@ -1113,12 +1114,12 @@ void vpImageTools::resize(const vpImage<Type> &I, vpImage<Type> &Ires, const vpI
#endif
for (int i = 0; i < static_cast<int>(Ires.getHeight()); i++) {
const float v = (i + half) * scaleY - half;
const int v0 = static_cast<int>(v);
const float v0 = std::floor(v);
const float yFrac = v - v0;

for (unsigned int j = 0; j < Ires.getWidth(); j++) {
const float u = (j + half) * scaleX - half;
const int u0 = static_cast<int>(u);
const float u0 = std::floor(u);
const float xFrac = u - u0;

if (method == INTERPOLATION_NEAREST) {
Expand Down
4 changes: 2 additions & 2 deletions modules/core/include/visp3/core/vpMunkres.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ inline vpMunkres::STEP_T vpMunkres::stepSix(std::vector<std::vector<Type> > &cos
template <typename Type>
inline std::vector<std::pair<unsigned int, unsigned int> > vpMunkres::run(std::vector<std::vector<Type> > costs)
{
const auto original_row_size = costs.size();
const auto original_col_size = costs.front().size();
const auto original_row_size = static_cast<Type>(costs.size());
const auto original_col_size = static_cast<Type>(costs.front().size());
const auto sq_size = std::max<Type>(original_row_size, original_col_size);

auto mask = std::vector<std::vector<vpMunkres::ZERO_T> >(
Expand Down
18 changes: 9 additions & 9 deletions modules/core/src/image/vpImageCircle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ void incrementIfIsInMask(const vpImage<bool> &mask, const int &width, const int

unsigned int vpImageCircle::computePixelsInMask(const vpImage<bool> &mask) const
{
const int xm = m_center.get_u(), ym = m_center.get_v();
const float xm = static_cast<float>(m_center.get_u()), ym = static_cast<float>(m_center.get_v());
const float r_float = static_cast<float>(m_radius);
const int width = mask.getWidth();
const int height = mask.getHeight();
Expand Down Expand Up @@ -1073,14 +1073,14 @@ unsigned int vpImageCircle::computePixelsInMask(const vpImage<bool> &mask) const
float sin_theta = std::sin(theta);
float rcos_pos = r_float * cos_theta;
float rsin_pos = r_float * sin_theta;
x1 = xm + rcos_pos; // theta
y1 = ym + rsin_pos; // theta
x2 = xm - rsin_pos; // theta + pi
y2 = ym + rcos_pos; // theta + pi
x3 = xm - rcos_pos; // theta + pi/2
y3 = ym - rsin_pos; // theta + pi/2
x4 = xm + rsin_pos; // theta + pi
y4 = ym - rcos_pos; // theta + pi
x1 = static_cast<int>(xm + rcos_pos); // theta
y1 = static_cast<int>(ym + rsin_pos); // theta
x2 = static_cast<int>(xm - rsin_pos); // theta + pi
y2 = static_cast<int>(ym + rcos_pos); // theta + pi
x3 = static_cast<int>(xm - rcos_pos); // theta + pi/2
y3 = static_cast<int>(ym - rsin_pos); // theta + pi/2
x4 = static_cast<int>(xm + rsin_pos); // theta + pi
y4 = static_cast<int>(ym - rcos_pos); // theta + pi
incrementIfIsInMask(mask, width, height, x1, y1, count);
incrementIfIsInMask(mask, width, height, x2, y2, count);
incrementIfIsInMask(mask, width, height, x3, y3, count);
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/image/vpImageFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ void vpImageFilter::canny(const vpImage<unsigned char> &Isrc, vpImage<unsigned c
cannyFilteringSteps, p_mask);
}
else if (lowerCannyThresh < 0.f) {
lowerCannyThresh = upperCannyThresh / 3.;
lowerCannyThresh = upperCannyThresh / 3.f;
}
vpCannyEdgeDetection edgeDetector(gaussianFilterSize, gaussianStdev, apertureGradient, lowerCannyThresh, upperCannyThresh,
lowerThresholdRatio, upperThresholdRatio, cannyFilteringSteps);
Expand Down
18 changes: 9 additions & 9 deletions modules/imgproc/src/vpImgproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void gammaCorrectionLogMethod(vpImage<unsigned char> &I, const vpImage<bool> *p_
I.getMinMaxValue(inputMin, inputMax);
unsigned char inputRange = inputMax - inputMin;

float gamma_computed = (std::log(128.f) - std::log(256.f)) / (std::log(mean) - std::log(inputRange));
float gamma_computed = static_cast<float>((std::log(128.f) - std::log(256.f)) / (std::log(mean) - std::log(inputRange)));
float inverse_gamma = 1.f / gamma_computed;

// Construct the look-up table
Expand Down Expand Up @@ -397,19 +397,19 @@ void gammaCorrectionClassificationBasedMethod(vpImage<unsigned char> &I, const v
float gamma = 0.f;
if (isAlreadyHighContrast) {
// Case medium to high contrast image
gamma = std::exp((1.f - (meanNormalized + stdevNormalized))/2.f);
gamma = static_cast<float>(std::exp((1.f - (meanNormalized + stdevNormalized))/2.f));
}
else {
// Case low contrast image
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
gamma = -std::log2(stdevNormalized);
gamma = -static_cast<float>(std::log2(stdevNormalized));
#else
gamma = -std::log(stdevNormalized) / std::log(2);
gamma = -static_cast<float>(std::log(stdevNormalized) / std::log(2));
#endif
}
if (meanNormalized < 0.5) {
// Case dark image
float meanPowerGamma = std::pow(meanNormalized, gamma);
float meanPowerGamma = static_cast<float>(std::pow(meanNormalized, gamma));
for (unsigned int i = 0; i <= 255; i++) {
float iNormalized = static_cast<float>(i)/255.f;
float iPowerGamma = std::pow(iNormalized, gamma);
Expand Down Expand Up @@ -500,7 +500,7 @@ void gammaCorrectionSpatialBased(vpImage<unsigned char> &I, const vpImage<bool>
vpImageTools::resize(I_8_blur, L_8, width, height, vpImageTools::INTERPOLATION_CUBIC);
const float alpha = 0.5f;
unsigned int size = height * width;
float stdev = I.getStdev(p_mask);
float stdev = static_cast<float>(I.getStdev(p_mask));
float p;
if (stdev <= 40) {
p = 2.f;
Expand Down Expand Up @@ -546,7 +546,7 @@ void gammaCorrectionSpatialBased(vpImage<vpRGBa> &I, const vpImage<bool> *p_mask
vpImage<unsigned char> I_gray(height, width);
for (unsigned int i = 0; i < size; ++i) {
vpRGBa rgb = I.bitmap[i];
I_gray.bitmap[i] = 0.299 * rgb.R + 0.587 * rgb.G + 0.114 *rgb.B;
I_gray.bitmap[i] = static_cast<unsigned char>(0.299 * rgb.R + 0.587 * rgb.G + 0.114 * rgb.B);
}
vpImage<unsigned char> I_2, I_4, I_8;
I_gray.subsample(2, 2, I_2);
Expand All @@ -565,7 +565,7 @@ void gammaCorrectionSpatialBased(vpImage<vpRGBa> &I, const vpImage<bool> *p_mask
vpImageTools::resize(I_8_blur, L_8, width, height, vpImageTools::INTERPOLATION_CUBIC);
const float alpha = 0.5f;

float stdev = I.getStdev(p_mask);
float stdev = static_cast<float>(I.getStdev(p_mask));
float p;
if (stdev <= 40) {
p = 2.f;
Expand Down Expand Up @@ -601,7 +601,7 @@ void gammaCorrection(vpImage<unsigned char> &I, const float &gamma, const vpGamm
{
float inverse_gamma = 1.0;
if ((gamma > 0) && (method == GAMMA_MANUAL)) {
inverse_gamma = 1.0 / gamma;
inverse_gamma = 1.0f / gamma;
// Construct the look-up table
unsigned char lut[256];
for (unsigned int i = 0; i < 256; i++) {
Expand Down
4 changes: 2 additions & 2 deletions modules/imgproc/test/with-dataset/testImgproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int main(int argc, const char **argv)

// Gamma correction
vpImage<vpRGBa> I_color_gamma_correction;
double gamma = 2.2;
float gamma = 2.2f;
t = vpTime::measureTimeMs();
vp::gammaCorrection(I_color, I_color_gamma_correction, gamma);
t = vpTime::measureTimeMs() - t;
Expand Down Expand Up @@ -376,7 +376,7 @@ int main(int argc, const char **argv)

// Gamma correction
vpImage<unsigned char> I_gamma_correction;
gamma = 1.8;
gamma = 1.8f;
t = vpTime::measureTimeMs();
vp::gammaCorrection(I, I_gamma_correction, gamma);
t = vpTime::measureTimeMs() - t;
Expand Down
4 changes: 2 additions & 2 deletions modules/io/src/image/private/vpImageIoOpenCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void readOpenCV(vpImage<vpRGBf> &I, const std::string &filename)
*/
void readPNGfromMemOpenCV(const std::vector<unsigned char> &buffer, vpImage<unsigned char> &I)
{
cv::Mat1b buf(buffer.size(), 1, const_cast<unsigned char *>(buffer.data()));
cv::Mat1b buf(static_cast<int>(buffer.size()), 1, const_cast<unsigned char *>(buffer.data()));
cv::Mat1b img = cv::imdecode(buf, cv::IMREAD_GRAYSCALE);
I.resize(img.rows, img.cols);
std::copy(img.begin(), img.end(), I.bitmap);
Expand All @@ -189,7 +189,7 @@ void readPNGfromMemOpenCV(const std::vector<unsigned char> &buffer, vpImage<unsi
*/
void readPNGfromMemOpenCV(const std::vector<unsigned char> &buffer, vpImage<vpRGBa> &I_color)
{
cv::Mat1b buf(buffer.size(), 1, const_cast<unsigned char *>(buffer.data()));
cv::Mat1b buf(static_cast<int>(buffer.size()), 1, const_cast<unsigned char *>(buffer.data()));
cv::Mat3b img = cv::imdecode(buf, cv::IMREAD_COLOR);
vpImageConvert::convert(img, I_color);
}
Expand Down
4 changes: 2 additions & 2 deletions modules/io/src/image/private/vpImageIoStb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void readPNGfromMemStb(const std::vector<unsigned char> &buffer, vpImage<unsigne
{
int x = 0, y = 0, comp = 0;
const int req_channels = 1;
unsigned char *buffer_read = stbi_load_from_memory(buffer.data(), buffer.size(), &x, &y, &comp, req_channels);
unsigned char *buffer_read = stbi_load_from_memory(buffer.data(), static_cast<int>(buffer.size()), &x, &y, &comp, req_channels);
assert(comp == req_channels);

I.init(buffer_read, y, x, true);
Expand All @@ -165,7 +165,7 @@ void readPNGfromMemStb(const std::vector<unsigned char> &buffer, vpImage<unsigne
void readPNGfromMemStb(const std::vector<unsigned char> &buffer, vpImage<vpRGBa> &I_color)
{
int x = 0, y = 0, comp = 0;
unsigned char *buffer_read = stbi_load_from_memory(buffer.data(), buffer.size(), &x, &y, &comp, 0);
unsigned char *buffer_read = stbi_load_from_memory(buffer.data(), static_cast<int>(buffer.size()), &x, &y, &comp, 0);

if (comp == 4) {
const bool copyData = true;
Expand Down
4 changes: 2 additions & 2 deletions modules/robot/src/real-robot/pololu-maestro/vpPololu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ unsigned short vpPololu::radToPwm(float angle) const
float a = m_range_pwm / m_range_angle;
float b = m_min_pwm - m_min_angle * a;

return (a * angle + b);
return static_cast<unsigned short>(a * angle + b);
}

bool vpPololu::connected() const
Expand Down Expand Up @@ -194,7 +194,7 @@ void vpPololu::setAngularPosition(float pos_rad, float vel_rad_s)
{
if ((m_min_angle <= pos_rad) && (pos_rad <= m_max_angle)) {
unsigned short pos_pwm = radToPwm(pos_rad);
unsigned short pos_speed = std::fabs(radSToSpeed(vel_rad_s));
unsigned short pos_speed = static_cast<unsigned short>(std::fabs(radSToSpeed(vel_rad_s)));
// Handle the case where pos_speed = 0 which corresponds to the pwm max speed
if (pos_speed == 0) {
pos_speed = 1;
Expand Down
6 changes: 4 additions & 2 deletions modules/tracker/mbt/src/edge/vpMbtMeLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ void vpMbtMeLine::sample(const vpImage<unsigned char> &I, bool doNoTrack)
vpImagePoint iP;
iP.set_i(is);
iP.set_j(js);
unsigned int is_uint = static_cast<unsigned int>(is);
unsigned int js_uint = static_cast<unsigned int>(js);
// If point is in the image, add to the sample list
if ((!outOfImage(iP, (int)(m_me->getRange() + m_me->getMaskSize() + 1), nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())
&& inMeMaskCandidates(m_maskCandidates, iP.get_i(), iP.get_j())) {
if ((!outOfImage(iP, (int)(m_me->getRange() + m_me->getMaskSize() + 1), nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)
&& inMeMaskCandidates(m_maskCandidates, is_uint, js_uint)) {
vpMeSite pix;
pix.init(iP.get_i(), iP.get_j(), m_delta, 0, m_sign);
pix.setDisplay(m_selectDisplay);
Expand Down
26 changes: 18 additions & 8 deletions modules/tracker/me/src/moving-edges/vpMeEllipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ vpMeEllipse::vpMeEllipse(const vpMeEllipse &me_ellipse)
m_alphamin(me_ellipse.m_alphamin), m_alphamax(me_ellipse.m_alphamax), m_uc(me_ellipse.m_uc), m_vc(me_ellipse.m_vc),
m_n20(me_ellipse.m_n20), m_n11(me_ellipse.m_n11), m_n02(me_ellipse.m_n02),
m_expectedDensity(me_ellipse.m_expectedDensity), m_numberOfGoodPoints(me_ellipse.m_numberOfGoodPoints),
m_trackCircle(me_ellipse.m_trackCircle), m_trackArc(me_ellipse.m_trackArc)
m_trackCircle(me_ellipse.m_trackCircle), m_trackArc(me_ellipse.m_trackArc), m_arcEpsilon(me_ellipse.m_arcEpsilon)
{ }

vpMeEllipse::~vpMeEllipse()
Expand Down Expand Up @@ -300,8 +300,10 @@ void vpMeEllipse::sample(const vpImage<unsigned char> &I, bool doNotTrack)
computePointOnEllipse(ang, iP);
// If point is in the image, add to the sample list
// Check done in (i,j) frame)
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())
&& inMeMaskCandidates(m_maskCandidates, iP.get_i(), iP.get_j())) {
unsigned int is_uint = static_cast<unsigned int>(iP.get_i());
unsigned int js_uint = static_cast<unsigned int>(iP.get_j());
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)
&& inMeMaskCandidates(m_maskCandidates, is_uint, js_uint)) {
const unsigned int crossSize = 5;
vpDisplay::displayCross(I, iP, crossSize, vpColor::red);

Expand Down Expand Up @@ -361,7 +363,9 @@ unsigned int vpMeEllipse::plugHoles(const vpImage<unsigned char> &I)
while (ang < (nextang - incr)) {
vpImagePoint iP;
computePointOnEllipse(ang, iP);
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())) {
unsigned int is_uint = static_cast<unsigned int>(iP.get_i());
unsigned int js_uint = static_cast<unsigned int>(iP.get_j());
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)) {
double theta = computeTheta(iP);
vpMeSite pix;
pix.init(iP.get_i(), iP.get_j(), theta);
Expand Down Expand Up @@ -420,7 +424,9 @@ unsigned int vpMeEllipse::plugHoles(const vpImage<unsigned char> &I)
ang = (nextang + ang) / 2.0; // point added at mid angle
vpImagePoint iP;
computePointOnEllipse(ang, iP);
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())) {
unsigned int is_uint = static_cast<unsigned int>(iP.get_i());
unsigned int js_uint = static_cast<unsigned int>(iP.get_j());
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)) {
double theta = computeTheta(iP);
vpMeSite pix;
pix.init(iP.get_i(), iP.get_j(), theta);
Expand Down Expand Up @@ -479,7 +485,9 @@ unsigned int vpMeEllipse::plugHoles(const vpImage<unsigned char> &I)
for (unsigned int i = 0; i < nbpts; ++i) {
vpImagePoint iP;
computePointOnEllipse(ang, iP);
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())) {
unsigned int is_uint = static_cast<unsigned int>(iP.get_i());
unsigned int js_uint = static_cast<unsigned int>(iP.get_j());
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)) {
double theta = computeTheta(iP);
vpMeSite pix;
pix.init(iP.get_i(), iP.get_j(), theta);
Expand Down Expand Up @@ -529,7 +537,9 @@ unsigned int vpMeEllipse::plugHoles(const vpImage<unsigned char> &I)
for (unsigned int i = 0; i < nbpts; ++i) {
vpImagePoint iP;
computePointOnEllipse(ang, iP);
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, iP.get_i(), iP.get_j())) {
unsigned int is_uint = static_cast<unsigned int>(iP.get_i());
unsigned int js_uint = static_cast<unsigned int>(iP.get_j());
if ((!outOfImage(iP, 0, nbrows, nbcols)) && inRoiMask(m_mask, is_uint, js_uint)) {
double theta = computeTheta(iP);
vpMeSite pix;
pix.init(iP.get_i(), iP.get_j(), theta);
Expand Down Expand Up @@ -1241,7 +1251,7 @@ void vpMeEllipse::initTracking(const vpImage<unsigned char> &I, const vpColVecto
computeAbeFromNij();
computeKiFromNij();

if (m_trackArc) {
if (m_trackArc && pt1 && pt2) {
m_alpha1 = computeAngleOnEllipse(*pt1);
m_alpha2 = computeAngleOnEllipse(*pt2);
if ((m_alpha2 <= m_alpha1) || (std::fabs(m_alpha2 - m_alpha1) < m_arcEpsilon)) {
Expand Down
Loading

0 comments on commit 2c238c6

Please sign in to comment.