#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include <cmath>
using namespace cv;
using namespace std;
int main()
{
double t = 7;
Mat src_in = imread("6.jpg");
Mat src_clone = src_in.clone();
imshow("1", src_in);
Mat src = Mat(Size(src_in.cols * 1.0 / t, src_in.rows * 1.0 / t), src.type());
Mat dst(src_in.size(), src_in.type(), Scalar(255, 255, 255));
resize(src_in, src, Size(src_in.cols / t, src_in.rows / t), 2);
string str[10] = {"9","8", "7", "6", "5", "4", "3", "2", "1", "0"};
cvtColor(src, src, CV_BGR2GRAY);
blur(src, src, Size(3, 3));
for (int i = 0; i < src.rows; i++) {
for (int j = 0; j < src.cols; j++) {
int c = (int)src.at<uchar>(i, j);
使用opencv将图片像素变为数字实现“数字化”
最新推荐文章于 2024-07-21 15:59:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)