当前位置: 首页 > news >正文

外 网站 公司实用又有创意的产品设计

外 网站 公司,实用又有创意的产品设计,关于公司网站建设情况的汇报,秀人网络科技有限公司使用python开发的开运算调试器 简介效果代码 简介 用来调试闭运算效果的小工具#xff0c;滑动条可以控制滤波核的大小#xff0c;用来查看不同滤波核下的闭运算效果。 效果 代码 import sys from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayou… 使用python开发的开运算调试器 简介效果代码 简介 用来调试闭运算效果的小工具滑动条可以控制滤波核的大小用来查看不同滤波核下的闭运算效果。 效果 代码 import sys from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QFileDialog, QSlider from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtCore import Qt import cv2 import numpy as npclass ImageDisplayWidget(QWidget):def __init__(self):super().__init__()self.initUI()self.image Nonedef initUI(self):self.main_layout QVBoxLayout()self.resize(820, 620)self.open_button self.create_button(打开图片, self.open_image)self.img_win QWidget()img_win_layout QHBoxLayout()self.img_win.setLayout(img_win_layout)self.orgin_img_label QLabel()self.image_label QLabel()self.add_image_view(img_win_layout, 原图, self.orgin_img_label)self.add_image_view(img_win_layout, 处理后的图, self.image_label)self.slider self.create_slider(self.process_image)self.slider2 self.create_slider(self.process_image)self.slider_value_label QLabel(滤波核大小: 0x0)controls_layout QHBoxLayout()self.add_control(controls_layout, 滤波核大小ksize:, self.slider, self.slider_value_label)controls_layout2 QHBoxLayout()self.main_layout.addWidget(self.open_button)self.main_layout.addWidget(self.img_win)self.main_layout.addLayout(controls_layout)self.main_layout.addLayout(controls_layout2)self.setLayout(self.main_layout)self.setWindowTitle(闭运算调试器)self.set_common_style(self.slider_value_label)# self.set_common_style()self.show()def add_image_view(self, layout, label_text, image_label):image_view_layout QVBoxLayout()name_label QLabel(label_text)name_label.setAlignment(Qt.AlignCenter)image_view_layout.addWidget(image_label, alignmentQt.AlignCenter)image_view_layout.addWidget(name_label, alignmentQt.AlignCenter)layout.addLayout(image_view_layout)self.set_common_style(name_label)def create_button(self, text, clicked_slot):button QPushButton(text)button.clicked.connect(clicked_slot)self.set_common_style(button)return buttondef create_slider(self, value_changed_slot):slider QSlider(Qt.Horizontal)slider.setMinimum(1)slider.setMaximum(100)slider.setSingleStep(2)slider.valueChanged.connect(value_changed_slot)self.set_slider_style(slider)return sliderdef add_control(self, layout, label_text, slider, value_label):control_label QLabel(label_text)layout.addWidget(control_label)layout.addWidget(slider)layout.addWidget(value_label)self.set_common_style(control_label)def set_common_style(self, label):label.setStyleSheet( QLabel { font-family: 微软雅黑; font-size: 12pt; color: red; }QPushButton { font-family: 微软雅黑; font-size: 12pt; color: red; } )def set_slider_style(self, slider):slider.setStyleSheet( QSlider::groove:horizontal { background: #999999; height: 8px; margin: 0; border-radius: 4px; } QSlider::handle:horizontal { background: red; border: 1px solid #999999; width: 16px; height: 16px; margin: -7px 0; /* handle is placed in the middle */ border-radius: 8px; } QSlider::add-page:horizontal { background: #FF0000; /* This is the red color from your font color */ } QSlider::sub-page:horizontal { background: #555555; /* You can choose a different color for the filled part */ } )def open_image(self):self.filename, _ QFileDialog.getOpenFileName(self, 打开图片, ., 图片文件 (*.png *.jpg *.jpeg *.bmp))if self.filename:self.image cv2.imread(self.filename)or_img cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB)h, w, ch or_img.shapebytes_per_line ch * wq_img QImage(or_img.data, w, h, bytes_per_line, QImage.Format_RGB888)pixmap QPixmap.fromImage(q_img)if pixmap.width() 600 or pixmap.height() 600:pixmap pixmap.scaled(600, 600, Qt.KeepAspectRatio, Qt.SmoothTransformation)self.orgin_img_label.setPixmap(pixmap)self.process_image()def process_image(self):if self.image is None:returnkernel_size self.slider.value()if kernel_size %2 0:passelse:self.slider_value_label.setText(f矩形核大小: {kernel_size}x{kernel_size})kernel np.ones((kernel_size, kernel_size), np.uint8)processed_image cv2.morphologyEx(self.image, cv2.MORPH_CLOSE, kernel)processed_image cv2.cvtColor(processed_image, cv2.COLOR_BGR2RGB)h, w, ch processed_image.shapebytes_per_line ch * wq_img QImage(processed_image.data, w, h, bytes_per_line, QImage.Format_RGB888)pixmap QPixmap.fromImage(q_img)if pixmap.width() 600 or pixmap.height() 600:pixmap pixmap.scaled(600, 600, Qt.KeepAspectRatio, Qt.SmoothTransformation)self.image_label.setPixmap(pixmap)if __name__ __main__:app QApplication(sys.argv)ex ImageDisplayWidget()sys.exit(app.exec_())
http://www.w-s-a.com/news/113354/

相关文章:

  • 网站做的最好的公司行业网址大全
  • 内网怎么做网站服务器seo统计
  • 丽水市企业网站建设 微信营销 影视拍摄计算机专业吃香吗
  • 龙岗做网站公司哪家好找到做网站的公司
  • 网站图片alt属性wordpress 自定义栏目 调用
  • 怎样建网站最快广州网站建设工程
  • iis7 网站404错误信息12306网站很难做吗
  • 网站建设600元包公司设计图片大全
  • 网站建设费用怎么做分录做校园网站代码
  • 网站改版做重定向福州网站建设思企
  • 网站建设全流程企业形象网站开发业务范畴
  • wordpress无法查看站点西安优秀高端网站建设服务商
  • 固始网站制作熟悉免费的网络营销方式
  • 做网站到a5卖站赚钱搜索引擎优化代理
  • 沈阳网站建设包括win10优化
  • 做百度手机网站点击软网站seo优化徐州百度网络
  • 徐州专业网站制作标志设计作业
  • 自己可以做网站空间吗海天建设集团有限公司网站
  • 教学督导网站建设报告aspcms网站图片不显示
  • 网站开发公司成本是什么门户网站宣传方案
  • 上海 企业网站建设网站怎么开通微信支付
  • 饮料网站建设wordpress主题猫
  • 网站建设需要编码不有没有专门的网站做品牌授权的
  • 做爰在线网站免费空间列表
  • 网站外链建设工作总结郑州网站建设扌汉狮网络
  • 建设企业网站的需要多长时间网站使用说明书模板
  • 建网站首页图片哪里找263企业邮箱网页版登录
  • 盐城网站建设电话高端定制网站
  • 成都网站seo技术施工企业样板先行制度
  • 高端网站建设电话河北建筑工程信息网站