Page 1 of 1

BlackThresholdImage() use in c++ application

Posted: 2010-03-18T11:48:51-07:00
by rich2449
What is the correct way to access the function BlackThresholdImage() in a c++ application?

I'm starting to use Magick++, which does not appear to have this function. I can see the function in magick\threshold.cpp, but am unsure of the correct method of accessing this function.

Googling around has not enlightened me, the function does not appear to be in the image class, or in the magick:: namespace, so rather than start hacking it in, I figured it's worth asking in here.

Thanks in advance, Rich

Re: BlackThresholdImage() use in c++ application

Posted: 2010-03-18T11:58:48-07:00
by magick
Not all MagickCore methods are supported with Magick++, instead you can access MagickCore methods in Magick++ with the MagickCore namespace, e.g. MagickCore::BlackThresholdImage().

Re: BlackThresholdImage() use in c++ application

Posted: 2010-03-18T12:16:18-07:00
by rich2449
Eureka!

When using MagicCore functions on Magick++ image objects are any precautions needed to make the image object aware that the underlying image may have changed? From the looks of things, so long as I call modifyImage() before using the MagickCore function I should be fine?

Code: Select all

   Magick::Image test_image;
   // .. load up image here
   image_test.modifyImage();
   MagickCore::BlackThresholdImage( test_image.image(), "25%" );

Thank you!

Re: BlackThresholdImage() use in c++ application

Posted: 2010-03-18T12:25:38-07:00
by magick
It wouldn't hurt to call modifyImage() but I believe modifyImage() was introduced before we had a robust implementation of reference counted image objects.

Re: BlackThresholdImage() use in c++ application

Posted: 2010-03-18T12:31:45-07:00
by rich2449
Thank you!

I agree, from the looks of the code calling modifyImage() should be the only function required.

Thank you again, this is great software!