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

专业分销网站建设软件代码大全

专业分销网站建设,软件代码大全,室内设计作品欣赏,东莞搜索引擎网站推广SGM(Semi-Global Matching)原理#xff1a; SGM的原理在wiki百科和matlab官网上有比较详细的解释#xff1a; wiki matlab 如果想完全了解原理还是建议看原论文 paper#xff08;我就不看了#xff0c;懒癌犯了。#xff09; 优质论文解读和代码实现 一位大神自己用c实现…SGM(Semi-Global Matching)原理 SGM的原理在wiki百科和matlab官网上有比较详细的解释 wiki matlab 如果想完全了解原理还是建议看原论文 paper我就不看了懒癌犯了。 优质论文解读和代码实现 一位大神自己用c实现的SGM算法github 先介绍两个重要的参数 注这一部分参考的是matlab的解释后面的部分是参考的opencv的实现细节可能有些出入大体上是一致的。 Disparity Levels and Number of Directions Disparity Levels Disparity Levels: Disparity levels is a parameter used to define the search space for matching. As shown in figure below, the algorithm searches for each pixel in the Left Image from among D pixels in the Right Image. The D values generated are D disparity levels for a pixel in Left Image. The first D columns of Left Image are unused because the corresponding pixels in Right Image are not available for comparison. In the figure, w represents the width of the image and h is the height of the image. For a given image resolution, increasing the disparity level reduces the minimum distance to detect depth. Increasing the disparity level also increases the computation load of the algorithm. At a given disparity level, increasing the image resolution increases the minimum distance to detect depth. Increasing the image resolution also increases the accuracy of depth estimation. The number of disparity levels are proportional to the input image resolution for detection of objects at the same depth. This example supports disparity levels from 8 to 128 (both values inclusive). The explanation of the algorithm refers to 64 disparity levels. The models provided in this example can accept input images of any resolution.——matlab 字太多看不懂让gpt解释了一下 # gpt生成仅供本人理解SSD原理 import numpy as npdef compute_disparity(left_img, right_img, block_size5, num_disparities64):# 图像尺寸height, width left_img.shape# 初始化视差图disparity_map np.zeros_like(left_img)# 遍历每个像素for y in range(height):for x in range(width):# 定义搜索范围min_x max(0, x - num_disparities // 2)max_x min(width, x num_disparities // 2)# 提取左图像块left_block left_img[y:yblock_size, x:xblock_size]# 初始化最小 SSD 和对应的视差min_ssd float(inf)best_disparity 0# 在搜索范围内寻找最佳视差for d in range(min_x, max_x):# 提取右图像块right_block right_img[y:yblock_size, d:dblock_size]# 计算 SSDssd np.sum((left_block - right_block)**2)# 更新最小 SSD 和对应的视差if ssd min_ssd:min_ssd ssdbest_disparity abs(x - d)# 将最佳视差保存到视差图中disparity_map[y, x] best_disparityreturn disparity_map# 示例用法 left_img np.random.randint(0, 255, size(100, 100), dtypenp.uint8) right_img np.roll(left_img, shift5, axis1) # 创建右图右移了5个像素disparity_map compute_disparity(left_img, right_img, block_size5, num_disparities64)# 可视化结果这里简化为将视差图缩放以便可视化 import matplotlib.pyplot as plt plt.imshow(disparity_map, cmapgray) plt.title(Disparity Map) plt.show() 这样就明白了Disparity Levels就是计算视差的范围视差搜索范围。 Number of Directions Number of Directions Number of Directions: In the SGBM algorithm, to optimize the cost function, the input image is considered from multiple directions. In general, accuracy of disparity result improves with increase in number of directions. This example analyzes five directions: left-to-right (A1), top-left-to-bottom-right (A2), top-to-bottom (A3), top-right-to-bottom-left (A4), and right-to-left (A5). 按照单一路径匹配像素不够稳健按照图像进行二维最优的全局匹配时间复杂度太高NP完全问题所以SGM的作者使用一维路径聚合的方式来近似二维最优。 pic 参考 SAD和SSD 用SAD 或者 SSD计算图像相似度来做匹配。 公式 公式和代码虽然是gpt生成的但是公式看起来没错代码可以帮助理解仅供参考。 代码里面的 num_disparities 就是 Disparity Levels SGBM in opencv 本人用opencv较多这里仅关注代码在opencv的实现。 opencv StereoSGBM_create示例 # gpt生成仅作为参考具体请查看opencv官方文档https://docs.opencv.org/4.x/d2/d85/classcv_1_1StereoSGBM.html import cv2 import numpy as np# 读取左右视图 left_image cv2.imread(left_image.png, cv2.IMREAD_GRAYSCALE) right_image cv2.imread(right_image.png, cv2.IMREAD_GRAYSCALE)# 创建SGBM对象 sgbm cv2.StereoSGBM_create(minDisparity0,numDisparities16, # 视差范围一般为16的整数倍blockSize5, # 匹配块的大小一般为奇数P18 * 3 * 5 ** 2, # SGBM算法参数P232 * 3 * 5 ** 2, # SGBM算法参数disp12MaxDiff1, # 左右视差图的最大差异uniquenessRatio10, # 匹配唯一性百分比speckleWindowSize100, # 过滤小连通区域的窗口大小speckleRange32 # 连通区域内的差异阈值 )# 计算视差图 disparity_map sgbm.compute(left_image, right_image)# 将视差图进行归一化处理 disparity_map cv2.normalize(disparity_map, None, 0, 255, cv2.NORM_MINMAX)# 显示左图、右图和视差图 cv2.imshow(Left Image, left_image) cv2.imshow(Right Image, right_image) cv2.imshow(Disparity Map, disparity_map.astype(np.uint8))cv2.waitKey(0) cv2.destroyAllWindows() Difference between SGBM and SGM what is the difference between opencv sgbm and sgm opencv官方的解释 The class implements the modified H. Hirschmuller algorithm [82] that differs from the original one as follows: By default, the algorithm is single-pass, which means that you consider only 5 directions instead of 8. Set modeStereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the algorithm but beware that it may consume a lot of memory.The algorithm matches blocks, not individual pixels. Though, setting blockSize1 reduces the blocks to single pixels.Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi sub-pixel metric from [15] is used. Though, the color images are supported as well. Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness check, quadratic interpolation and speckle filtering). 大概的意思就是与SGM不同之处在于SGBM算法匹配的时候最小单位是blocks而不是像素不过设置blockSize1的时候就变成SGM了。没有实现互信息而是用了更简单的Birchfield-Tomasi sub-pixel metric。除此之外还有一些预处理和后处理操作。 大概是这样不知道对不对。 深度的立体匹配算法 先开个坑
http://www.zqtcl.cn/news/826608/

相关文章:

  • 易企秀网站怎么做轮播图装饰设计公司wordpress主题
  • 网站建设搜索优wordpress the
  • 怎么做点图片连接网站北京大学网络服务
  • 家具制作网站台州网页设计公司
  • 优化网站 提高查询建设综合购物网站
  • 农产品网站设计方案湖南长沙网站建设公司
  • 网站过期查询服务器放网站吗
  • 郑州做网站的外包公司有哪些大连seo排名
  • 写小说的网站自己做封面2008年做的网站
  • 哈尔滨做网站哪家好强企业邮箱登录入口163
  • 网站点击率原因学php到做网站要多久
  • 哪里有创建网站的长沙网站seo技巧
  • 影楼公共网站wordpress提交360
  • 哪有做网站东莞中堂网站建设
  • 什么叫域名访问网站网络运营管理
  • 深圳网络推广网站泰安网站建设公司
  • 淄博网站建设铭盛信息如何注册一个app平台
  • 深圳网站的建设维护公司成功的网站必须具备的要素
  • wordpress主题站主题小型企业网站的设计与实现
  • 长沙专门做网站公司怎么进入网站管理页面
  • 做网站企业的发展前景东莞免费企业网站模板推广
  • 国外做锅炉的网站wordpress批量提交表单
  • 浙江省建设科技推广中心网站兼职做网站这样的网站
  • 网站开发前端培训最有设计感的网站
  • 巢湖有没有专门做网站的公司深圳 网站设计公司价格
  • 信息图表设计网站站长工具使用方法
  • 建站赔补用python做网站优点
  • 个人免费域名空间建站淄博网络公司全网推广
  • 企业信息年报系统南昌做seo的公司
  • 门户网站开发模板动漫设计与制作设计课程