Closed hafedh-trimeche closed 1 year ago
It is unclear what "load image from memory" means. Does the memory buffer contain pixel values, or the contents of an image file?
Have you looked at the CImg documentation?
To allocate and free a CImg instance:
CImg *load_img_from_memory(char* buffer, int w, int h, int s)
{
return new CImg(buffer, s, w, h);
}
...
CImg *myImage = load_img_from_memory(buffer, w, h, s);
...
delete myImage;
Hello,
Load from memory means from Raw Binary Data.
This is a usage of memory loading for pHash:
__declspec(dllexport) int ph_image_digest_mem(unsigned char* buffer, int width, int height, int channels, double sigma, double gamma, Digest& digest, int N)
{
CImg<unsigned char> img(buffer,width, height,1,channels,false);
return _ph_image_digest(img, sigma, gamma, digest, N);
}
Best regards.
Hello, Would this function be used to load image from memory and how to free it?
CImg load_img_from_memory(char* buffer, int w, int h, int s)
{
return CImg(buffer, s, w, h);
}
Best regards.