voidMyDemo::pixelVisit_Demo(Mat& image){ int w = image.cols; int h = image.rows; int dims = image.channels(); for (int row = 0; row < h; row++) { for (int col = 0; col < w; col++) {
//灰度图像 if (dims == 1) { int pv = image.at<uchar>(row, col); image.at<uchar>(row, col) = 255 - pv; }
voidMyDemo::pixelVisit_Demo(Mat& image){ int w = image.cols; int h = image.rows; int dims = image.channels(); for (int row = 0; row < h; row++) { uchar* current_row = image.ptr<uchar>(row); for (int col = 0; col < w; col++) {
//image * m -> dst voidMyDemo::operators_Demo(Mat& image){ Mat m = Mat::zeros(image.size(), image.type()); m = Scalar(20, 20, 20); Mat dst = Mat::zeros(image.size(), image.type()); int w = image.cols; int h = image.rows; int dims = image.channels();
for (int row = 0; row < h; row++) { for (int col = 0; col < w; col++) {
//灰度图像 if (dims == 1) { int pv = image.at<uchar>(row, col); image.at<uchar>(row, col) = 255 - pv; }
voidMyDemo::operators_Demo(Mat& image){ Mat dst = Mat::zeros(image.size(), image.type()); Mat m = Mat::zeros(image.size(), image.type()); m = Scalar(20, 20, 20);
//add(image, m, dst); //subtract(image, m, dst); multiply(image, m, dst); //divide(image, m, dst);