help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting a Matlab program to Octave


From: momozilla76
Subject: Converting a Matlab program to Octave
Date: Wed, 2 Jul 2014 19:03:47 -0700 (PDT)

Im new to Octave and I am using a previously made program to learn how to use
octave but I am having troubles with the function.

function [o] = adaptiveThres(a,W,noShow); 
%Adaptive thresholding is performed by segmenting image a 
[w,h] = size(a); 
o = zeros(w,h); 
%seperate it to W block 
%step to w with step length W 
for i=1:W:w 
for j=1:W:h 
mean_thres = 0; 
if i+W-1 <= w & j+W-1 <= h 
 mean_thres = mean2(a(i:i+W-1,j:j+W-1)); 
 mean_thres = 0.8*mean_thres;  57
 
 o(i:i+W-1,j:j+W-1) = a(i:i+W-1,j:j+W-1) < mean_thres; 
 end; 
 end; 
end; 
if nargin == 2 
imagesc(o); 
colormap(gray); 
end; 


output:
error: 'a' undefined near line 3 column 13
error: evaluating argument list element number 1

can someone please help me 



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Converting-a-Matlab-program-to-Octave-tp4665171.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]