18 #ifndef PIC_FILTERING_FILTER_CROP_HPP 19 #define PIC_FILTERING_FILTER_CROP_HPP 21 #include "../filtering/filter.hpp" 22 #include "../util/vec.hpp" 119 Image img(1, 512, 512, 3);
126 out->
Write(
"test_crop_2d_output.png");
147 for(
int i = 0; i < 3; i++) {
148 this->
mini[i] = min[i];
149 this->
maxi[i] = max[i];
177 mini[0] = int(
minf[0] * imgIn[0]->widthf);
178 mini[1] = int(
minf[1] * imgIn[0]->heightf);
179 mini[2] = int(
minf[2] * imgIn[0]->framesf);
181 maxi[0] = int(
maxf[0] * imgIn[0]->widthf);
182 maxi[1] = int(
maxf[1] * imgIn[0]->heightf);
183 maxi[2] = int(
maxf[2] * imgIn[0]->framesf);
186 channels =
MIN(imgIn[0]->channels,
maxi[3]) -
mini[3];
193 for(
int i = 0; i < 3; i++) {
198 delta[0] = imgIn[0]->width;
200 maxi[0] = imgIn[0]->width;
204 delta[1] = imgIn[0]->height;
206 maxi[1] = imgIn[0]->height;
210 delta[2] = imgIn[0]->frames;
212 maxi[2] = imgIn[0]->frames;
224 for(
int p = box->
z0; p < box->z1; p++) {
225 for(
int j = box->
y0; j < box->y1; j++) {
226 for(
int i = box->
x0; i < box->x1; i++) {
227 float *dst_data = (*dst)(i -
mini[0], j -
mini[1], p -
mini[2]);
228 float *src_data = (*src[0])(i, j, p);
230 for(
int k =
mini[3]; k <=
maxi[3]; k++) {
231 dst_data[k -
mini[3]] = src_data[k];
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
Vec4i maxi
Definition: filter_crop.hpp:33
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
static Image * execute(Image *imgIn, Image *imgOut, Vec2i min, Vec2i max)
execute
Definition: filter_crop.hpp:107
static Image * execute(Image *imgIn, Image *imgOut, Vec4i min, Vec4i max)
execute
Definition: filter_crop.hpp:92
The Filter class.
Definition: filter.hpp:50
void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
OutputSize.
Definition: filter_crop.hpp:174
Vec3f minf
Definition: filter_crop.hpp:34
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
static void test()
test
Definition: filter_crop.hpp:117
Vec< 2, int > Vec2i
Vec2i.
Definition: vec.hpp:829
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_crop.hpp:220
FilterCrop(Vec2i min, Vec2i max)
FilterCrop.
Definition: filter_crop.hpp:130
int y0
Definition: bbox.hpp:32
bool flag
Definition: filter_crop.hpp:32
Vec4i mini
Definition: filter_crop.hpp:33
The FilterCrop class.
Definition: filter_crop.hpp:29
#define PIC_INLINE
Definition: base.hpp:33
Vec3f maxf
Definition: filter_crop.hpp:34
#define MIN(a, b)
Definition: math.hpp:69
The Image class stores an image as buffer of float.
Definition: image.hpp:60
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
int z0
Definition: bbox.hpp:32
bool Write(std::string nameFile, LDR_type typeWrite, int writerCounter)
Write saves an Image into a file on the disk.
The Vec class.
Definition: vec.hpp:35