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

网站开发软硬件配置设计公司起名字

网站开发软硬件配置,设计公司起名字,黄骅港港务集团,3d模型素材库OpenCV 方法演示项目 项目地址#xff1a;https://github.com/WangQvQ/opencv-tutorial 项目简介 这个开源项目是一个用于演示 OpenCV 方法的工具#xff0c;旨在帮助初学者快速理解和掌握 OpenCV 图像处理技术。通过这个项目#xff0c;你可以轻松地对图像进行各种处理https://github.com/WangQvQ/opencv-tutorial 项目简介 这个开源项目是一个用于演示 OpenCV 方法的工具旨在帮助初学者快速理解和掌握 OpenCV 图像处理技术。通过这个项目你可以轻松地对图像进行各种处理从灰度化到边缘检测以及更多其他方法。项目使用 Gradio 创建用户友好的界面让用户能够轻松选择不同的图像处理方法和参数。 为什么选择这个项目 教育性这个项目的主要目的是教育。它提供了对 OpenCV 方法的实际演示以帮助初学者更好地理解和掌握这些技术。 互动性通过 Gradio 创建的用户界面用户可以立即看到不同处理方法的效果并可以自己调整参数以更深入地理解每种方法的工作原理。 适用广泛这个项目可以帮助广大初学者无论是学习计算机视觉、图像处理还是对 OpenCV 有兴趣的人都会受益。 特性 提供了多种 OpenCV 图像处理方法的演示包括灰度化、反转颜色、平移、直方图均衡化、腐蚀、膨胀、均值滤波、中值滤波、高斯滤波等。 支持自定义卷积核允许用户尝试不同的卷积核来处理图像。 提供图像旋转、仿射变换和透射变换的演示以及选择角度和参数的选项。 使用 Gradio 创建用户友好的界面让用户能够轻松选择不同的图像处理方法和参数。 使用方法 获取项目首先你需要将这个项目克隆到你的本地计算机上。你可以使用以下命令来获取项目 git clone https://github.com/WangQvQ/opencv-tutorial.git安装依赖项确保你已经安装了以下依赖项 OpenCVGradioNumPy 如果你没有安装它们你可以使用以下命令安装 pip install opencv-python-headless4.7.0.72 gradio3.1.5 numpy1.22.4运行项目使用以下命令来运行项目 python opencv_demo.py运行后你将看到一个网址通常是 http://localhost:7860你可以在浏览器中访问它。 使用界面在浏览器中你可以上传图像并选择不同的处理方法和参数然后查看处理后的图像效果。 示例代码 以下是部分方法的代码示例: # 灰度化处理函数 def grayscale(input_image):gray_image cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)return gray_image# 平移图像处理函数 def translate_image(input_image, translation_x, translation_y):rows, cols, _ input_image.shapetranslation_matrix np.float32([[1, 0, translation_x], [0, 1, translation_y]])translated_image cv2.warpAffine(input_image, translation_matrix, (cols, rows))return translated_image# Canny 边缘检测处理函数 def edge_detection(input_image):edges cv2.Canny(input_image, 100, 200)return edges贡献 如果你对项目有任何改进或建议欢迎贡献代码或提出问题。我们欢迎开发者共同改进这个项目以使其更加有用和友好。 源代码 如果你不想克隆项目也可以直接运行我的源代码 import cv2 import gradio as gr import numpy as np # 原始图像处理函数 def original_image(input_image):return input_image# 灰度化处理函数 def grayscale(input_image):gray_image cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)return gray_image# 平移图像处理函数 def translate_image(input_image, translation_x, translation_y):rows, cols, _ input_image.shapetranslation_matrix np.float32([[1, 0, translation_x], [0, 1, translation_y]])translated_image cv2.warpAffine(input_image, translation_matrix, (cols, rows))return translated_image# Canny 边缘检测处理函数 def edge_detection(input_image):edges cv2.Canny(input_image, 100, 200)return edges# Sobel 边缘检测处理函数 def sobel_edge_detection(input_image):gray_image cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)sobel_x cv2.Sobel(gray_image, cv2.CV_64F, 1, 0, ksize5)sobel_y cv2.Sobel(gray_image, cv2.CV_64F, 0, 1, ksize5)sobel_magnitude cv2.magnitude(sobel_x, sobel_y)sobel_magnitude np.uint8(255 * sobel_magnitude / np.max(sobel_magnitude))return sobel_magnitude# 反转颜色处理函数 def invert_colors(input_image):inverted_image cv2.bitwise_not(input_image)return inverted_image# 腐蚀处理函数 def erosion(input_image, iterations):kernel np.ones((5, 5), np.uint8)eroded_image cv2.erode(input_image, kernel, iterationsiterations)return eroded_image# 膨胀处理函数 def dilation(input_image, dilation_iterations):kernel np.ones((5, 5), np.uint8)dilated_image cv2.dilate(input_image, kernel, iterationsdilation_iterations)return dilated_image# 均值滤波处理函数 def mean_blur(input_image):mean_blurred_image cv2.blur(input_image, (5, 5))return mean_blurred_image# 中值滤波处理函数 def median_blur(input_image):median_blurred_image cv2.medianBlur(input_image, 5)return median_blurred_image# 高斯滤波处理函数 def gaussian_blur(input_image):gaussian_blurred_image cv2.GaussianBlur(input_image, (5, 5), 0)return gaussian_blurred_image# 双边滤波处理函数 def bilateral_filter(input_image):bilateral_filtered_image cv2.bilateralFilter(input_image, 9, 75, 75)return bilateral_filtered_image# 方块滤波处理函数 def box_filter(input_image):box_filtered_image cv2.boxFilter(input_image, -1, (5, 5))return box_filtered_image# 直方图均衡化处理函数 def histogram_equalization(input_image):gray_image cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)equalized_image cv2.equalizeHist(gray_image)return cv2.cvtColor(equalized_image, cv2.COLOR_GRAY2BGR)# 仿射变换处理函数 def affine_transform(input_image):# 创建仿射变换矩阵rows, cols, _ input_image.shapematrix cv2.getRotationMatrix2D((cols / 4, rows / 2), 70, 0.5) # 90度旋转和1.5倍缩放result_image cv2.warpAffine(input_image, matrix, (cols, rows))return result_image# 透射变换处理函数 def perspective_transform(input_image):# 定义四个输入图像的角点坐标rows, cols, _ input_image.shape# 修改pts1和pts2的值以减小透射变换的弯曲程度pts1 np.float32([[0, 0], [cols, 0], [0, rows], [cols, rows]])pts2 np.float32([[30, 30], [cols - 50, 50], [50, rows - 50], [cols - 50, rows - 50]])# 计算投射矩阵matrix cv2.getPerspectiveTransform(pts1, pts2)# 进行投射变换result_image cv2.warpPerspective(input_image, matrix, (cols, rows))return result_image# 自定义卷积核 def custom_filter(input_image):kernel np.array([[-1, -1, -1], [-1, 9, -1], [-1, -1, -1]])return cv2.filter2D(input_image, -1, kernel)# 图像旋转处理函数 def rotate_image(input_image, rotation_angle):rows, cols, _ input_image.shapematrix cv2.getRotationMatrix2D((cols / 2, rows / 2), rotation_angle, 1)result_image cv2.warpAffine(input_image, matrix, (cols, rows))return result_image# 创建 Gradio 接口 input_image gr.inputs.Image() method gr.inputs.Radio(choices[原图, 灰度化, 反转颜色, 平移, 直方图均衡化, 腐蚀, 膨胀, 均值滤波, 中值滤波, 高斯滤波,双边滤波, 方块滤波, 仿射变换, 透射变换, 图像旋转, Sobel边缘检测, Canny边缘检测, 自定义卷积核], default原图)rotation_angle gr.inputs.Slider(minimum-180, maximum180, default45, label图像旋转: 旋转角度) iterations gr.inputs.Slider(minimum0, maximum10, step1, default1, label腐蚀: 腐蚀参数) dilation_iterations gr.inputs.Slider(minimum0, maximum10, step1, default1, label膨胀: 膨胀参数) translation_x gr.inputs.Slider(minimum-200, maximum200, default200, label平移: X轴平移) translation_y gr.inputs.Slider(minimum-200, maximum200, default200, label平移: Y轴平移)output_image gr.outputs.Image(typepil)# 创建函数根据下拉菜单的选择来执行不同的方法 def apply_opencv_methods(input_image, method, rotation_angle, iterations, dilation_iterations,translation_x, translation_y):if method 原图:return original_image(input_image)elif method 图像旋转:return rotate_image(input_image, rotation_angle)elif method 腐蚀:return erosion(input_image, iterations)elif method 膨胀:return dilation(input_image, dilation_iterations)elif method Sobel边缘检测:return sobel_edge_detection(input_image)elif method 平移:return translate_image(input_image, translation_x, translation_y)elif method 自定义卷积核:return custom_filter(input_image)else:methods {灰度化: grayscale,Canny边缘检测: edge_detection,反转颜色: invert_colors,均值滤波: mean_blur,中值滤波: median_blur,高斯滤波: gaussian_blur,双边滤波: bilateral_filter,方块滤波: box_filter,仿射变换: affine_transform,透射变换: perspective_transform,直方图均衡化: histogram_equalization,}return methods[method](input_image)# 创建 Gradio 接口 gr.Interface(fnapply_opencv_methods,inputs[input_image, method, rotation_angle, iterations, dilation_iterations, translation_x,translation_y],outputsoutput_image,liveTrue,title图像处理初学者导引,description选择一张图像, 并选择对应方法 ).launch(shareFalse)
http://www.sczhlp.com/news/221546/

相关文章:

  • 成都淘宝网站建设公司网站空间域名建设
  • 大连建网站需要多少钱设计师如何做自己的个人网站
  • 河南省城乡与住房建设厅网站四川移动端网站建设
  • 各大网站提交入口网址漳州市建设局网站6
  • 湘潭网站seo公司有域名后如何建网站
  • 崇信县门户网站最新留言珠海市城乡规划建设局网站
  • 做网站商城必须要买空间吗网站建设 需求分析报告
  • 佛山网站建设app宁夏人脸识别门禁
  • 琼中网站建设网站备案跟做哪个推广有关系吗
  • 长春火车站什么时候通车国内课程网站建设现状
  • 铁路建设工程网站网站应该怎么做运维
  • 网站制作主要公司在哪查找网站的建设者
  • 房屋租赁系统网站开发商家管理系统
  • 贵州灵溪seo整站优化学做app软件在哪里学
  • 株洲seo网站推广番禺网站开发技术
  • 网站建站哪家公司好一点源码网站取名
  • 东莞阳光网站官网厦门建设工程交易中心网站
  • 自己做团购网站怎么样湛江招聘网最新招聘
  • 网站价格明细表论坛型网站开发
  • 邢台做外贸网站学做美食视频网站
  • 专业做网站机构wordpress 外部链接插件
  • 三鼎网络网站建设家装设计网页版
  • 网站诊断分析案例长春做网络优化的公司
  • 免费找客户网站建立新中国的构想及其实践
  • 成交型网站建设方案畅言 wordpress插件
  • 百度网盟推广的定义渭南网站建设seo
  • vue.js2.5 pc网站开发插件 wordpress
  • 关键词没有排名的网站怎么做做网站贵吗
  • 什么网站做效果图最多wordpress 页面美化
  • 图片分类展示网站源码征婚网站上拉业务做恒指期货