Gleb Andreev
Gleb Andreev

Reputation: 11

CImg failed to recognize format of file "bmp"

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!

Upvotes: 1

Views: 326

Answers (1)

Ella Wooden
Ella Wooden

Reputation: 16

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");

Upvotes: 0

Related Questions