Add greyscale option to threshold operation (#480)

This commit is contained in:
Matt Hirsch
2016-07-03 14:32:07 -04:00
committed by Lovell Fuller
parent 4b98dbb454
commit 85f20c6e1b
8 changed files with 55 additions and 3 deletions

View File

@@ -327,4 +327,11 @@ namespace sharp {
);
}
VImage Threshold(VImage image, double const threshold, bool const thresholdGrayscale) {
if(!thresholdGrayscale) {
return image >= threshold;
}
return image.colourspace(VIPS_INTERPRETATION_B_W) >= threshold;
}
} // namespace sharp