A conclusion about impixel Func in matlab - matlab

I am new to matlap
And this is a simple impixel statement :
I = imread('user.png'); impixel(I)
the error :
Error using getpts (line 174)
Interruption during mouse point selection.
Error in impixel>parse_inputs (line 199)
[xi,yi] = getpts(ancestor(h,'axes'));
Error in impixel (line 76)
[a,cm,xi,yi,x,y] = parse_inputs(varargin{:});
Error in first (line 2)
impixel(I);
The name of file is "first"
What is wrong here ,i have been searching a whole day , any help please

Related

How do I resolve these errors in MATLAB image processing while using command impixel

I am new to MATLAB image processing and trying to extract image features on the basis of colour thresholding but unable to go further. Right after selecting image pixel and I receive the following errors:
Error using getpts (line 174)
Interruption during mouse point selection.
Error in impixel>parse_inputs (line 199)
[xi,yi] = getpts(ancestor(h,'axes'));
Error in impixel (line 76)
[a,cm,xi,yi,x,y] = parse_inputs(varargin{:});
Error in featureextraction (line 5)
pval = impixel(a);
Here is my code:
oneToolImg = 'E:\Ujala Documents\hfu ss\forschungspraktikum\oneTool.jpg';
a = imread(oneToolImg);
figure(1)
imshow(a)
pval = impixel(a);
tool = (a(:,:,1)>91) & (a(:,:,2)>82) & (a(:,:,3)<252);
figure,imshow(tool)

Why do I get error message trying to crossvalidate PCR using matlab?

I am using the commands proposed here. When I execute
PCRmsep = sum(crossval(#pcrsse,X,Y,'KFold',6),1) / n;
I get the following error messages:
Error using crossval>evalFun (line 480)
The function 'pcrsse' generated the following error:
Index exceeds matrix dimensions.
Error in crossval>getFuncVal (line 497) funResult =
evalFun(funorStr,arg(:));
Error in crossval (line 343)
funResult = getFuncVal(1, nData, cvp, data, funorStr, []);
What does this error mean and how can I prevent this error?
X: 24x9 matrix
Y: 24x1 matrix
I'm new to Matlab and also trying to use this function. I was getting the same error and had a look at the function. For me, saving a copy and changing the maxNumComp value from 10 to 8 (I have 8 predictors) made it work. Yet to figure out why...

Error using syntax fitcnb() MATLAB

I have variable (type table) in matlab:
and I'm using fitcnb for training naive bayes. I execute code:
Mdl = fitcnb(data,'class')
But I get an error :
Error using classreg.learning.FullClassificationRegressionModel.prepareDataCR (line 129) X must be a numeric matrix.
Error in classreg.learning.classif.FullClassificationModel.prepareData (line 455) [X,Y,W,dataSummary] = ...
Error in classreg.learning.FitTemplate/fit (line 205 [X,Y,dataPrepOut{1:this.NDataPrepOut}] = ...
Error in ClassificationNaiveBayes.fit (line 127) this = fit(temp,X,Y);
Error in fitcnb (line 219) this = ClassificationNaiveBayes.fit(X,Y,varargin{:});
fitcnb call's syntax is correct
Mdl = fitcnb(tbl,ResponseVarName)
But why I get an error ?

MATLAB neural network for image recognition does not work

I am trying to get familiar with the Image category classification using deep learning. I am trying to run the Matlab example available on
http://uk.mathworks.com/help/vision/examples/image-category-classification-using-deep-learning.html
However running this example is giving me the following error
Error using message/getString
Unable to load a message catalog 'nnet_cnn:layer:Layer'. Please check
the file location and format.
Error in nnet.cnn.layer.Layer/getVectorHeader (line 113)
header = getString( message( ...
Error in nnet.cnn.layer.Layer/displayNonScalarObject (line 86)
header = sprintf( ' %s\n', getVectorHeader( layers )
);
Error in cnn (line 150)
convnet.Layers
Moreover if I pass and ignore this error, I will get the following error later for the line
trainingFeatures = activations(convnet, trainingSet, featureLayer, ...
'MiniBatchSize', 32, 'OutputAs', 'columns')
Undefined variable "nnet" or class "nnet.internal.cnngpu.convolveForward2D".
Error in nnet.internal.cnn.layer.Convolution2D/doForward (line 218)
Z = nnet.internal.cnngpu.convolveForward2D( ...
Error in nnet.internal.cnn.layer.Convolution2D/forwardNormal (line 195)
Z = this.doForward(X,this.Weights.Value,this.Bias.Value);
Error in nnet.internal.cnn.layer.Convolution2D/forward (line 98)
[Z, memory] = this.forwardNormal( X );
Error in nnet.internal.cnn.SeriesNetwork/activations (line 50)
output = this.Layers{currentLayer}.forward( output );
Error in SeriesNetwork/activations (line 269)
YChannelFormat = predictNetwork.activations(X, layerID);
Error in cnn (line 262)
trainingFeatures = activations(convnet, trainingSet, featureLayer, ...
Can please someone tell me the possibilities for getting this error and how to solve it.
Regards

Taking Integration Error

I'm new at MATLAB. I want to write code of this equations.
I tried with below code which is written by me.
k=-6:6;
n=-6:6
x= double(k>=0);
h=10*exp(-10*(n-k)).*double((n<=0));
fonk=double(k>=0).*(10*exp(-10*(n-k)).*double(k-n>=0));
for n=1:5
y=integral(#(k)fonk(k,n),6,6);
stem((-6:-6),y);
But It gives
Subscript indices must either be real positive integers or logicals.
Error in untitled2>#(k)fonk(k,n) (line 10)
y=integral(#(k)fonk(k,n),1,6);
Error in integralCalc/iterateScalarValued (line 315)
fx = FUN(t);
Error in integralCalc/vadapt (line 133)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 76)
[q,errbnd] = vadapt(#AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in untitled2 (line 10)
y=integral(#(k)fonk(k,n),1,6);
errors. I have been googling for this error but I cant find solution. Thanks for Helping.
Modifying your 5th line should be sufficient. You don't need 1~4th lines.
fonk=#(kv,nv) double(kv>=0).*(10*exp(-10*(nv-kv)).*double(kv-nv>=0));
for n=1:5
y(n)=integral(#(z) fonk(z,n),-6,6);
end
stem(y)
You need to define fonk as a function that takes two arguments otherwise integral does not understand it. Also you need to use a vector form of y to store results.