not enough input arguments

1 view (last 30 days)
Fathima Nasha
Fathima Nasha on 6 Jun 2021
Answered: Surabhi KS on 10 Jun 2021
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 Comment
SALAH ALRABEEI
SALAH ALRABEEI on 6 Jun 2021
check the sizs of the matrix after initialization

Sign in to comment.

Answers (3)

DGM
DGM on 6 Jun 2021
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 on 6 Jun 2021
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 Comment
DGM
DGM on 6 Jun 2021
Edited: DGM on 6 Jun 2021
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().

Sign in to comment.


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

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!