can someone give me the source code for imgaussfilt function.
Ältere Kommentare anzeigen
Since I am using matlab 2013a I don't have imgaussfilt function. I want to use that function with my current work. So I want to create that function in my matlab file. If someone can share me the source code of the imgaussfilt.m file it will be very helpful. thanks
1 Kommentar
Steven Lord
am 1 Nov. 2017
Jeganson Durai, please do not post code included in MathWorks toolboxes. I deleted the comment to which you had attached the file.
Akzeptierte Antwort
Weitere Antworten (3)
Walter Roberson
am 1 Dez. 2015
2 Stimmen
Yes, no problem. All you need to do is get a job with Mathworks and you will have access to the source.
If getting a job at Mathworks is a problem for some reason, then there is always the alternative of buying Mathworks. All of Mathworks -- the entire company. Mathworks is privately held, not on the Stock Exchange, so you would have to convince the current owners to sell, which might be a little difficult. My advice on that has always been that a $US 5 million non-refundable deposit will at least get you a meeting in which they would listen to your buy-out proposal.
Note: "get a job at Mathworks" is the response of Mathworks employees, the official way to get access to the source. The possibility of buying out Mathworks for a couple of billion dollars is my own suggestion.
Daniel Marelius Bjørnstad
am 1 Jun. 2017
Bearbeitet: Daniel Marelius Bjørnstad
am 8 Jun. 2017
I think have found a way to do the same thing imgaussfilt is doing. I think the function gausswin is still in the imaging toolbox though, but this should illuminate what is going on anyway.
function arr_out = gaussian(arr, sigma)
arr = double(arr);
% Default value of alpha in gausswin is 2.5.
alpha = 2.5;
% The number of points included in the window.
% To be honest I dont understand this completely, but I changed around
% an equation in the documentation for gausswin and it seems to fit.
% Bottom line is that we create a window that has enough points to
% include the shape of gaussian.
N = round(2*alpha*sigma);
% Create the window.
filter_arr = gausswin(N, alpha);
% Normalize to ensure output is correct after convolution.
filter_arr = filter_arr/sum(filter_arr);
% Padd the array with the start end end of the array,
% this is important to get the same results as
% imgaussfilt. Looks good for pictures.
pad_length = ceil(N/2);
% Support both ways of having 1d arrays because matlab is annoying.
if size(arr,1) == 1
padding = ones(1,pad_length);
arr = [padding*arr(1), arr, padding*arr(end)];
else
padding = ones(pad_length,1);
arr = [padding*arr(1); arr; padding*arr(end)];
end
% Do the filtering.
arr_out = conv(arr, filter_arr, 'same');
% Remove the padding we introduced.
arr_out = arr_out(pad_length+1:end-pad_length);
end
1 Kommentar
Jeganson Durai
am 1 Nov. 2017
What about arr???
Image Analyst
am 1 Dez. 2015
You can see some of it this way.
>> edit imgaussfilt.m
Perhaps that will be enough for you.
Kategorien
Mehr zu Digital Filtering finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!