plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | wmvanvliet/ERP-beamformer-master | st_lcmv_fit.m | .m | ERP-beamformer-master/matlab/st_lcmv_fit.m | 2,196 | utf_8 | 7601308141150e1b2339d34ee1dce8ec | function W = st_lcmv_fit(X, template, varargin)
% Fit a spatio-temporal LCMV beamformer.
%
% Required parameters
% -------------------
% X : 3D matrix (n_channels x n_samples x n_trials)
% The trials.
%
% template : 2D matrix (n_channels x n_samples)
% Spatio-temporal activation pattern of the component to e... |
github | zqingithub/Tools-of-Label-Distribution-Learning-master | kernelmatrix.m | .m | Tools-of-Label-Distribution-Learning-master/Predict And Test/Algorithm/MSVR/kernelmatrix.m | 1,642 | utf_8 | 2d9cda654463d330d5d2a0e746274b2b | % ---------------------------------------------------------------------------------------------------
% KERNELMATRIX
%
% K = kernelmatrix(ker,X,X2,parameter);
%
% Builds a kernel from training and test data matrices.
%
% Inputs:
% ker: {'lin' 'poly' 'rbf'}
% X: data matrix with training samples in rows and features i... |
github | zqingithub/Tools-of-Label-Distribution-Learning-master | my_KNN.m | .m | Tools-of-Label-Distribution-Learning-master/Predict And Test/Algorithm/AA-KNN/my_KNN.m | 1,696 | utf_8 | 7c420d9480789b29b126e3f17c5e5fd8 | % K-Nearest-Neighbor classifier(K-NN classifier)
%Input:
% train_feature,test_feature are training set and test
% set,respectively.
% train_distribution,test_distribution are label distribution of training
% set and test set,respectively.
% k is the number of nearest neighbors
% Distance_mark: ... |
github | zqingithub/Tools-of-Label-Distribution-Learning-master | msvr.m | .m | Tools-of-Label-Distribution-Learning-master/Algorithm/MSVR/msvr.m | 4,223 | utf_8 | ea7389a5d94847a9757935e7b7eff3f7 | %
% Multioutput SVR
%
% We have m labeled examples, d dimensions and k outputs to predict.
%
% inputs: - x : training patterns (m x d),
% - y : training targets (m x k),
% - ker : kernel type ('lin', 'poly', 'rbf'),
% - C : cost parameter,
% - par : kernel parameter (see func... |
github | zqingithub/Tools-of-Label-Distribution-Learning-master | kernelmatrix.m | .m | Tools-of-Label-Distribution-Learning-master/Algorithm/MSVR/kernelmatrix.m | 1,642 | utf_8 | 2d9cda654463d330d5d2a0e746274b2b | % ---------------------------------------------------------------------------------------------------
% KERNELMATRIX
%
% K = kernelmatrix(ker,X,X2,parameter);
%
% Builds a kernel from training and test data matrices.
%
% Inputs:
% ker: {'lin' 'poly' 'rbf'}
% X: data matrix with training samples in rows and features i... |
github | zqingithub/Tools-of-Label-Distribution-Learning-master | fminlbfgs.m | .m | Tools-of-Label-Distribution-Learning-master/Algorithm/BFGS-LLD/fminlbfgs.m | 31,526 | utf_8 | c0aeba957b926c46c78f6c861a970647 | function [x,fval,exitFlag,output,grad]=fminlbfgs(funfcn,xInit,optim)
%FMINLBFGS Finds a local minimum of a function of several variables.
%
% Description
% [X,FVAL,EXITFLAG,OUTPUT,GRAD]=FMINLBFGS(FUNFCN,XINIT,OPTIM) finds a local minimum of a function of several variables.
% This optimizer is developed for image reg... |
github | pmoulon/groupsac-master | runProsacFundmat.m | .m | groupsac-master/matlab/runProsacFundmat.m | 2,820 | utf_8 | 9f131e18f5149cfc374ecc9ad17d193a | %% prosac for fundamental matrix matching
function [] = testProsacFundmat()
clear PR;
global PR;
%% set up putatives
xs1 = [1251 1243; 1603 923; 2067 1031; 787 484; 1355 363; 2163 743; 1875 1715]';
xs2 = [723 887; 1091 699; 1691 811; 447 635; 971 91; 1903 447; 1483 1555]';
scores = [1 1 1 1 1 1 1];
ordering = [1 : ... |
github | pmoulon/groupsac-master | groupByFlows.m | .m | groupsac-master/matlab/grouping/groupByFlows.m | 1,315 | utf_8 | ef0c9ac723c14866febb45dba346b4ee | % use image segmentation to group the data points for GroupSAC
function [seg_num vis_map clustCent] = groupByFlows(xs1, xs2, bandwidth, verbose)
% output:
% seg_num - the total number of segments
% vis_map - the row is the point index, the column is the segment index
% clustCent - the cluster centers
if ~exist('ve... |
github | pmoulon/groupsac-master | testGroupByFlows.m | .m | groupsac-master/matlab/grouping/testGroupByFlows.m | 1,907 | utf_8 | 6c1099b41f2118b22955773f1050161b | function test_suite = testGroupByFlows
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testOneCluster
xs1 = [1 2 3 4 5
0 0 0 0 0];
xs2 = [2 3 4 5 6
0 0 0 0 0];
bandwidth = 10;
[seg_num vis_map clustCent] = groupByFlows(xs1, xs2, bandwidth);
assertEqual(s... |
github | pmoulon/groupsac-master | dist2.m | .m | groupsac-master/matlab/thirdParty/MeanShift/dist2.m | 388 | utf_8 | 471f1b643b119c7055325a90e28a23b6 | % dist2 - pointer ro function that measures distance square
% the distance function should be able to take two d by N matrices
% and return a vector of length N, where Ni is the distance^2
% between the two i-th vectors.
function [dist] = dist2(x1, x2)
dist = zeros(1,size(x1,2));
dist0 = x1 -... |
github | pmoulon/groupsac-master | vgg_vec_swap.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_vec_swap.m | 780 | utf_8 | 307d6317417b5a6d720ead1d634a58a6 | % S = vgg_vec_swap(x,y) For square matrix A and vectors x, y it is x'*A*y = vgg_vec(A)'*vgg_vec_swap(x,y).
%
% x ... matrix N-by-K
% y ... matrix N-by-K
% S ... matrix K^2-by-N
%
% Examples :-
%
% - Estimating fundamental matrix F that should satisfy x(:,k)'*F*y(:,k) = 0 from
% given points x(:,k), y(:,k... |
github | pmoulon/groupsac-master | vgg_commut_matrix.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_commut_matrix.m | 493 | utf_8 | 55200858a4c7cf668d8c66be237e5f59 | % VGG_COMMUT_MATRIX Commutation matrix, to transpose a matrix(:)
%
% Classical matrix re-arrangement operator, see book Magnus-Neudecker.
%
% Useful for rearranging matrix equations. It is
% vgg_vec(X') = vgg_commut_matrix(size(X))*vgg_vec(X).
%
% See also vgg_matrix_test
% Added by Tom Werner, originally f... |
github | pmoulon/groupsac-master | vgg_diagonalize_conic.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_diagonalize_conic.m | 619 | utf_8 | 772bcd6d2eb805732329de8ba5b88338 | % H = vgg_diagonalize_conic(C) Finds Euclidean transformation sending conic canonical position.
%
% For any symmetric matrix C, returns Euclidean transformation H such that
% H'*C*H
% is a diagonal matrix.
%
% Typical usage is to transform conics to canonical form, to classify or plot them.
function H = v... |
github | pmoulon/groupsac-master | vgg_vec.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_vec.m | 646 | utf_8 | 171049009dcb9542b104bb274c1aaea3 | % vgg_vec De-/vectorization of a matrix.
%
% For a matrix X, vgg_vec(X) = X(:).
% For a N^2-vector x, vgg_vec(x) = reshape(x,N,N).
%
% Classical matrix re-arrangement operator, see book Magnus-Neudecker.
% Trivial function, included mainly for consistency with notation in literature.
%
% Useful for rearranging... |
github | pmoulon/groupsac-master | vgg_mrdivs.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_mrdivs.m | 1,613 | utf_8 | d557e2e9cdb433370cb108a5ef35b136 | % vgg_mrdivs Solves equation system Y*diag(s) = A*X with unkowns A, s.
%
% A = vgg_mrdivs(X,Y) solves (overdetermined) equation system Y*diag(s) = A*X
% by linear method (DLT algorithm).
% Parameters:
% X ... double (N,K)
% Y ... double (M,K)
% A ... double (M,N)
% s ... double (1,K)
%
% Precondition... |
github | pmoulon/groupsac-master | vgg_solvelin_blksym.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_solvelin_blksym.m | 1,751 | utf_8 | c457c9569cb56f85f756e60cdfb8b022 | %VGG_SOLVELIN_BLKSYM Solves M*x==y where M is (typically huge sparse) symmetric 4-block matrix.
% It solves the system much more efficiently than a general (sparse) linear system solver.
% Typical usage to solve normal equations in Levenberg-Marquardt in bundle adjustment.
%
% X = VGG_SOLVELIN_BLKSYM(A,B,C,... |
github | pmoulon/groupsac-master | vgg_duplic_matrix.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_duplic_matrix.m | 584 | utf_8 | 1c5580e5ad365adf0d02986007ae6791 | % d = vgg_duplic_matrix(n) Duplication matrix.
%
% Classical matrix re-arrangement operator, see book Magnus-Neudecker.
%
% Useful for rearranging equations with symmetric matrices.
% For square symmetric X, it is
%
% vgg_duplic_matrix(n)*vgg_vech(X) = vgg_vec(X)
%
% See also vgg_matrix_test, vgg_vech_swap... |
github | pmoulon/groupsac-master | vgg_wedge.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_wedge.m | 1,888 | utf_8 | a45560fc9b16368b5c20c58bd060e3f1 | % vgg_wedge Wedge product of N-1 N-vectors (generalization of cross product).
%
% Y = vgg_wedge(X) Wedge product of columns/rows of X.
% Y ... double (1,N).
% X ... double (N,N-1).
% It is Y = X(:,1) \wedge X(:,2) \wedge ... \wedge X(:,N-1). For N=3,
% wedge product is the same as cross (vector) product. E.... |
github | pmoulon/groupsac-master | vgg_matrix_test.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_matrix_test.m | 1,274 | utf_8 | 159692d381ad63d62a971d74f25877c6 | function vgg_matrix_test
% Test the matrix "flattening" functions from Magnus and Neudecker
% vgg_vec
% vgg_vech
% vgg_commut_matrix
% vgg_duplic_matrix
% vgg_lmultiply_matrix
% Author: awf@robots.ox.ac.uk
A = randn(4,5);
B = randn(5,2);
C = randn(2,4);
fprintf('vgg_matrix_test: BEGIN\n');
assert... |
github | pmoulon/groupsac-master | vgg_rq.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_rq.m | 425 | utf_8 | d63398113a3ab31c7019ccb1cfcbc2c4 | % [R,Q] = vgg_rq(S) Just like qr but the other way around.
%
% If [R,Q] = vgg_rq(X), then R is upper-triangular, Q is orthogonal, and X==R*Q.
% Moreover, if S is a real matrix, then det(Q)>0.
% By awf
function [U,Q] = rq(S)
S = S';
[Q,U] = qr(S(end:-1:1,end:-1:1));
Q = Q';
Q = Q(end:-1:1,end:-1:1);
U =... |
github | pmoulon/groupsac-master | vgg_vech_swap.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_numerics/vgg_vech_swap.m | 938 | utf_8 | 5cd120034ca7d3de1eebce1d6565c3a8 | % S = vgg_vech_swap(x,y) For symmetric matrix A it is x'*A*y = vgg_vech(A)'*vgg_vech_swap(x,y).
%
% x ... matrix N-by-K
% y ... matrix N-by-K
% S ... matrix K*(K+1)/2-by-N
%
% Examples :-
%
% - Estimating symmetric matrix A that should satisfy x(:,k)'*A*y(:,k) = 0 from
% given points x(:,k), y(:,k). We s... |
github | pmoulon/groupsac-master | vgg_line3d_pv_from_pm.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_pv_from_pm.m | 310 | utf_8 | c506df610aaf9c977e6464a727bc11a5 | % L = vgg_line3d_pv_from_pm(G) Conversion of Pluecker matrix to Pluecker vector 3d line representation.
%
% G ... double(4,4), skew-symmetric Pluecker matrix
% L ... double(1,6), Pluecker vector
% T.Werner
function L = vgg_line3d_pv_from_pm(G)
L = [G(1:3,4); vgg_contreps(G(1:3,1:3))']';
return |
github | pmoulon/groupsac-master | vgg_H_from_x_nonlin.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_H_from_x_nonlin.m | 1,360 | utf_8 | 103612a5f9951e905b561b8094e024b3 | function [H,rms] = vgg_H_from_x_nonlin(H_initial,p1,p2)
% [H,rms] = vgg_H_from_x_nonlin(H_initial,xs1,xs2)
%
% Compute H using non-linear method which minimizes Sampson's approx to
% geometric reprojection error (see Hartley & Zisserman Alg 3.3 page 98 in
% 1st edition, Alg 4.3 page ... |
github | pmoulon/groupsac-master | vgg_F_from_P.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_F_from_P.m | 697 | utf_8 | 6380e7f6f42bb24f9e45ed0954e38a3f | %F = vgg_F_from_P(P) Compute fundamental matrix from two camera matrices.
% P is cell (2), P = {P1 P2}. F has size (3,3). It is x2'*F*x1 = 0
%
% Overall scale of F is unique and such that, for any X, P1, P2, it is
% F*x1 = vgg_contreps(e2)*x2, where
% x1 = P1*X, x2 = P2*X, e2 = P2*C1, C1 = vgg_wedge(P1).
... |
github | pmoulon/groupsac-master | vgg_KR_from_P.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_KR_from_P.m | 853 | utf_8 | 10fb36cab617c6ac5a62c1c95dd50d63 | %VGG_KR_FROM_P Extract K, R from camera matrix.
%
% [K,R,t] = VGG_KR_FROM_P(P [,noscale]) finds K, R, t such that P = K*R*[eye(3) -t].
% It is det(R)==1.
% K is scaled so that K(3,3)==1 and K(1,1)>0. Optional parameter noscale prevents this.
%
% Works also generally for any P of size N-by-(N+1).
% ... |
github | pmoulon/groupsac-master | vgg_selfcalib_qaffine.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_selfcalib_qaffine.m | 4,575 | utf_8 | f71f15b70c022aaabe933cd54890d0ad | % vgg_selfcalib_qaffine Upgrading projective to quasi-affine reconstruction.
%
% Given projective reconstruction [P,X] with correct signs of P and X
% (the output of vgg_signsPX_from_x), it finds homography H transforming
% [P,X] to quasi-affine reconstruction [Pq,Xq] = [P*inv(H),H*X].
% Let Ainf=[0 0 0 1] be pla... |
github | pmoulon/groupsac-master | vgg_X_from_xP_lin.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_X_from_xP_lin.m | 1,095 | utf_8 | 3667f3326569b0459ad82bd02a88dc1a | %vgg_X_from_xP_lin Estimation of 3D point from image matches and camera matrices, linear.
% X = vgg_X_from_xP_lin(x,P,imsize) computes projective 3D point X (column 4-vector)
% from its projections in K images x (3-by-K matrix) and camera matrices P (K-cell
% of 3-by-4 matrices). Image sizes imsize (2-by-K ma... |
github | pmoulon/groupsac-master | vgg_plane_from_2P_H.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_plane_from_2P_H.m | 738 | utf_8 | c4f1c110d184164985ba011c67fd869e | % A = vgg_plane_from_2P_H(P1,P2,H) From two cameras and inter-image homography, it gets the scene plane.
%
% The method is linear and there is no preconditioning - works only for consistent triplet (P1,P2,H).
%
% P1, P2 ... double (3,4)
% H ... double (3,3)
% A ... double (4,1)
%
% It is H = P2*vgg_H_from_2P_p... |
github | pmoulon/groupsac-master | vgg_line3d_pv_from_XY.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_pv_from_XY.m | 722 | utf_8 | e05d8f5d14296e5923b18024f6152df9 | % L = vgg_line3d_pv_from_XY(X,Y) Pluecker vector 3d line from two 3d points.
%
% Syntax: L = vgg_line3d_pv_from_XY(X,Y) or
% L = vgg_line3d_pv_from_XY(XY)
%
% X, Y ... size (4,N), 3D points
% XY ... size (4,2*N), XY stacked as XY = [X1 Y1 ... XN YN].
% L ... size (N,6), Pluecker vector(s) of 3D line(s... |
github | pmoulon/groupsac-master | vgg_F_from_7pts_2img.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_F_from_7pts_2img.m | 1,509 | utf_8 | c746c7d6443fd85d50b660f0be1f88ba | %vgg_F_from_7pts_2img Computes fundamental matrix from 7 points across 2 images.
%
% [P,X] = vgg_F_from_7pts_2img(x), where
% x ... double(3,7,2) or cell{2} of double(3,7), 7 homogeneous points in 2 images
% F ... double(3,3), fundamental matrix
% There are 0 to 3 solutions for F. Solutions are prun... |
github | pmoulon/groupsac-master | vgg_X_from_xP_nonlin.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_X_from_xP_nonlin.m | 1,752 | utf_8 | efb7adb695d175ceed1e8a2e1fef99ea | %vgg_X_from_xP_nonlin Estimation of 3D point from image matches and camera matrices, nonlinear.
% X = vgg_X_from_xP_lin(x,P,imsize) computes max. likelihood estimate of projective
% 3D point X (column 4-vector) from its projections in K images x (3-by-K matrix)
% and camera matrices P (K-cell of 3-by-4 matric... |
github | pmoulon/groupsac-master | vgg_line3d_pm_from_pv.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_pm_from_pv.m | 310 | utf_8 | dcbfc96b9057f80afd0af449b51a43a1 | % G = vgg_line3d_pm_from_pv(L) Conversion of Pluecker vector to Puecker matrix 3d line representation.
%
% L ... double(1,6), Pluecker vector of the 3d line
% G ... double(4,4), Puecker matrix
% T.Werner
function G = vgg_line3d_pm_from_pv(L)
G = [vgg_contreps(L(4:6)) L(1:3)'; -L(1:3) 0];
return |
github | pmoulon/groupsac-master | vgg_line3d_pv_from_2planes.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_pv_from_2planes.m | 584 | utf_8 | f0afc682caee6ff87d148c9506f3121b | % L = vgg_line3d_pv_from_2planes(A,B) Pluecker vector of 3d line met by two planes.
%
% Syntax: L = vgg_line3d_pv_from_2planes(A,B) or
% L = vgg_line3d_pv_from_2planes(AB)
%
% A, B ... size (N,4), 3d planes
% AB ... size (2*N,4), N pairs of 3d planes. It is AB = [A1; B1; A2; B2; ... ; AN; BN].
% L ... s... |
github | pmoulon/groupsac-master | vgg_signsPX_from_x.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_signsPX_from_x.m | 4,005 | utf_8 | c7d5a18241488c1ca8ba5104eee36964 | % [P,X] = vgg_signsPX_from_x(P,X,x) Finds signs of P and X in a projective reconstruction.
%
% Given a projective reconstruction, i.e. P, X, and x such that
% s_n^k x_n^k = P^k X_n,
% where
% - P^k is k-th camera matrix
% - X_n is n-th scene point
% - x_n^k is image projection of X_n in camera P^k
% ... |
github | pmoulon/groupsac-master | vgg_line3d_Ppv.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_Ppv.m | 706 | utf_8 | 397d6699a9971df4388cfd206bc27f97 | % Q = vgg_line3d_Ppv(P) Transforms a camera matrix to use it with Pluecker vector 3d line representation.
%
% P ... double(3,4), ordinary camera matrix
% Q ... double(6,3), transformed camera matrix (quadratic function of elements of P)
% such that the projection of a 3d line by the camera is given by
%
% ... |
github | pmoulon/groupsac-master | vgg_line3d_XY_from_pm.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_XY_from_pm.m | 452 | utf_8 | dc2d6dc79e1ab6a73f12d3c7f663d6b2 | % XY = vgg_line3d_XY_from_pm(L) Converts Pluecker matrix 3d line to a pair of homogeneous 3d points.
%
% L ... double(4,4), skew-symmetric Pluecker matrix of 3d line
% XY ... double(4,2), pair of 3d points spanning the line, in homogen. coordinates
%
% XY are obtained by svd, their homogeneous vectors are mutuall... |
github | pmoulon/groupsac-master | vgg_poly3d_orthorectify.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_poly3d_orthorectify.m | 3,268 | utf_8 | 10d4aa22d3379d53ac398daed4a66a6b | %vgg_poly3d_orthorectify Frontoparallel rectification of image of 3D polygon.
% [H,imsize] = vgg_poly3d_orthorectify(Q,u) finds homography H that
% removes perspective distortion of image Q*hom(u) of a 3D polygon. Parameters:
% u ... double(2,N), inhomog. coordinates of polygon vertices measured in an ortho... |
github | pmoulon/groupsac-master | vgg_P_from_F.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_P_from_F.m | 424 | utf_8 | 9f421887ea84dc943f597969f47e9483 | %P = vgg_P_from_F(F) Compute cameras from fundamental matrix.
% F has size (3,3), P has size (3,4).
%
% If x2'*F*x1 = 0 for any pair of image points x1 and x2,
% then the camera matrices of the image pair are
% P1 = eye(3,4) and P2 = vgg_P_from_F(F), up to a scene homography.
% Tomas Werner, Oct 2001
... |
github | pmoulon/groupsac-master | vgg_T_from_P.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_T_from_P.m | 1,010 | utf_8 | 89c7a744dccc81dbc0a54df89e7c255f | % T = vgg_T_from_P(P) Trifocal tensor from 3 camera matrices.
%
% P ... cell (3), camera matrices
% T ... double (3,3,3)
%
% For 3 corresponding lines l1..l3 (each of size (1,3)) in cameras P1..P3 it is
% for i=1:3, l1(1,i) = l2*T(:,:,i)*l3'; end
% up to scale.
%
% T is obtained by with unique absolu... |
github | pmoulon/groupsac-master | vgg_line3d_from_lP_nonlin.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_from_lP_nonlin.m | 11,456 | utf_8 | b812873d65b6ae35261f412d8a022e14 | % vgg_line3d_from_lP_nonlin Non-linear estimation of (possibly constrained) 3D line segment from image line segments.
%
% SYNOPSIS
% L = vgg_line3d_from_lP_nonlin(s,P [,imsize] [,L0] [,X] [,nonlin_opt])
%
% s ... cell(K) of double(3,3), inv. covariance matrices of the K image line segments:-
% - If the segment... |
github | pmoulon/groupsac-master | vgg_selfcalib_metric_vansq.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_selfcalib_metric_vansq.m | 3,599 | utf_8 | dfec9ad31ae420f250fc7845e5a33102 | % vgg_selfcalib_metric_vansq Metric selfcalibration from 3 orthogonal principal directions and square pixels.
%
% DESCRIPTION
% Given projective camera matrices P and 3 scene points V, it computes 3D-to-3D
% homography H which upgrades the old reconstruction to metric one, i.e.,
% differing from the true one only... |
github | pmoulon/groupsac-master | vgg_line3d_from_lP_lin.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_from_lP_lin.m | 1,629 | utf_8 | bd8090dc9d71f4476773760a1e035668 | % vgg_line3d_linear Linear estimation of 3d line from image lines and camera matrices.
%
% SYNOPSIS
% L = vgg_line3d_from_lP_lin(s,P [,imsize]), where
%
% s ... cell(K) of double(3,3), inv. covariance matrices of the K image line segments:-
% - If the segments are estimated from edges, it is s(:,k) = x*x',
% ... |
github | pmoulon/groupsac-master | vgg_PX_from_6pts_3img.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_PX_from_6pts_3img.m | 4,996 | utf_8 | 6b2095fc2f0081347d159b9f64abd845 | %vgg_PX_from_6pts_3img Computes camera matrices and world points from 6 points across 3 images.
%
% [P,X] = vgg_PX_from_6pts_3img(x), where
% x ... double(3,6,3) or cell{3} of double(3,6), 6 homogeneous points in 3 images
% P ... double(3,4,3), P(:,:,k) is k-th camera matrix
% X ... double(4,6), ... |
github | pmoulon/groupsac-master | vgg_H_from_P_plane.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_H_from_P_plane.m | 768 | utf_8 | 2f3af6a75d064bf889a8ab4118f7d2c5 | % vgg_H_from_P_plane Given 3D plane and camera, returns 4-by-3 matrix mapping image points to points on the plane.
%
% H = vgg_H_from_P_plane(A,P), where
% A ... size (4,1), scene plane
% P ... size (3,4), camera matrix
% H ... size (4,3), matrix such that X = x*H, where x (size (3,1)) is an image point
% ... |
github | pmoulon/groupsac-master | vgg_line3d_XY_from_pv.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/vgg_line3d_XY_from_pv.m | 402 | utf_8 | 13142cdb3af2b92197eb408f4bbe1ff8 | % XY = vgg_line3d_XY_from_pv(L) Converts Pluecker vector 3d line to a pair of homogeneous points.
%
% L ... double(1,6), Pluecker vector
% XY ... double(4,2), pair of 3d points spanning the line
%
% XY are obtained by svd, their homogeneous vectors are mutually orthogonal.
% T.Werner
function XY = vgg_line3... |
github | pmoulon/groupsac-master | vgg_singF_from_FF.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_multiview/private/vgg_singF_from_FF.m | 769 | utf_8 | 7880d3aef3030b7b8aa76f889080ff07 | %VGG_SINGF_FROM_FF Linearly combines two 3x3 matrices to a singular one.
%
% a = vgg_singF_from_FF(F) computes scalar(s) a such that given two 3x3 matrices F{1} and F{2},
% it is det( a*F{1} + (1-a)*F{2} ) == 0.
function a = vgg_singF_from_FF(F)
% precompute determinants made from columns of F{1}, F{2}
... |
github | pmoulon/groupsac-master | ransacfithomography_vgg.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_examples/ransacfithomography_vgg.m | 4,638 | utf_8 | c5c99f4eb90cbc10401be7c62ea8797d | % RANSACFITHOMOGRAPHY - fits 2D homography using RANSAC
%
% Usage: [H, inliers] = ransacfithomography_vgg(x1, x2, t)
%
% Arguments:
% x1 - 2xN or 3xN set of homogeneous points. If the data is
% 2xN it is assumed the homogeneous scale factor is 1.
% x2 - 2xN or 3xN set of homogeneou... |
github | pmoulon/groupsac-master | testhomog_vgg.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_examples/testhomog_vgg.m | 2,267 | utf_8 | 3b03fe92a4fa5d3ee43273952d7b690c | % Demonstration of feature matching via simple correlation, and then using
% RANSAC to estimate the homography matrix and at the same time identify
% (mostly) inlying matches
% Peter Kovesi
% School of Computer Science & Software Engineering
% The University of Western Australia
% pk at csse uwa edu au
% http://www.... |
github | pmoulon/groupsac-master | vgg_gui_F.m | .m | groupsac-master/matlab/thirdParty/vgg/vgg_ui/vgg_gui_F.m | 6,561 | utf_8 | 7f1bcfdf6ef40a26cd38444242300cb1 | function fig=vgg_gui_F(i1,i2,F)
%
% fig=vgg_gui_F(i1,i2,F)
%
%
% Visualizes the fundamental matrix of two views
%
%IN:
% i1 - Matlab image
% i2 - Matlab image
% F - Fundamental matrix (p1'*F*p2=0). Assumes that image coordiantes
% are 1..width where pixel centers are at integer locations.
%
%OUT:
% fig ... |
github | pmoulon/groupsac-master | fundmatrix.m | .m | groupsac-master/matlab/thirdParty/Peter/fundmatrix.m | 3,961 | utf_8 | 250dfa8051640daab30229f35667f4d6 | % FUNDMATRIX - computes fundamental matrix from 8 or more points
%
% Function computes the fundamental matrix from 8 or more matching points in
% a stereo pair of images. The normalised 8 point algorithm given by
% Hartley and Zisserman p265 is used. To achieve accurate results it is
% recommended that 12 or more poi... |
github | pmoulon/groupsac-master | normalise2dpts.m | .m | groupsac-master/matlab/thirdParty/Peter/normalise2dpts.m | 2,177 | utf_8 | 21c52c2fe9f576e1bb3136a3ad191936 | % NORMALISE2DPTS - normalises 2D homogeneous points
%
% Function translates and normalises a set of 2D homogeneous points
% so that their centroid is at the origin and their mean distance from
% the origin is sqrt(2). This process typically improves the
% conditioning of any equations used to solve homographies, fun... |
github | pmoulon/groupsac-master | testGroupsacFundmat.m | .m | groupsac-master/matlab/interfaces/testGroupsacFundmat.m | 1,443 | utf_8 | f2acfd24b98c9ceadc21197524bfd9f8 | function test_suite = testGroupsacFundmat
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
clear GR vis_map;
global GR vis_map;
%% set up putatives, the first putative is an outliner
xs1 = [1 1; 1251 1243; 1603 923; 2067 1031; 787 484; 1355 363; 2163 743; 1... |
github | pmoulon/groupsac-master | fundmat7ptRansac.m | .m | groupsac-master/matlab/interfaces/fundmat7ptRansac.m | 822 | utf_8 | 70088b690c818909eb163e444f3e07fc | % use RANSAC to determine the inliers in the points by fitting a fundamental matrix model
function [success, inliers, model] = fundmat7ptRansac(xs1, xs2, sigma)
assert(size(xs1,2) == size(xs2,2));
assert(size(xs1,1) == 2);
assert(size(xs2,1) == 2);
%% control parameters
datum_num = size(xs1, 2);
fun_compute ... |
github | pmoulon/groupsac-master | testLineFittingRansac.m | .m | groupsac-master/matlab/interfaces/testLineFittingRansac.m | 751 | utf_8 | 11b70c57b646220e618705583a64ed99 | function test_suite = testLineFittingRansac
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
a = -5;
b = 2;
inlier_num = 20;
outlier_num = 10;
sigma = 0.1;
% generate points
pts = zeros(inlier_num + outlier_num, 2);
pts(:, 1) = (rand(inlier_num + outlier_nu... |
github | pmoulon/groupsac-master | lineFittingRansac.m | .m | groupsac-master/matlab/interfaces/lineFittingRansac.m | 737 | utf_8 | ff43eb12d346fbf71adc4b68a6bc6f24 | % use RANSAC to determine the inliers in the points by fitting a line model
function [success, inliers, model] = lineFittingRansac(points, sigma)
%% control parameters
datum_num = size(points, 1);
fun_compute = @(sampled) lineFittingSolver(points(sampled,:));
fun_evaluate = lineFittingEvaluator(points, sigma);
... |
github | pmoulon/groupsac-master | testFundmat7ptRansac.m | .m | groupsac-master/matlab/interfaces/testFundmat7ptRansac.m | 746 | utf_8 | d17914002bd7dacd6dcb9d208b187171 | function test_suite = testFundmat7ptRansac
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
% load data
i1 = 1; i2 = 2;
[view, Xi, ~] = vgg_example_scene(4);
F = vgg_F_from_P(view(i1).P, view(i2).P);
xs1 = [];
xs2 = [];
for i = 1:size(Xi, 2)
n1 = Xi(i1... |
github | pmoulon/groupsac-master | testProsacFundmat.m | .m | groupsac-master/matlab/interfaces/testProsacFundmat.m | 1,178 | utf_8 | 38f6c564e1a327849a37d9a35c11e4bb | function test_suite = testProsacFundmat
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
clear PR;
global PR;
%% set up putatives
xs1 = [1251 1243; 1603 923; 2067 1031; 787 484; 1355 363; 2163 743; 1875 1715]';
xs2 = [723 887; 1091 699; 1691 811; 447 635; ... |
github | pmoulon/groupsac-master | early_termination.m | .m | groupsac-master/matlab/ransac/early_termination.m | 645 | utf_8 | b53dccbeda71f01c62779dce6a3b0f80 | %% the early termination only checks whether the sampling contains only the inliers (given the ground truth inliers beforehand)
%% it is only used to evaluate how fast RANSAC finds the real inliers, not for the real experiment
function [fun_handle] = early_termination(is_inlier, prop)
fun_handle = @check_termination;
... |
github | pmoulon/groupsac-master | candidatesProsac.m | .m | groupsac-master/matlab/ransac/candidatesProsac.m | 1,210 | utf_8 | 7861af948255aede1b5f677c06e0efac | %% return the points from certain groups, for debugging purpose
function [fun_handle] = candidatesProsac(min_sample_num, rounds_to_equal, ordering)
global PR;
T_N = rounds_to_equal;
T_n_ratio = T_N / nchoosek(length(ordering),min_sample_num);
fun_handle = @select_candidates;
%% the function to return
function [... |
github | pmoulon/groupsac-master | group_ransac_termination.m | .m | groupsac-master/matlab/ransac/group_ransac_termination.m | 2,311 | utf_8 | 5af33ef31c68aa706124587ace4e08e8 | %% the default termination check for RANSAC, which only depends on the rounds needed
function [fun_handle] = group_ransac_termination(min_sample_num, max_rounds, confidence, verbose)
global vis_map GR;
persistent min_inlier rounds_needed rounds_allowed;
l1mp = log(1.0 - confidence);
fun_handle = @check_termination;... |
github | pmoulon/groupsac-master | candidates_multiple_groups.m | .m | groupsac-master/matlab/ransac/candidates_multiple_groups.m | 1,831 | utf_8 | 7ab5d4eca5509b18859176e3323da8ea | %% return the handle of a function that gives candidates for RANSAC's sampling
%% always return the maximum size group that has not been sampled yet
function [fun_handle] = candidates_multiple_groups(min_sample_num, rounds_to_equal, vis_map, cfgs)
% cfgs : each row is a group configruation
global GR;
fun_handle = @se... |
github | pmoulon/groupsac-master | ransacRoundsNeeded.m | .m | groupsac-master/matlab/ransac/ransacRoundsNeeded.m | 435 | utf_8 | c52e487da70e9688f3bd9da33d5920a9 | % return the minimal rounds needed for a given data set size and a given inlier number
function [needed] = ransacRoundsNeeded(max_rounds, min_sample_num, l1mp, datum_num, inlier_num)
w = inlier_num / datum_num; % inlier point probability
eps_log = log(1.0 - w ^ min_sample_num); % outlier sample probability
if inlier_... |
github | pmoulon/groupsac-master | calc_cfg_cup_rounds.m | .m | groupsac-master/matlab/ransac/calc_cfg_cup_rounds.m | 402 | utf_8 | 5e9ddfac33d27f807e971fec877d1f73 | % compute the rounds for the given configuration
function [rounds] = calc_cfg_cup_rounds(vis_map, min_sample_num, rounds_to_equal, cfg, exhaust)
persistent total;
pt_num = sum(find(sum(vis_map(:,cfg),2)));
rounds = nchoosek(pt_num, min_sample_num);
if ~exhaust
if isempty(total)
total = nchoosek(size(vis_map,1), ... |
github | pmoulon/groupsac-master | check_ground_truth.m | .m | groupsac-master/matlab/ransac/check_ground_truth.m | 286 | utf_8 | c8f2cd3251c2c914103c523374639308 | %% check whether the inliers are compatible with ground truth
function [fail] = check_ground_truth(is_inlier, inliers, prop)
if ~exist('prop', 'var')
prop = 0.8;
end
%fail = sum(is_inlier(inliers)) < sum(is_inlier) * prop;
fail = length(inliers) < sum(is_inlier) * prop;
end |
github | pmoulon/groupsac-master | group_ransac.m | .m | groupsac-master/matlab/ransac/group_ransac.m | 2,700 | utf_8 | 8fa98dcd15ae4df6c986d01fbf67c1e8 | %% draw a group ransac
function [] = group_ransac()
global vis_map % global gui variables
%% calculate different group combinations and show the pie charts
% combo_sums = zeros(sample_num,1);
% for group_used = 1 : 4
% grps = nchoosek(1:group_num, group_used); % the group combinati... |
github | pmoulon/groupsac-master | draw_samples.m | .m | groupsac-master/matlab/ransac/draw_samples.m | 231 | utf_8 | fd3fc9cd44bf212173085e30983aa420 | %% pick up {sample_num} samples from {candidates}
function [sampled] = draw_samples(candidates, sample_num)
idx_rand = randperm(length(candidates))';
idx_selected = idx_rand(1:sample_num);
sampled = candidates(idx_selected);
end
|
github | pmoulon/groupsac-master | build_grp_cfgs.m | .m | groupsac-master/matlab/ransac/build_grp_cfgs.m | 2,039 | utf_8 | 9b5d4fdfc4b4659595169727b0a1f28a | %% build a list of group configs and their corresponding rounds
function [] = build_grp_cfgs(min_sample_num, rounds_to_equal, grps_used, verbose)
global GR vis_map;
% if exhause, we are going to compute the exact combination number
exhaust = isa(rounds_to_equal, 'char');
% generate unsorted group configurations
grp_... |
github | pmoulon/groupsac-master | prosac_termination.m | .m | groupsac-master/matlab/ransac/prosac_termination.m | 1,816 | utf_8 | 94ed0af0ce981872d46084c9342694c5 | %% the default termination check for RANSAC, which only depends on the rounds needed
function [fun_handle] = prosac_termination(min_sample_num, max_rounds, confidence)
global PR;
l1mp = log(1.0 - confidence);
persistent min_inlier rounds_needed;
fun_handle = @check_termination;
function [terminate best_inliers... |
github | pmoulon/groupsac-master | candidates_fixed_groups.m | .m | groupsac-master/matlab/ransac/candidates_fixed_groups.m | 372 | utf_8 | 4710c0ee82b9b6ccb03b8756d47d3518 | %% return the points from certain groups, for debugging purpose
function [fun_handle] = candidates_fixed_groups(vis_map, groups)
disp('*********************running in fixed groups mode!***************');
pt_idx = find(sum(vis_map(:,groups), 2));
fun_handle = @select_candidates;
function [candidates] = select_c... |
github | pmoulon/groupsac-master | ransacThreshold.m | .m | groupsac-master/matlab/ransac/ransacThreshold.m | 383 | utf_8 | e22ea2c9f6772ccd939e1dd9889faf31 | % compute the threshold used in RANSAC
function [threshold] = ransac_threshold(codimension, sigma)
sigma2 = sigma * sigma;
switch codimension
case 1
threshold = 3.84 * sigma2;
case 2
threshold = 5.99 * sigma2;
case 3
threshold = 7.81 * sigma2;
case 4
threshold = 9.49 * s... |
github | pmoulon/groupsac-master | comb_group_counts.m | .m | groupsac-master/matlab/ransac/comb_group_counts.m | 1,411 | utf_8 | 8e64ef5296d9e27b4e270e69b3994299 | % the function returns all the combinations such that
% each group's count is not zero and the sum of the counts is sample_num
% e.g. one combination for grp_num = 4, sample_num = 6 is [1 1 1 3]
function [combs] = comb_group_counts(grp_num, sample_num)
assert(grp_num <= sample_num);
if grp_num == 1
combs = sampl... |
github | pmoulon/groupsac-master | testRansacRoundsNeeded.m | .m | groupsac-master/matlab/ransac/testRansacRoundsNeeded.m | 723 | utf_8 | 4a39e5c3792f9848bc2c46c19d6897fd | function test_suite = testRansacRoundsNeeded
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
max_rounds = 1e5;
min_sample_num = 7;
l1mp = log(1 - 0.99);
datum_num = 200;
inlier_num = 120;
rounds = ransacRoundsNeeded(max_rounds, min_sample_num, l1mp, datum_n... |
github | pmoulon/groupsac-master | candidates_single_group.m | .m | groupsac-master/matlab/ransac/candidates_single_group.m | 1,822 | utf_8 | 12d3a42458cb201599f3a0181659422c | %% return the handle of a function that gives candidates for RANSAC's sampling
function [fun_handle] = candidates_single_group(min_sample_num, rounds_to_equal, verbose)
global GR vis_map;
% assert we only have single-group points
assert(sum(abs(sum(vis_map,2) - 1)) == 0);
fun_handle = @select_candidates;
functi... |
github | pmoulon/groupsac-master | testProsacSample.m | .m | groupsac-master/matlab/ransac/testProsacSample.m | 1,010 | utf_8 | 401a8cac3cfbb691ae67857a43532c58 | %% unit tests for testCandidatesProsac
function test_suite = testProsacSample
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testNotExceeded
global PR;
PR = {};
PR.exceeded = false;
PR.n = 30;
ordering = 1:100;
func = prosacSample(ordering);
candidates = (1:30)';
... |
github | pmoulon/groupsac-master | early_termination_prosac.m | .m | groupsac-master/matlab/ransac/early_termination_prosac.m | 982 | utf_8 | 499f33ed14609a273275f18391cf4e09 | %% the early termination only checks whether the sampling contains only the inliers (given the ground truth inliers beforehand)
%% it is only used to evaluate how fast RANSAC finds the real inliers, not for the real experiment
function [fun_handle] = early_termination_prosac(is_inlier, prop, datum, fun_evaluate)
inlie... |
github | pmoulon/groupsac-master | testCandidatesProsac.m | .m | groupsac-master/matlab/ransac/testCandidatesProsac.m | 468 | utf_8 | ca37622bb5abfc05784559c461e9a948 | %% unit tests for testCandidatesProsac
function test_suite = testCandidatesProsac
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
global PR;
PR = {};
min_sample_num = 7;
rounds_to_equal = 200000;
ordering = 1:200; % 200 data points
func = candidatesProsac... |
github | pmoulon/groupsac-master | calc_cfg_cap_rounds.m | .m | groupsac-master/matlab/ransac/calc_cfg_cap_rounds.m | 1,840 | utf_8 | b9a032a8533b7d36ac20479415833598 | % compute the rounds for the given configuration
function [rounds] = calc_cfg_cap_rounds(vis_map, min_sample_num, rounds_to_equal, cfg, exhaust)
persistent total;
rounds = combs_of_cap2(cfg);
if ~exhaust
if isempty(total)
total = nchoosek(size(vis_map,1), min_sample_num);
end
rounds = ceil(rounds / total * r... |
github | pmoulon/groupsac-master | prosacSample.m | .m | groupsac-master/matlab/ransac/prosacSample.m | 532 | utf_8 | b10ddf350baa50f45f13c65e67e8c175 | % prosac sampling, always sample from the last element
function [fun_handle] = prosacSample(ordering)
global PR;
fun_handle = @func_to_return;
function [sampled] = func_to_return(candidates, min_sample_num)
if ~PR.exceeded
% draw samples from 1 to n-1
sampled = draw_samples(candidates(1:end-1), min_samp... |
github | pmoulon/groupsac-master | hommat4ptSolver.m | .m | groupsac-master/matlab/estimators/hommat4ptSolver.m | 367 | utf_8 | b066f6d0777987fc8f1bac3d9afebb76 | % return a function handle for computing the error between points given a
% homography matrix
function [fun_handle] = hommat4ptSolver(xs1, xs2)
assert(size(xs1,2) == size(xs2,2));
assert(size(xs1,1) == 2);
assert(size(xs2,1) == 2);
fun_handle = @compute;
function [H] = compute(sampled)
H = vgg_H_from_x_lin... |
github | pmoulon/groupsac-master | testFundmat7ptError.m | .m | groupsac-master/matlab/estimators/testFundmat7ptError.m | 1,045 | utf_8 | dd4b58b343d22150973d53b5885f7936 | function test_suite = testFundmat7ptError
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testError
F = [0 0 0; 0 0 -1; 0 1 0];
x0 = [0; 0; 1]; y0 = [0; 0; 1];
x1 = [0; 0; 1]; y1 = [100; 0; 1];
x2 = [0; 0; 1]; y2 = [0; 0.1; 1];
x3 = [0; 0; 1]; y3 = [0; 1... |
github | pmoulon/groupsac-master | hommat4ptEvaluator.m | .m | groupsac-master/matlab/estimators/hommat4ptEvaluator.m | 1,041 | utf_8 | f3735e5493418836fec356ce166007ce | % return an evaluate function handle to use in homography matrix fitting RANSAC
function [fun_handle] = homat4ptEvaluator(xs1, xs2, sigma)
%% compute error threshold
codimension = 1;
err_tol = ransacThreshold(codimension, sigma);
%% convert to homogeneous coordinates
xs1 = [xs1; ones(1, size(xs1, 2))];
xs2 = [xs2; on... |
github | pmoulon/groupsac-master | testLineFittingSolver.m | .m | groupsac-master/matlab/estimators/testLineFittingSolver.m | 473 | utf_8 | 31861df1fbe70d4cae155356faf31058 | function test_suite = testLineFittingSolver
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testNoNoise
y = 5:3:50;
x = 1:length(y);
points = [x' y'];
[ab] = lineFittingSolver(points);
assertElementsAlmostEqual(3, ab(1));
assertElementsAlmostEqual(2, ab(2));
%%%%%%%%... |
github | pmoulon/groupsac-master | testFundmat7ptEvaluator.m | .m | groupsac-master/matlab/estimators/testFundmat7ptEvaluator.m | 880 | utf_8 | b1e33650d9f948b68458afb536c2a38e | function test_suite = testFundmat7ptEvaluator
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testVgg
% load data
i1 = 1; i2 = 1;
[view, Xi, ~] = vgg_example_scene(4);
F = vgg_F_from_P(view(i1).P, view(i2).P);
xs1 = [];
xs2 = [];
for i = 1:size(Xi, 2)
n1 = Xi(i1... |
github | pmoulon/groupsac-master | fundmat7ptSolver.m | .m | groupsac-master/matlab/estimators/fundmat7ptSolver.m | 625 | utf_8 | 094188833a6929c9d881e494e3242237 | % return a function handle for computing the fundamental matrix from a set of points
function [fun_handle] = fundmat7ptSolver(xs1, xs2)
assert(size(xs1,2) == size(xs2,2));
assert(size(xs1,1) == 2);
assert(size(xs2,1) == 2);
xs1 = [xs1; ones(1, size(xs1, 2))];
xs2 = [xs2; ones(1, size(xs2, 2))];
fun_handle = ... |
github | pmoulon/groupsac-master | hommat4ptError.m | .m | groupsac-master/matlab/estimators/hommat4ptError.m | 154 | utf_8 | fc6a4d5b08bfe4e6796f4d537edb9e5f | %% sampson error for homography matrix
function [error] = hommat4ptError(H, x1, x2)
Hx = H * x1;
Hx = Hx/Hx(3,:);
error = sqrt(sum((x2-Hx).*(x2-Hx)));
end |
github | pmoulon/groupsac-master | testLineFittingEvaluator.m | .m | groupsac-master/matlab/estimators/testLineFittingEvaluator.m | 373 | utf_8 | a04b53887957f4b5c3ccbcb4e6a3032a | function test_suite = testLineFittingEvaluator
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple
pts = [1 2; 2 4; 2 5; 3 6; 4 7];
sigma = 0;
fun = lineFittingEvaluator(pts, sigma);
ab = [2 0];
actual = fun(ab, 1:length(pts));
expected = [1; 2; 4];
assertEqua... |
github | pmoulon/groupsac-master | testFundmat7ptSolver.m | .m | groupsac-master/matlab/estimators/testFundmat7ptSolver.m | 499 | utf_8 | efeb12ec498c51765d124287e8990b5a | function test_suite = testFundmat7ptSolver
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testNoNoise
xs1 = [723 887; 1091 699; 1691 811; 447 635; 971 91; 1903 447; 1483 1555]';
xs2 = [1251 1243; 1603 923; 2067 1031; 787 484; 1355 363; 2163 743; 1875 1715]';
func = ... |
github | pmoulon/groupsac-master | fundmat7ptError.m | .m | groupsac-master/matlab/estimators/fundmat7ptError.m | 248 | utf_8 | 649620ae5f7835e2910fb8deb5062b8a | %% sampson error for fundamental matrix
function [error] = fundmat7ptError(F, x1, x2)
xfx = x2' * F * x1;
error = xfx ^ 2 / (jjt(F,x1) + jjt(F',x2));
function [ret] = jjt(f,v)
fv = f * v;
ret = fv(1) ^ 2 + fv(2) ^ 2;
end
end |
github | pmoulon/groupsac-master | testLineFittingError.m | .m | groupsac-master/matlab/estimators/testLineFittingError.m | 745 | utf_8 | 88f649873af94477c40d8c2813052d5c | function test_suite = testLineFittingError
initTestSuite;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function testSimple1
ab = [1 0];
pt = [1 0];
actual = lineFittingError(ab, pt);
expected = 1 / sqrt(2);
assertElementsAlmostEqual(expected, actual);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
github | pmoulon/groupsac-master | fundmat7ptEvaluator.m | .m | groupsac-master/matlab/estimators/fundmat7ptEvaluator.m | 1,234 | utf_8 | 5336d382d19830360207bfc00268a58a | % return an evaluate function handle to use in fundamental matrix fitting RANSAC
function [fun_handle] = fundmat7ptEvaluator(xs1, xs2, sigma)
%% compute error threshold
codimension = 1;
err_tol = ransacThreshold(codimension, sigma);
%% convert to homogeneous coordinates
xs1 = [xs1; ones(1, size(xs1, 2))];
xs2 = [xs2;... |
github | pmoulon/groupsac-master | lineFittingError.m | .m | groupsac-master/matlab/estimators/lineFittingError.m | 256 | utf_8 | 253fa1a838a76c76e9c3286a6ab4c562 | %% the distance between the given point and the line y=ax+b, i.e. ax-y+b=0
% http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
function [dist] = lineFittingError(ab, pt)
dist = abs(ab(1)*pt(1) - pt(2) + ab(2)) / sqrt(ab(1) * ab(1) + 1);
end |
github | DUT-DIPLab/Graph-Multi-NMF-Feature-Clustering-master | PerViewNMF.m | .m | Graph-Multi-NMF-Feature-Clustering-master/GMultiNMF/PerViewNMF.m | 7,500 | utf_8 | a0e50598a41422647a7b1550e5279037 | function [U_final, V_final, nIter_final, elapse_final, bSuccess, objhistory_final] = PerViewNMF(X, k, Vo,W, options, U, V)
%
% Notation:
% X ... (mFea x nSmp) data matrix of one view
% mFea ... number of features
% nSmp ... number of samples
% k ... number of hidden factors
% W ... weight matrix of t... |
github | DUT-DIPLab/Graph-Multi-NMF-Feature-Clustering-master | GNMF_Multi.m | .m | Graph-Multi-NMF-Feature-Clustering-master/GMultiNMF/GNMF_Multi.m | 6,661 | utf_8 | 4550b20bf336ac5964822c418becb0d1 | function [U_final, V_final, nIter_final, objhistory_final] = GNMF_Multi(X, k, W, options, U, V)
% Notation:
% X ... (mFea x nSmp) data matrix
% mFea ... number of words (vocabulary size)
% nSmp ... number of documents
% k ... number of hidden factors
% W ... weight matrix of the affinity graph
%
% opti... |
github | DUT-DIPLab/Graph-Multi-NMF-Feature-Clustering-master | Laplacian_GK.m | .m | Graph-Multi-NMF-Feature-Clustering-master/GMultiNMF/tools/Laplacian_GK.m | 897 | utf_8 | 0c320decdd7a6d5b602a1b5d237b5865 | function L = Laplacian_GK(X, para)
% each column is a data
if isfield(para, 'k')
k = para.k;
else
k = 20;
end;
if isfield(para, 'sigma')
sigma = para.sigma;
else
sigma = 1;
end;
[nFea, nSmp] = size(X);
D = L2_distance_1(X,X);
W = spalloc(nSmp,nSmp,20*nSmp);
[dumb idx] = sort(D, 2); % ... |
github | DUT-DIPLab/Graph-Multi-NMF-Feature-Clustering-master | litekmeans.m | .m | Graph-Multi-NMF-Feature-Clustering-master/GMultiNMF/print/litekmeans.m | 15,116 | utf_8 | f9a76a4de4f1e8bf56e3e4030be316b6 | function [label, center, bCon, sumD, D] = litekmeans(X, k, varargin)
%LITEKMEANS K-means clustering, accelerated by matlab matrix operations.
%
% label = LITEKMEANS(X, K) partitions the points in the N-by-P data matrix
% X into K clusters. This partition minimizes the sum, over all
% clusters, of the within-clus... |
github | HyeonwooNoh/caffe-master | prepare_batch.m | .m | caffe-master/matlab/caffe/prepare_batch.m | 1,298 | utf_8 | 68088231982895c248aef25b4886eab0 | % ------------------------------------------------------------------------
function images = prepare_batch(image_files,IMAGE_MEAN,batch_size)
% ------------------------------------------------------------------------
if nargin < 2
d = load('ilsvrc_2012_mean');
IMAGE_MEAN = d.image_mean;
end
num_images = length... |
github | HyeonwooNoh/caffe-master | matcaffe_demo_vgg.m | .m | caffe-master/matlab/caffe/matcaffe_demo_vgg.m | 3,036 | utf_8 | f836eefad26027ac1be6e24421b59543 | function scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file, mean_file)
% scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file, mean_file)
%
% Demo of the matlab wrapper using the networks described in the BMVC-2014 paper "Return of the Devil in the Details: Delving Deep into Convolutional... |
github | HyeonwooNoh/caffe-master | matcaffe_demo.m | .m | caffe-master/matlab/caffe/matcaffe_demo.m | 3,344 | utf_8 | 669622769508a684210d164ac749a614 | function [scores, maxlabel] = matcaffe_demo(im, use_gpu)
% scores = matcaffe_demo(im, use_gpu)
%
% Demo of the matlab wrapper using the ILSVRC network.
%
% input
% im color image as uint8 HxWx3
% use_gpu 1 to use the GPU, 0 to use the CPU
%
% output
% scores 1000-dimensional ILSVRC score vector
%
% You m... |
github | HyeonwooNoh/caffe-master | matcaffe_demo_vgg_mean_pix.m | .m | caffe-master/matlab/caffe/matcaffe_demo_vgg_mean_pix.m | 3,069 | utf_8 | 04b831d0f205ef0932c4f3cfa930d6f9 | function scores = matcaffe_demo_vgg_mean_pix(im, use_gpu, model_def_file, model_file)
% scores = matcaffe_demo_vgg(im, use_gpu, model_def_file, model_file)
%
% Demo of the matlab wrapper based on the networks used for the "VGG" entry
% in the ILSVRC-2014 competition and described in the tech. report
% "Very Deep Convo... |
github | casaro/AutoExtend-master | gradientChecking.m | .m | AutoExtend-master/AutoExtend/gradientChecking.m | 2,278 | utf_8 | 1560433538c932f72b59a7cf9561622e | function [] = gradientChecking(w, E, D, R, grad_E, grad_D, iter, weights, mode, epsilon)
fprintf('Gradient checking in iteration: %3d\n', iter);
E_epsilon = E;
[row,column,value] = find(E);
grad = zeros(10,2);
e = 1;
for l=randi(length(row),1,10)
E_epsilon(row(l), column(l)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.