'How Can I Convert Image .png to string in C++?
I am new to using C++. I am trying to convert an image to a string (I need to convert an image to a buffer).
So I use the "opencv" library. I try it but it doesn't work. When I execute my program this way:
g++ testpng.cpp -o testpng
This is the error in the terminal:
/usr/local/include/opencv4/opencv2/opencv.hpp:48:10: fatal error: opencv2/opencv_modules.hpp: No such file or directory
48 | #include "opencv2/opencv_modules.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I need help to solve this error, or a working example to convert an image (.png) to a string, please!!
Solution 1:[1]
If all you want is to load an image and then retrieve data from it, use the stb header library. It's simple to use, no binary libraries, only header files required. Simply download it from github and then include the stb_image.h file in your project.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GameWin221 |
