数字图像处理基础与应用 第五章

5-1感觉这些方法主体都差不多,就是微分算子不同,懒得一个个写了

from cv2 import cv2
import numpy as np
import randomdef singleDirectionsharpen(img, N=3):p = N // 2img_shape = np.shape(img)out = np.zeros(img_shape)for i in range(img_shape[0]):for j in range(img_shape[1]):if i >= p and i < img_shape[0] - p and j >= p and j < img_shape[1] - p:out[i][j] = img[i - 1][j - 1] - img[i + 1][j - 1] + 2 * (img[i - 1][j] - img[i + 1][j]) + img[i - 1][j + 1] - img[i + 1][j + 1]else:out[i][j] = 0return outimg = cv2.imread("C:\\test\\1.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
single_irection_sharpen = singleDirectionsharpen(gray)cv2.imwrite("C:\\test\\single_irection_sharpen.jpg", single_irection_sharpen)single_irection_sharpen = cv2.imread("C:\\test\\single_irection_sharpen.jpg")cv2.imshow('gray', gray)
cv2.imshow('single_irection_sharpen', single_irection_sharpen)cv2.waitKey()
cv2.destroyAllWindows

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/550505.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

新版scipy中的imread,imsave,imresize被弃用解决方法

阅读文献代码时发现新版scipy中的imread,imsave,imresize被弃用报错 搜索了一下发现可以用imageio中的imread和imsave代替原有的&#xff0c;用numpy的reshape来代替imresize 试了一下&#xff0c;不太行&#xff0c;文献中imread有mode‘L’&#xff0c;即读取灰度图&#xff…

anaconda中tensorflow-estimator版本应与tensorflow-gpu版本相同

把tensorflow升级到2.1.0版本是发现import tensorflow as tf出错 发现是anaconda安装的tensorflow-estimator版本是2.2.0&#xff0c;将版本回退到2.1.0后解决了问题

tf.contrib在tf2中无法使用

在尝试文献中代码时发现tf.comtrib无法使用 官方文档中说 It is still possible to run 1.X code, unmodified (except for contrib), in TensorFlow 2.0: import tensorflow.compat.v1 as tf tf.disable_v2_behavior()除了contrib应该都用能两行代码解决问题,contrib则用kera…

发现了imageio文档中有代替scipy.misc的说明

原文&#xff1a;https://imageio.readthedocs.io/en/latest/scipy.html?highlightimread imageio.imread可以代替scipy.misc.imread 用pilmode代替mode 用as_gray代替flatten pilmode类型&#xff1a; ‘L’ (8-bit pixels, grayscale) ‘P’ (8-bit pixels, mapped to an…

fastai学习笔记——安装

虽然说是推荐linux&#xff0c;windows可能有bug&#xff0c;但是我还是没办法只用linux win10anaconda python3.7 安装很简单 conda install -c fastchan fastai anaconda 好了也没发现有啥问题 测试torch是否可用 import torch cuda.test.is_available()True

fastai学习——第一个bug

跟着视频学习&#xff0c;在运行第一段测试代码的时候出现问题 from fastai.vision.all import * path untar_data(URLs.PETS)/imagesdef is_cat(x): return x[0].isupper() dls ImageDataLoaders.from_name_func(path, get_image_files(path), valid_pct0.2, seed42,label_…

fastai学习:01_intro Questionnaire

fastAI Questionnaire 感觉还挺多的&#xff0c;怪不得说每一课要额外8小时进行学习。 1.Do you need these for deep learning? Lots of math T / F Lots of data T / F Lots of expensive computers T / F A PhD T / F F F F F 2.Name five areas where deep learning is …

fastai学习——第二个问题

第二节课需要使用bing image search api获取bing图片搜索中的熊图片&#xff0c;此时发现获取api需要注册azure&#xff0c;卡在绑定卡上很久&#xff0c;想了想还要去弄一张带visa的卡&#xff0c;还是算了&#xff0c;就用猫狗大战数据集实验吧&#xff0c;按照与学习视频中类…

fastai学习:02_production Questionnaire

1.Where do text models currently have a major deficiency? Deep learning is currently not good at generating correct responses! We don’t currently have a reliable way to, for instance, combine a knowledge base of medical information with a deep learning m…

fastai学习:04_mnist_basics Questionnaire

1.How is a grayscale image represented on a computer? How about a color image? 灰度图&#xff1a;单通道&#xff0c;0-256 彩色图&#xff1a;三通道RGB或HSV&#xff0c;0-256 2.How are the files and folders in the MNIST_SAMPLE dataset structured? Why? 分为…

fastai学习:05_pet_breeds Questionnaire

1.Why do we first resize to a large size on the CPU, and then to a smaller size on the GPU? 首先&#xff0c;在训练模型时&#xff0c;我们希望能够将图片的尺寸统一&#xff0c;整理为张量&#xff0c;传入GPU&#xff0c;我们还希望最大限度地减少执行不同增强计算的…

fastai学习:06_multicat Questionnarie

1.How could multi-label classification improve the usability of the bear classifier? 可以对不存在的熊进行分类 2.How do we encode the dependent variable in a multi-label classification problem? One-hot encoding: Using a vector of zeros, with a one in each…

【论文阅读笔记】Detecting Camouflaged Object in Frequency Domain

1.论文介绍 Detecting Camouflaged Object in Frequency Domain 基于频域的视频目标检测 2022年发表于CVPR [Paper] [Code] 2.摘要 隐藏目标检测&#xff08;COD&#xff09;旨在识别完美嵌入其环境中的目标&#xff0c;在医学&#xff0c;艺术和农业等领域有各种下游应用。…

ubuntu中使用firefox浏览器播放bilibili的h5网页视频

安装好系统后&#xff0c;直接firefox打开bilibili显示没有flash插件 找了一圈没有发现自动播放h5的选项 搜索了一下发现可能是需要解码器 sudo apt-get install ubuntu-restricted-extras就能看了

ubuntu挂起唤醒后十几秒钟就自动熄屏一次

昨天晚上笔记本没关机&#xff0c;ubuntu挂起一晚上&#xff0c;今天早上打开电脑&#xff0c;发现每过十几秒钟就自动熄屏一次&#xff0c;重启之后好了&#xff0c;不知道什么原因 搜索了一下说可能是DPMS的问题&#xff0c;用xset -dpms可以关闭电源管理选项 但是本来的设置…

python3 上传文件到目标机器_Python3 +服务器搭建私人云盘,再也不怕限速了

先来看看效果电脑访问手机访问Windows版本搭建(1).首先你需要在你的电脑上或者服务器上安装Python3.X。(2).然后通过如下指令来安装updog库&#xff0c;网上有很多关于updog的介绍&#xff0c;我这里就不详细说pip3 install updog(3).静静的等他安装完成&#xff0c;然后执行以…

Ubuntu下绘图软件krita64位无中文问题

ubuntu20 sudo apt install krita-l10n 就有了 参考&#xff1a;https://bbs.deepin.org/post/181669

tableau度量值计算_Tableau图表界面组成介绍

声明&#xff1a;内容来源拉勾教育数据分析训练营课程视频1 Tableau工作表基本界面基础概念&#xff1a;维度、度量、聚合、粒度。维度: 维度包含定量值(例如名称、日期或地理数据)&#xff0c;可以使用维度进行分类、分段以及揭示数据中的详细信息。维度影响视图中的详细级别。…

小强升职记思维导图_你学会用 “思维导图” 学英语了吗?

今天我们来讲讲目前比较火爆的“思维导图学习法”。思维导图又叫“MIND MAP”&#xff0c;是英国人托尼博赞发明的一种思维工具。托尼博赞本人在心理学、语言学、数学以及科学方向均获得过学位&#xff0c;而且他还创造了世界脑力奥林匹克运动。虽然大师已逝&#xff0c;但是这…

ubuntu下创建软件图标和直接点文件打开

ubuntu中有一些从github上下载的软件或者是appimage软件&#xff0c;能够使用&#xff0c;但是不在应用程序中显示&#xff0c;也不能直接点文件来打开程序 以cajviewer为例子&#xff0c;下下来是CAJViewer-x86_64-buildubuntu1604-210401.AppImage 打开目录/usr/share/appli…