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

Chapter 6 Joining Images

# 这个是numpy的功能
# imgHor = np.hstack((img, img))
# imgVer = np.vstack((img, img))def stackImages(scale, imgArray):rows = len(imgArray)cols = len(imgArray[0])rowsAvailable = isinstance(imgArray[0], list)width = imgArray[0][0].shape[1]height = imgArray[0][0].shape[0]if rowsAvailable:for x in range ( 0, rows):for y in range(0, cols):if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]:imgArray[x][y] = cv2.resize(imgArray[x][y], (0, 0), None, scale, scale)else:imgArray[x][y] = cv2.resize(imgArray[x][y], (imgArray[0][0].shape[1], imgArray[0][0].shape[0]), None, scale, scale)if len(imgArray[x][y].shape) == 2: imgArray[x][y]= cv2.cvtColor( imgArray[x][y], cv2.COLOR_GRAY2BGR)imageBlank = np.zeros((height, width, 3), np.uint8)hor = [imageBlank]*rowshor_con = [imageBlank]*rowsfor x in range(0, rows):hor[x] = np.hstack(imgArray[x])ver = np.vstack(hor)else:for x in range(0, rows):if imgArray[x].shape[:2] == imgArray[0].shape[:2]:imgArray[x] = cv2.resize(imgArray[x], (0, 0), None, scale, scale)else:imgArray[x] = cv2.resize(imgArray[x], (imgArray[0].shape[1], imgArray[0].shape[0]), None,scale, scale)if len(imgArray[x].shape) == 2: imgArray[x] = cv2.cvtColor(imgArray[x], cv2.COLOR_GRAY2BGR)hor= np.hstack(imgArray)ver = horreturn verimgStack = stackImages(0.8, ([img, img, img]))

 

image

image

image

 

http://www.zskr.cn/news/8909.html

相关文章:

  • 动态主机配置协议(DHCP)中的中继机制及其配置
  • 进一步理解自适应卡尔曼滤波(AKF) - 教程
  • 完整教程:基于Spring Boot植物销售管理系统的设计与实现
  • Vdd Vcc
  • 使用Java实现用户的注册和登录流程
  • Windows安装Kafka(kafka_2.12-3.9.1),配置Kafka,以及遇到的困难解决方案
  • Chapter 5 Wrap Perspective
  • 手动清除Ubuntu系统中的内存缓存
  • 插值相关
  • 详解scheduleAtFixedRate 与 scheduleWithFixedDelay 的区别
  • 模拟输入的过程
  • Manim实现水波纹特效
  • CSP 2025 S1 游记
  • JS之使用for...of赋值失败的原因分析
  • Linux /lib/modules/$(uname -r)/ 目录功能作用详解
  • 软件工程第二次作业_个人项目
  • Chapter 3 Resize and Cropping
  • 解决Kubernetes集群中master节点无法与node节点通信的策略
  • 配置Nginx以支持Websocket连接的方法
  • Extundelete工具恢复数据
  • 最新!!!MySQL环境搭建(windows系统) - 详解
  • SQLite数据库 - 教程
  • 【Bluedroid】A2DP Source 音频流暂停流程解析[3]:AVDTP 协议中 Suspend Accept 响应的处理流程与建立分析(Suspend Accept)
  • Mysql查询条件里的字符串不加引导索引失效
  • 详细介绍:在Ubuntu平台搭建RTMP直播服务器使用SRS简要指南
  • 实用指南:在 k8s 上部署 Kafka 4.0 3节点集群
  • 完整教程:VLAN划分——TRUNK
  • 现代操作系统-音频处理技术1 Linux驱动底层
  • 智元首次明确七人合伙人团队
  • ABC424