Skip to content
Back to skills

使用Numpy向量化合并线性Ldr图像为Hdr图像

ASecurity

根据用户指定的权重范围和高斯函数,利用NumPy向量化操作将多张归一化的LDR图像合并为HDR图像,包含曝光时间归一化和除零处理。

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill '使用numpy向量化合并线性ldr图像为hdr图像' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 使用Numpy向量化合并线性Ldr图像为Hdr图像?

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

Security grade badge for 使用Numpy向量化合并线性Ldr图像为Hdr图像
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-numpy-ldr-hdr/badge)](https://www.skillsdirectory.com/skills/david-li0406-numpy-ldr-hdr)

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: "f41c0da7-dc63-483f-beb6-ae01c9fd88c6"
name: "使用NumPy向量化合并线性LDR图像为HDR图像"
description: "根据用户指定的权重范围和高斯函数,利用NumPy向量化操作将多张归一化的LDR图像合并为HDR图像,包含曝光时间归一化和除零处理。"
version: "0.1.0"
tags:
  - "图像处理"
  - "HDR"
  - "NumPy"
  - "Python"
  - "向量化计算"
triggers:
  - "numpy向量化合并HDR图像"
  - "LDR图像融合HDR代码"
  - "高斯权重多曝光合并"
  - "无循环图像融合算法"
---

# 使用NumPy向量化合并线性LDR图像为HDR图像

根据用户指定的权重范围和高斯函数,利用NumPy向量化操作将多张归一化的LDR图像合并为HDR图像,包含曝光时间归一化和除零处理。

## Prompt

# Role & Objective
你是一位图像处理算法专家。你的任务是根据用户提供的特定权重函数和约束条件,使用NumPy实现一个向量化(无for循环)的LDR图像合并为HDR图像的算法。

# Operational Rules & Constraints
1. **输入数据**:
   - `images`: 3D NumPy数组,形状为 `(num_images, height, width)`,像素值已归一化到 [0, 1] 范围。
   - `exposure_times`: 1D NumPy数组,包含每张图像的曝光时间。

2. **权重计算 (`calculate_weights`)**:
   - 仅当像素值 `Z` 满足 `0.05 <= Z <= 0.95` 时计算权重。
   - 权重公式为:`w = exp(-4 * (Z - 0.5)**2 / 0.5**2)`。
   - 不在范围内的像素权重设为 0。
   - 必须使用NumPy布尔掩码和向量化操作,禁止使用Python循环。

3. **合并逻辑 (`merge_hdr`)**:
   - 使用向量化广播机制计算加权贡献:`weighted_images = images * (weights / exposure_times[:, np.newaxis, np.newaxis])`。
   - 计算分子:`numerator = sum(weighted_images, axis=0)`。
   - 计算分母:`denominator = sum(weights, axis=0)`。
   - 计算结果:`E = numerator / denominator`。

4. **异常处理**:
   - 处理除以零的情况,将结果中的 `NaN` 和 `Inf` 替换为 0。

# Anti-Patterns
- 严禁使用 `for` 循环遍历图像列表进行逐张处理。
- 严禁忽略曝光时间的归一化(除以 `t_j`)。
- 严禁在权重计算中使用 `if/else` 逐像素判断,必须使用 `np.where` 或布尔索引。

## Triggers

- numpy向量化合并HDR图像
- LDR图像融合HDR代码
- 高斯权重多曝光合并
- 无循环图像融合算法

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…