资源简介
压缩包里是python的代码文件(包含代码),你的电脑安装了python可直接打开,我放了一张图片在里面,图像处理包括了对图形灰度化、腐蚀、图片二值化、寻找最大轮廓、canny边缘检测、获取hsv与rgb值、膨胀等技术。

代码片段和文件信息
import cv2 as cv
import tkinter as tk
import numpy as np
from datetime import datetime as time1
“““
Created on 2019.12.10
@author: wang
“““
def save_picture(picture):
news = time1.today()
xx = time1.timetuple(news) #得到时间元组
text3 = “%d-%d-%d----%d-%d-%d.png“ % (xx[0]xx[1]xx[2]xx[3]xx[4]xx[5])
cv.imwrite(text3picture)
lists.insert(‘end‘“write ok : %s \n“%text3)
‘‘‘-----------------------------窗口------------------------------‘‘‘
window = tk.Tk()
window.title(‘last homework‘)
window.geometry(‘800x508‘)
pic = cv.imread(‘picture.jpg‘)
HSV=cv.cvtColor(piccv.COLOR_BGR2HSV)
“““ ------------------------------------放置状态打印框-------------------------------------------- “““
list_scro = tk.Scrollbar(windowhighlightthickness = 10) #接受文本的滚动条
lists = tk.Text(window bg = ‘white‘width = 32 heigh = 16yscrollcommand=list_scro.set) #显示接收数据文本框
lists.place(x = 300y = 300)
list_scro.pack(side = tk.RIGHTfill = tk.Y)
list_scro.config(command = lists.yview) #设置滚动条链接接收文本
‘‘‘---------------------------------标签类---------------------------‘‘‘
‘‘‘---------------------------------二值化阈值---------------------------‘‘‘
ezhVar = tk.StringVar()
ezhVar.set(‘二值化阈值最小值‘)
ezhlabel = tk.Label(window textvariable = ezhVar bg = ‘white‘ font = (‘Arial‘ 12)width = 16 heigh = 1 )
ezhlabel.place(x=400 y = 30)
ezhVar = tk.StringVar()
ezhVar.set(‘二值化阈值最大值‘)
ezhlabel = tk.Label(window textvariable = ezhVar bg = ‘white‘ font = (‘Arial‘ 12)width = 16 heigh = 1 )
ezhlabel.place(x=400 y = 60)
ezhVar = tk.StringVar()
ezhVar.set(‘卷积核大小‘)
ezhlabel = tk.Label(window textvariable = ezhVar bg = ‘white‘ font = (‘Arial‘ 12)width = 16 heigh = 1 )
ezhlabel.place(x=400 y = 90)
‘‘‘--------------------------------文本框类----------------------------------‘‘‘
ResolvingXText = tk.Entry(windowwidth = 5) #输入分辨率 文本框
ResolvingXText.place(x=560 y = 30)
ResolvingXText.insert(‘end‘‘127‘) #给文本框设置默认值
ResolvingYText = tk.Entry(windowwidth = 5) #输入分辨率 文本框
ResolvingYText.place(x=560 y = 60)
ResolvingYText.insert(‘end‘‘255‘) #给文本框设置默认值
ResolvingZText = tk.Entry(windowwidth = 5) #输入分辨率 文本框
ResolvingZText.place(x=560 y = 90)
ResolvingZText.insert(‘end‘‘10‘) #给文本框设置默认值
‘‘‘-----------------------------------保存文件---------------------------‘‘‘
def set_save() : #设置最小边长函数
global pic
if pic is not None:
save_picture(pic)
closeButton = tk.Button(window text = ‘save‘ width = 6 heigh = 1 command = set_save)
closeButton.place(x=150y=20)
‘‘‘-----------------------------------打开文件---------------------------‘‘‘
def set_open() : #设置最小边长函数
cv.imshow(‘nowpic‘pic)
cv.waitKey(1)
closeButton = tk.Button(window text = ‘open‘ width = 6 heigh = 1 command = set_open)
closeButton.place(x=90y=20)
‘‘‘-----------------------------------关闭---------------------------‘‘‘
def close() : #设置最小边长函数
cv.destroyAllWindows()
quit()
closeButton = tk.Button(window
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 44432 2019-12-10 23:28 python图像处理\picture.jpg
文件 8289 2019-12-24 12:33 python图像处理\ver0.1.py
目录 0 2020-03-11 18:26 python图像处理
----------- --------- ---------- ----- ----
52721 3
- 上一篇:cplex教程python
- 下一篇:SVM实现文本分类代码
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
评论
共有 条评论