error: invalid call to script
21 ビュー (過去 30 日間)
古いコメントを表示
Hello, i tried writing this code for contrast adjustment homework and it gives me this error:
code:
img=imread('sea.jpg');
figure();
subplot(2,2,1), imshow(img)
subplot(2,2,2), imhist(img)
[m1,m2]= size(img)
final= imadjust(img)
subplot(2,2,3), imshow(final)
subplot(2,2,4), imhist(final)
max=img(1,1);
min=img(1,1);
for i=1:m1
for j=1:m2
if(img(i,j)>max)
max=img(i,j);
end
if (img(i,j)<min)
min= img(i,j);
end
end
end
------------------
The error:
error: invalid call to script /home/oo/imadjust.m
error: called from imadjust sea at line 8 column 6
-------------
why am i getting this error and how can i fix it.
0 件のコメント
回答 (1 件)
Voss
2022 年 5 月 29 日
You are getting that error because you have a file called imadjust.m (located in /home/oo/), which is a script. Scripts take no input arguments, so trying to execute imadjust(img) (i.e., imadjust with the input img) in your code causes the error.
One way to fix it would be to rename your file imadjust.m to something else, so that when you call imadjust(img) you execute the function from the Image Processing Toolbox imadjust instead of your script.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!