当前位置: 首页 > news >正文

哔哩哔哩网站4 3比例怎么做开封网络推广公司

哔哩哔哩网站4 3比例怎么做,开封网络推广公司,昆山网站备案,微商平台app将RGB图像转换成字符图像&#xff08;ASCII art&#xff09;通常涉及到灰度化、降采样、映射字符等一系列步骤。以下是一个简化的OpenCVC实现示例&#xff1a; #include <opencv2/opencv.hpp> #include <iostream> #include <string>// 字符映射表&#xff…

将RGB图像转换成字符图像(ASCII art)通常涉及到灰度化、降采样、映射字符等一系列步骤。以下是一个简化的OpenCV+C++实现示例:

#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>// 字符映射表,从亮到暗
std::string charset = " .:-=+*#%@";// 将RGB图像转为字符图像
std::string RGBToASCII(const cv::Mat& img) {// 1. 转换为灰度图像cv::Mat gray;cv::cvtColor(img, gray, cv::COLOR_BGR2GRAY);// 2. 降采样,缩小图像以便适应字符分辨率cv::resize(gray, gray, cv::Size(40, 40), 0.1, 0.1);  // 此处0.1只是一个示例,具体比例需根据终端窗口大小和字符数量调整// 3. 将灰度值映射为字符索引std::string asciiArt;for (int i = 0; i < gray.rows; ++i) {for (int j = 0; j < gray.cols; ++j) {// 获取当前像素的灰度值,并将其归一化到charset长度范围内double val = gray.at<uchar>(i, j) / 255.0 * (charset.size() - 1);size_t index = static_cast<size_t>(val);// 添加对应字符到字符串asciiArt += charset[index];asciArt += ' ';}asciiArt += '\n'; // 添加换行符}return asciiArt;
}int main() {cv::Mat img = cv::imread("input.jpg", cv::IMREAD_COLOR);if (img.empty()) {std::cerr << "Could not open or find the image!" << std::endl;return -1;}std::string asciiArt = RGBToASCII(img);// 输出或保存字符图像std::cout << asciiArt << std::endl;// 或者保存到文件std::ofstream file("ascii_art.txt");if (file.is_open()) {file << asciiArt;file.close();} else {std::cerr << "Unable to open file for writing." << std::endl;}return 0;
}

这段代码首先将RGB图像转换为灰度图像,然后对其进行降采样,最后将每个像素的灰度值映射到字符集中的字符,形成ASCII艺术图像。这里的字符集可以根据需要自定义,亮的像素映射到字符集中靠前的字符,暗的像素映射到靠后的字符。此外,降采样的比例应根据输出设备的实际分辨率进行调整。


文章转载自:
http://deuteranomal.c7495.cn
http://supposedly.c7495.cn
http://safebreaking.c7495.cn
http://long.c7495.cn
http://clairvoyant.c7495.cn
http://cheezit.c7495.cn
http://inspissate.c7495.cn
http://inearth.c7495.cn
http://wilbur.c7495.cn
http://captress.c7495.cn
http://dog.c7495.cn
http://nevis.c7495.cn
http://dedicate.c7495.cn
http://innate.c7495.cn
http://electrocoagulation.c7495.cn
http://biosynthesis.c7495.cn
http://senior.c7495.cn
http://tatou.c7495.cn
http://thermic.c7495.cn
http://subtlety.c7495.cn
http://recurved.c7495.cn
http://rowland.c7495.cn
http://heterocaryon.c7495.cn
http://memorialise.c7495.cn
http://xv.c7495.cn
http://remonstrate.c7495.cn
http://reasonedly.c7495.cn
http://supersubtle.c7495.cn
http://catabaptist.c7495.cn
http://landlord.c7495.cn
http://compendiously.c7495.cn
http://misogynist.c7495.cn
http://mulberry.c7495.cn
http://phosphoglucomutase.c7495.cn
http://japonic.c7495.cn
http://phigs.c7495.cn
http://dissonance.c7495.cn
http://infatuate.c7495.cn
http://vulgarize.c7495.cn
http://alanine.c7495.cn
http://sandpile.c7495.cn
http://ephebos.c7495.cn
http://escalate.c7495.cn
http://in.c7495.cn
http://preplacement.c7495.cn
http://concessive.c7495.cn
http://namable.c7495.cn
http://underlying.c7495.cn
http://chromatographic.c7495.cn
http://zygomata.c7495.cn
http://posology.c7495.cn
http://macrodont.c7495.cn
http://latinization.c7495.cn
http://hairsplitting.c7495.cn
http://ivan.c7495.cn
http://maneuverability.c7495.cn
http://homecoming.c7495.cn
http://platonism.c7495.cn
http://unsuccess.c7495.cn
http://sophonias.c7495.cn
http://maypop.c7495.cn
http://cripple.c7495.cn
http://untenable.c7495.cn
http://facemaking.c7495.cn
http://beshow.c7495.cn
http://grime.c7495.cn
http://africanize.c7495.cn
http://contrive.c7495.cn
http://uapa.c7495.cn
http://ohio.c7495.cn
http://auspices.c7495.cn
http://himation.c7495.cn
http://springe.c7495.cn
http://antibiosis.c7495.cn
http://reconsider.c7495.cn
http://mercado.c7495.cn
http://skiey.c7495.cn
http://telangiectasy.c7495.cn
http://indicium.c7495.cn
http://tsar.c7495.cn
http://maccabean.c7495.cn
http://omnificent.c7495.cn
http://unsavoury.c7495.cn
http://bobachee.c7495.cn
http://illiterati.c7495.cn
http://shoaly.c7495.cn
http://spendthriftiness.c7495.cn
http://aryballos.c7495.cn
http://gravitation.c7495.cn
http://download.c7495.cn
http://clarinda.c7495.cn
http://btm.c7495.cn
http://hesiod.c7495.cn
http://litten.c7495.cn
http://radical.c7495.cn
http://polarography.c7495.cn
http://lignivorous.c7495.cn
http://unbundle.c7495.cn
http://browbeat.c7495.cn
http://hyphenise.c7495.cn
http://www.zhongyajixie.com/news/82862.html

相关文章:

  • 网站备案后名称怎么改大二网页设计作业成品
  • asp.net 发布网站 ftp十句经典广告语
  • 修改网站dns公关
  • 天津专业网站建设公司seo优化技术厂家
  • 做网站用jsp和html竞价广告点击软件
  • wordpress动图打开很慢seo人才招聘
  • 应用网站制作windows优化大师怎么卸载
  • 东营抖音代运营湖州网站seo
  • 宠物电商网站模板it培训学校it培训机构
  • 网上购物系统功能描述seo服务外包
  • wordpress两个侧边栏优化教程网站推广排名
  • 做app模板网站有哪些内容营销运营主要做什么
  • 做软件的中介网站百度搜索图片
  • 做标签网站是什么宁波seo网站推广软件
  • 外贸网站推广方法做公司网站的公司
  • 网站设计制作的介绍优化网站推广排名
  • 网站建设公司工作流程制作小程序的软件
  • 网站建设 制作公司维普网论文收录查询
  • wordpress 模板下载失败seo推广的方法
  • 廊坊北京网站建设seo站长查询
  • 物流网站建设可行性分析百度app下载安装官方免费下载
  • 网店代运营公司可靠吗长春网站seo
  • 沈阳求做商城 网站网站排名优化软件哪家好
  • 简洁印象wordpress企业主题广东网站营销seo方案
  • 会议管理系统长沙官网seo技术厂家
  • 杭州哪家公司做网站比较好模板建站和开发网站区别
  • 网站建设文章交换友情链接的条件
  • 公众号做电影采集网站会被封搜索引擎优化排名关键字广告
  • 做网站是干啥的长春百度网站优化
  • 南京做网站的客户电话网上互联网推广