图像融合skimage

  • 图像融合
  • 代码结果示例

图像融合

##拉普拉斯金字塔

In CollageCreate function, there is a Fusion class object. The Fusion class will get the image folder name and contains different kinds of methods to process the images. You can put different numbers of images into the folder and it will process all these images and output a fusion image. In the class , it will first load the images and then calculate all their Laplacian pyramids. I use the pyramids to fuse the images in multiscale layers. Finally , I upsample the fused Laplacian pyramids and use all of them to create a new fusion type. So far, the fusion image is created and I plot this image in the end.

import numpy as np
import matplotlib.pyplot as plt
from skimage import data, transform, color,exposure, img_as_float, io
import osclass Fusion(object):def __init__(self,AddressofFolder):self.folder_name = AddressofFolderself.n_images = Noneself.images = self.load_images(self.folder_name)self.pyramids = self.get_laplacian()self.ls = Noneself.stack_ls()def load_images(self,path):names = os.listdir(path)self.n_images = len(names)images = [io.imread(os.path.join('images',n)) for n in names]new_ = []for i in images:new_.append(transform.resize(i,(600,600,3)))return new_def get_laplacian(self):ls = []for i in self.images:lp = list(transform.pyramid_laplacian(i, downscale=2, multichannel=True))ls.append(lp)return lsdef stack_ls(self):layers = len(self.pyramids[0])n1 = self.n_images//2n2 = self.n_images - n1ls1_imgs = []for l in range(0,layers):temp = self.pyramids[0][l]for i in range(1,n1):temp = np.hstack((temp[:,:],self.pyramids[i][l][:,:]))ls1_imgs.append(temp)#[print(i.shape) for i in ls1_imgs]ls1_shape = [l.shape for l in ls1_imgs]for i in range(n1,self.n_images):for l in range(0,layers):if i!=self.n_images-1:self.pyramids[i][l] = transform.resize(self.pyramids[i][l],(self.pyramids[i][l].shape[0],max(1,ls1_shape[l][1]//n2)))else:w = ls1_shape[l][1] - ls1_shape[l][1]//n2*(n2-1)#h = ls1_shape[l][0] - ls1_shape[l][0]//n2*(n2-1)self.pyramids[i][l] = transform.resize(self.pyramids[i][l],(self.pyramids[i][l].shape[0],w))[print(i[0].shape) for i in self.pyramids]ls2_imgs = []for l in range(0,layers):temp = self.pyramids[n1][l]for i in range(n1+1,self.n_images):temp = np.hstack((temp[:,:],self.pyramids[i][l][:,:]))ls2_imgs.append(temp)self.ls = [][print(i.shape) for i in ls1_imgs][print(i.shape) for i in ls2_imgs]for l1,l2 in zip(ls1_imgs,ls2_imgs):l = np.vstack((l1[:,:],l2[:,:]))self.ls.append(l)print(len(self.ls))[print(i.shape) for i in self.ls]def sfusion(self):new_image = self.ls[-1]for i in range(len(self.ls) - 1):temp_img = self.ls[len(self.ls) - 2 - i]# gs_tmp = GS[len(LS)-2-i]# z = temp_img.shape[0]# o = temp_img.shape[1]# new_image = transform.resize(new_image,(rows,cols))new_image = transform.rescale(new_image, 2, multichannel=True)temp_img = transform.resize(temp_img, (new_image.shape[0], new_image.shape[1]))# gs_tmp = transform.resize(gs_tmp, (new_image.shape[0], new_image.shape[1]))new_image = new_image + temp_imgself.fusion_image = new_imageplt.imshow(new_image*3)plt.show()def CollageCreate(AddressofFolder):f = Fusion(AddressofFolder)print([i.shape for i in f.images])f.sfusion()if __name__ == '__main__':CollageCreate('images')

代码结果示例

图像融合 skimage相关推荐

  1. 图像融合质量评价方法SSIM、PSNR、EN、MSE与NRMSE(一)

    文章目录 1 前言 2 融合评价指标介绍 2.1 结构相似性 SSIM 2.2 峰值信噪比 PSNR 2.3 信息熵 Entropy 2.4 均方误差 MSE 2.5 归一化均方根误差 NRMSE 3 ...

  2. 图像融合质量评价方法MSSIM、MS-SSIM、FS、Qmi、Qabf与VIFF(三)

    文章目录 1 前言 2 融合评价指标介绍 2.1 结构相似性(SSIM)相关 2.2 互信息(MI)相关 2.3 基于视觉信息保真度的指标VIFF 2.4 融合质量Qabf 3 代码实现 3.1 多层 ...

  3. 【opencv】(2) 图像处理:边界填充、图像融合、图像阈值、数值计算

    主要内容有:边界填充 cv2.copyMakeBorder(),数值计算 cv2.add(),改变尺寸 cv2.resize(),图像融合 cv2.addWeighted(),图像阈值 cv2.thr ...

  4. python——图像处理3(均值偏移、改变亮度、图像修复、图像融合)

    https://blog.csdn.net/gm_ergou/article/details/92846396 1.均值偏移(磨皮效果) import cv2 as cv import numpy a ...

  5. matlab将二值图像与原图重叠_[转载]图像处理matlab及图像融合图像镶嵌图像拼接...

    在实际的对图像处理过程中,由于我们读出的图像是unit8型,而在MATLAB的矩阵运算中要求所有的运算变量为double型(双精度型).因此读出的图像数据不能直接进行相加求平均,因此必须使用一个函数将 ...

  6. matlab图像融合评价,MATLAB 图像融合评估算法

    MATLAB 图像融合评价算法 function laplacian(ori_A,ori_B) path(path,'FusionEvaluation/') %Ori_A = imread('cloc ...

  7. 图像拼接和图像融合技术

    from: OpenCV探索之路(二十四)图像拼接和图像融合技术 图像拼接在实际的应用场景很广,比如无人机航拍,遥感图像等等,图像拼接是进一步做图像理解基础步骤,拼接效果的好坏直接影响接下来的工作,所 ...

  8. 泊松图像融合(泊松融合)

    泊松图像融合(泊松融合) from: http://blog.csdn.net/baimafujinji/article/details/46787837 在之前的文章中,我们详细介绍了基于泊松方程的 ...

  9. 基于权因子的图像融合

    基于权因子的图像融合 参见: OpenCV alpha(权因子) 融合举例

最新文章

  1. 【Linux入门连载一】[Win10下安装Linux虚拟机]VMWare15运行CentOS7(亲测有效)
  2. ActionScript 3.0 概要
  3. 按钮旁边加一个提示_地铁站的那些“红色按钮”,你知道是干啥用的吗?乱按可能被拘留...
  4. 接口测试用python怎么做_请问一下python怎么做接口测试工具?
  5. 生成全1矩阵_2020美赛A题(1)-图像处理
  6. java list填入table_JavaFX从ObservableList填充TableView
  7. Linq在sharepoint中的查询
  8. 线性判别分析(Linear Dicriminant Analysis)参数推导记录备忘
  9. 7. Swift 基于Xmpp和openfire实现一个简单的登录注册
  10. php op array,PHP手册 - Compile a string of PHP code and return the resulting op array
  11. 发那科机器人仿真软件FANUCROBOGUIDE打开机器备份
  12. 程序猿 C语言入门 颈椎,【计时器小工具】70行代码让你远离颈椎病,致所有的程序猿们...
  13. storm风暴英雄 tempo_风暴英雄Tempo Storm 安娜版本天梯环境速报 安娜强度居T3
  14. 所有的 Python 库都整理
  15. Win8.1在关机界面卡住无反应问题的解决
  16. 「Python条件结构」嵌套if:实现奖学金评定
  17. 【转】一个交警肺腑之言:高速公路行车的安全注意事项
  18. 双离合档把上按钮作用_双离合怎么换挡图解,7速双离合档位示意图
  19. ClickHouse技术分享PPT
  20. android 开启gps 简书,Android蓝牙第三方库FastBle使用注意事项(需开启GPS定位)

热门文章

  1. 考研c语言入门自学书籍推荐,【每周一点】2020计算机考研:参考书及复习重点...
  2. Unity Prefab批量修改
  3. 【每日早报】2019/12/03
  4. Mendeley 使用技巧
  5. 两种土壤细菌群落结构高通量绝对定量方法
  6. 2020年的个人总结
  7. 将外网服务器端口映射到本地端口
  8. table表头固定只让内容滚动
  9. web---盒子模型(思维导图)
  10. URL中参数值带有中文的解决方案