Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply function to each pixel of the image

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.

like image 496
spurra Avatar asked Oct 01 '22 08:10

spurra


1 Answers

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

  • How to scan images
  • Documentation of the LUT function

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

like image 81
bjoernz Avatar answered Oct 05 '22 10:10

bjoernz