How to take Image as Input in a function
24 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Im trying to make a function that takes a image of any type (png,jpeg etc) and then performs some task on them. But i cannot figure how to take the image as input in the function. Please help :)
0 Commenti
Risposte (2)
Cris LaPierre
il 31 Mar 2020
You'd have to first load the image into MATLAB and store it in a variable. You can then pass that variable as input to your function.
5 Commenti
Cris LaPierre
il 5 Giu 2023
Modificato: Cris LaPierre
il 5 Giu 2023
Share the code you have written (including loading your image) that calls/uses your function.
Image Analyst
il 6 Giu 2023
For example
grayImage = imread('moon.tif');
meanGL = mean2(grayImage)
grayImage2 = DarkenImage(grayImage); % Call function
meanGL2 = mean2(grayImage2)
%======================================================
% Define function that divides the image values by 2
function output = DarkenImage(inputImageArray)
output = inputImageArray / 2;
end
1 Commento
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!