| 2792 | |
| 2793 | |
| 2794 | CV_IMPL void |
| 2795 | cvCalcArrBackProject( CvArr** img, CvArr* dst, const CvHistogram* hist ) |
| 2796 | { |
| 2797 | if( !CV_IS_HIST(hist)) |
| 2798 | CV_Error( CV_StsBadArg, "Bad histogram pointer" ); |
| 2799 | |
| 2800 | if( !img ) |
| 2801 | CV_Error( CV_StsNullPtr, "Null double array pointer" ); |
| 2802 | |
| 2803 | int size[CV_MAX_DIM]; |
| 2804 | int i, dims = cvGetDims( hist->bins, size ); |
| 2805 | |
| 2806 | bool uniform = CV_IS_UNIFORM_HIST(hist); |
| 2807 | const float* uranges[CV_MAX_DIM] = {0}; |
| 2808 | const float** ranges = 0; |
| 2809 | |
| 2810 | if( hist->type & CV_HIST_RANGES_FLAG ) |
| 2811 | { |
| 2812 | ranges = (const float**)hist->thresh2; |
| 2813 | if( uniform ) |
| 2814 | { |
| 2815 | for( i = 0; i < dims; i++ ) |
| 2816 | uranges[i] = &hist->thresh[i][0]; |
| 2817 | ranges = uranges; |
| 2818 | } |
| 2819 | } |
| 2820 | |
| 2821 | cv::vector<cv::Mat> images(dims); |
| 2822 | for( i = 0; i < dims; i++ ) |
| 2823 | images[i] = cv::cvarrToMat(img[i]); |
| 2824 | |
| 2825 | cv::Mat _dst = cv::cvarrToMat(dst); |
| 2826 | |
| 2827 | CV_Assert( _dst.size() == images[0].size() && _dst.depth() == images[0].depth() ); |
| 2828 | |
| 2829 | if( !CV_IS_SPARSE_HIST(hist) ) |
| 2830 | { |
| 2831 | cv::Mat H((const CvMatND*)hist->bins); |
| 2832 | cv::calcBackProject( &images[0], (int)images.size(), |
| 2833 | 0, H, _dst, ranges, 1, uniform ); |
| 2834 | } |
| 2835 | else |
| 2836 | { |
| 2837 | cv::SparseMat sH((const CvSparseMat*)hist->bins); |
| 2838 | cv::calcBackProject( &images[0], (int)images.size(), |
| 2839 | 0, sH, _dst, ranges, 1, uniform ); |
| 2840 | } |
| 2841 | } |
| 2842 | |
| 2843 | |
| 2844 | ////////////////////// B A C K P R O J E C T P A T C H ///////////////////////// |
nothing calls this directly
no test coverage detected