문제

Im currently adding different features to a very simple digital image processing program. It is coded using the unsafe methods. This program only works with greyscale images.

My question is how do i apply masks to pixels?

도움이 되었습니까?

해결책

Just multiply pix_vals by the mask and sum. So just add:

p[y * stride + x] = pix_val[0] * Gx[0] + ... + pix_val[8] * Gx[8];

EDIT: Watch out for the corner cases though, you should really change your offsets to [-1, 0, 1] instead of [0, 1, 2] and handle the boundary conditions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top