#include #include #include #include #include "Ttiming.h" #include using namespace std; using namespace cv; #define RX 5 #define RY 5 int main(int argc, char *argv[]) { int i,j,k,l,m,n; TTiming tt; char *endptr; int sumka_r, sumka_g, sumka_b; int suma_wag = 0; int ratio[RX][RY] = { {1, 4, 7, 4, 1}, {4, 16, 26, 16, 4}, {7, 26, 41, 26, 7}, {4, 16, 26, 16, 4}, {1, 4, 7, 4, 1} }; if (argc < 4) { cerr << "Usage: " << argv[0] << " " << endl; exit(1); } int threads_num = strtol(argv[1], &endptr, 10); if (*endptr) { cerr << "Invalid number of threads format" << endl; exit(1); } if (threads_num <= 0) { cerr << "The number of threads must be positive" << endl; exit(1); } for (i=0; iimg.rows-3 || j<2 || j>img.cols-3) { img_out.at(i, j)[0] = img.at(i, j)[0]; img_out.at(i, j)[1] = img.at(i, j)[1]; img_out.at(i, j)[2] = img.at(i, j)[2]; } else { sumka_r = 0; sumka_g = 0; sumka_b = 0; m=i-2; for (k=0; k(m, n)[0]; sumka_g += ratio[k][l] * img.at(m, n)[1]; sumka_r += ratio[k][l] * img.at(m, n)[2]; } } img_out.at(i, j).val[0] = sumka_b / suma_wag; img_out.at(i, j).val[1] = sumka_g / suma_wag; img_out.at(i, j).val[2] = sumka_r / suma_wag; } } } long elapsed = tt.End(); cout << "Time: " << elapsed << " ms" << endl; imwrite(argv[3], img_out); exit(0); }