提交 ebb9c615 编写于 作者: V Vadim Pisarevsky

fixed bug with Mat::dataend initialization. Now morph-ex test passes; Also...

fixed bug with Mat::dataend initialization. Now morph-ex test passes; Also fixed CV_Assert() implementation
上级 4a14795e
......@@ -199,11 +199,11 @@ CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback,
#ifdef __GNUC__
#define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, __func__, __FILE__, __LINE__) )
#define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, __func__, __FILE__, __LINE__) )
#define CV_Assert( expr ) do { if(!(expr)) cv::error( cv::Exception(CV_StsAssert, #expr, __func__, __FILE__, __LINE__) ); } while(0)
#define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, __func__, __FILE__, __LINE__) )
#else
#define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, "", __FILE__, __LINE__) )
#define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, "", __FILE__, __LINE__) )
#define CV_Assert( expr ) do { if(!(expr)) cv::error( cv::Exception(CV_StsAssert, #expr, "", __FILE__, __LINE__) ); } while(0)
#define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, "", __FILE__, __LINE__) )
#endif
#ifdef _DEBUG
......
......@@ -147,15 +147,16 @@ static void updateContinuityFlag(Mat& m)
static void finalizeHdr(Mat& m)
{
updateContinuityFlag(m);
if( m.dims > 2 )
int d = m.dims;
if( d > 2 )
m.rows = m.cols = -1;
if( m.data )
{
m.datalimit = m.datastart + m.size[0]*m.step[0];
if( m.size[0] > 0 )
{
m.dataend = m.data;
for( int i = 0; i < m.dims; i++ )
m.dataend = m.data + m.size[d-1]*m.step[d-1];
for( int i = 0; i < d-1; i++ )
m.dataend += (m.size[i] - 1)*m.step[i];
}
else
......@@ -599,7 +600,7 @@ void Mat::push_back(const Mat& elems)
Mat cvarrToMat(const CvArr* arr, bool copyData,
bool allowND, int coiMode)
bool /*allowND*/, int coiMode)
{
if( !arr )
return Mat();
......
......@@ -131,7 +131,7 @@ public:
virtual bool grab();
virtual bool retrieve(CV_OUT Mat& image, int channel=0);
virtual CV_WRAP_AS(query) VideoCapture& operator >> (Mat& image);
virtual VideoCapture& operator >> (Mat& image);
virtual bool set(int propId, double value);
virtual double get(int propId);
......@@ -152,7 +152,7 @@ public:
virtual bool open(const string& filename, int fourcc, double fps,
Size frameSize, bool isColor=true);
virtual bool isOpened() const;
virtual CV_WRAP_AS(write) VideoWriter& operator << (const Mat& image);
virtual VideoWriter& operator << (const Mat& image);
protected:
Ptr<CvVideoWriter> writer;
......
......@@ -939,7 +939,7 @@ struct HSV2RGB_b
typedef uchar channel_type;
HSV2RGB_b(int _dstcn, int _blueIdx, int _hrange)
: dstcn(_dstcn), cvt(3, _blueIdx, _hrange)
: dstcn(_dstcn), cvt(3, _blueIdx, (float)_hrange)
{}
void operator()(const uchar* src, uchar* dst, int n) const
......@@ -1139,7 +1139,7 @@ struct HLS2RGB_b
typedef uchar channel_type;
HLS2RGB_b(int _dstcn, int _blueIdx, int _hrange)
: dstcn(_dstcn), cvt(3, _blueIdx, _hrange)
: dstcn(_dstcn), cvt(3, _blueIdx, (float)_hrange)
{}
void operator()(const uchar* src, uchar* dst, int n) const
......@@ -1528,7 +1528,7 @@ struct RGB2Luv_f
float d = (4*13) / std::max(X + 15 * Y + 3 * Z, FLT_EPSILON);
float u = L*(X*d - _un);
float v = L*((9*0.25)*Y*d - _vn);
float v = L*((9*0.25f)*Y*d - _vn);
dst[i] = L; dst[i+1] = u; dst[i+2] = v;
}
......@@ -1589,7 +1589,7 @@ struct Luv2RGB_f
v = v*d + _vn;
float iv = 1.f/v;
X = 2.25f * u * Y * iv ;
Z = (12 - 3 * u - 20 * v) * Y * 0.25 * iv;
Z = (12 - 3 * u - 20 * v) * Y * 0.25f * iv;
float R = X*C0 + Y*C1 + Z*C2;
float G = X*C3 + Y*C4 + Z*C5;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册