Skip to content
Back to skills

Matlab Hough

ASecurity

实现离散点Hough变换算法,输入包含浮点数的坐标点,输出检测到的直线斜率和截距,不使用MATLAB自带函数

  • 57 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 31, 2026
tools

Security analysis

A100/100

Scanned May 31, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill matlab-hough --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Matlab Hough?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Matlab Hough
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-matlab-hough/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-matlab-hough)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "065718d2-7446-49d2-a65f-f3d2b4defd5c"
name: "MATLAB离散点Hough变换直线检测"
description: "实现离散点Hough变换算法,输入包含浮点数的坐标点,输出检测到的直线斜率和截距,不使用MATLAB自带函数"
version: "0.1.0"
tags:
  - "MATLAB"
  - "Hough变换"
  - "直线检测"
  - "离散点"
  - "图像处理"
triggers:
  - "离散点Hough变换"
  - "MATLAB直线检测"
  - "浮点坐标直线提取"
  - "不用自带函数的Hough变换"
  - "离散点斜率截距计算"
---

# MATLAB离散点Hough变换直线检测

实现离散点Hough变换算法,输入包含浮点数的坐标点,输出检测到的直线斜率和截距,不使用MATLAB自带函数

## Prompt

# Role & Objective
实现一个MATLAB函数,对输入的离散点坐标(包含小数)进行Hough变换,检测直线并输出斜率和截距。不使用MATLAB自带的hough函数。

# Communication & Style Preferences
- 使用MATLAB语法编写
- 代码注释清晰
- 输出格式为斜率和截距

# Operational Rules & Constraints
1. 输入参数:x坐标向量和y坐标向量
2. 设置角度分辨率thetaResolution和极径分辨率rhoResolution
3. 计算numTheta = ceil(180/thetaResolution)
4. 计算点集范围D = sqrt((max(x)-min(x))^2 + (max(y)-min(y))^2)
5. 计算numRho = ceil(D/rhoResolution)
6. 初始化Hough累加器H = zeros(numRho, numTheta)
7. 遍历每个点,对每个角度计算rho = x(i)*cosd(theta) + y(i)*sind(theta)
8. 使用rhoIdx = round(rho)确保索引为整数
9. 检查rhoIdx在有效范围内:if rhoIdx >= 1 && rhoIdx <= numRho
10. 设置阈值threshold = 0.5 * max(H(:))
11. 使用houghpeaks检测峰值
12. 计算斜率:slope = -cosd(theta) / sind(theta)
13. 计算截距:intercept = rho / sind(theta)
14. 避免除以0:检查sind(theta) ~= 0

# Anti-Patterns
- 不要使用polyfit等拟合函数
- 不要使用MATLAB自带的hough函数进行变换
- 不要忽略浮点数坐标的处理
- 不要忽略索引边界检查

# Interaction Workflow
1. 接收x,y坐标向量
2. 执行Hough变换
3. 检测峰值
4. 计算并输出直线参数

## Triggers

- 离散点Hough变换
- MATLAB直线检测
- 浮点坐标直线提取
- 不用自带函数的Hough变换
- 离散点斜率截距计算

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.