图片Gaussian pyramid(一)

2024-06-08 22:38
文章标签 gaussian pyramid 图片

本文主要是介绍图片Gaussian pyramid(一),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

简介

偶然在一个网页上发现一个Python图像处理的方法,能够进行图片的缩放。首先进行了高斯滤波,当缩放到小于30×30时break。

helpers:

# import the necessary packages
from skimage.transform import pyramid_gaussian
import cv2
from PIL import Imageimage = Image.open('./image/cat2.jpg')        
# METHOD #2: Resizing + Gaussian smoothing.
for (i, resized) in enumerate(pyramid_gaussian(image, downscale=2)):# if the image is too small, break from the loopif resized.shape[0] < 30 or resized.shape[1] < 30:break# show the resized imagecv2.imshow("Layer {}".format(i + 1), resized)cv2.waitKey(0)resized = resized*255cv2.imwrite('./'+WinName+'.jpg',resized[:,:,:])

使用Image.open效果

这里写图片描述

Layer 1 = 1024 X 768

这里写图片描述

Layer 2 = 512 X 384

这里写图片描述

Layer 3 = 256 X 192

这里写图片描述

Layer 4 = 128 X 96

这里写图片描述

Layer 5 = 64 X 48

使用cv2.imread效果

这里写图片描述

Layer 1 = 1024 X 768

这里写图片描述

Layer 2 = 512 X 384

这里写图片描述

Layer 3 = 256 X 192

这里写图片描述

Layer 4 = 128 X 96

这里写图片描述

Layer 5 = 64 X 48

参考

【1】Image Pyramids with Python and OpenCV - PyImageSearch
http://www.pyimagesearch.com/2015/03/16/image-pyramids-with-python-and-opencv/
【2】jrosebr1/imutils: A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
https://github.com/jrosebr1/imutils
【3】Histogram of Oriented Gradients and Object Detection - PyImageSearch
http://www.pyimagesearch.com/2014/11/10/histogram-oriented-gradients-object-detection/
【4】Module: transform — skimage v0.14dev docs
http://scikit-image.org/docs/dev/api/skimage.transform.html#pyramid-gaussian

这篇关于图片Gaussian pyramid(一)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1043512

相关文章

JAVA读取MongoDB中的二进制图片并显示在页面上

1:Jsp页面: <td><img src="${ctx}/mongoImg/show"></td> 2:xml配置: <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001

在服务器上浏览图片

@StarSky 2018-10-26 15:09 字数 15971 阅读 28 https://www.zybuluo.com/StarSky/note/1294871 来源 2018-09-27 线上服务器安装 imgcat Tool   2018-09-27 线上服务器安装 imgcat 0. 准备文件:iterm2_shell_integration.bash1. 在有权限

el-upload 上传图片及回显照片和预览图片,文件流和http线上链接格式操作

<div v-for="(info, index) in zsjzqwhxqList.helicopterTourInfoList" :key="info.id" >编辑上传图片// oss返回线上地址http链接格式:<el-form-itemlabel="巡视结果照片":label-width="formLabelWidth"><el-upload:action="'http:

【QML】用 Image(QQuickPaintedItem) 显示图片

大体功能: 频繁地往界面推送图片,帧率达到视频效果。捕获画布上的鼠标事件和键盘事件。 代码如下: // DrawImageInQQuickPaintedItem.pro 代码如下:QT += quick# You can make your code fail to compile if it uses deprecated APIs.# In order to do so, uncom

用Ps将PSD切片并将切片保存为透明背景的图片

第一步:选择放大镜工具或者Ctrl++将要切片的部分放大。 第二步:选择移动工具单击要切片的部分,在右边的图层栏找到要切片的图层在文字上右键选择转换为智能对象,再右键该图层的文字选择栅格化图层。 第三步:单击选中所要切片的部分,然后Ctrl+A、Ctrl+C、Ctrl+N(背景内容选择透明)、Ctrl+V、Ctrl+S(将文件保存为PNG格式),这样就可以得到透明背景的图片了!

Android性能优化系列之Bitmap图片优化

在Android开发过程中,Bitmap往往会给开发者带来一些困扰,因为对Bitmap操作不慎,就容易造成OOM(Java.lang.OutofMemoryError - 内存溢出),本篇博客,我们将一起探讨Bitmap的性能优化。 为什么Bitmap会导致OOM? 1.每个机型在编译ROM时都设置了一个应用堆内存VM值上限dalvik.vm.heapgrowthlimit,用来限定每个应用可

加载网络图片显示大图

1.将图片的uri列表和下标传给ImagePagerActivity public void imageBrower(int position, ArrayList<String> urls2) {Intent intent = new Intent(this, ImagePagerActivity.class); intent.putExtra(ImagePagerActivity

html标签转换成img图片

app 里的元素需要转换成图片 <script src="../assets/js/html2canvas.min.js"></script>$(function () {html2canvas(document.querySelector("#app"), {useCORS: true}).then(canvas => {layer.close(vm.layerIndex)var img =

Typora撰写Markdown文档上传到github上图片显示问题

OS:Windows 软件:Typora 相信很多人都有撰写Markdown文档的需求,在这里首先安利一下Markdown撰写利器---typora。 Typora支持多种快捷方式生成markdown语法,快速入门,排版整齐漂亮。 当我们向markdown中粘贴图片资源的时候,会自动提示保存图片到...  这时我们可以在存放markdown文档的地方建立一个assert或者pic静态资源文

Jupiter notebook显示数据和图片 备忘

import cv2 as cvimport numpy as np%matplotlib inline #将图片显示在页面内np.set_printoptions(threshold=np.inf) #显示大量数据 path = '/Users/yuanl/Desktop/test1.jpg'img = cv.imread('/Users/yuanl/Desktop/test1.jpg',