How to access pixel values of CV_32F/CV_64F Mat?

前端 未结 2 1363
庸人自扰
庸人自扰 2020-12-16 15:28

I was working on homography and whenever I try to check the values of H matrix (type CV_64F) using H.at(i, j) I get random numbers(sometimes garbag

2条回答
  •  时光说笑
    2020-12-16 15:58

    You should try this:

    A.at(i, j);
    

    because your matrix is of "type" CV_64F which in turn means it contains elements of type double, not float.

    By the way, I'm not sure whether you are aware of this, but you can use cout to print the matrix like so:

    std::cout << A << std::endl;
    

    I found this to be useful for inspecting a small matrix or a slice of a matrix.

提交回复
热议问题