Commit f213d65d authored by Bellaktris's avatar Bellaktris

try to fix more errors

parent c26e0c08
...@@ -342,10 +342,10 @@ public: ...@@ -342,10 +342,10 @@ public:
* \param filename : name of the file where the model is stored * \param filename : name of the file where the model is stored
*/ */
StructuredEdgeDetectionImpl(const cv::String &filename, StructuredEdgeDetectionImpl(const cv::String &filename,
const RFFeatureGetter *howToGetFeatures) const RFFeatureGetter *_howToGetFeatures)
: name("StructuredEdgeDetection"), : name("StructuredEdgeDetection"),
howToGetFeatures( howToGetFeatures != NULL howToGetFeatures( _howToGetFeatures != NULL
? howToGetFeatures ? _howToGetFeatures
: createRFFeatureGetter() ) : createRFFeatureGetter() )
{ {
cv::FileStorage modelFile(filename, FileStorage::READ); cv::FileStorage modelFile(filename, FileStorage::READ);
......
...@@ -5,9 +5,7 @@ Automatic white balance correction ...@@ -5,9 +5,7 @@ Automatic white balance correction
balanceWhite balanceWhite
------------ ------------
.. ocv:function:: void balanceWhite(const Mat &src, Mat &dst, const int algorithmType, .. ocv:function:: void balanceWhite(const Mat &src, Mat &dst, const int algorithmType, const float inputMin = 0.0f, const float inputMax = 255.0f, const float outputMin = 0.0f, const float outputMax = 255.0f)
const float inputMin = 0.0f, const float inputMax = 255.0f,
const float outputMin = 0.0f, const float outputMax = 255.0f)
The function implements different algorithm of automatic white balance, i.e. The function implements different algorithm of automatic white balance, i.e.
it tries to map image's white color to perceptual white (this can be violated it tries to map image's white color to perceptual white (this can be violated
...@@ -15,9 +13,7 @@ due to specific illumination or camera settings). ...@@ -15,9 +13,7 @@ due to specific illumination or camera settings).
:param src : source image :param src : source image
:param dst : destination image :param dst : destination image
:param algorithmType : type of the algorithm to use. Use WHITE_BALANCE_SIMPLE to perform :param algorithmType : type of the algorithm to use. Use WHITE_BALANCE_SIMPLE to perform smart histogram adjustments (ignoring 4% pixels with minimal and maximal values) for each channel.
smart histogram adjustments (ignoring 4% pixels with minimal
and maximal values) for each channel.
:param inputMin : minimum value in the input image :param inputMin : minimum value in the input image
:param inputMax : maximum value in the input image :param inputMax : maximum value in the input image
:param outputMin : minimum value in the output image :param outputMin : minimum value in the output image
...@@ -25,5 +21,5 @@ due to specific illumination or camera settings). ...@@ -25,5 +21,5 @@ due to specific illumination or camera settings).
.. seealso:: .. seealso::
:ocv:function:`cvtColor`, :ocv:func:`cvtColor`,
:ocv:function:`equalizeHist` :ocv:func:`equalizeHist`
\ No newline at end of file \ No newline at end of file
...@@ -17,4 +17,4 @@ link: http://www.ipol.im/pub/art/2011/ys-dct/. ...@@ -17,4 +17,4 @@ link: http://www.ipol.im/pub/art/2011/ys-dct/.
.. seealso:: .. seealso::
:ocv:function:`fastNLMeansDenoising` :ocv:func:`fastNLMeansDenoising`
\ No newline at end of file \ No newline at end of file
...@@ -134,21 +134,21 @@ namespace cv ...@@ -134,21 +134,21 @@ namespace cv
{ {
CV_Assert( src.type() == CV_MAKE_TYPE(CV_32F, 3) ); CV_Assert( src.type() == CV_MAKE_TYPE(CV_32F, 3) );
Mat m = Mat_<float>(3, 3) << (cvInvSqrt(3), cvInvSqrt(3), cvInvSqrt(3), cv::Matx33f mt(cvInvSqrt(3), cvInvSqrt(3), cvInvSqrt(3),
cvInvSqrt(2), 0.0f, -cvInvSqrt(2), cvInvSqrt(2), 0.0f, -cvInvSqrt(2),
cvInvSqrt(6), -2.0f*cvInvSqrt(6), cvInvSqrt(6)); cvInvSqrt(6), -2.0f*cvInvSqrt(6), cvInvSqrt(6));
cv::transform(src, dst, m); cv::transform(src, dst, mt);
std::vector <Mat> mv; std::vector <Mat> mv;
split(dst, mv); split(dst, mv);
for (int i = 0; i < mv.size(); ++i) for (size_t i = 0; i < mv.size(); ++i)
grayDctDenoising(mv[i], mv[i], sigma, psize); grayDctDenoising(mv[i], mv[i], sigma, psize);
merge(mv, dst); merge(mv, dst);
cv::transform( dst, dst, m.inv() ); cv::transform( dst, dst, mt.inv() );
} }
/*! This function implements simple dct-based image denoising, /*! This function implements simple dct-based image denoising,
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
//M*/ //M*/
#include <vector> #include <vector>
#include <limits>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <iostream> #include <iostream>
......
...@@ -94,7 +94,7 @@ namespace cv ...@@ -94,7 +94,7 @@ namespace cv
for (int j = 0; j < depth; ++j) for (int j = 0; j < depth; ++j)
{ {
int currentBin = (val - minValue + 1e-4) / interval; int currentBin = int( (val - minValue + 1e-4f) / interval );
++hist[pos + currentBin]; ++hist[pos + currentBin];
pos = (pos + currentBin)*bins; pos = (pos + currentBin)*bins;
...@@ -106,7 +106,7 @@ namespace cv ...@@ -106,7 +106,7 @@ namespace cv
} }
} }
int total = src[i].total(); int total = int( src[i].total() );
int p1 = 0, p2 = bins - 1; int p1 = 0, p2 = bins - 1;
int n1 = 0, n2 = total; int n1 = 0, n2 = total;
...@@ -143,10 +143,11 @@ namespace cv ...@@ -143,10 +143,11 @@ namespace cv
break; break;
} }
default: default:
CV_Assert( false ); CV_Error_( CV_StsNotImplemented,
("Unsupported algorithm type (=%d)", algorithmType) );
} }
dst.create(/**/ src[0].size(), CV_MAKETYPE( src[0].depth(), src.size() ) /**/); dst.create(/**/ src[0].size(), CV_MAKETYPE( src[0].depth(), int( src.size() ) ) /**/);
cv::merge(src, dst); cv::merge(src, dst);
} }
...@@ -198,7 +199,8 @@ namespace cv ...@@ -198,7 +199,8 @@ namespace cv
break; break;
} }
default: default:
CV_Assert( false ); CV_Error_( CV_StsNotImplemented,
("Unsupported source image format (=%d)", src.type()) );
break; break;
} }
} }
......
...@@ -7,7 +7,7 @@ namespace cvtest ...@@ -7,7 +7,7 @@ namespace cvtest
cv::String dir = cvtest::TS::ptr()->get_data_path() + "dct_image_denoising/"; cv::String dir = cvtest::TS::ptr()->get_data_path() + "dct_image_denoising/";
int nTests = 1; int nTests = 1;
float psnrThreshold[] = {0.5}; float thresholds[] = {0.1};
int psize[] = {8}; int psize[] = {8};
double sigma[] = {9.0}; double sigma[] = {9.0};
...@@ -26,10 +26,9 @@ namespace cvtest ...@@ -26,10 +26,9 @@ namespace cvtest
cv::Mat sqrError = ( currentResult - previousResult ) cv::Mat sqrError = ( currentResult - previousResult )
.mul( currentResult - previousResult ); .mul( currentResult - previousResult );
cv::Scalar mse = cv::sum(sqrError) / cv::Scalar::all( sqrError.total()*sqrError.channels() ); cv::Scalar mse = cv::sum(sqrError) / cv::Scalar::all( double(sqrError.total()*sqrError.channels()) );
double psnr = 10*log10(3*255*255/(mse[0] + mse[1] + mse[2])) - psnr;
EXPECT_GE( psnr, psnrThreshold[i] ); EXPECT_LE( mse[0] + mse[1] + mse[2] + mse[3], thresholds[i] );
} }
} }
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ namespace cvtest ...@@ -6,7 +6,7 @@ namespace cvtest
{ {
cv::String dir = cvtest::TS::ptr()->get_data_path() + "simple_white_balance/"; cv::String dir = cvtest::TS::ptr()->get_data_path() + "simple_white_balance/";
int nTests = 12; int nTests = 12;
float threshold = 0.005; float threshold = 0.005f;
for (int i = 0; i < nTests; ++i) for (int i = 0; i < nTests; ++i)
{ {
...@@ -21,7 +21,7 @@ namespace cvtest ...@@ -21,7 +21,7 @@ namespace cvtest
cv::Mat sqrError = ( currentResult - previousResult ) cv::Mat sqrError = ( currentResult - previousResult )
.mul( currentResult - previousResult ); .mul( currentResult - previousResult );
cv::Scalar mse = cv::sum(sqrError) / cv::Scalar::all( sqrError.total()*sqrError.channels() ); cv::Scalar mse = cv::sum(sqrError) / cv::Scalar::all( double( sqrError.total()*sqrError.channels() ) );
EXPECT_LE( mse[0]+mse[1]+mse[2]+mse[3], threshold ); EXPECT_LE( mse[0]+mse[1]+mse[2]+mse[3], threshold );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment