1 | initial version |
i won't attempt to crack those captcha's (this is somewhat silly in the 1st place), but imho this is a good place to think about remapping , please have a look at the tutorial !
int main()
{
Mat img = imread("captcha1.jpg");
float phase = -0.8 * CV_PI;
float freq = 2.0 * CV_PI / img.cols;
float amp = 15;
Mat_<Vec2f> proj(img.size());
for (int y=0; y<img.rows; y++) {
for (int x=0; x<img.cols; x++) {
float u = float(x) * freq;
float v = sin(phase + u) * amp;
proj(y,x) = Vec2f(x, float(y) + v);
}
}
Mat corr;
cv::remap(img, corr, proj, cv::Mat(), INTER_LINEAR);
imshow("in",img);
imshow("out",corr);
waitKey();
}
2 | No.2 Revision |
i won't attempt to crack those captcha's (this is somewhat silly in the 1st place), but imho this is a good place to think about remapping , please have a look at the tutorial !
int main()
{
Mat img = imread("captcha1.jpg");
float phase = -0.8 * CV_PI;
float freq = 2.0 * CV_PI / img.cols;
float amp = 15;
Mat_<Vec2f> proj(img.size());
for (int y=0; y<img.rows; y++) {
for (int x=0; x<img.cols; x++) {
float u = float(x) * freq;
0; // todo, i'll lleave it to you !
float v = sin(phase + u) float(x) * freq) * amp;
proj(y,x) = Vec2f(x, Vec2f(float(x) + u, float(y) + v);
}
}
Mat corr;
cv::remap(img, corr, proj, cv::Mat(), INTER_LINEAR);
imshow("in",img);
imshow("out",corr);
waitKey();
}
3 | No.3 Revision |
i won't attempt maybe you should try to crack those captcha's (this is somewhat silly in undo the 1st place), but imho this is a good place to think about distortion, before doing any further processing,
remapping , would help a lot here, please have a look at the tutorial !
int main()
{
Mat img = imread("captcha1.jpg");
float phase = -0.8 * CV_PI;
float freq omega = 2.0 * CV_PI / img.cols;
float amp = 15;
Mat_<Vec2f> proj(img.size());
for (int y=0; y<img.rows; y++) {
for (int x=0; x<img.cols; x++) {
float u = 0; // todo, i'll lleave it to you !
float v = sin(phase + float(x) * freq) omega) * amp;
proj(y,x) = Vec2f(float(x) + u, float(y) + v);
}
}
Mat corr;
cv::remap(img, corr, proj, cv::Mat(), INTER_LINEAR);
imshow("in",img);
imshow("out",corr);
waitKey();
}