how to use WhiteThresholdImage with magick++ ?
I search for it and i found for solutions and so i try:
#include <Magick++.h>
using namespace Magick;
int main()
{
Magick::InitializeMagick("");
Image image;
image.read("logo.jpg");
char* threshold = 20;
MagickLib::WhiteThresholdImage(image, threshold);
}
error: cannot convert ‘Magick::Image’ to ‘MagickLib::Image* {aka MagickLib::_Image*}’ for argument ‘1’ to ‘unsigned int MagickLib::WhiteThresholdImage(MagickLib::Image*, const char*)’
#include
using namespace Magick;
int main()
{
Magick::InitializeMagick("");
Image image;
image.read("logo.jpg");
char* threshold = 20;
WhiteThresholdImage(image, threshold);
}
error: ‘WhiteThresholdImage’ was not declared in this scope
You are mixing the C API with the C++ API and they can't be mixed like that.
The WhiteThresholdImage() function is not exposed via Magick++. However, the quantumOperator() method can do the same thing (and much more). The following will white-threshold pixels over 20% of the numeric range to white: