| 2951 | |
| 2952 | |
| 2953 | CV_IMPL void |
| 2954 | cvCalcProbDensity( const CvHistogram* hist, const CvHistogram* hist_mask, |
| 2955 | CvHistogram* hist_dens, double scale ) |
| 2956 | { |
| 2957 | if( scale <= 0 ) |
| 2958 | CV_Error( CV_StsOutOfRange, "scale must be positive" ); |
| 2959 | |
| 2960 | if( !CV_IS_HIST(hist) || !CV_IS_HIST(hist_mask) || !CV_IS_HIST(hist_dens) ) |
| 2961 | CV_Error( CV_StsBadArg, "Invalid histogram pointer[s]" ); |
| 2962 | |
| 2963 | { |
| 2964 | CvArr* arrs[] = { hist->bins, hist_mask->bins, hist_dens->bins }; |
| 2965 | CvMatND stubs[3]; |
| 2966 | CvNArrayIterator iterator; |
| 2967 | |
| 2968 | cvInitNArrayIterator( 3, arrs, 0, stubs, &iterator ); |
| 2969 | |
| 2970 | if( CV_MAT_TYPE(iterator.hdr[0]->type) != CV_32FC1 ) |
| 2971 | CV_Error( CV_StsUnsupportedFormat, "All histograms must have 32fC1 type" ); |
| 2972 | |
| 2973 | do |
| 2974 | { |
| 2975 | const float* srcdata = (const float*)(iterator.ptr[0]); |
| 2976 | const float* maskdata = (const float*)(iterator.ptr[1]); |
| 2977 | float* dstdata = (float*)(iterator.ptr[2]); |
| 2978 | int i; |
| 2979 | |
| 2980 | for( i = 0; i < iterator.size.width; i++ ) |
| 2981 | { |
| 2982 | float s = srcdata[i]; |
| 2983 | float m = maskdata[i]; |
| 2984 | if( s > FLT_EPSILON ) |
| 2985 | if( m <= s ) |
| 2986 | dstdata[i] = (float)(m*scale/s); |
| 2987 | else |
| 2988 | dstdata[i] = (float)scale; |
| 2989 | else |
| 2990 | dstdata[i] = (float)0; |
| 2991 | } |
| 2992 | } |
| 2993 | while( cvNextNArraySlice( &iterator )); |
| 2994 | } |
| 2995 | } |
| 2996 | |
| 2997 | class EqualizeHistCalcHist_Invoker : public cv::ParallelLoopBody |
| 2998 | { |
nothing calls this directly
no test coverage detected