【发布时间】:2021-11-22 23:09:44
【问题描述】:
我的目标是按像素分析图像(以确定颜色)。我想在 C++ 中从图像路径创建位图:
string path = currImg.path;
cout << path << " " << endl;
然后我做了一些需要的类型更改,因为位图构造函数不接受简单的字符串类型:
wstring path_wstr = wstring(path.begin(), path.end());
const wchar_t* path_wchar_t = path_wstr.c_str();
最后构造Bitmap:
Bitmap* img = new Bitmap(path_wchar_t);
如何构造 Bitmap 以逐像素扫描照片以了解每个像素的颜色?
【问题讨论】:
-
我觉得你最好用CImage类,还有GetPixel,GetPixelAddressdocs.microsoft.com/en-us/cpp/atl-mfc-shared/reference/…