0

I'm loading an image file into memory using leptonica library, I tried to print all the color bytes:

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
    }
}
}

Why does it crash? Or what's the correct way of fetching color bytes?

Thanks.

aj3423
  • 2,003
  • 3
  • 32
  • 70
  • How do you know pixRead ? Can you include the details of "the crash" in your question ? – quantdev Jun 10 '14 at 05:41
  • pixRead is used in tesseract example code. The crash is "Unhandled exception at 0x0040294d in test.exe: 0xC0000005: Access violation reading location 0x0120e000." – aj3423 Jun 10 '14 at 05:46

0 Answers0