Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

strange behaviour with c++0x/c++11/c++1y compiler flags and image showing

Ok as the title says I have an issue with loading an image and using different CXX_FLAGS in the compiler. In the project that I am working if I set set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") through the cmakelist file and compile the following code:

// load original image
Mat src = imread("../panther.png");


// check if image is loaded without problems
if(!src.data || src.empty())
{
    cerr << "Problem loading image!" << endl;
    return -1;
}

imshow("src", src);

Mat3f src_float = src / 255.f;
imshow("src_float", src_float);

I will get the following result:

image description

image description

However, now if I enable the c++11 or c++1y flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") or set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") the src_float image output changes:

image description

why that, does anyone has a clue and how we can prevent this?

Thanks.

p.s. and yes it is the panther again :-p....

click to hide/show revision 2
retagged

strange behaviour with c++0x/c++11/c++1y compiler flags and image showing

Ok as the title says I have an issue with loading an image and using different CXX_FLAGS in the compiler. In the project that I am working if I set set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") through the cmakelist file and compile the following code:

// load original image
Mat src = imread("../panther.png");


// check if image is loaded without problems
if(!src.data || src.empty())
{
    cerr << "Problem loading image!" << endl;
    return -1;
}

imshow("src", src);

Mat3f src_float = src / 255.f;
imshow("src_float", src_float);

I will get the following result:

image description

image description

However, now if I enable the c++11 or c++1y flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") or set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") the src_float image output changes:

image description

why that, does anyone has a clue and how we can prevent this?

Thanks.

p.s. and yes it is the panther again :-p....