46void Rgb2Gray(
const ImageIn& imaIn, ImageOut* imaOut) {
49 assert(imaIn.Depth() >= 3);
51 imaOut->Resize(imaIn.Height(), imaIn.Width(), 1);
54 for (
int j = 0; j < imaIn.Height(); ++j) {
55 for (
int i = 0; i < imaIn.Width(); ++i) {
57 RGB2GRAY(imaIn(j, i, 0), imaIn(j, i, 1), imaIn(j, i, 2));
65 unsigned char* buffer =
66 new unsigned char[image.Width() * image.Height() * image.Depth()];
68 for (
int y = 0; y < image.Height(); y++) {
69 for (
int x = 0; x < image.Width(); x++) {
70 for (
int d = 0; d < image.Depth(); d++) {
71 int index = (y * image.Width() +
x) * image.Depth() + d;
72 buffer[index] = 255.0 *
image(y, x, d);
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)