cd MFiles\ A1 = BiSmooth(A,8); ??? Undefined function or variable 'A'. A1 = BiSmooth(I,8); ??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'. Error in ==> filter2 at 46 y = conv2(1,stencil,x,shape); Error in ==> BiSmooth at 12 I1 = filter2(X/c,A); whos I Name Size Bytes Class I 240x320x3 230400 uint8 array Grand total is 230400 elements using 230400 bytes help conv2 CONV2 Two dimensional convolution. C = CONV2(A, B) performs the 2-D convolution of matrices A and B. If [ma,na] = size(A) and [mb,nb] = size(B), then size(C) = [ma+mb-1,na+nb-1]. C = CONV2(H1, H2, A) convolves A first with the vector H1 along the rows and then with the vector H2 along the columns. C = CONV2(..., SHAPE) returns a subsection of the 2-D convolution with size specified by SHAPE: 'full' - (default) returns the full 2-D convolution, 'same' - returns the central part of the convolution that is the same size as A. 'valid' - returns only those parts of the convolution that are computed without the zero-padded edges. size(C) = [ma-mb+1,na-nb+1] when all(size(A) >= size(B)), otherwise C is an empty matrix []. If any of A, B, H1, and H2 are empty, then C is an empty matrix []. See also conv, convn, filter2 and, in the Signal Processing Toolbox, xcorr2. Overloaded functions or methods (ones with the same name in other directories) help uint8/conv2.m help uint16/conv2.m Reference page in Help browser doc conv2 type BiSmooth.m % smooth image A using a binomial filters of order p (should be even) function [SI] = BiSmooth(A,p); X = [1 2 1]; c = 4; for i=2:2:p-2, X = conv(X,[1 2 1]); c = c*4; end; I1 = filter2(X/c,A); I2 = filter2(X'/c,I1); SI = uint8(I2); help filter2 FILTER2 Two-dimensional digital filter. Y = FILTER2(B,X) filters the data in X with the 2-D FIR filter in the matrix B. The result, Y, is computed using 2-D correlation and is the same size as X. Y = FILTER2(B,X,'shape') returns Y computed via 2-D correlation with size specified by 'shape': 'same' - (default) returns the central part of the correlation that is the same size as X. 'valid' - returns only those parts of the correlation that are computed without the zero-padded edges, size(Y) < size(X). 'full' - returns the full 2-D correlation, size(Y) > size(X). FILTER2 uses CONV2 to do most of the work. 2-D correlation is related to 2-D convolution by a 180 degree rotation of the filter matrix. Class support for inputs B,X: float: double, single See also filter, conv2. Reference page in Help browser doc filter2 A1 = BiSmooth(I,4); ??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'. Error in ==> filter2 at 46 y = conv2(1,stencil,x,shape); Error in ==> BiSmooth at 12 I1 = filter2(X/c,A); uiopen('F:\MFiles\BiSmooth.m', true); A1 = BiSmooth(I,4); ??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'. Error in ==> filter2 at 46 y = conv2(1,stencil,x,shape); Error in ==> BiSmooth at 12 I1 = filter2(X,A); A1 = BiSmooth(I,4); ??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'. Error in ==> filter2 at 46 y = conv2(1,stencil,x,shape); Error in ==> BiSmooth at 12 I1 = filter2(uint8(X),A); A1 = BiSmooth(I,4); ??? Function 'conv2' is not defined for values of class 'double' and attributes 'full 3d real'. Error in ==> filter2 at 46 y = conv2(1,stencil,x,shape); Error in ==> BiSmooth at 12 I1 = filter2(uint16(X),uint16(A)); help conv2 CONV2 Two dimensional convolution. C = CONV2(A, B) performs the 2-D convolution of matrices A and B. If [ma,na] = size(A) and [mb,nb] = size(B), then size(C) = [ma+mb-1,na+nb-1]. C = CONV2(H1, H2, A) convolves A first with the vector H1 along the rows and then with the vector H2 along the columns. C = CONV2(..., SHAPE) returns a subsection of the 2-D convolution with size specified by SHAPE: 'full' - (default) returns the full 2-D convolution, 'same' - returns the central part of the convolution that is the same size as A. 'valid' - returns only those parts of the convolution that are computed without the zero-padded edges. size(C) = [ma-mb+1,na-nb+1] when all(size(A) >= size(B)), otherwise C is an empty matrix []. If any of A, B, H1, and H2 are empty, then C is an empty matrix []. See also conv, convn, filter2 and, in the Signal Processing Toolbox, xcorr2. Overloaded functions or methods (ones with the same name in other directories) help uint8/conv2.m help uint16/conv2.m Reference page in Help browser doc conv2 ls . ._.DS_Store Gradient.m NMS2.m .. BiSmooth.m Hysteresis.m .DS_Store ColorGradients.m NMS.m type ColorGradients.m function [Gx,Gy] = ColorGradients(I,t) Ir = BiSmooth(I(:,:,1),4); Ig = BiSmooth(I(:,:,2),4); Ib = BiSmooth(I(:,:,3),4); [rx,ry] = Gradient(Ir); [gx,gy] = Gradient(Ig); [bx,by] = Gradient(Ib); a = rx.^2 + gx.^2 + bx.^2; b = rx.*ry + gx.*gy + bx.*by; c = ry.^2 + gy.^2 + by.^2; tr = a + c; ind = find(tr > t); Gx = zeros(size(rx)); Gy = zeros(size(rx)); for i=1:length(ind), S = [a(ind(i)) b(ind(i)); b(ind(i)) c(ind(i))]; [V,D] = eig(S); if (D(2,2) > D(1,1)) m = D(1,1); D(1,1) = D(2,2); D(2,2) = m; e = V(:,1); V(:,1) = V(:,2); V(:,2) = e; end; e = V(:,1)*sqrt(D(1,1)); Gx(ind(i)) = e(1); Gy(ind(i)) = e(2); end; [Gx,Gy] = ColorGradients(I,5); m1=NMS2(Gx,Gy,5); m1 = Hysteresis(m1,5); [I,J] = find(m1>0); In = find(m1>0); [M,N] = size(m1); quiver(J,M-I+1,Gx(In),Gy(In),1); Gx(I(1),J(1)) ans = 18.0178 Gy(I(1),J(1)) ans = 32.3347 k = 1; atan2(Gy(I(k),J(k)), Gx(I(k),J(k))) ans = 1.0624 k = 1; atan2(Gy(I(k),J(k)), Gx(I(k),J(k)))*180/pi ans = 60.8722 In = find((Gx~=0) || (Gy~=0)); ??? Operands to the || and && operators must be convertible to logical scalar values. In = find((Gx~=0) | (Gy~=0)); whos In Name Size Bytes Class In 47406x1 379248 double array Grand total is 47406 elements using 379248 bytes whos Name Size Bytes Class Gx 240x320 614400 double array Gy 240x320 614400 double array I 6145x1 49160 double array In 47406x1 379248 double array J 6145x1 49160 double array M 1x1 8 double array N 1x1 8 double array ans 1x1 8 double array k 1x1 8 double array m1 240x320 614400 double array Grand total is 290100 elements using 2320800 bytes 47406/(320*640) ans = 0.2315 47406/(320*240) ans = 0.6173 [M,N] = size(Gx); angle = zeros(M,N); angle(In) = atan2(Gy(In),Gx(In)); min(min(angle)) ans = -3.1415 ind1 = find(angle < 0); angle(ind1) = angle(ind1) + 2*pi; min(min(angle)) ans = 0 max(max(angle)) ans = 3.9255 angle(In) = angle(In)*180/pi; hist(angle(In),36); angle1(In) = int(angle(In)/10) + 1 ??? Function 'int' is not defined for values of class 'double'. angle1(In) = int16(angle(In)/10) + 1; hist(angle1(In)) ??? Error using ==> mtimes Integers can only be combined with integers of the same class, or scalar doubles. Error in ==> hist at 73 xx = miny + binwidth*(0:x); max(max(angle1)) ans = 23 min(min(angle1(In))) ans = 1 [I,J] = find(m1>0); In = find(m1>0); [M,N] = size(m1); quiver(J,M-I+1,Gx(In),Gy(In),1); In1 = find(angle1 == 6); whos In1 Name Size Bytes Class In1 1x1851 14808 double array Grand total is 1851 elements using 14808 bytes hold; [I,J] = find(angle1 == 6); In1 = find(angle1 == 6); [M,N] = size(m1); quiver(J,M-I+1,Gx(In1),Gy(In1),1,'r'); Current plot held [I,J] = find(m1>0); In = find(m1>0); [M,N] = size(m1); quiver(J,M-I+1,Gx(In),Gy(In),1); angle1 = int16(angle(In)/10); angle1(In) = angle1(In) + 1; ??? Index exceeds matrix dimensions. angle1 = int16(angle/10); angle1(In) = angle1(In) + 1; [I,J] = find(m1>0); In = find(m1>0); [M,N] = size(m1); quiver(J,M-I+1,Gx(In),Gy(In),1); hold; [I,J] = find(angle1 == 6); In1 = find(angle1 == 6); [M,N] = size(m1); quiver(J,M-I+1,Gx(In1),Gy(In1),1,'r'); Current plot held [I,J] = find(angle1 == 9); In1 = find(angle1 == 9); [M,N] = size(m1); quiver(J,M-I+1,Gx(In1),Gy(In1),1,'g'); [I,J] = find(angle1 == 19); In1 = find(angle1 == 19); [M,N] = size(m1); quiver(J,M-I+1,Gx(In1),Gy(In1),1,'m'); EH = cell{36,1}; ??? Undefined variable "cell" or class "cell". EH = cell(36,1); for i=1:36, clear In; In = find(angle1 == i); EH{i,1} = In; end; [I,J] = find(m1>0); In = find(m1>0); [M,N] = size(m1); quiver(J,M-I+1,Gx(In),Gy(In),1); hold; [I,J] = find(angle1 == 19); [M,N] = size(m1); quiver(J,M-I+1,Gx(EH{19,1}),Gy(EH{19,1}),1,'m'); Current plot held length(EH{19,1}) ans = 4952 help random RANDOM Generate random arrays from a specified distribution. The appropriate syntax depends on the number of parameters in the distribution you are using: R = RANDOM(NAME,A) returns an array of random numbers from the named distribution that requires a single parameter array A. R = RANDOM(NAME,A,B) returns an array of random numbers from the named distribution that requires two parameter arrays A and B. R = RANDOM(NAME,A,B,C) returns an array of random numbers from the named distribution that requires three parameter arrays A, B, and C. The size of R is the common size of A, B, and C if all are arrays. If any parameters are scalars, the size of R is the size of the other parameter(s). R = RANDOM(NAME,A,M,N,...) or R = RANDOM(NAME,A,[M,N,...]) returns an M-by-N-by-... array of random numbers. R = RANDOM(NAME,A,B,M,N,...) or R = RANDOM(NAME,A,B,[M,N,...]) returns an M-by-N-by-... array of random numbers. R = RANDOM(NAME,A,B,C,M,N,...) or R = RANDOM(NAME,A,B,C,[M,N,...]) returns an M-by-N-by-... array of random numbers. NAME can be one of: 'beta' or 'Beta', 'bino' or 'Binomial', 'chi2' or 'Chisquare', 'exp' or 'Exponential', 'ev' or 'Extreme Value', 'f' or 'F', 'gam' or 'Gamma', 'gev' or 'Generalized Extreme Value', 'gp' or 'Generalized Pareto', 'geo' or 'Geometric', 'hyge' or 'Hypergeometric', 'logn' or 'Lognormal', 'nbin' or 'Negative Binomial', 'ncf' or 'Noncentral F', 'nct' or 'Noncentral t', 'ncx2' or 'Noncentral Chi-square', 'norm' or 'Normal', 'poiss' or 'Poisson', 'rayl' or 'Rayleigh', 't' or 'T', 'unif' or 'Uniform', 'unid' or 'Discrete Uniform', 'wbl' or 'Weibull'. Partial matches are allowed and case is ignored. RANDOM calls many specialized routines that do the calculations. See also cdf, icdf, mle, pdf. Reference page in Help browser doc random perm(n) ??? Undefined function or variable 'n'. perm(10) ??? Undefined command/function 'perm'. help perm Searching class methods ... 20% (type ctrl-C to stop)Searching class methods ... 21% (type ctrl-C to stop)Searching class methods ... 22% (type ctrl-C to stop)Searching class methods ... 23% (type ctrl-C to stop)Searching class methods ... 24% (type ctrl-C to stop)Searching class methods ... 25% (type ctrl-C to stop)Searching class methods ... 26% (type ctrl-C to stop)Searching class methods ... 27% (type ctrl-C to stop)Searching class methods ... 28% (type ctrl-C to stop)Searching class methods ... 29% (type ctrl-C to stop)Searching class methods ... 30% (type ctrl-C to stop)Searching class methods ... 31% (type ctrl-C to stop)Searching class methods ... 32% (type ctrl-C to stop)Searching class methods ... 33% (type ctrl-C to stop)Searching class methods ... 34% (type ctrl-C to stop)Searching class methods ... 35% (type ctrl-C to stop)Searching class methods ... 36% (type ctrl-C to stop)Searching class methods ... 37% (type ctrl-C to stop)Searching class methods ... 38% (type ctrl-C to stop)Searching class methods ... 39% (type ctrl-C to stop)Searching class methods ... 40% (type ctrl-C to stop)Searching class methods ... 41% (type ctrl-C to stop)Searching class methods ... 42% (type ctrl-C to stop)Searching class methods ... 43% (type ctrl-C to stop)Searching class methods ... 44% (type ctrl-C to stop)Searching class methods ... 45% (type ctrl-C to stop)Searching class methods ... 46% (type ctrl-C to stop)Searching class methods ... 47% (type ctrl-C to stop)Searching class methods ... 48% (type ctrl-C to stop)Searching class methods ... 49% (type ctrl-C to stop)Searching class methods ... 50% (type ctrl-C to stop)Searching class methods ... 51% (type ctrl-C to stop)Searching class methods ... 52% (type ctrl-C to stop)Searching class methods ... 53% (type ctrl-C to stop)Searching class methods ... 54% (type ctrl-C to stop)Searching class methods ... 55% (type ctrl-C to stop)Searching class methods ... 56% (type ctrl-C to stop)Searching class methods ... 57% (type ctrl-C to stop)Searching class methods ... 58% (type ctrl-C to stop)Searching class methods ... 59% (type ctrl-C to stop)Searching class methods ... 60% (type ctrl-C to stop)Searching class methods ... 61% (type ctrl-C to stop)Searching class methods ... 62% (type ctrl-C to stop)Searching class methods ... 63% (type ctrl-C to stop)Searching class methods ... 64% (type ctrl-C to stop)Searching class methods ... 65% (type ctrl-C to stop)Searching class methods ... 66% (type ctrl-C to stop)Searching class methods ... 67% (type ctrl-C to stop)Searching class methods ... 68% (type ctrl-C to stop)Searching class methods ... 69% (type ctrl-C to stop)Searching class methods ... 70% (type ctrl-C to stop)Searching class methods ... 71% (type ctrl-C to stop)Searching class methods ... 72% (type ctrl-C to stop)Searching class methods ... 73% (type ctrl-C to stop)Searching class methods ... 74% (type ctrl-C to stop)Searching class methods ... 75% (type ctrl-C to stop)Searching class methods ... 76% (type ctrl-C to stop)Searching class methods ... 77% (type ctrl-C to stop)Searching class methods ... 78% (type ctrl-C to stop)Searching class methods ... 79% (type ctrl-C to stop)Searching class methods ... 80% (type ctrl-C to stop)Searching class methods ... 81% (type ctrl-C to stop)Searching class methods ... 82% (type ctrl-C to stop)Searching class methods ... 83% (type ctrl-C to stop)Searching class methods ... 84% (type ctrl-C to stop)Searching class methods ... 85% (type ctrl-C to stop)Searching class methods ... 86% (type ctrl-C to stop)Searching class methods ... 87% (type ctrl-C to stop)Searching class methods ... 88% (type ctrl-C to stop)Searching class methods ... 89% (type ctrl-C to stop)Searching class methods ... 90% (type ctrl-C to stop)Searching class methods ... 91% (type ctrl-C to stop)Searching class methods ... 92% (type ctrl-C to stop)Searching class methods ... 93% (type ctrl-C to stop)Searching class methods ... 94% (type ctrl-C to stop)Searching class methods ... 95% (type ctrl-C to stop)Searching class methods ... 96% (type ctrl-C to stop)Searching class methods ... 97% (type ctrl-C to stop)Searching class methods ... 98% (type ctrl-C to stop)Searching class methods ... 99% (type ctrl-C to stop) perm.m not found. Use the Help browser Search tab to search the documentation, or type "help help" for help command options, such as help for methods. help random RANDOM Generate random arrays from a specified distribution. The appropriate syntax depends on the number of parameters in the distribution you are using: R = RANDOM(NAME,A) returns an array of random numbers from the named distribution that requires a single parameter array A. R = RANDOM(NAME,A,B) returns an array of random numbers from the named distribution that requires two parameter arrays A and B. R = RANDOM(NAME,A,B,C) returns an array of random numbers from the named distribution that requires three parameter arrays A, B, and C. The size of R is the common size of A, B, and C if all are arrays. If any parameters are scalars, the size of R is the size of the other parameter(s). R = RANDOM(NAME,A,M,N,...) or R = RANDOM(NAME,A,[M,N,...]) returns an M-by-N-by-... array of random numbers. R = RANDOM(NAME,A,B,M,N,...) or R = RANDOM(NAME,A,B,[M,N,...]) returns an M-by-N-by-... array of random numbers. R = RANDOM(NAME,A,B,C,M,N,...) or R = RANDOM(NAME,A,B,C,[M,N,...]) returns an M-by-N-by-... array of random numbers. NAME can be one of: 'beta' or 'Beta', 'bino' or 'Binomial', 'chi2' or 'Chisquare', 'exp' or 'Exponential', 'ev' or 'Extreme Value', 'f' or 'F', 'gam' or 'Gamma', 'gev' or 'Generalized Extreme Value', 'gp' or 'Generalized Pareto', 'geo' or 'Geometric', 'hyge' or 'Hypergeometric', 'logn' or 'Lognormal', 'nbin' or 'Negative Binomial', 'ncf' or 'Noncentral F', 'nct' or 'Noncentral t', 'ncx2' or 'Noncentral Chi-square', 'norm' or 'Normal', 'poiss' or 'Poisson', 'rayl' or 'Rayleigh', 't' or 'T', 'unif' or 'Uniform', 'unid' or 'Discrete Uniform', 'wbl' or 'Weibull'. Partial matches are allowed and case is ignored. RANDOM calls many specialized routines that do the calculations. See also cdf, icdf, mle, pdf. Reference page in Help browser doc random doc random doc random doc random help permute PERMUTE Permute array dimensions. B = PERMUTE(A,ORDER) rearranges the dimensions of A so that they are in the order specified by the vector ORDER. The array produced has the same values as A but the order of the subscripts needed to access any particular element are rearranged as specified by ORDER. The elements of ORDER must be a rearrangement of the numbers from 1 to N. PERMUTE and IPERMUTE are a generalization of transpose (.') for N-D arrays. Example: a = rand(1,2,3,4); size(permute(a,[3 2 1 4])) % now it's 3-by-2-by-1-by-4. See also ipermute, circshift. Overloaded functions or methods (ones with the same name in other directories) help uss/permute.m help umat/permute.m help ufrd/permute.m help ndlft/permute.m Reference page in Help browser doc permute permute(10) ??? Error using ==> permute Not enough input arguments. permute(1:10) ??? Error using ==> permute Not enough input arguments. help rand RAND Uniformly distributed pseudo-random numbers. R = RAND(N) returns an N-by-N matrix containing pseudo-random values drawn from a uniform distribution on the unit interval. RAND(M,N) or RAND([M,N]) returns an M-by-N matrix. RAND(M,N,P,...) or RAND([M,N,P,...]) returns an M-by-N-by-P-by-... array. RAND with no arguments returns a scalar. RAND(SIZE(A)) returns an array the same size as A. You can use any one of three generator algorithms, as follows: RAND(METHOD,S) causes RAND to use the generator determined by METHOD, and initializes the state of that generator. S is a scalar integer value from 0 to 2^32-1, or the output of RAND(METHOD). METHOD is one of the following strings: 'state' - Use a modified version of Marsaglia's Subtract-with-Borrow algorithm, the default in MATLAB Versions 5 and later. This method can generate all the double precision values in the closed interval [2^(-53), 1-2^(-53)], and, theoretically, can generate over 2^1492 values before repeating itself. 'seed' - Use a multiplicative congruential algorithm, the default in MATLAB Version 4. This method generates double precision values in the closed interval [1/(2^31-1), 1-1/(2^31-1)], with a period of 2^31-2. 'twister' - Use the Mersenne Twister algorithm by Nishimura and Matsumoto. This method generates double precision values in the closed interval [2^(-53), 1-2^(-53)], with a period of (2^19937-1)/2. RAND(METHOD) returns the current internal state of the generator determined by METHOD. However, it does not switch generators. The sequence of numbers produced by RAND is determined by the internal state of the generator. Setting the generator to the same fixed state allows computations to be repeated. Setting the generator to different states leads to unique computations, however, it does not improve any statistical properties. Since MATLAB resets the state at start-up, RAND will generate the same sequence of numbers in each session unless the state is changed. Note: The size inputs M, N, and P... should be nonnegative integers. Negative integers are treated as 0. Examples: Return RAND to its default initial state. rand('state',0) Initialize RAND to a different state each time. rand('state',sum(100*clock)) Save the current state, generate 100 values, reset the state, and repeat the sequence. s = rand('state'); u1 = rand(100); rand('state',s); u2 = rand(100); % contains exactly the same values as u1 Generate uniform values from the interval [a, b]. r = a + (b-a).*rand(100,1); Generate integers uniform on the set 1:n. r = ceil(n.*rand(100,1)); Use the Mersenne Twister generator, with the default initial state used by Nishimura and Matsumoto. rand('twister',5489); For a full description of the Mersenne Twister algorithm, see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html. See also randn, sprand, sprandn, randperm. Reference page in Help browser doc rand randperm(10) ans = 8 2 10 7 4 3 6 9 5 1 rand(10) ans = Columns 1 through 7 0.6154 0.0579 0.0153 0.8381 0.1934 0.4966 0.7271 0.7919 0.3529 0.7468 0.0196 0.6822 0.8998 0.3093 0.9218 0.8132 0.4451 0.6813 0.3028 0.8216 0.8385 0.7382 0.0099 0.9318 0.3795 0.5417 0.6449 0.5681 0.1763 0.1389 0.4660 0.8318 0.1509 0.8180 0.3704 0.4057 0.2028 0.4186 0.5028 0.6979 0.6602 0.7027 0.9355 0.1987 0.8462 0.7095 0.3784 0.3420 0.5466 0.9169 0.6038 0.5252 0.4289 0.8600 0.2897 0.4449 0.4103 0.2722 0.2026 0.3046 0.8537 0.3412 0.6946 0.8936 0.1988 0.6721 0.1897 0.5936 0.5341 0.6213 Columns 8 through 10 0.7948 0.1365 0.5828 0.9568 0.0118 0.4235 0.5226 0.8939 0.5155 0.8801 0.1991 0.3340 0.1730 0.2987 0.4329 0.9797 0.6614 0.2259 0.2714 0.2844 0.5798 0.2523 0.4692 0.7604 0.8757 0.0648 0.5298 0.7373 0.9883 0.6405 int16(rand(10,1)*4972)+1 ans = 1040 1889 3896 3386 2294 2824 3950 295 2998 251 int16(rand(10,1)*300)+1 ans = 126 92 263 6 231 292 298 238 133 150 int16(rand(10,1)*300) ans = 64 193 96 288 218 124 223 80 132 280 hist(rand(300,1),100) hist(rand(300,1),100) hist(rand(1000,1),300) diary