OpenCV vs Matlab : Different Values on pixels with imread

后端 未结 2 908
庸人自扰
庸人自扰 2020-12-05 11:45

I have encountered a problem with the function imread() in Matlab (2014) and OpenCV (3.0) on Windows 7 with jpg files.

I don\'t have the same values by

2条回答
  •  甜味超标
    2020-12-05 11:54

    This code gives the correct values for your example image test2.jpg:

    #include 
    #include 
    
    int main()
    {
        auto img = cv::imread("test2.jpg");
        auto pixel = img.at(85, 85);
        std::cout << (int)pixel[0] << "\t" << (int)pixel[1]
                  << "\t" << (int)pixel[2] << std::endl;
    }
    

    Output:

    118     105     91
    

    The OpenCV version here is 2.4.10. I get the same result when using your code. I suppose there is a bug somewhere that is beyond your influence.

提交回复
热议问题