Merge pull request #6455 from belgraviton:bugfix_5953
This commit is contained in:
commit
681fd7f214
@ -227,7 +227,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T, int shift>
|
||||||
class CLAHE_Interpolation_Body : public cv::ParallelLoopBody
|
class CLAHE_Interpolation_Body : public cv::ParallelLoopBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -277,8 +277,8 @@ namespace
|
|||||||
float * xa_p, * xa1_p;
|
float * xa_p, * xa1_p;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T, int shift>
|
||||||
void CLAHE_Interpolation_Body<T>::operator ()(const cv::Range& range) const
|
void CLAHE_Interpolation_Body<T, shift>::operator ()(const cv::Range& range) const
|
||||||
{
|
{
|
||||||
float inv_th = 1.0f / tileSize_.height;
|
float inv_th = 1.0f / tileSize_.height;
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ namespace
|
|||||||
|
|
||||||
for (int x = 0; x < src_.cols; ++x)
|
for (int x = 0; x < src_.cols; ++x)
|
||||||
{
|
{
|
||||||
int srcVal = srcRow[x];
|
int srcVal = srcRow[x] >> shift;
|
||||||
|
|
||||||
int ind1 = ind1_p[x] + srcVal;
|
int ind1 = ind1_p[x] + srcVal;
|
||||||
int ind2 = ind2_p[x] + srcVal;
|
int ind2 = ind2_p[x] + srcVal;
|
||||||
@ -310,7 +310,7 @@ namespace
|
|||||||
float res = (lutPlane1[ind1] * xa1_p[x] + lutPlane1[ind2] * xa_p[x]) * ya1 +
|
float res = (lutPlane1[ind1] * xa1_p[x] + lutPlane1[ind2] * xa_p[x]) * ya1 +
|
||||||
(lutPlane2[ind1] * xa1_p[x] + lutPlane2[ind2] * xa_p[x]) * ya;
|
(lutPlane2[ind1] * xa1_p[x] + lutPlane2[ind2] * xa_p[x]) * ya;
|
||||||
|
|
||||||
dstRow[x] = cv::saturate_cast<T>(res);
|
dstRow[x] = cv::saturate_cast<T>(res) << shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,9 +422,9 @@ namespace
|
|||||||
|
|
||||||
cv::Ptr<cv::ParallelLoopBody> interpolationBody;
|
cv::Ptr<cv::ParallelLoopBody> interpolationBody;
|
||||||
if (_src.type() == CV_8UC1)
|
if (_src.type() == CV_8UC1)
|
||||||
interpolationBody = cv::makePtr<CLAHE_Interpolation_Body<uchar> >(src, dst, lut_, tileSize, tilesX_, tilesY_);
|
interpolationBody = cv::makePtr<CLAHE_Interpolation_Body<uchar, 0> >(src, dst, lut_, tileSize, tilesX_, tilesY_);
|
||||||
else if (_src.type() == CV_16UC1)
|
else if (_src.type() == CV_16UC1)
|
||||||
interpolationBody = cv::makePtr<CLAHE_Interpolation_Body<ushort> >(src, dst, lut_, tileSize, tilesX_, tilesY_);
|
interpolationBody = cv::makePtr<CLAHE_Interpolation_Body<ushort, 4> >(src, dst, lut_, tileSize, tilesX_, tilesY_);
|
||||||
|
|
||||||
cv::parallel_for_(cv::Range(0, src.rows), *interpolationBody);
|
cv::parallel_for_(cv::Range(0, src.rows), *interpolationBody);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user