CImg failed to recognize format of file "bmp"

296 Views Asked by At

I installed CImg to load the image (Visual Studio 2019). I wanted to get my picture, but no matter how I indicate the path to the picture, CImg does not see it. My code:

#include "neural_network.h"
#include "CImg/CImg.h"
#include "PictureStream.h"
#include "PixelMatrix.h"
using namespace cimg_library;

int main() {
    neural_network my_Network;
    CImg<double> image("C:\\pic.bmp");
    my_Network.setImg(image);
    my_Network.showImg();
}

As a result I see: result

I would be very grateful for your help!

1

There are 1 best solutions below

0
On

You need two consecutive backslash in your string, but in C/C++, writing two backslashs in a string means a single backslash, so you have to double it:

 CImg<double> image("C:\\\\pic.bmp");