I am getting the following error when I run my program "Assignment has more non-singleton rhs dimensions than non-singleton subscripts". Please do help.

1 view (last 30 days)
{
clear all;
close all;
clc;
input=imread('C:\Users\Nilu\Desktop\lena.jpg');
subplot(4,4,1);
imshow(input);
img=imresize(input, [256,256]);
% %red plane
img_r(:,:,1)=img(:,:,1);
img_r(:,:,2)=0;
img_r(:,:,3)=0;
% %green plane
img_g(:,:,2)=img(:,:,2);
img_g(:,:,1)=0;
img_g(:,:,3)=0;
% %blue plane
img_b(:,:,3)=img(:,:,3);
img_b(:,:,1)=0;
img_b(:,:,2)=0;
subplot(4,4,2);
imshow(img_r);
subplot(4,4,3);
imshow(img_g);
subplot(4,4,4);
imshow(img_b);
img_r=img_r(:,:,1);
img_g=img_g(:,:,2);
img_b=img_b(:,:,3);
subplot(4,4,5);
imshow(img_r);
disp(img(1,1));
A=3.5;
B=0.3;
x0=0.123;
y0=0.177:0.277;
x1=0.1;
y1=0;
for i=1:65536
x1= 1-A*y0+B*abs(x0);
y1=x0;
x0=x1;
z(i)=x0;
d(i)=x0*256;
end
count=10000;
k=1;
for i=1:256
for j=1:256
b(i,j)=d(k);
k=k+1;
end
end
b=uint8(b);
finalr=bitxor(img_r,b);
subplot(4,4,6);
imshow(finalr);
finalg=bitxor(img_g,b);
subplot(4,4,7);
imshow(finalg);
finalb=bitxor(img_b,b);
subplot(4,4,8);
imshow(finalb);
B(:,:,1)=finalr;
B(:,:,2)=finalg;
B(:,:,3)=finalb;
subplot(4,4,9);
imshow(uint8(B));
%bitxor_mod2bit
b=50;
c=bitxor(B(:,:,1),b);
subplot(4,4,9);
imshow(uint8(c));
% % % % for first 2 bits
d1=bitget(B(:,:,1),7:8);
d1=bi2de(d1);
disp(d1);
e1=bitget(b,7:8);
e1=bi2de(e1);
disp(e1);
f1=(d1+e1);
disp(f1);
f1=mod(f1,4);
disp(f1);
f1=dec2bin(f1,2);
disp(f1);
% % % % for 3rd,4th bit
d2=bitget(B(:,:,1),5:6);
d2=bi2de(d2);
disp(d2);
e2=bitget(b,5:6);
e2=bi2de(e2);
disp(e2);
f2=(d2+e2);
disp(f2);
f2=mod(f2,4);
% disp(f2);
f2=dec2bin(f2,2);
disp(f2);
% % % % for the 5th,6th bits
d3=bitget(B(:,:,1),3:4);
d3=bi2de(d3);
disp(d3);
e3=bitget(b,3:4);
e3=bi2de(e3);
disp(e3);
f3=(d3+e3);
disp(f3);
f3=mod(f3,4);
disp(f3);
f3=dec2bin(f3,2);
disp(f3);
% % % % for the last 2 bits
d4=bitget(B(:,:,1),1:2);
d4=bi2de(d4);
disp(d4);
e4=bitget(b,1:2);
e4=bi2de(e4);
disp(e4);
f4=(d4+e4);
disp(f4);
f4=mod(f4,4);
disp(f4);
f4=dec2bin(f4,2);
disp(f4);
% % % % concate all the bits and convert binary to decimal
s=strcat(f1,f2,f3,f4);
disp(s);
subplot(4,4,10);
imshow(uint8(s));
s=bin2dec(s);
disp(s);
}

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!