Undefined variable or class ERROR when i call my function
古いコメントを表示
my function takes in two inputs the number of random points or pixels (p) and the file name that all the data will be extracted from. and simply outputs those points. here's the relevant part of the code.
function [points] = SelectPPixels(filename,P)
imagedata=imread(filename, 'JPG');
[rows,cols,colors]=size(imagedata);
3 件のコメント
Walter Roberson
2018 年 8 月 22 日
You did not say which variable or class is being complained about.
....
To answer your previous (now deleted) question as I see some of the same issues here:
You should initialize points to an appropriate size: otherwise the size it comes out is going to be determined by which locations were randomly chosen.
Remember that jpeg images are almost always color images, so you should probably be copying all three color planes.
Are you passing in the file extension as part of the file name? If you are, then using 'JPG' as part of the imread() call is not needed. Perhaps you instead want
imagedata = imread( [filename '.jpg'] );
The big YeeT
2018 年 8 月 23 日
Walter Roberson
2018 年 8 月 23 日
You have not indicated exactly what the error is. Are you storing SelectPPixels in a file SelectPPixels.m that is on your MATLAB path? Perhaps you are trying to call upon SelectPixels instead of SelectPPixels?
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!