How do you handle negative pixel values after filtering?

后端 未结 2 819
情歌与酒
情歌与酒 2020-12-19 12:48

I have a 8-bit image and I want to filter it with a matrix for edge detection. My kernel matrix is

0  1  0
1 -4  1
0  1  0

For some indic

2条回答
  •  醉梦人生
    2020-12-19 13:10

    Out of range values are extremely common in JPEG. One handles them by clamping.

    If X < 0 then X := 0 ;   
    If X > 255 then X := 255 ;
    

提交回复
热议问题