Experimenting inverting pictures with Octave

Viewed 22

First time using Octave to experiment inverting an image. My filename is LinearAlgebraLab1.m and after I run the file with Octave I get error "error: no such file, '/home/LinearAlgebraLab1.m'"

However, before this, I was getting an error that my .jpg file couldn't be found. What should I change to have Octave run my script correctly without any errors?

%% import image
C = imread('MonaLisa2.jpg');

%% set slopes and intercepts for color transformation

redSlope = 1;
redIntercept = -80; 

greenSlope = -.75;
greenIntercept = 150; 

blueSlope = -.50;
blueIntercept = 200; 

%%redSlope = 1;
%%redIntercept = -80; 

%%greenSlope = -.75;
%%greenIntercept = 150; 

%%blueSlope = -.50;
%%blueIntercept = 200; redSlope = 1;


%% store RGB channels from image separately 

R = C(:,:,1); 
G = C(:,:,2); 
B = C(:,:,3); 

C2 = C; 
S=size(C);
m=S(1,1);
n=S(1,2);
%h=S(1,3);

%% change red channel

M = R; 
%%M2 = redSlope*cast(M,'double') + redIntercept*ones(786,579);
M2 = redSlope*cast(M,'double') + redIntercept*ones(m,n);
C2(:,:,1) = M2; 

%% change green channel

M = G; 
M2 = greenSlope*cast(M,'double') + greenIntercept*ones(m,n);
C2(:,:,2) = M2; 

%% change blue channel

M = B; 
M2 = blueSlope*cast(M,'double') + blueIntercept*ones(m,n);
C2(:,:,3) = M2; 


%% visualize new image
image(C2)
axis equal tight off
set(gca,'position',[0 0 1 1],'units','normalized')
0 Answers
Related