zoukankan      html  css  js  c++  java
  • 图像拼接显示_python

        glass_img = cv2.imread(glass_dir + glass_img_name)
        test_img  = cv2.imread(test_dir  + test_img_name)
        
        all_w = max(test_img.shape[1], glass_img.shape[1])*2
        all_h = max(test_img.shape[0], glass_img.shape[0])
    
        #save glass_img 和 test_img
        glass_test_img = np.zeros((all_h, all_w, 3), dtype="uint8")
    left_img_xmin = int(glass_test_img.shape[1]/4 - glass_img.shape[1]/2)
    left_img_ymin = int(glass_test_img.shape[0]/2 - glass_img.shape[0]/2)
    left_img_xmax = int(left_img_xmin + glass_img.shape[1])
    left_img_ymax = int(left_img_ymin + glass_img.shape[0])

    right_img_xmin = int(glass_test_img.shape[1]/2 + (glass_test_img.shape[1]/4 - test_img.shape[1]/2))
    right_img_ymin = int(glass_test_img.shape[0]/2 - test_img.shape[0]/2)
    right_img_xmax = int(right_img_xmin + test_img.shape[1])
    right_img_ymax = int(right_img_ymin + test_img.shape[0])
        glass_test_img[left_img_ymin:left_img_ymax,left_img_xmin:left_img_xmax,:]     = glass_img
        glass_test_img[right_img_ymin:right_img_ymax,right_img_xmin:right_img_xmax,:] = test_img
        
        cv2.imwrite('./1/'+str(num)+'_'+'0.png',glass_test_img)
    

      长、宽不一致的两张图像,拼接一起显示,不进行resize操作

  • 相关阅读:
    Linux系统调用
    Kubernetes 中强化tab 功能
    Docker镜像构建之案例分享
    网络基础之名词介绍
    网络基础协议之UDP(下篇)
    网络基础协议之UDP(上篇)
    内核升级
    尼恩 Java高并发三部曲 [官方]
    CDN图解(秒懂
    DNS图解(秒懂
  • 原文地址:https://www.cnblogs.com/wjjcjj/p/14282789.html
Copyright © 2011-2022 走看看