21#ifndef LIBMV_IMAGE_SAMPLE_H_
22#define LIBMV_IMAGE_SAMPLE_H_
31 const int i =
int(round(y));
32 const int j =
int(round(x));
37 const int ix =
static_cast<int>(
x);
42 }
else if (ix > size - 2) {
62 const T im11 =
image(y1, x1,
v);
63 const T im12 =
image(y1, x2,
v);
64 const T im21 =
image(y2, x1,
v);
65 const T im22 =
image(y2, x2,
v);
67 return T(dy * (dx * im11 + (1.0 - dx) * im12) +
68 (1 - dy) * (dx * im21 + (1.0 - dx) * im22));
81 for (
int i = 0; i < image.Depth(); ++i) {
82 const T im11 =
image(y1, x1, i);
83 const T im12 =
image(y1, x2, i);
84 const T im21 =
image(y2, x1, i);
85 const T im22 =
image(y2, x2, i);
87 sample[i] =
T(dy * (dx * im11 + (1.0 - dx) * im12) +
88 (1 - dy) * (dx * im21 + (1.0 - dx) * im22));
96 int height = in.Height() / 2;
97 int width = in.Width() / 2;
98 int depth = in.Depth();
100 out->Resize(height, width, depth);
103 for (
int r = 0; r < height; ++r) {
104 for (
int c = 0; c < width; ++c) {
105 for (
int k = 0; k < depth; ++k) {
107 (*out)(r, c, k) = (in(2 * r, 2 * c, k) +
108 in(2 * r + 1, 2 * c, k) +
109 in(2 * r, 2 * c + 1, k) +
110 in(2 * r + 1, 2 * c + 1, k)) / 4.0f;
125 sampled->
Resize(2 * half_width + 1, 2 * half_width + 1, channels);
126 for (
int r = -half_width; r <= half_width; ++r) {
127 for (
int c = -half_width; c <= half_width; ++c) {
128 for (
int i = 0; i <
channels; ++i) {
129 (*sampled)(r + half_width, c + half_width, i) =
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
ATTR_WARN_UNUSED_RESULT const BMVert * v
3D array (row, column, channel).
void Resize(int height, int width, int depth=1)
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
T SampleNearest(const Array3D< T > &image, float y, float x, int v=0)
Nearest neighbor interpolation.
T SampleLinear(const Array3D< T > &image, float y, float x, int v=0)
Linear interpolation.
void DownsampleChannelsBy2(const Array3Df &in, Array3Df *out)
void LinearInitAxis(float x, int size, int *x1, int *x2, float *dx)
void SamplePattern(const FloatImage &image, double x, double y, int half_width, int channels, FloatImage *sampled)