not enough input arguments

1 回表示 (過去 30 日間)
Fathima Nasha
Fathima Nasha 2021 年 6 月 6 日
回答済み: Surabhi KS 2021 年 6 月 10 日
Someone please help me with this error.If someone can help me with this please contact me with my mail id fathimanashapk@cet.ac.in
  1 件のコメント
SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 6 日
check the sizs of the matrix after initialization

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

回答 (3 件)

DGM
DGM 2021 年 6 月 6 日
The error is occurring because you're not providing the function odDetect with any arguments. A function will throw the error on the first line where the missing argument is needed. In this case, 'image' is missing.
As to why it's missing, nobody knows how you're calling odDetect. If you need to include the external code, include it as formatted code. Nobody can run a picture of code or scroll to parts that are hidden.

Fathima Nasha
Fathima Nasha 2021 年 6 月 6 日
1st is my initializing code
%% Initialize the parameters
size_m = 12;
size_n = 12;
% Creating laplacian of gaussians and gaussian coeffecients for blob detection
logCoefficients = fspecial('log',[12 12],2);
gaussianCoefficients = fspecial('gaussian',5,2);
scaleFactor_m = 10;
scaleFactor_n = 10;
% Initialize mesLasso Parameters
param.mode = 1;
param.lambda = 0.01;
load Dictionary
now the odDetect code
%% OD Detection code
% Input : RGB Fundal Image (M x N x 3)
% Output: [X_coord Y_coord] corresponding to OD location
function [x y] = odDetect(image)
% Initialize the parameters
initialize;
imageGray = double(rgb2gray(image)); % Converting the test image to grayscale
testImage_red = double(image(:,:,1)); % Extracting the red channel of test image
imageGray = filter2(gaussianCoefficients,imresize(imageGray,[size(imageGray,1)/scaleFactor_m size(imageGray,2)/scaleFactor_n])); % Reducing the size by a factor of 10 and smoothening the image
testImage_red = filter2(gaussianCoefficients,imresize(testImage_red,[size(testImage_red,1)/scaleFactor_m size(testImage_red,2)/scaleFactor_n]));
testImage_size = size(imageGray);
testImage_gray_matrix = im2col(imageGray,[size_m size_n],'sliding'); % Rearranging the sub images into columns in a 'sliding' fashion
testImage_red_matrix = im2col(testImage_red,[size_m size_n],'sliding');
alpha_gray = mexLasso(NormalizeMat(testImage_gray_matrix),Dictionary,param); % Obtaining the sparse coefficients solving the l1 minimization problem
alpha_red = mexLasso(NormalizeMat(testImage_red_matrix),Dictionary,param);
eta_gray = sum((alpha_gray(1:82,:)))./(sum(abs(alpha_gray(83:end,:)))+0.01); % Calculating the confidence measures
eta_red = sum((alpha_red(1:82,:)))./(sum(abs(alpha_red(83:end,:)))+0.01);
eta = full(reshape(eta_gray,[testImage_size(1)-size_m+1 testImage_size(2)-size_n+1]).*reshape(eta_red,[testImage_size(1)-size_m+1 testImage_size(2)-size_n+1]))-20; % Calculating the combined confidence measure
eta = filter2(-logCoefficients,filter2(-logCoefficients,filter2(-logCoefficients,eta))); % Applying the laplacian of Gaussians blob detector
% fprintf(1,'max t1 for gray ***********'); max(eta_gray(:))
% fprintf(1,'max t2 for red ************'); max(eta_red(:))
[max_i max_j] = find(reshape(eta_gray,[testImage_size(1)-size_m+1 testImage_size(2)-size_n+1]) == max(eta_gray(:))); % Finding the coordinates
[max_i2 max_j2] = find(reshape(eta_red,[testImage_size(1)-size_m+1 testImage_size(2)-size_n+1]) == max(eta_red(:)));
[max_i3 max_j3] = find(reshape(eta,[testImage_size(1)-size_m+1 testImage_size(2)-size_n+1]) == max(eta(:)));
x=(max_j3+size_n/2)*scaleFactor_n;
y=(max_i2+size_m/2)*scaleFactor_m;
%% Displaying the image
figure(2);imshow(image);colormap(gray);hold on;
% plot((max_j+size_n/2)*scaleFactor_n,(max_i+size_m/2)*scaleFactor_m,'k+','LineWidth',2); % superimposing the obtained coordiantes on the original image
% hold on;
% plot((max_j2+size_n/2)*scaleFactor_n,(max_i2+size_m/2)*scaleFactor_m,'r+','LineWidth',2);
% hold on;
plot((max_j3+size_n/2)*scaleFactor_n,(max_i3+size_m/2)*scaleFactor_m,'y+','MarkerSize',15,'LineWidth',5);
  1 件のコメント
DGM
DGM 2021 年 6 月 6 日
編集済み: DGM 2021 年 6 月 6 日
This isn't an answer. If you want to follow up with a comment on your question, post this as a comment there. If you want to post this as a comment on my answer, post it there.
We can talk once the conversation is in order, but I'll point out that nothing here calls odDetect().

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


Surabhi KS
Surabhi KS 2021 年 6 月 10 日
You need to call your function with the appropriate variables.
Call odDetect with its defined variables for example:
I = imread('pathtoyourimage');
odDetect(I)

カテゴリ

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