how i can resolve error of paddedsize in matlab? - matlab

Undefined function or method 'paddedsize' for input arguments of type 'double'
how i can resolve this.
f = imread('cameraman.tif');
PQ=paddedsize(size(f));
F=fft2(f,PQ(1),PQ(2));
sig=40;
H=lpfilter('ideal',PQ(1),PQ(2),sig);
imshow(fftshift(H),[ ]);
G=H.*F;
g=real(ifft2(G));
g=g(1:size(f,1),1:size(f,2));
figure;
imshow(g,[ ]);

paddedsize is not a MATLAB builtin or library function. Presumably this comes from some third-party library you should try and find.

'paddedsize' is a function available on the Matlab File Exchange Here. In order to use the function you will need to download the m-file into your working directory or add the file location to your path.

Related

Alternative of the imageDatastore function

I have been going through a tutorial of deep learning in MATLAB. I tried to execute the following code
rootFolder = 'E:/Data Science and Machine Learning Stuff/DataSets/scene_categories';
categories = {'bedroom' , 'CALsuburb' , 'industrial' , 'kitchen' , 'livingroom','PARoffice','store'};
imds = imageDatastore(fullfile(rootFolder, categories),'LabelSource', 'foldernames');
tbl = countEachLabel(imds)
Executing the above code generates the following error:
Undefined function or variable 'imageDatastore'.
After doing a lot of research about the error I finally came to know that the function imageDatastore is introduced in R2015b.
My current MATLAB release is R2015a, so I do not have access to this function. I have also tried the datastore function that is present in this release (R2015a) but have had no luck.
Can anyone help in writing an alternative code for the imageDatastore function that performs the same function as imageDatastore; or can some tell me how to use the datastore function for this task.

Unable to run code for DSP-SIFT in MATLAB

So, I got the code for DSP-SIFT from the original works of the author in the form of a toolbox. When I followed the instructions and tried to get it to run in MATLAB :
>> dsp_setup
>> dsp_mosaic
Undefined function 'vl_usift' for input arguments of type 'single'.
Error in vl_dspsift (line 50)
frames = vl_usift(im);
Error in dsp_mosaic (line 68)
[f1, d1] = vl_dspsift(im1g, opt);
After Googling this error(I am new to MATLAB), I found a solution saying that maybe my function cannot be recognised by MATLAB, so I need to add the containing folder to the MATLAB search path, which I tried doing:
>> which vl_usift -all
'vl_usift' not found.
>> addpath ('/home/dsp_toolbox_v0.0.2/dsp_toolbox_v0.0.2/toolbox/sift/')
Howver, I get the same error when trying to run the code.
I can add the code if it helps, but I do need advice on how to proceed from here.
Thanks
So, after a few hours of searching around, I finally came across the problem, there were a few lines commented in the setup file which I had to uncomment. Simple and frustrating.
Thanks!

Command line error in function call

I am working on a GA code in MATLAB. When I execute the following syntax in the command window
function[opt,fopt,histf]=ga(n,fitnessfct,decodefct,selectfct,stopeval)
I get the following error
Error: Function definitions are not permitted in this context.
You must define your function in another M-file named by ga.
1- Create a new script, M-file where you can you use "Ctrl+N"
2- Declare your function writing:
function [opt, fopt, histf] = ga(n, fitnessfct, decodefct, selectfct, stopeval)
% // function statements
end
3- Save the function file and name it as ga
4- Make sure setting the path of current directory to your working directory.
That is it..

read_grib, where to put ibm2fltmex5.dll

I need to read some Meteological data in grib format. I have download a code which can read the data. but in the middel of code ibm2fltmex5.dll is needed. I have download the dll too from ibm2fltmex5.dll. I have created folders (MeteoLab\Read_GRIB) in (C:\Program Files\MATLAB\R2009a\toolbox) and put the dll in it.I restart my PC but that code error again.
function bds_struct=get_bds(fid,lenbds)
bds=fread(fid,11);
bds_struct.len=lenbds;
bds_struct.oct4=bds(4);
bds_struct.bsfE=int2(bds(5),bds(6));
bds_struct.RefVal=ibm2fltmex5(bds(7:10));
bds_struct.nbits=bds(11);
bds=fread(fid,lenbds-11);
bds_struct.bindata=uint8(bds);
error is
Undefined function or method 'ibm2fltmex5' for input arguments of type
'double'
.
Did I put dll in the correct place? what else should I do?
Any comments is appriciated.
I find another Way, there is a Matlab function which do the same: can be download from :
ibm2flt.m

how to connect or load file.dll to matlab?

I want through matlab tutorial but I did not understand it clearly.
Could anyone can explain to me step by step how to load and call .dll functions in matlab?
I tried to use loadlibrary function but I get and error, if anyone can tell we where to put the .dll file and the .h file?
I don't do this often, but i usually do something like:
fullpathToHeader = 'c:\full\path\to\a\header.h';
fullpathToDll = 'c:\full\path\to\a\libraty.dll';
loadlibrary(fullpathToDll, fullpathToHeader);
Then if that works, you can call library functions as:
[outArg1, outArg2, ...] = calllib('library','function',inArg1, inArg2, ...)
See the following link, which contains some problems I encountered and overcame, when trying to load a dll into matlab:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/341602