0

我正在使用 leptonica 库将图像文件加载到内存中,我尝试打印所有颜色字节:

int main() {

PIX* pix = pixRead("e:/white.png"); // an empty image for testing

// print all the pixel color
for(int row=0; row<pix->h; row++) {
    for(int col=0; col<pix->w; col++) {
        cout << pix->data[row*pix->w+col] << " "; // this causes crash
    }
}
}

为什么会崩溃?或者获取颜色字节的正确方法是什么?

谢谢。

4

0 回答 0