#include"opencv_test.h" opencv_t::opencv_t() { } opencv_t::~opencv_t() { } opencv_t* opencv_t::create_new() { opencv_t* temp = nullptr; temp = new opencv_t(); return temp; } void opencv_t::visit_xiangsu(Mat& temp) { int w = temp.cols; int h = temp.rows; int dims = temp.channels(); for (int row = 0; row < h; row++) { for (int col = 0; col < w; col++) { if (dims == 1) { int pv = temp.at(row, col); temp.at(row, col) = 255 - pv; } else if (dims == 3) { Vec3b pv = temp.at(row, col); temp.at(row, col)[0] = 255 - pv[0]; temp.at(row, col)[1] = 255 - pv[1]; temp.at(row, col)[2] = 255 - pv[2]; } } } }