| 400 | }; |
| 401 | |
| 402 | ImageChannelReduction::ImageChannelReduction( |
| 403 | const std::string& ikey, |
| 404 | std::string preset, |
| 405 | const std::string& okey) |
| 406 | : ImageTransformOp(ikey, okey) { |
| 407 | auto settings = IMAGE_CHANNEL_REDUCTION_PRESETS.find(preset); |
| 408 | |
| 409 | if (settings == IMAGE_CHANNEL_REDUCTION_PRESETS.end()) { |
| 410 | throw std::runtime_error( |
| 411 | std::string("ImageChannelReduction: unable to find preset ") + preset); |
| 412 | } |
| 413 | |
| 414 | this->bias_ = settings->second.bias; |
| 415 | memcpy(this->m_, settings->second.m, sizeof(this->m_)); |
| 416 | } |
| 417 | |
| 418 | std::shared_ptr<Array> ImageChannelReduction::apply_image( |
| 419 | const std::shared_ptr<const Array>& image) const { |