mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
imgproc: add parameter checks in calcHist and calcBackProj
This commit is contained in:
@@ -75,8 +75,8 @@ calcHistLookupTables_8u( const Mat& hist, const SparseMat& shist,
|
||||
int sz = !issparse ? hist.size[i] : shist.size(i);
|
||||
size_t step = !issparse ? hist.step[i] : 1;
|
||||
|
||||
double v_lo = ranges[i][0];
|
||||
double v_hi = ranges[i][1];
|
||||
double v_lo = ranges ? ranges[i][0] : 0;
|
||||
double v_hi = ranges ? ranges[i][1] : 256;
|
||||
|
||||
for( j = low; j < high; j++ )
|
||||
{
|
||||
@@ -183,7 +183,7 @@ static void histPrepareImages( const Mat* images, int nimages, const int* channe
|
||||
imsize.height = 1;
|
||||
}
|
||||
|
||||
if( !ranges )
|
||||
if( !ranges ) // implicit uniform ranges for 8U
|
||||
{
|
||||
CV_Assert( depth == CV_8U );
|
||||
|
||||
@@ -951,6 +951,8 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CV_Assert(images && nimages > 0);
|
||||
|
||||
CV_OVX_RUN(
|
||||
images && histSize &&
|
||||
nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && _mask.getMat().empty() &&
|
||||
@@ -1261,6 +1263,8 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CV_Assert(images && nimages > 0);
|
||||
|
||||
Mat mask = _mask.getMat();
|
||||
calcHist( images, nimages, channels, mask, hist, dims, histSize,
|
||||
ranges, uniform, accumulate, false );
|
||||
@@ -1608,6 +1612,8 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CV_Assert(images && nimages > 0);
|
||||
|
||||
Mat hist = _hist.getMat();
|
||||
std::vector<uchar*> ptrs;
|
||||
std::vector<int> deltas;
|
||||
@@ -1777,6 +1783,8 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CV_Assert(images && nimages > 0);
|
||||
|
||||
std::vector<uchar*> ptrs;
|
||||
std::vector<int> deltas;
|
||||
std::vector<double> uniranges;
|
||||
|
||||
Reference in New Issue
Block a user