18 #ifndef PIC_FILTERING_FILTER_REMOVE_INF_NAN_HPP 19 #define PIC_FILTERING_FILTER_REMOVE_INF_NAN_HPP 21 #include "../filtering/filter.hpp" 44 for(
int j = box->
y0; j < box->y1; j++) {
45 for(
int i = box->
x0; i < box->x1; i++) {
47 float *tmp_data = (*src[0])(i, j);
48 float *tmp_dst = (*dst )(i, j);
50 for(
int ch = 0; ch < channels; ch++) {
52 float val = tmp_data[ch];
57 for(
int k = -1; k <= 1; k++) {
58 for(
int l = -1; l <= 1; l++) {
60 float *tmp_val = (*src[0])(i + l, j + k);
62 if(!(
isnan(tmp_val[ch]) ||
isinf(tmp_val[ch]))) {
63 values[c2] = tmp_val[ch];
72 std::sort(values, values + c2);
73 tmp_dst[ch] = values[5];
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
int channels
Definition: image.hpp:80
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
The Filter class.
Definition: filter.hpp:50
The FilterRemoveInfNaN class.
Definition: filter_remove_inf_nan.hpp:28
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
PIC_INLINE bool isinf(T value)
isinf is it a Inf value?
Definition: math.hpp:103
int y0
Definition: bbox.hpp:32
PIC_INLINE bool isnan(T value)
isnan is it a NaN?
Definition: math.hpp:93
FilterRemoveInfNaN()
FilterRemoveInfNaN.
Definition: filter_remove_inf_nan.hpp:88
The Image class stores an image as buffer of float.
Definition: image.hpp:60
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_remove_inf_nan.hpp:38
PIC_INLINE ImageVec Single(Image *img)
Single creates an std::vector which contains img; this is for filters input.
Definition: image_vec.hpp:36
Definition: bilateral_separation.hpp:25
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: filter_remove_inf_nan.hpp:99