Ai
1 Star 0 Fork 0

李明/imageidentification

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mean.js 547 Bytes
一键复制 编辑 原始数据 按行查看 历史
李明 提交于 2025-06-16 21:09 +08:00 . [modify]更新内容
/**
* 将图像数据转换为灰度图像(均值法)
* @param {NormalizeImageData} imageData - 图像数据对象
* @description 遍历每个像素点,通过RGB三通道取平均值计算灰度值
*/
export default function mean(imageData) {
for (let row = 0; row < imageData.height; row++) {
for (let col = 0; col < imageData.width; col++) {
const data = imageData.getSpecificPositionData(row, col);
const gray = (data[0] + data[1] + data[2]) / 3;
imageData.setSpecificPositionData(row, col, gray);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/usernameisregistered/imageidentification.git
git@gitee.com:usernameisregistered/imageidentification.git
usernameisregistered
imageidentification
imageidentification
master

搜索帮助