Canjie-Luo / Text-Image-Augmentation

Geometric Augmentation for Text Image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why oldDotL are set by DstPoints ?

huntzhan opened this issue · comments

Could you help explain the following contradiction?

According to the paper, w_k is defined with respect to the fiducial point(control point) p_k, and hence oldDotL should represent the fiducial point here:

w[k] = 1 / ((i - oldDotL[k].x) * (i - oldDotL[k].x) +
(j - oldDotL[k].y) * (j - oldDotL[k].y));

But instead oldDotL are set with the deformed positions:

void ImgWarp_MLS::setDstPoints(const vector<Point_<int> > &qdst) {
nPoint = qdst.size();
oldDotL.clear();
oldDotL.reserve(nPoint);
for (size_t i = 0; i < qdst.size(); i++) oldDotL.push_back(qdst[i]);
}

qdst.push_back(Point(rand()%threshold, rand()%threshold));
qdst.push_back(Point(img_input.cols-rand()%threshold, rand()%threshold));
qdst.push_back(Point(img_input.cols-rand()%threshold, img_input.rows-rand()%threshold));
qdst.push_back(Point(rand()%threshold, img_input.rows-rand()%threshold));
for (int i = 1; i < segment; i++){
qsrc.push_back(Point(cut*i, 0));
qsrc.push_back(Point(cut*i, img_input.rows));
qdst.push_back(Point(cut*i+rand()%threshold-0.5*threshold, rand()%threshold-0.5*threshold));
qdst.push_back(Point(cut*i+rand()%threshold-0.5*threshold, img_input.rows+rand()%threshold-0.5*threshold));
}
cv::Mat result = trans1.setAllAndGenerate(img_input, qsrc, qdst, img_input.cols, img_input.rows);

Just realize the mapping is from deformed space to source space.