Hello all,
I would like to search for a certain value (=255) within a 3x3 neighborhood of a selected pixel. If one or more pixels in that 3x3 neighborhood have that value, the selected pixel’s value should be changed to that value (=255) as well. This needs to be done for every pixel of the image.
Currently I am indexing through every single pixel asking for the value and performing a boolean operation. However, this leads to heavy performance issues. Can you tell me if there is a layer in pytorch that I can customize to meet my needs? I’ve thought about a layer that turns all pixels with value 255 to value 0 first and then just multiplies all neighborhood pixel values. That way the result would be 0 if atleast one of the pixels value in the 3x3 neighborhood was 0. Is there a smooth way in pytorch to implement this approach?
Best regards