Allow use of recomb op with 1/2 channel input #2584

This commit is contained in:
Lovell Fuller
2021-02-19 16:37:29 +00:00
parent 1986b5cfe6
commit f6f16b91db
3 changed files with 26 additions and 11 deletions

View File

@@ -149,8 +149,8 @@ namespace sharp {
*/
VImage Recomb(VImage image, std::unique_ptr<double[]> const &matrix) {
double *m = matrix.get();
image = image.colourspace(VIPS_INTERPRETATION_sRGB);
return image
.colourspace(VIPS_INTERPRETATION_sRGB)
.recomb(image.bands() == 3
? VImage::new_from_memory(
m, 9 * sizeof(double), 3, 3, 1, VIPS_FORMAT_DOUBLE