I get this error:
context
what I intend to do is to pass a vector of seven elements (values 1 to 7) and an Image to a function to execute a series of filters, then calculate the psnr value of the output image and store the psnr value in an array and pass the output image and the psnr array back.
image_fintering code:
Undefined function or variable "a".
Error in image_filtering (line 55)
a(end+1) = peaksnr ;
Error in runtime_test (line 15)
[out_img , a_out] = image_filtering (v (:,:),inpt_img);
this is the calling code
runtime_test
function [output_image,a] = image_filtering( filter_order,input_image )
se1 = strel('disk',1); % disk, radius 1
se2 = strel('disk',2); % disk, radius 2
se3 = strel('disk',4); % disk, radius 4
se4 = strel('line',5,45); % line, length 5, angle 45 degrees
se5 = strel('line',5,0); % line, length 5, angle 0 degrees
se6 = strel('square',3); % 3-by-3 square
se7 = strel('ball',15,5);
filter_iterations= size(filter_order);
filter_iterations = filter_iterations(2);
disp(filter_order);
for i = 1:filter_iterations
switch filter_order(1,i)
case 1
output_image = imclose(input_image,se1);
case 2
output_image = imclose(input_image,se2);
case 3
output_image = imclose(input_image,se3);
case 4
output_image = imclose(input_image,se4);
case 5
output_image = imclose(input_image,se5);
case 6
output_image = imclose(input_image,se6);
case 7
output_image = imclose(input_image,se7);
end
end
peaksnr = psnr(output_image,input_image);
a(end+1) = peaksnr ;
end