我正在尝试从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.
}
然而,结果并不如预期。 这是在彩色图片上画的一条对角线。
![enter image description here](https://istack.dev59.com/Ubdt0.webp)
![enter image description here](https://istack.dev59.com/CZ6DZ.webp)
Mat::at<template T>(int, int)
没有具体的解释。 不管怎样,现在我知道问题出在哪里了。谢谢大家。 - Max