how can I run function in file exchange

1 visualizzazione (ultimi 30 giorni)
I download this file exchange
but I couldnt run it , in command window get
Error: File: sauvola.m Line: 55 Column: 1
This statement is not inside any function.
(It follows the END that terminates the definition of the function "sauvola".)
Error in filterbri (line 20)
S=sauvola(img,[150 150]);
how to run this file exchange?
  2 Commenti
Stephen23
Stephen23 il 10 Lug 2023
Modificato: Stephen23 il 10 Lug 2023
" (It follows the END that terminates the definition of the function "sauvola".)"
The two functions provided in that FEX submission do not use END to mark the end of those functions.
So you must have modified the functions or be referring to some other functions. It looks as if you might be trying to save them inside a script... which is not required: just download those functions and call them. Or perhaps you have nemd your own script/function with the same name: best avoided.
yasmin ismail
yasmin ismail il 10 Lug 2023
I am biggener in matlab, thus can you expalin more how to do it
for example If i have the attached image, how can I use function to get the threshold for it?

Accedi per commentare.

Risposta accettata

MarKf
MarKf il 10 Lug 2023
You're right, that sauvola.m that you linked has only 45 lines (but there's no actual end that terminates the function definition, unless you meant the end of file).
So maybe there is another sauvola.m in your path. you can try which sauvola to check if it's the same one.
Also you did not copy and paste the whole error so we arevactually unsure what the issue is.
  8 Commenti
yasmin ismail
yasmin ismail il 10 Lug 2023
I have another issue in using niblack file exchange for thresholding
I used same way in sauvola in niblack as following
filepath = 'Stre.jpg';
img = imread(filepath);
imgray = rgb2gray(img); % or chose one of the rgb channels (3rd dimension)
% figure, image(imgray) % visualise grayscale image
bwimg = niblack(imgray); % local thresholding with standard values
imshow(bwimg)
I got the following error:
Index in position 2 exceeds array bounds (must not exceed 942).
Error in averagefilter (line 90)
imageI = t(1+m:rows+m, 1+n:columns+n) + t(1:rows, 1:columns)...
Error in niblack (line 42)
mean = averagefilter(image, window, padding);
Error in check1 (line 5)
bwimg = niblack(imgray); % local thresholding with standard values
can you help, please?
yasmin ismail
yasmin ismail il 10 Lug 2023
it is working well but when I take the result as input to to get threshold by savoul the result appear with outerframe as shown in attachment
how can I remove this frame or not allowed it to appear?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by