我試圖從Mat對象中獲取像素。爲了測試,我嘗試在一個正方形上繪製一條對角線,並期望從左上角到右下角獲得完美的直線。通過Mat獲取像素::在
for (int i =0; i<500; i++){
//I just hard-coded the width (or height) to make the problem more obvious
(image2.at<int>(i, i)) = 0xffffff;
//Draw a white dot at pixels that have equal x and y position.
}
但是,結果並不如預期。 這是在彩色照片上繪製的對角線。 這是一張灰度圖。 任何人都看到問題?
哦,是的,每個人都看到了問題。 – qPCR4vir 2013-02-28 08:27:21
@ qPCR4vir圖像不是500x500? – 2013-02-28 08:29:46
其700 * 700,但結果與任何數字保持不變。 – 2013-02-28 08:30:38