Question: In the following code, please note the missing sections labeled ? 1 and ? 2 . function [ img ] = examQuestion ( n )

In the following code, please note the missing sections labeled ?1 and ?2.
function [img]= examQuestion (n)
img = zeros(n);
MaxDist =?1;
for i =1:n
for j =1:n
if i == j
img(i,j)=0;
else
distance =?2;
img(i,j)=255*distance/MaxDist;
end
end
end
img = uint8(img);
The output image will have pixel intensity scaled with its distance to diagonal (where i and j are identical), which of the following should replace the missing sections?
Group of answer choices
?1 should be n-1,?2 should be abs(i-j)
?1 should be n-1,?2 should be i
?1 should be n,?2 should be (i+j)/2
?1 should be n,?2 should abs(i-j)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!