type Gradient.m % Partial derivatives in X and Y directions function [Gx,Gy] = Gradient(A, p); X = [-1 0 1]/2; % filter Y = [1 0 -1]'/2; % filter Gx = filter2(X,A); % correlation Gy = filter2(Y,A); [M,N] = size(A); Gx(1:p+1,:) = 0; Gx(M-p-1:M,:) = 0; Gx(:,1:p+1) = 0; Gx(:,N-p-1:N) = 0; Gy(1:p+1,:) = 0; Gy(M-p-1:M,:) = 0; Gy(:,1:p+1) = 0; Gy(:,N-p-1:N) = 0; 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); ls *.jpg image1.jpg image2.jpg s_289.jpg s_290.jpg I = imread('image1.jpg'); figure, imshow(I); I = imread('s_290.jpg'); figure, imshow(I); ls AffineFlow.m AffineModel.m AffineModel.m~ AffineModelCentered AffineModelCentered.m AffineModelCentered.m~ AffineModelFilter.m AffineModelRegularize.m BiSmooth.m ColorGradients.m ColorSearch-3wide.m ColorSearch.m ColorSearch_3wide.m ComputeAllFlows.m ComputeAllFlows_ROIs.m ConstantModel.m ConstantModelRansac.m DF.tar DF.txt DMFTranslation.m DMFTranslationC.m Display.m DisplayFlow.m DisplayGradients.m DisplayMF.m DisplayMatchingFlow.m Ed.tar EstimateConstantFlow.m EstimateConstantFlow_Ric.m EstimateConstantFlow_old.m EstimateFlow-3w.m EstimateFlow.m EstimateFlow.m~ EstimateFlow_3w.m EstimateGaitTranslationalMotion.m ExtractFlow.m ExtractFlows.m ExtractFlows.m~ Flow0.eps Flow1.eps FlowDisplay.m FlowDisplay0.m FlowDisplay2.m FlowDisplayColor.m FlowDisplayHistogram.m FlowVotingSmall.m FlowVotingSmall0.m ForegroundFlow.m GAIT GenerateRotationalModels.m Gradient.m GrayGradients.m GraySearch-3wide.m GraySearch.m GraySearch_3wide.m HistogramsGait.m Hysteresis.m Img1.eps Img2.eps Interpolate-3wide.m Interpolate.m Interpolate_3wide.m MatchFlowModels.m MatchFlowModels_fast.m MatchModelToFlow.m MaxVotes.m MaxVotes1.m MedianFlowFilter.m MedianFlowFilter.m~ MedianFlowFilter4.m MedianFlowFilter8.m Mfiles.zip ModelFlowDisplay.m NFHistogram.m NFHistogram.m~ NMS.m NMS2.m NormalFlow-3wide.m NormalFlow.m NormalFlow.m~ NormalFlow0.eps NormalFlow1.eps NormalFlowHistogram.m NormalFlow_3wide.m Penalty.m PrincipalDirections.m PrincipalDirections.m~ PrincipalFlowDirection.m PrincipalTranslationRotation.m QuadFlow.m QuadModel.m QuadModelRegularize.m RotatingModel.m RotationCenters.m RotationModel.m RotationModels.m Sep 28 2013.txt SmallRegionFlow.m StabilizeAffineFlow StabilizeAffineFlow.m StabilizeAffineFlowNew.m StabilizeAffineFlowNew.m~ StabilizeFrame.m StabilizeFrameNew.m StabilizeQuadFlow.m VectorMedian.m WarpImage.m background.tif data.00371.bmp data.00372.bmp diff0.eps diff1.eps diff2.eps flow.fig flow38.pdf image1.bmp image1.jpg image2.jpg image2.tiff s_289.jpg s_290.jpg stab_frame1.eps stab_frame2.eps tempflow.txt SI = BiSmooth(I, 5); {Undefined function 'conv2' for input arguments of type 'double' and attributes 'full 3d real'. Error in filter2 (line 45) y = conv2(x,stencil,shape); Error in BiSmooth (line 12) I1 = filter2(X/c,A); } SI = zeros(size(I)); Si(:,:,1) = BiSmooth(I(:,:,1),5); SI(:,:,1) = BiSmooth(I(:,:,1),5); SI(:,:,2) = BiSmooth(I(:,:,2),5); SI(:,:,3) = BiSmooth(I(:,:,3),5); SI = uint8(SI); figure, imshow(SI); figure, imshow(SI); SI(:,:,1) = BiSmooth(I(:,:,1),16); SI(:,:,2) = BiSmooth(I(:,:,2),16); SI(:,:,3) = BiSmooth(I(:,:,3),16); figure, imshow(SI); end end | {Error: Illegal use of reserved keyword "end". } diary off