setImageBias has no effect
Posted: 2014-06-13T05:30:21-07:00
According to the manual: "MagickSetImageBias() sets the image bias for any method that convolves an image (e.g. MagickConvolveImage())."
However it appears to have no actual effect. The code below is a C test case based on a StackOverflow question
Expected result - image has 50% grey for 'flat' areas:
Actual result - image has black for 'flat' areas:
I don't have a windows box available for testing on that.
However it appears to have no actual effect. The code below is a C test case based on a StackOverflow question
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wand/MagickWand.h>
void ThrowWandException(MagickWand *wand) {
char *description;
ExceptionType severity;
description = MagickGetException(wand, &severity);
(void) fprintf(stderr,"%s %s %lu %s\n",GetMagickModule(),description);
description=(char *) MagickRelinquishMemory(description);
exit(-1);
}
int main(int argc,char **argv) {
MagickWand *magick_wand;
MagickBooleanType status;
unsigned long range;
double kernel[] = { -0.70,0,0.70,-0.70,0,0.70,-0.70,0,0.70 };
MagickWandGenesis();
magick_wand = NewMagickWand();
status = MagickReadImage(magick_wand, "./stack.jpg");
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
status = MagickTransformImageColorspace(magick_wand, GRAYColorspace);
MagickGetQuantumRange(&range);
status = MagickSetImageBias(magick_wand, 0.5);
//Not sure if this is meant to be a quantum value
//It makes no difference either way
//status = MagickSetImageBias(magick_wand, range / 2);
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
status = MagickConvolveImageChannel(magick_wand, DefaultChannels, 3, kernel);
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
status = MagickWriteImages(magick_wand, "setImageBias_%d.jpg", MagickTrue);
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
magick_wand = DestroyMagickWand(magick_wand);
MagickWandTerminus();
return(0);
}
Expected result - image has 50% grey for 'flat' areas:
Actual result - image has black for 'flat' areas:
I don't have a windows box available for testing on that.