60 "Extrapolates an image using a motion field in injection.",
68 process(motion,dst,dst);
76 const int width = src.getWidth();
77 const int height = src.getHeight();
84 const ImageT<T> &u = motion.getChannel(0);
85 const ImageT<T> &v = motion.getChannel(1);
87 CoordinateHandler c(width,height);
95 if ((motion.getChannelCount()>2) && (src.hasAlphaChannel())){
97 std::cerr <<
"Motion Extrap: weighted\n";
98 const ImageT<T> &wMotion = motion.getChannel(motion.getChannelCount()-1);
99 const ImageT<T2> &wData = src.getAlphaChannel();
101 if (drain::Debug > 3){
103 ScaleOp<T,T2>(1.0,0).process(wMotion,tmp); File::write(tmp,
"motion-w0.png");
106 for (
int j = 0; j < height; ++j) {
107 for (
int i = 0; i < width; ++i) {
109 p.setLocation(i+scale*u.at(a)+offset,j+scale*v.at(a)+offset);
111 if (c.handle(p) == CoordinateHandler::UNCHANGED){
112 cumulator.add(p.x,p.y,src.at(a),wData.at(a));
124 for (
int j = 0; j < height; ++j) {
125 for (
int i = 0; i < width; ++i) {
127 p.setLocation(i+scale*u.at(a)+offset,j+scale*v.at(a)+offset);
129 if (c.handle(p) == CoordinateHandler::UNCHANGED){
130 cumulator.add(p.x,p.y,src.at(a),10.0);
137 cumulator.extractTo(dst,
"dw");
141 if (drain::Debug > 0){
142 std::cerr << this->name;
143 std::cerr <<
" offset=" << offset;
144 std::cerr <<
" scale=" << scale;
F getParameter(const std::string &p) const
Gets a single parameter.
Definition: BeanLike.h:86
General-purpose image compositing.
Definition: AccumulationArray.h:112
size_t address(size_t i) const
Computes the index location from image coordinates. Does not involve bit resolution.
Definition: ImageFrame.h:148
Base class for image processing functions.
Definition: ImageOp.h:49
ImageOp(const std::string &name=__FUNCTION__, const std::string &description="")
Definition: ImageOp.h:156
A template class for images with static storage type.
Definition: ImageT.h:67
virtual void setGeometry(size_t width, size_t height, size_t imageChannels=1, size_t alphaChannels=0)
Resizes the image, keeps the current type.
Definition: Image.h:95
Definition: DataSelector.cpp:1277