18 #ifndef PIC_ALGORITHMS_SUB_SAMPLE_STACK_HPP 19 #define PIC_ALGORITHMS_SUB_SAMPLE_STACK_HPP 21 #include "../util/math.hpp" 22 #include "../util/std_util.hpp" 24 #include "../image.hpp" 25 #include "../image_vec.hpp" 26 #include "../point_samplers/sampler_random.hpp" 27 #include "../histogram.hpp" 45 printf(
"Computing histograms...");
67 printf(
"Sampling...");
75 float u = float(i) / div;
83 float *ptr = std::upper_bound(&bin_c[0], &bin_c[0]+256, u);
105 int width = stack[0]->width;
106 int height = stack[0]->height;
122 printf(
"--subSample samples: %d \t \t old samples: %d\n",
nSamples, oldNSamples);
134 float fetched = (*stack[j])(x, y)[k];
135 float tmp =
lround(fetched * 255.0f);
194 if(!((stack.size() > 1 && (
nSamples > 1)))) {
199 this->channels = stack[0]->channels;
200 this->exposures = int(stack.size());
208 if (alpha < 0.f || alpha > 1.f)
210 else if (alpha > 0.5f)
213 if(alpha > 0.f && alpha <= 0.5f) {
214 float t_min_f = alpha;
215 float t_max_f = 1.0f - t_min_f;
217 int t_min = int(t_min_f * 255.0f);
218 int t_max = int(t_max_f * 255.0f);
220 for(
int i = 0; i <
total; i++) {
251 for(
int i = 0; i <
total; i++) {
int total
Definition: sub_sample_stack.hpp:148
int getSamplesPerLevel(int level)
getSamplesPerLevel
float * cumulativef(bool bNormalized)
cumulativef computes the cumulative Histogram.
Definition: histogram.hpp:440
void calculate(Image *imgIn, VALUE_SPACE type=VS_LIN, int nBin=256, BBox *box=NULL, int channel=0)
calculate computes the histogram of an input image. In the case of LDR images, they are ssumed to be ...
Definition: histogram.hpp:213
T * delete_s(T *data)
delete_s
Definition: std_util.hpp:123
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
The Histogram class is a class for creating, managing, loading, and saving histogram for an Image...
Definition: histogram.hpp:37
PIC_INLINE long lround(double x)
lround rounds double numbers properly.
Definition: math.hpp:229
float * getCumulativef()
getCumulativef this function returns the cumulative Histogram. Note that cumulativef needs to be comp...
Definition: histogram.hpp:459
~SubSampleStack()
Definition: sub_sample_stack.hpp:165
void getSampleAt(int level, int i, int &x, int &y)
getSampleAt
Definition: point_samplers.hpp:51
Definition: histogram.hpp:31
int * samples
Definition: sub_sample_stack.hpp:149
The SubSampleStack class.
Definition: sub_sample_stack.hpp:34
int channels
Definition: sub_sample_stack.hpp:146
void sampleGrossberg(ImageVec &stack)
sampleGrossberg creates a low resolution version of the stack using Grossberg and Nayar sampling...
Definition: sub_sample_stack.hpp:42
void sampleSpatial(ImageVec &stack, SAMPLER_TYPE sub_type=ST_MONTECARLO_S)
sampleSpatial creates a low resolution version of the stack.
Definition: sub_sample_stack.hpp:103
SAMPLER_TYPE
Definition: point_samplers.hpp:51
SubSampleStack()
SubSampleStack.
Definition: sub_sample_stack.hpp:156
void execute(ImageVec &stack, int nSamples, float alpha=0.f, bool bSpatial=false, SAMPLER_TYPE sub_type=ST_MONTECARLO_S)
execute
Definition: sub_sample_stack.hpp:190
#define CLAMPi(x, a, b)
Definition: math.hpp:81
Definition: bilateral_separation.hpp:25
int nSamples
Definition: sub_sample_stack.hpp:147
The RandomSampler class.
Definition: sampler_random.hpp:43
int exposures
Definition: sub_sample_stack.hpp:145
void release()
release
Definition: sub_sample_stack.hpp:173
void print()
print
Definition: sub_sample_stack.hpp:249
The Vec class.
Definition: vec.hpp:35
int getNSamples() const
getNSamples
Definition: sub_sample_stack.hpp:241