目录
note
// g(x,y) = a * f(x,y) + b
code
void line_convert_fun(uchar& in, uchar& out) {
out = -1 * in + 255;
}
void img_line_convert(Mat& src, Mat& res) {
if (src.empty()) {
printf("src empty\n");
return;
}
int src_rows = src.rows;
int src_cols = src.cols;
res = Mat(src_rows, src_cols, CV_8UC1);
for (int i = 0; i < src_rows; ++i) {
for (int j = 0; j < src_cols; ++j) {
line_convert_fun(src.at<uchar>(i,j), res.at<uchar>(i,j));
}
}
}