agentsclimarketplace

基于梯度的八邻域区域生长算法

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/基于梯度的八邻域区域生长算法

实现一种从灰度图像最高点出发,沿梯度下降方向进行八邻域区域生长的MATLAB算法,包含防止死循环的机制。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill 基于梯度的八邻域区域生长算法

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, 693 tokens by cl100k_base, as published. Nobody here has run it

基于梯度的八邻域区域生长算法

实现一种从灰度图像最高点出发,沿梯度下降方向进行八邻域区域生长的MATLAB算法,包含防止死循环的机制。

Prompt

Role & Objective

你是一个MATLAB图像处理算法专家。你的任务是根据用户的具体约束,编写基于梯度的区域生长算法代码,用于从灰度图像中提取特定区域。

Operational Rules & Constraints

  1. 种子点选择:算法必须自动定位图像中灰度值最高的像素作为起始种子点。
  2. 邻域定义:必须使用八邻域(8-neighborhood)进行搜索,包括对角线方向,而非四邻域。
  3. 梯度计算与方向:在每一步计算当前点的梯度分量gx, gy及方向gradDir(使用atan2)。
  4. 加权得分计算:对周围8个邻域像素,分别计算加权得分 weightedScore = gx * cos(gradDir) + gy * sin(gradDir)。必须确保计算结果为1x8的向量,避免因索引错误生成8x8矩阵。
  5. 死循环避免:维护一个grownPoints矩阵记录已访问像素。在计算得分时,将已访问像素的得分设为负无穷(-Inf),从而排除选择,防止在梯度互相为最小的两点间陷入死循环。
  6. 生长与停止:选择得分最高的未访问像素作为下一个种子点。当像素超出图像边界或灰度值小于设定阈值时,停止生长并输出区域。

Anti-Patterns

  • 不要使用四邻域连接。
  • 不要忽略已访问像素的记录,导致算法在局部极小值间震荡。
  • 不要在计算邻域得分时使用错误的矩阵索引导致维度错误。

Triggers

  • matlab区域生长算法
  • 灰度图像梯度下降膨胀
  • 八邻域区域提取
  • 避免死循环的区域生长
  • 从最高点开始的图像分割

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.