// 读取像素 #include #include using namespace std; using namespace cv; int main() { string image_path = "../img/1.png"; Mat image = imread(image_path); if (image.empty()) { cout << "错误:无法加载图像,请检查路径是否正确。" << endl; return -1; } Vec3b pixel_value = image.at(100, 150); cout << "B: " << (int)pixel_value[0] << " " << "G: " << (int)pixel_value[1] << " " << "R: " << (int)pixel_value[2] << endl; }