Skip to content

Opencv3.0.0‘s bug of normalize function #489

@DengPingFan

Description

@DengPingFan

My platform is windows 64bit,visual stdio 2013,i am using the opencv3.0.0 to test the normalize() function.I have found something wrong with it.

If i use in-place way to normalize a CV_64FC1 Mat to a CV_32F it would be wrong.but when use non in-place way to normalize a CV_64FC1 Mat to a CV_32F it would be wright.

pragma once

pragma warning(disable: 4819)

ifdef _DEBUG

define lnkLIB(name) name "d"

else

define lnkLIB(name) name

endif

include

include

define CV_VERSION_ID CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)

define cvLIB(name) lnkLIB("opencv_" name CV_VERSION_ID)

pragma comment( lib, cvLIB("core"))

pragma comment( lib, cvLIB("imgproc"))

pragma comment( lib, cvLIB("highgui"))

if CV_MAJOR_VERSION == 3

pragma comment(lib, cvLIB("imgcodecs")) //the opencv3.0 need it

endif

if CV_MAJOR_VERSION == 2

pragma comment(lib, cvLIB("contrib"))

endif

include

using namespace cv;
using namespace std;

int main()
{
Mat img = Mat::zeros(1, 5, CV_64FC1);

img.at(0, 0) = 0.0345;
img.at(0, 1) = 0.2322;
img.at(0, 2) = 0.6483;
img.at(0, 3) = 0.2322;
img.at(0, 4) = 0.0345;

//it will be produce wrong result
normalize(img, img, 1, 0, NORM_MINMAX, CV_32F);

//it will be produce wright result
Mat img1;
//normalize(img, img1, 1, 0, NORM_MINMAX, CV_32F);

return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions