从leptonica::PIX(c++)访问颜色数据数组

从leptonica::PIX(c++)访问颜色数据数组,c++,leptonica,C++,Leptonica,我正在使用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

我正在使用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
    }
}
}
为什么会崩溃?或者,获取颜色字节的正确方法是什么


谢谢。

你是怎么知道pixRead的?您能否在问题中包含崩溃的详细信息?tesseract示例代码中使用了pixRead。在test.exe:0xC0000005:访问冲突读取位置0x0120e000中的0x00294D处出现未处理的崩溃异常。