mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Fixed several issues found by static analysis
This commit is contained in:
parent
3a062eed5b
commit
dd5976162b
@ -72,6 +72,7 @@ private:
|
||||
cv::Matx<double, 9, 1> r_hat;
|
||||
cv::Matx<double, 3, 1> t;
|
||||
double sq_error;
|
||||
SQPSolution() : sq_error(0) {}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1409,7 +1409,15 @@ struct ExpFunctor : public BaseFunctor
|
||||
ExpFunctor(float base_ = -1.f, float scale_ = 1.f, float shift_ = 0.f)
|
||||
: base(base_), scale(scale_), shift(shift_)
|
||||
{
|
||||
// For base > 0 :
|
||||
// y = base^(scale * input + shift)
|
||||
// ln(y) = ln(base)*(scale * input + shift)
|
||||
// y = exp((ln(base)*scale) * input + (ln(base)*shift))
|
||||
// y = exp(normalized_scale * input + normalized_shift)
|
||||
CV_Check(base, base == -1.f || base > 0.f, "Unsupported 'base' value");
|
||||
const float ln_base = (base == -1.f) ? 1.f : log(base);
|
||||
normScale = scale * ln_base;
|
||||
normShift = shift * ln_base;
|
||||
}
|
||||
|
||||
bool supportBackend(int backendId, int targetId)
|
||||
@ -1418,19 +1426,6 @@ struct ExpFunctor : public BaseFunctor
|
||||
backendId == DNN_BACKEND_HALIDE || backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH;
|
||||
}
|
||||
|
||||
void finalize()
|
||||
{
|
||||
// For base > 0 :
|
||||
// y = base^(scale * input + shift)
|
||||
// ln(y) = ln(base)*(scale * input + shift)
|
||||
// y = exp((ln(base)*scale) * input + (ln(base)*shift))
|
||||
// y = exp(normalized_scale * input + normalized_shift)
|
||||
|
||||
float ln_base = (base == -1.f) ? 1.f : log(base);
|
||||
normScale = scale * ln_base;
|
||||
normShift = shift * ln_base;
|
||||
}
|
||||
|
||||
void apply(const float* srcptr, float* dstptr, int len, size_t planeSize, int cn0, int cn1) const
|
||||
{
|
||||
float a = normScale, b = normShift;
|
||||
|
@ -917,7 +917,7 @@ public:
|
||||
if (max_elem!=last)
|
||||
{
|
||||
dstData[x0] = *max_elem;
|
||||
if( compMaxIdx )
|
||||
if( compMaxIdx && dstMaskData )
|
||||
{
|
||||
dstMaskData[x0] = std::distance(first, max_elem);
|
||||
}
|
||||
|
@ -1213,6 +1213,7 @@ struct TextDetectionModel_DB_Impl : public TextDetectionModel_Impl
|
||||
{
|
||||
double area = contourArea(inPoly);
|
||||
double length = arcLength(inPoly, true);
|
||||
CV_Assert(length > FLT_EPSILON);
|
||||
double distance = area * unclipRatio / length;
|
||||
|
||||
size_t numPoints = inPoly.size();
|
||||
|
@ -314,7 +314,7 @@ class SourceReaderCB : public IMFSourceReaderCallback
|
||||
{
|
||||
public:
|
||||
SourceReaderCB() :
|
||||
m_nRefCount(0), m_hEvent(CreateEvent(NULL, FALSE, FALSE, NULL)), m_bEOS(FALSE), m_hrStatus(S_OK), m_reader(NULL), m_dwStreamIndex(0)
|
||||
m_nRefCount(0), m_hEvent(CreateEvent(NULL, FALSE, FALSE, NULL)), m_bEOS(FALSE), m_hrStatus(S_OK), m_reader(NULL), m_dwStreamIndex(0), m_lastSampleTimestamp(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user