资源简介
两种尺度的图像滑窗效果,1)基于多尺度图片的定位;2)基于多尺寸滑动窗口的定位

代码片段和文件信息
‘‘‘
Created on 2017年8月19日
@author: XuTing
‘‘‘
# import the necessary packages
import imutils
from skimage.transform import pyramid_gaussian
import cv2
def pyramid(image scale=1.5 minSize=(30 30)):
# yield the original image
print(‘(H:{}W:{})‘.format(image.shape[0] image.shape[1]))
# yield image
# compute the new dimensions of the image and resize it
w = int(image.shape[1] / scale)
image = imutils.resize(image width=w)
print(‘resize=(H:{}W:{})‘.format(image.shape[0] image.shape[1]))
# if the resized image does not meet the supplied minimum
# size then stop constructing the pyramid
if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
print(“Out of size!“)
else:
yield image
def pyramid2(image scale=1.5 minSize=(30 30)):
# yield the original image
yield image
# keep looping over the pyramid
while True:
# compute the new dimensions of the image and resize it
w = int(image.shape[1] / scale)
image = imutils.resize(image width=w)
print(‘(H:{}W:{})‘.format(image.shape[0] image.shape[1]))
# if the resized image does not meet the supplied minimum
# size then stop constructing the pyramid
if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
print(“Out of size!“)
break
# yield the next image in the pyramid
yield image
def sliding_window(image stepSize windowSize):
# slide a window across the image
for y in range(0 image.shape[0] stepSize):
for x in range(0 image.shape[1] stepSize):
# yield the current window
yield (x y image[y:y + windowSize[1] x:x + windowSize[0]])
if __name__ == ‘__main__‘:
image = cv2.imread(‘../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 loop
if resized.shape[0] < 30 or resized.shape[1] < 30:
break
# show the resized image
WinName = “layer {}“.format(i + 1)
cv2.imshow(WinName resized)
cv2.waitKey(0)
resized = resized*255
cv2.imwrite(‘./‘+WinName+‘.jpg‘resized)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-20 21:39 MyImage_Sliding\
文件 2382 2017-11-20 21:54 MyImage_Sliding\helpers.py
文件 1453 2017-11-20 21:27 MyImage_Sliding\Image_Sliding_differentPic.py
文件 1747 2017-11-20 21:52 MyImage_Sliding\Image_Sliding_differentWindow.py
文件 1419 2017-11-20 21:13 MyImage_Sliding\Image_Sliding_Same.py
文件 148262 2017-11-20 21:31 MyImage_Sliding\la
文件 50166 2017-11-20 21:31 MyImage_Sliding\la
文件 15116 2017-11-20 21:31 MyImage_Sliding\la
文件 5521 2017-11-20 21:31 MyImage_Sliding\la
文件 2307 2017-11-20 21:31 MyImage_Sliding\la
文件 1241 2017-08-19 20:03 MyImage_Sliding\pyramid.py
目录 0 2017-11-20 21:54 MyImage_Sliding\__pycache__\
文件 1862 2017-11-20 21:54 MyImage_Sliding\__pycache__\helpers.cpython-35.pyc
- 上一篇:openmp官方文档
- 下一篇:内隐联想测验程序
相关资源
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- Python中Numpy库最新教程
- 用python编写的移动彩信的发送程序
- Python全栈学习笔记面向对象大作业:
- python实现的ftp自动上传、下载脚本
- Python版的A*寻路算法
- IronPython IDE
- 基于GIS的地下水流可视化多尺度数值
- pip-10.0.1.tar.gz
- Data Science from Scratch 2nd Edition
- shape_predictor_68_face_landmarks.dat.bz2 68个标
- 爬取豆瓣电影TOP250程序,包含非常详
- 中文维基百科语料库百度网盘网址.
- MSCNN_dehaze.rar
- 爬取豆瓣排行榜电影数据(含GUI界面
- 字典文本资源
- Brainfuck / OoK 解码脚本
- 案例实战信用卡欺诈检测数据集
- 招商策略_抱团启示录那些年我们一起
- sip-4.19.zip
- 树莓派3b+学习使用教程
- 一种基于LBM的气液固三相流多尺度模
- numpy 中文学习手册
- pytorch-1.4.0-py3.7_cpu_0.tar.bz2
- 机器学习实战 高清完整版PDF
- 多尺度hessian滤波器图像增强
- 泰坦尼克号0.81准确率实验报告.docx
-
abaqus sc
ripting reference manual.pdf - 网页版聊天程序--网络程序设计课程大
- Give Me Some Credit
评论
共有 条评论