将函数应用于图像的每个像素 [英] Apply function to each pixel of the image

查看:145
本文介绍了将函数应用于图像的每个像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenCV中是否有一个采用输入矩阵,输出矩阵和函数的方法,并将此函数应用于每个像素?例如,像检查像素的值,如果它低于某个阈值,将其设置为0,否则保持值

Is there a method in OpenCV which takes an input matrix, an output matrix and a function, and applies this function to each pixel? E.g a function like "check value of pixel, if it's below a certain threshold, set it to 0, otherwise keep the value"

我知道我可以迭代自己矩阵的像素并自己应用函数,只是想知道是否有一个函数可以帮我省下这项工作。

I know I can iterate myself over the pixels of a matrix and apply the function myself, just wondering if there is a function which would save me this work.

推荐答案

如果性能是一个问题,您可能会对以下链接感兴趣:

If performance is a concern, the following links might be of interest to you:

  • How to scan images
  • Documentation of the LUT function

如果使用灰度图像,可以轻松创建合适的LUT。

You can easily create an appropriate LUT if you work with gray scale images.

这篇关于将函数应用于图像的每个像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆