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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.