18 #ifndef PIC_FILTERING_FILTER_NPASSES_HPP 19 #define PIC_FILTERING_FILTER_NPASSES_HPP 21 #include "../util/std_util.hpp" 23 #include "../filtering/filter.hpp" 128 for(
int i = 0; i < 2; i++) {
150 stdVectorClear<Image>(
imgTmp);
168 auto *tmp = imgIn[0];
173 for(
int i = 0; i < n; i++) {
175 flt_i->changePass(i, n);
176 flt_i->OutputSize(imgIn, width, height, channels, frames);
178 imgIn0->
width = width;
192 int width, height, frames, channels;
193 OutputSize(imgIn, width, height, frames, channels);
198 setToANullVector<Image>(
imgTmp, n);
202 filters[0]->OutputSize(imgIn, tw, th, tf, tc);
204 if(tw !=
imgTmp[0]->width ||
205 th !=
imgTmp[0]->height ||
206 tf !=
imgTmp[0]->frames ||
207 tc !=
imgTmp[0]->channels) {
209 stdVectorClear<Image>(
imgTmp);
211 setToANullVector<Image>(
imgTmp, n);
217 imgOut =
new Image(frames, width, height, channels);
219 if(imgOut->
height != height ||
220 imgOut->
width != width ||
222 imgOut->
frames != frames) {
223 imgOut =
new Image(frames, width, height, channels);
262 bool parallel =
false)
269 for(
int i = 0; i < n2; i++) {
271 flt_i->changePass(i, n);
279 flt_n->changePass(n2, n);
281 imgOut =
filters[n2]->Process(imgIn, imgOut);
287 bool parallel =
false)
294 flt_0->changePass(0, n);
298 for(
int i = 1; i < n; i++) {
300 flt_i->changePass(i, n);
313 if(imgIn.empty() ||
filters.empty()) {
319 int width, height, frames, channels;
320 OutputSize(imgIn, width, height, frames, channels);
322 bool bSame = (imgIn[0]->width == width) &&
323 (imgIn[0]->height == height) &&
324 (imgIn[0]->frames == frames) &&
325 (imgIn[0]->channels == channels);
virtual Filter * getFilter(int i)
getFilter
Definition: filter_npasses.hpp:153
void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
OutputSize.
Definition: filter_npasses.hpp:164
int channels
Definition: image.hpp:80
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
Image * ProcessGen(ImageVec imgIn, Image *imgOut, bool parallel)
ProcessGen.
Definition: filter_npasses.hpp:261
bool isSimilarType(const Image *img)
isSimilarType checks if the current image is similar to img; i.e. if they have the same width...
The Filter class.
Definition: filter.hpp:50
virtual void PreProcess(ImageVec imgIn, Image *imgOut)
PreProcess.
Definition: filter_npasses.hpp:42
int frames
Definition: image.hpp:80
Image * imgAllocated
Definition: filter_npasses.hpp:33
virtual int getIterations()
getIterations
Definition: filter_npasses.hpp:159
Image * setupAuxNGen(ImageVec imgIn, Image *imgOut)
setupAuxNGen
Definition: filter_npasses.hpp:189
Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter_npasses.hpp:310
Image * setupAuxNSame(ImageVec imgIn, Image *imgOut)
setupAuxNSame
Definition: filter_npasses.hpp:230
~FilterNPasses()
Definition: filter_npasses.hpp:135
FilterNPasses()
FilterNPasses.
Definition: filter_npasses.hpp:124
#define PIC_INLINE
Definition: base.hpp:33
Image * ProcessSame(ImageVec imgIn, Image *imgOut, bool parallel)
ProcessSame.
Definition: filter_npasses.hpp:286
The Image class stores an image as buffer of float.
Definition: image.hpp:60
Image * allocateSimilarOne()
allocateSimilarOne creates an Image with similar size of the calling instance.
void release()
release
Definition: filter_npasses.hpp:140
Definition: bilateral_separation.hpp:25
ImageVec imgTmp
Definition: filter_npasses.hpp:35
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
std::vector< Filter * > filters
Definition: filter_radial_basis_function.hpp:121
Image * imgTmpSame[2]
Definition: filter_npasses.hpp:34
The FilterNPasses class.
Definition: filter_npasses.hpp:30