1

I'm using INRIA person dataset, i iterate the images and everything is fine and after i have this function

   vector<Mat> HOG_extract(Mat input_image, bool patch_size, int width, int height)
{
    Mat gray_image;
    cvtColor(input_image, gray_image, CV_BGR2GRAY);


    HOGDescriptor hog;
    hog.winSize = Size(width, height);
    hog.blockSize = Size(block_size, block_size);
    hog.blockStride = Size(block_stride, block_stride);
    hog.cellSize = Size(cell_size, cell_size);
    hog.nbins = bin_size;

    vector<float> hog_value;
    vector<Point> locations;
    hog.compute(gray_image, hog_value, Size(0, 0), Size(0, 0), locations);
}

when he gets to hog.compute i receive an exception and libpng error: IDAT: invalid distance too far back.

like how i can solve this? looks like something happend when using imread and converting in gray

  • That doesn't make sense. If the error is really generated by `libpng`, it would happen during `imread()` not after you have loaded and converted to greyscale. Try running the unhappy image through the `pngcheck` program. – Mark Setchell May 23 '18 at 20:04
  • this pngcheck has some options or how i could iterate for my folder of images in a batch For %%i in (*.png) do pngcheck.exe – Alexandra Tupu May 23 '18 at 20:40
  • Yes, you'll need to use a loop I think. – Mark Setchell May 24 '18 at 19:24
  • but this pngcheck.exe he doesnt have an paramater when running it? cause for me it doesnt work just like that – Alexandra Tupu May 25 '18 at 05:23
  • 1
    Here's the manual http://manpages.ubuntu.com/manpages/bionic/man1/pngcheck.1.html – Mark Setchell May 25 '18 at 06:23
  • what compiler/IDE is this for? Your other question suggest C++Builder RAD ... I suspect from your code that You are using dynamic lists (`vector<>`) on some structures (`point`) so Your issue might be related to this [bds 2006 C hidden memory manager conflicts (class new / delete vs. AnsiString)](https://stackoverflow.com/a/18016392/2521214) its worth a try to add the missing constructors/destructors into all structures/classes used with `new/delete` at any level and any place in your code ... However RAD should have the issue solved already ... – Spektre Nov 29 '19 at 14:31

1 Answers1

1

There seems to be an issue with the dataset. I think it was edited with an error using an older version of libpng. I managed to fix it with the help of "png-fix-IDAT-windowsize" tool which you can find here: http://www.libpng.org/pub/png/apps/pngcheck.html

Bubber
  • 11
  • 1
  • 1