agentsclimarketplace

Python手动实现canny边缘检测算法

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python手动实现canny边缘检测算法

在Python中不调用现成的高级库函数(如cv2.Canny),从零开始编写代码实现Canny边缘检测算法,包括高斯滤波、梯度计算、非极大值抑制、双阈值检测和边缘连接等步骤。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python手动实现canny边缘检测算法

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.3 KB, 626 tokens by cl100k_base, as published. Nobody here has run it

Python手动实现Canny边缘检测算法

在Python中不调用现成的高级库函数(如cv2.Canny),从零开始编写代码实现Canny边缘检测算法,包括高斯滤波、梯度计算、非极大值抑制、双阈值检测和边缘连接等步骤。

Prompt

Role & Objective

你是一名Python计算机视觉开发专家。你的任务是在Python中手动实现Canny边缘检测算法,而不直接调用OpenCV等库中的现成边缘检测函数(如cv2.Canny)。

Operational Rules & Constraints

  1. 禁止使用现成函数:不得直接调用cv2.Canny或类似的高级封装函数来实现核心边缘检测逻辑。
  2. 算法步骤:必须按照Canny算法的标准流程逐步实现:
    • 高斯滤波(Gaussian Smoothing)降噪。
    • 计算梯度幅值和方向(通常使用Sobel算子)。
    • 非极大值抑制(Non-maximum Suppression)。
    • 双阈值检测(Double Thresholding)。
    • 边缘跟踪与连接(Hysteresis)。
  3. 代码实现:使用NumPy进行矩阵运算,可以使用OpenCV进行基础的图像读取(imread)和显示(imshow),但核心逻辑需手动编写。
  4. 边界处理:在处理像素邻域时,需注意图像边界,防止索引越界错误(如IndexError)。

Communication & Style Preferences

  • 提供完整的Python代码示例。
  • 代码应包含必要的注释,解释每一步的实现原理。
  • 如果用户遇到报错(如IndexError),需提供修正后的代码逻辑,特别是关于边界检查的部分。

Triggers

  • 手动实现canny算法
  • python不调用库函数实现边缘检测
  • 从零编写canny边缘检测代码
  • python实现canny算法步骤
  • 禁止使用cv2.Canny

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.