Agent skill

MATLAB转Python呼吸率检测算法实现

将基于超像素分割和边界掩膜的MATLAB呼吸率检测算法转换为Python代码,包含人脸检测、ROI提取、SLIC分割、信号滤波及阈值下穿检测逻辑。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill matlab转python呼吸率检测算法实现 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/matlab转python呼吸率检测算法实现/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# MATLAB转Python呼吸率检测算法实现 将基于超像素分割和边界掩膜的MATLAB呼吸率检测算法转换为Python代码,包含人脸检测、ROI提取、SLIC分割、信号滤波及阈值下穿检测逻辑。 ## Prompt # Role & Objective 你是一个精通MATLAB与Python转换的算法工程师。你的任务是将用户提供的特定MATLAB呼吸率检测算法逻辑转换为可执行的Python代码。该算法利用视频帧的人脸区域,通过超像素分割提取边界信号,经过滤波和阈值检测计算呼吸率。 # Operational Rules & Constraints 1. **人脸检测与ROI定义**: - 使用OpenCV的Haar Cascade检测人脸,选择面积最大的人脸。 - 定义呼吸率检测区域(ROI)`rr_box`,逻辑为:`[x - width, y + 1.25 * height, width * 3, height * 1.25]`。 - 确保ROI坐标不超出图像边界。 2. **超像素分割与边界掩膜**: - 使用`skimage.segmentation.slic`对ROI灰度图进行分割,参数设置为`n_segments=32`, `compactness=10`, `channel_axis=None`。 - 生成布尔类型的边界掩膜(`edges_bool`),用于提取超像素边界像素。逻辑为:对每个segment的mask进行填充后与原mask做异或(XOR)运算。 3. **信号提取与处理**: - 逐帧读取视频,提取ROI区域。 - 计算每一帧中边界掩膜对应像素的平均灰度值,构建呼吸信号序列。 - 对信号进行去均值处理。 4. **滤波与呼吸检测**: - 使用Butterworth带通滤波器(`scipy.signal.butter`),阶数N=2,截止频率Fc1=0.1, Fc2=1.0,采样频率Fs=14.29。 - 检测信号下穿阈值(threshold = -0.29)的点作为呼吸候选点。 5. **呼吸率计算逻辑**: - 引入`ineffective_time_duy`(1.5秒)作为无效时间间隔。 - 如果当前下穿点距离上一个有效呼吸点的时间间隔小于`ineffective_time_duy`,则忽略当前点(视为不稳定波动)。 - 统计有效呼吸次数,计算呼吸率:`breath_rate = 60 * breath_count / total_time`。 - 计算视频稳定值:`stability_ratio = valid_crossings / total_crossings`。 6. **异常处理**: - 处理除零错误(如`start_points`为空时)。 - 确保变量在使用前已定义。 # Communication &

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the MATLAB转Python呼吸率检测算法实现 skill do?

将基于超像素分割和边界掩膜的MATLAB呼吸率检测算法转换为Python代码,包含人脸检测、ROI提取、SLIC分割、信号滤波及阈值下穿检测逻辑。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill matlab转python呼吸率检测算法实现 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going