2013-02-13 6 views
1
int main() {  

    Mat A = Mat::ones(100, 100, CV_8U)*3; 
    cout << A.at<int>(0,0) << endl; 

    return 0; 
} 

에서 작동하지 않는 출력은 매우 많은 수의 :: 50529027매트 :: 사람이 OpenCV의

이 사람이 나를 도울 수있다? C++ 코드는

답변

2
you're casting to the wrong type in A.at<int>() // should be uchar instead of int 

so, A.at<int>(0,0) sees 0x03030303, which is, in fact 50529027. 

Mat A = Mat::ones(100, 100, CV_8U)*3; 
cout << int(A.at<uchar>(0,0)) << endl; 

(A.at (약 캐스트) 대신 문자의 cout을 가진 수를 표시하는 단지입니다)
관련 문제