i am encountering this error on below mention code Undefined function or variable 'greenchannel'. Error in bidemo (line 47) [Gout]=bilateral_each_channel(w,sigma_r,sigma_d,greenchannel);
Show older comments
%%Clear everything
clear all;
close all;
clc;
v = VideoReader('peng.mp4');
tic
numFrames = v.NumberOfFrames;
k=1;
while k<=numFrames
frame=read(v,k);
frame=imresize(frame,[256 256]);
frame=double(frame);
[a b z]=size(frame);
frame = frame/255.0;
% Extract the individual red, green, and blue color channels.
redChannel = frame(:, :, 1);
greenChannel = frame(:, :, 2);
blueChannel = frame(:, :, 3);
sigma = 0.1; %noise standard deviation
xr = redChannel + sigma*randn(size(redChannel));
xg = greenChannel + sigma*randn(size(greenChannel));
xb = blueChannel + sigma*randn(size(blueChannel));
noisyRGB = cat(3,xr,xg,xb);
w=9; % window size
sigma_d=1;
sigma_r=30;
tic;
[Rout]=bilateral_each_channel(w,sigma_r,sigma_d,redChannel);
[Gout]=bilateral_each_channel(w,sigma_r,sigma_d,greenchannel);
[Bout]=bilateral_each_channel(w,sigma_r,sigma_d,bluechannel);
frame(:,:,1)=(Rout);
frame(:,:,2)=(Gout);
frame(:,:,3)=(Bout);
rgbFixed = cat(3, redMF,greenMF,blueMF);
imshow([frame,noisyRGB,rgbFixed],[0,1])
k=k+1;
end
finalpsnr1=avgPSNR1/numFrames
% finalpsnr2=avgPSNR2/numFrames
toc
Accepted Answer
More Answers (0)
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!