Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Got error message, can't figure it out. Doing it under case 10 Function call gives an error: ----------------------------------------------------------------- Not enough input arguments. Error in

MATLAB

Got error message, can't figure it out. Doing it under case 10

Function call gives an error:

-----------------------------------------------------------------

Not enough input arguments.

Error in color_swap (line 22) if current_img(i,j,k) >= r1-allowed && current_img(i,j,k)

Error in lab6_hwk6_given (line 132) newImage=color_swap(current_img)

------------------------------------------------------------------------------------------------------------------------

Function Call:

%Color Swap

function outImg = color_swap(current_img,r1,g1,b1,r2,g2,b2,allowed) %tic [x,y,z]=size(current_img); %preallocation of layers outImg = current_img; %preallocation of outImg for efficiency for i = 1:x for j = 1:y for k = 1:z if current_img(i,j,k) >= r1-allowed && current_img(i,j,k) = g1-allowed && current_img(i,j,k) = b1-allowed && current_img(i,j,k)

---------------------------Main Code:---------------------------------------

clear;close all;clc;

% Display a menu and get a choice choice = menu('Choose an option', 'Exit Program', 'Load Image', ... 'Display Image', 'Brighten Image', 'Brighten Image No Loops',... 'Invert_L', 'Invert_NL','Random Noise','Composite','Color_Swap'); % as you develop functions, add buttons for them here % Choice 1 is to exit the program while choice ~= 1 switch choice case 0 disp('Error - please choose one of the options.') % Display a menu and get a choice choice = menu('Choose an option', 'Exit Program',... 'Load Image', 'Display Image', 'Brighten Image',... 'Brighten Image No Loops', 'Invert_L', 'Invert_NL',... 'Random Noise','Composite','Color_Swap'); % as you develop functions, add buttons for them here case 2 % Load an image image_choice = menu('Choose an image', 'lena1', 'mandril1',... 'wrench', 'yoda'); switch image_choice case 1 filename = 'lena1.jpg'; case 2 filename = 'mandrill1.jpg'; case 3 filename = 'wrench1.jpg'; case 4 filename = 'yoda.bmp'; % fill in cases for all the images you plan to use end current_img = imread(filename); case 3 % Display image figure imagesc(current_img); if size(current_img,3) == 1 colormap gray end case 4 % Brighten image % 1. Ask the user for brightness value brightness=input('What is the brightness value: '); % 2. Call the appropriate function newImage = makeBright_NL(current_img, brightness); % create your own function for brightening % 3. Display the old and the new image using subplot % .... %subplot(...) %imagesc(current_img) % subplot(...) subplot(1,2,2), imshow(current_img) %imagesc(newImage) subplot(1,2,1), imshow(newImage) % 4. Save the newImage to a file imwrite (newImage,'New Image.JPEG') case 5 %makeBright_L % Brighten image % 1. Ask the user for brightness value brightness=input('What is the brightness value: '); % 2. Call the appropriate function newImage = makeBright_L(current_img, brightness); % create your own function for brightening subplot(1,2,2), imshow(current_img) %imagesc(newImage) subplot(1,2,1), imshow(newImage) % 4. Save the newImage to a file imwrite (newImage,'New Image.JPEG') case 6 newImage=invert_L(current_img) %Invert Image Fucntion Call subplot(1,2,1), imshow(current_img) %imagesc(newImage) subplot(1,2,2), imshow(newImage) imwrite (newImage,'New ImageL.JPEG') case 7 %No loops newImage=invert_NL(current_img) %Invert Image Fucntion Call subplot(1,2,1), imshow(current_img) %imagesc(newImage) subplot(1,2,2), imshow(newImage) imwrite (newImage,'New Image InvertNL.JPEG') case 8 %Random Noise No Loops newImage=addRandomNoise_NL(current_img) %Invert Image Fucntion Call subplot(1,2,1), imshow(current_img) %imagesc(newImage) subplot(1,2,2), imshow(newImage) imwrite (newImage,'New Image RandomNoise.JPEG') case 9 %Composite newImage=composite(current_img) %Invert Image Fucntion Call subplot(1,2,1), imshow(current_img) %imagesc(newImage) subplot(1,2,2), imshow(newImage) imwrite (newImage,'Composite.JPEG') case 10 %Color Swap newImage=color_swap(current_img) %Invert Image Fucntion Call subplot(1,2,1), imshow(current_img) %imagesc(newImage) subplot(1,2,2), imshow(newImage) imwrite (newImage,'Color_Swap.JPEG') end % Display menu again and get user's choice choice = menu('Choose an option', 'Exit Program', 'Load Image', ... 'Display Image', 'Brighten Image','Brighten Image No Loops',... 'Invert_L','Invert_NL','Random Noise','Composite','Color_Swap'); end

-----------------------------SAMPLE PICTURE----------------------------

%Lena

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions