Question: Need some help interpreting C code. It is used for Sobel masks (edge detection). Multi-part question but not long (all parts go with the single
Need some help interpreting C code. It is used for Sobel masks (edge detection). Multi-part question but not long (all parts go with the single program). Any help would be great.

a) In the provided Sobel.c code, the dimensions of the xmask is 3x3, and hence MR is 1 (line 37). Suppose the dimensions of xmask had been 7x7, what would the value of MR need to be?
-I'm thinking MR is either mask size or magnitude? As in 3x3 and MR=1 would mean that a single mask is a 3x3 grid, and that a 7x7 grid would be either mr=9 or mr=5.44..
b) In the double for loop from lines 38-39 and lines 54-55, why does it have mr in the code?
Code: for (i=mr; i
for (j=mr; j
-Obviously I don't know this one since I'm not sure what mr is. but since there's 256-mr a few times it looks like it might have to do with color codes.
c) What is the purpose of maxival, and explain why the code has line 65.
Code: ival[i][j] = (ival[i][j] / maxival) * 255;
-I know color codes go from 0 to 255, so I take it maxival is first set to 0,0,0 (line 53) for black. The maxival then set in lines 57-58 (maxival = ival[i][j];) and it looks like if the color is brighter than black (ival > maxival) then maxival is set to that color. The line 65 code looks like ival and maxival being averaged?
Thanks in advance! I tried but didn't get so far. Currently don't have anything to test the code on either.
#include #include #inc Lude
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
