CV
zeronose
这个作者很懒,什么都没留下…
展开
-
图像亮度公式
RGB有亮度吗?常用公式:Y(亮度)=(0.299R)+(0.587G)+(0.114*B)原创 2021-04-29 11:02:50 · 3414 阅读 · 0 评论 -
批量计算PSNR和SSIM
import tensorflow as tfimport numpy as npimport timestart = time.clock()def read_img(path): return tf.image.decode_image(tf.read_file(path))def psnr(tf_img1, tf_img2): return tf.image.psnr(tf_img1, tf_img2, max_val=255)def ssim(tf_img1, t原创 2021-04-16 22:07:52 · 2411 阅读 · 1 评论 -
数字图像处理--四种插值法详解
1、最近邻插值法(Nearest Neighbour Interpolation)这是最简单的一种插值方法,不需要计算,在待求像素的四邻象素中,将距离待求像素最近的邻像素灰度赋给待求像素。设i+u, j+v(i, j为正整数, u, v为大于零小于1的小数,下同)为待求像素坐标,则待求像素灰度的值 f(i+u, j+v) 如下图所示:2、双线性插值2.1 一维2.2 二维首先在x方向上面线性插值,得到R2、R1:然后以R2,R1在y方向上面再次线性插值:如果选择一个坐标系统使得原创 2021-03-22 14:22:59 · 7358 阅读 · 1 评论 -
上采样(upsampling)方法总结
总结一下上采样,主要来源于论文《Deep Learning for Image Super-resolution:A Survey》上采样层位置上采样方法2.1预定义插值式最近邻插值、双线性插值、双三次插值,效果和计算量逐个上升;虽然插值式上采样已没人用,但是下采样过程(数据准备从HRGT到LR)最常用的还是双三次。基于插值的上采样方法只能通过图像的本身内容提高图像的分辨率,并没有带来更多信息,相反还有噪声放大、计算复杂度增加、结果模糊等副作用。2.2 反卷积由于反卷积是个端到端的操作而原创 2021-03-19 10:50:37 · 21304 阅读 · 0 评论 -
批量计算PSNR,SSIM,MSE
如题,批量计算图像的psnr,ssim,mse,并将计算结果汇总写入文件import osimport numpy as npimport mathfrom PIL import Imageimport timestart = time.clock()def psnr(img1, img2): mse = np.mean((img1 / 1. - img2 / 1.) ** 2) if mse < 1.0e-10: return 100 * 1.0原创 2021-03-11 21:12:18 · 2125 阅读 · 0 评论 -
图像的大小(所占存储空间)与哪些因素有关?
如题,首先给出结论:分辨率,图像深度,存储格式如图 同样一部手机上的截图 最小的只有60多kb 最大的在1mb以上 这跟哪些因素有关?(图片为网上随便找的)有时,人肉眼认为没有区别的两张照片,但是存储的大小差别会很大(例如一个200kb,一个2000kb)分辨率分辨率是指一张图像在每英寸内有多少像素点,相同尺寸的两张图片,分辨率越高,图像文件越大,分辨率相同的两张图片,图像尺寸越大,图像文件越大,也就是说图像文件的大小取决于前两者的参数,随这两者的改变而改变。图像深度图像深度是指存储每原创 2021-03-11 20:52:27 · 14038 阅读 · 1 评论 -
matplotlib画图去掉坐标轴和坐标轴刻度
plt.xticks([]) # 去x坐标刻度plt.yticks([]) # 去y坐标刻度plt.axis('off') # 去坐标轴**注意:**这三行代码要放到plt.show() 之前,plt.imshow() 之后原创 2020-11-30 22:10:25 · 7622 阅读 · 0 评论 -
matplotlib画图去掉边缘空白
用matplotlib画图时,生成的图像边缘会有空白而且用pycharm生成的图像,全是640*480其实,只是在保存图像时设置参数,就可以去掉边缘空白# 设置参数 bbox_inches='tight', pad_inches=0 fig.savefig('images/dark_10/dark_%d.png' % i, bbox_inches='tight', pad_inches=0)大功告成,此时生成的图像就没有边缘的空白...原创 2020-11-30 22:25:07 · 7662 阅读 · 4 评论 -
图像处理--bicubic(双三次插值)
import scipy.miscfrom glob import globimport numpy as npimport osimport matplotlib.pyplot as pltpath = glob('图像路径')imgs_lr = []for img_path in path: img = scipy.misc.imread(img_path, mode='RGB').astype(np.float) # 这个尺寸只是展示图片的大小,跟像素没有关系原创 2020-11-30 11:28:38 · 1370 阅读 · 1 评论 -
Python调节图形的亮度--调亮
from skimage import exposure, ioimport matplotlib.pyplot as pltfrom glob import globpath = glob('图像保存路径')i = 0for img_path in path: i += 1 image = io.imread(img_path) gam = exposure.adjust_gamma(image, 0.1) # 调亮 如果gamma<1, 新图像比原图像亮,数值原创 2020-11-30 11:21:21 · 1159 阅读 · 0 评论 -
Python调节图形的亮度--调暗
from skimage import exposure, ioimport matplotlib.pyplot as pltfrom glob import globpath = glob('图像保存路径')i = 0for img_path in path: i += 1 image = io.imread(img_path) gam = exposure.adjust_gamma(image, 2) # 调暗 fig = plt.figure()原创 2020-11-30 11:16:16 · 1988 阅读 · 0 评论