Function to scale image

2 ビュー (過去 30 日間)
MSwar
MSwar 2020 年 5 月 30 日
コメント済み: MSwar 2020 年 5 月 30 日
Could someone kindly point out the syntax/ other error which is preventing my function to scale image from running properly?
function [scaledimage] = scalefunc(img, value)
scaledimage = value*img; %ensures that multiplication occurs element wise;
end
This is the output I am currently getting-
Not enough input arguments.
Error in scale (line 2)
scaledimage = value*img; %ensures that multiplication occurs element wise

採用された回答

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 5 月 30 日
How did you call the function? I assume you didn't pass input arguments
It must be called with input arguments, like
[scaledimage] = scalefunc('Image.jpg', 10)
  6 件のコメント
Sai Sri Pathuri
Sai Sri Pathuri 2020 年 5 月 30 日
Shift these lines to the above of function definition
img = imread('family.png');
imshow(scaledfunc(img, 10))
Currently, your file is a function and expects all statements to be inside function. Change it to a script by making above change
MSwar
MSwar 2020 年 5 月 30 日
Got it! Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by