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 | facundoq/courses-master | SimpleOptimizeMEU.m | .m | courses-master/pgm/p6/SimpleOptimizeMEU.m | 1,054 | utf_8 | d95f8c036ea2c35ab1beed9661053de1 | % Copyright (C) Daphne Koller, Stanford University, 2012
function [MEU OptimalDecisionRule] = SimpleOptimizeMEU(I)
% We assume there is only one decision rule in this function.
D = I.DecisionFactors(1);
PossibleDecisionRules = EnumerateDecisionRules(D);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
github | facundoq/courses-master | ShowPose.m | .m | courses-master/pgm/p8/ShowPose.m | 1,432 | utf_8 | 480c7ad39d9caf52ad16fd8cc5253326 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012
%
% Author: Huayan Wang, Andrew Duchi
% visualize a configuration the body parts
function img = ShowPose( pose )
% pose 10 x 3. 10 : body parts,
% 3 : y, x, alpha
pose(:,1) = pose(:,1) + 100;
pose(:,2) = pose(:,2) + 150;
pose = reshape(pose, [... |
github | facundoq/courses-master | lognormpdf.m | .m | courses-master/pgm/p8/lognormpdf.m | 159 | utf_8 | 145eafca5ce4cf649ea5bd971005f278 | %
% Copyright (C) Daphne Koller, Stanford Univerity, 2012
function val = lognormpdf(x, mu, sigma)
val = - (x - mu).^2 / (2*sigma^2) - log (sqrt(2*pi) * sigma); |
github | facundoq/courses-master | VisualizeModels.m | .m | courses-master/pgm/p8/VisualizeModels.m | 632 | utf_8 | 96364d24c5eac51124dce780dc8eec4f | % Copyright (C) Daphne Koller, Stanford Univerity, 2012
%
% Author: Huayan Wang
function VisualizeModels(P, G)
K = length(P.c);
f = figure;
while(1)
for k=1:K
subplot(1,K,k);
if size(G,3) == 1 % same graph structure for all classes
pose = SamplePose(P,G,k);
... |
github | facundoq/courses-master | submit.m | .m | courses-master/pgm/p8/submit.m | 24,472 | utf_8 | fe506b2c798ad661b509d57cbddf4bf3 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the pgm-class servers
% SUBMIT() will connect to the pgm-class server and submit your solution
% There is no penalty for submitting, so go ahead and try this!
%
% If this function does not work for you, use the web-submission mechanism.
% ... |
github | facundoq/courses-master | ComputeClassLikelihoodSample.m | .m | courses-master/pgm/p8/ComputeClassLikelihoodSample.m | 2,485 | utf_8 | a4d345390cfad113fd8a5395f8a8f243 | function class_l = ComputeClassLikelihoodSample(P, G, sample)
% You should compute the log likelihood of data as in eq. (12) and (13)
% in the PA description
% Hint: Use lognormpdf instead of log(normpdf) to prevent underflow.
% You may use log(sum(exp(logProb))) to do addition in the original
% space, sum... |
github | facundoq/courses-master | VisualizeDataset.m | .m | courses-master/pgm/p8/VisualizeDataset.m | 316 | utf_8 | 6cc0340af48645e3dae1185bb480284d | % Copyright (C) Daphne Koller, Stanford Univerity, 2012
%
% Author: Huayan Wang
function VisualizeDataset(Dataset)
f = figure;
for i=1:size(Dataset,1)
img = ShowPose(reshape(Dataset(i,:,:), [10 3]));
imshow(img);
pause(0.3)
if (~ishandle(f)) break; end; % quit loop when user closes the figure
end
|
github | facundoq/courses-master | MaxSpanningTree.m | .m | courses-master/pgm/p8/MaxSpanningTree.m | 2,102 | utf_8 | e2eb7e917fac0c48eb37d69923cae975 | function adj = MaxSpanningTree (weights)
% MAXSPANNINGTREE Maximum weight spanning tree
%
% adj = MaxSpanningTree(weights) takes an n-by-n weight matrix, which
% should be symmetric, and returns an adjacency list representation of
% the maximum weight spanning tree. The adjacency list will be directed,
% i.e... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/pgm/p8/submitWeb.m | 580 | utf_8 | 5f4510147426716d140b1e22e95d36d7 | % submitWeb Creates files from your code and output for web submission.
%
% If the submit function does not work for you, use the web-submission mechanism.
% Call this function to produce a file for the part you wish to submit. Then,
% submit the file to the class servers using the "Web Submission" button on ... |
github | facundoq/courses-master | SampleMultinomial.m | .m | courses-master/pgm/p8/SampleMultinomial.m | 302 | utf_8 | 1d4d597a8553fbb1755bcb12fc4896e4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012
function sample = SampleMultinomial(probabilities)
dice = rand(1,1);
accumulate = 0;
for i=1:length(probabilities)
accumulate = accumulate + probabilities(i);
if accumulate/sum(probabilities) > dice
break
end
end
sample = i;
|
github | facundoq/courses-master | PrintFactor.m | .m | courses-master/pgm/p8/PrintFactor.m | 526 | utf_8 | 7ab925539a614f01ebbef8c4c001d3c2 | % Copyright (C) Daphne Koller, Stanford University, 2012
function [] = PrintFactor(F)
% Pretty print the factor F.
% The first row lists the variables and subsequent rows are
% the joint assignment and their associated factor value in
% the last column.
for i=1:length(F.var)
fprintf(1, '%d\t', F.var(i... |
github | facundoq/courses-master | ConvertAtoG.m | .m | courses-master/pgm/p8/ConvertAtoG.m | 496 | utf_8 | 87fd4ba90b7e638012bb98d0af9ac21d | % File: ConvertAtoG.m
%
% Copyright (C) Daphne Koller, Stanford Univerity, 2012
%
% Author: Huayan Wang
function G = ConvertAtoG(A)
G = zeros(10,2);
A = A + A';
G(1,:) = [0 0];
visited = zeros(10,1);
visited(1) = 1;
cnt = 0;
while sum(visited) < 10
cnt = cnt+1;
for i=2:10
for j=1:10
if ... |
github | facundoq/courses-master | CompareData.m | .m | courses-master/pgm/p8/CompareData.m | 12,987 | utf_8 | 46835a49a414a167bfc299581ffef9fe | function retval = CompareData(data1, data2, context, Params)
% function retval = comparedata(data1, data2, context, Params)
% compares to see if data1 and data2 are roughly recursively equal. "Rough" here is defined by
% the Params. Note that matlabs ISEQUAL function is a test for exact equality. comparedata
% ... |
github | facundoq/courses-master | LearnCPDsGivenGraph.m | .m | courses-master/pgm/p8/LearnCPDsGivenGraph.m | 2,899 | utf_8 | 88e50af58081b14dae9a75a68d9881a7 | function [P loglikelihood] = LearnCPDsGivenGraph(dataset, G, labels)
%
% Inputs:
% dataset: N x 10 x 3, N poses represented by 10 parts in (y, x, alpha)
% G: graph parameterization as explained in PA description
% labels: N x 2 true class labels for the examples. labels(i,j)=1 if the
% the ith example belongs ... |
github | facundoq/courses-master | BlockLogDistribution.m | .m | courses-master/pgm/p5/BlockLogDistribution.m | 3,710 | utf_8 | 42cc8f2cd35bf3d6b17a1f48bec3fc68 | %BLOCKLOGDISTRIBUTION
%
% LogBS = BlockLogDistribution(V, G, F, A) returns the log of a
% block-sampling array (which contains the log-unnormalized-probabilities of
% selecting each label for the block), given variables V to block-sample in
% network G with factors F and current assignment A. Note that the var... |
github | facundoq/courses-master | ComputeExactMarginalsBP.m | .m | courses-master/pgm/p5/ComputeExactMarginalsBP.m | 2,013 | utf_8 | 356d51f3bd67254e5a4ff1a82fc31d4f | %COMPUTEEXACTMARGINALSBP Runs exact inference and returns the marginals
%over all the variables (if isMax == 0) or the max-marginals (if isMax == 1).
%
% M = COMPUTEEXACTMARGINALSBP(F, E, isMax) takes a list of factors F,
% evidence E, and a flag isMax, runs exact inference and returns the
% final marginals for ... |
github | facundoq/courses-master | rand2.m | .m | courses-master/pgm/p5/rand2.m | 445 | utf_8 | 56746621bedbc66c2099147b4952bb2f | % Copyright (C) Daphne Koller, Stanford University, 2012
function [val] = rand2(arg1,arg2)
val = -1;
gran = 1e6;
if(nargin>0&&ischar(arg1))
if(nargin==1)
arg2=1;
end
randi2(arg1,arg2);
val=0;
else
if(nargin==0)
val = randi2(1e6)/(1e6);
else
if(nargin==1)
if(length(arg1)>1)
arg2=a... |
github | facundoq/courses-master | EliminateVar.m | .m | courses-master/pgm/p5/EliminateVar.m | 1,346 | utf_8 | d107c19a06837def63e9460f88420c58 | % Function used in production of clique trees
%
% Copyright (C) Daphne Koller, Stanford University, 2012
function [newF C E] = EliminateVar(F, C, E, Z)
useFactors = [];
scope = [];
for i=1:length(F)
if any(F(i).var == Z)
useFactors = [useFactors i];
scope = union(scope, F(i).var);
end
end
% ... |
github | facundoq/courses-master | IndexToAssignment.m | .m | courses-master/pgm/p5/IndexToAssignment.m | 641 | utf_8 | 4500d5b7500f21f11c89b80922de3c42 | % IndexToAssignment Convert index to variable assignment.
%
% A = IndexToAssignment(I, D) converts an index, I, into the .val vector
% into an assignment over variables with cardinality D. If I is a vector,
% then the function produces a matrix of assignments, one assignment
% per row.
%
% See also Assignme... |
github | facundoq/courses-master | CliqueTreeCalibrate.m | .m | courses-master/pgm/p5/CliqueTreeCalibrate.m | 3,610 | utf_8 | 2c54be8808db19a03421528e2b0e6412 | %CLIQUETREECALIBRATE Performs sum-product or max-product algorithm for
%clique tree calibration.
% P = CLIQUETREECALIBRATE(P, isMax) calibrates a given clique tree, P
% according to the value of isMax flag. If isMax is 1, it uses max-sum
% message passing, otherwise uses sum-product. This function
% returns... |
github | facundoq/courses-master | ExtractMarginalsFromSamples.m | .m | courses-master/pgm/p5/ExtractMarginalsFromSamples.m | 1,091 | utf_8 | 529a32b21a4c107460200c7c4c5a8e6a | %EXTRACTMARGINALSFROMSAMPLES
%
% ExtractMarginalsFromSamples takes in a probabilistic network G, a list of samples, and a set
% of indices into samples that specify which samples to use in the computation of the
% marginals. The marginals are then computed using this subset of samples and returned.
%
% Samples... |
github | facundoq/courses-master | randsample.m | .m | courses-master/pgm/p5/randsample.m | 1,543 | utf_8 | 95e39083d2df80d0728c6cd3f1f7cb12 | %randsample(V,n,true,distribution) returns a set of n values sampled
% at random from the integers 1 through V with replacement using distribution
% 'distribution'
%
% replacing true with false causes sampling w/out replacement
% omitting the distribution causes a default to the uniform distribution
%
% Copyright (C) ... |
github | facundoq/courses-master | ClusterGraphCalibrate.m | .m | courses-master/pgm/p5/ClusterGraphCalibrate.m | 4,783 | utf_8 | bab6dc20ac0c332f92fb8cac27ee108d | % CLUSTERGRAPHCALIBRATE Loopy belief propagation for cluster graph calibration.
% P = CLUSTERGRAPHCALIBRATE(P, useSmart) calibrates a given cluster graph, G,
% and set of of factors, F. The function returns the final potentials for
% each cluster.
% The cluster graph data structure has the ... |
github | facundoq/courses-master | FactorMarginalization.m | .m | courses-master/pgm/p5/FactorMarginalization.m | 1,750 | utf_8 | c5e05c8d4059cb32dcd028428a787bb2 | % FactorMarginalization Sums given variables out of a factor.
% B = FactorMarginalization(A,V) computes the factor with the variables
% in V summed out. The factor data structure has the following fields:
% .var Vector of variables in the factor, e.g. [1 2 3]
% .card Vector of cardinalities corresp... |
github | facundoq/courses-master | VisualizeMCMCMarginals.m | .m | courses-master/pgm/p5/VisualizeMCMCMarginals.m | 2,554 | utf_8 | a52cdac6ed53a41190ef3528b2068e49 | % VISUALIZEMCMCMARGINALS
%
% This function accepts a list of sample lists, each from a different MCMC run. It then visualizes
% the estimated marginals for each variable in V over the lifetime of the MCMC run.
%
% samples_list - a list of sample lists; each sample list is a m-by-n matrix where m is the
% number of sam... |
github | facundoq/courses-master | smooth.m | .m | courses-master/pgm/p5/smooth.m | 431 | utf_8 | e49120038d1ea24bfca2efe6051e172a | % Copyright (C) Daphne Koller, Stanford University, 2012
function [YY] = smooth(Y,window)
if(~exist('window','var'))
window =5;
end
if(mod(window,2)==0)
window = window+1;
end
mid = (window+1)/2;
len = length(Y);
Smoother =zeros(len);
for i=1:len
dev = min([mid-1 min([i-1 len-i])]);
% dev
Smoother(i,(i-dev... |
github | facundoq/courses-master | FactorProduct.m | .m | courses-master/pgm/p5/FactorProduct.m | 2,357 | utf_8 | 06035e60b1296257aaf43c3e4e8aa15c | % FactorProduct Computes the product of two factors.
% C = FactorProduct(A,B) computes the product between two factors, A and B,
% where each factor is defined over a set of variables with given dimension.
% The factor data structure has the following fields:
% .var Vector of variables in the factor, e.g... |
github | facundoq/courses-master | LogProbOfJointAssignment.m | .m | courses-master/pgm/p5/LogProbOfJointAssignment.m | 341 | utf_8 | 3b24866daccab9ccaa5bde84906c38d2 | % Returns the log probability of an assignment A in a distribution defined by factors F
%
% Copyright (C) Daphne Koller, Stanford University, 2012
function logp = LogProbOfJointAssignment(F, A)
% work in log-space to prevent underflow
logp = 0.0;
for i = 1:length(F)
logp = logp + log(GetValueOfAssignment(F(i), A,... |
github | facundoq/courses-master | MHSWTrans.m | .m | courses-master/pgm/p5/MHSWTrans.m | 4,209 | utf_8 | 0be174e3fc7ff418bde5add3c6bde035 | % MHSWTRANS
%
% MCMC Metropolis-Hastings transition function that
% utilizes the Swendsen-Wang proposal distribution.
% A - The current joint assignment. This should be
% updated to be the next assignment
% G - The network
% F - List of all factors
% variant - a number (1 or 2) indicating the variant of Swe... |
github | facundoq/courses-master | submit.m | .m | courses-master/pgm/p5/submit.m | 37,742 | utf_8 | af0d03d5e8bbc6f624767b9f623ea8f8 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the pgm-class servers
% SUBMIT() will connect to the pgm-class server and submit your solution
% There is no penalty for submitting, so go ahead and try this!
%
% If this function does not work for you, use the web-submission mechanism.
% ... |
github | facundoq/courses-master | ConstructRandNetwork.m | .m | courses-master/pgm/p5/ConstructRandNetwork.m | 1,909 | utf_8 | 2e82a6321a69269141183b2b7039b4d4 | %
% This is a script that constructs the toy network and outputs toy_network and toy_factors into
% the environment. You should modify this file to change the parameters of the toy network.
%
% In this file, on_diag_weight represents the weight of the on-diagonal elements
% in your pairwise CPDs (weight of agreement) ... |
github | facundoq/courses-master | NaiveGetNextClusters.m | .m | courses-master/pgm/p5/NaiveGetNextClusters.m | 1,444 | utf_8 | 5e03b53b72309adfb59249640bf1a7ba | %NAIVEGETNEXTCLUSTERS Takes in a node adjacency matrix and returns the indices
% of the nodes between which the m+1th message should be passed.
%
% Output [i j]
% i = the origin of the m+1th message
% j = the destination of the m+1th message
%
% This method should iterate over the messages in increasing o... |
github | facundoq/courses-master | ComputeInitialPotentials.m | .m | courses-master/pgm/p5/ComputeInitialPotentials.m | 2,155 | utf_8 | 4e9e6a70ffa892c07c08a35886997c9b | %COMPUTEINITIALPOTENTIALS Sets up the cliques in the clique tree that is
%passed in as a parameter.
% P = COMPUTEINITIALPOTENTIALS(C) Takes the clique tree C which is a
% struct with three fields:
% - nodes: represents the cliques in the tree.
% - edges: represents the adjacency matrix of the tree.
% - facto... |
github | facundoq/courses-master | MHUniformTrans.m | .m | courses-master/pgm/p5/MHUniformTrans.m | 909 | utf_8 | 9caaed4d08c7265535717c36b0346ed1 | % MHUNIFORMTRANS
%
% MCMC Metropolis-Hastings transition function that
% utilizes the uniform proposal distribution.
% A - The current joint assignment. This should be
% updated to be the next assignment
% G - The network
% F - List of all factors
%
% Copyright (C) Daphne Koller, Stanford University, 2012
f... |
github | facundoq/courses-master | GetValueOfAssignment.m | .m | courses-master/pgm/p5/GetValueOfAssignment.m | 837 | utf_8 | 5be53ec21ee2dc20753b783db51acd8c | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor.
%
% v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment,
% A, in factor F. The order of the variables in A are assumed to be the
% same as the order in F.var.
%
% v = GETVALUEOFASSIGNMENT(F, A, VO) gets the va... |
github | facundoq/courses-master | GetNextCliques.m | .m | courses-master/pgm/p5/GetNextCliques.m | 2,759 | utf_8 | 7e4effa84213f2cc1c89be9b6030a174 | %GETNEXTCLIQUES Find a pair of cliques ready for message passing
% [i, j] = GETNEXTCLIQUES(P, messages) finds ready cliques in a given
% clique tree, P, and a matrix of current messages. Returns indices i and j
% such that clique i is ready to transmit a message to clique j.
%
% We are doing clique tree message... |
github | facundoq/courses-master | ComputeApproxMarginalsBP.m | .m | courses-master/pgm/p5/ComputeApproxMarginalsBP.m | 2,501 | utf_8 | 79b44b368b2f0f279d87127889a2d25b | % COMPUTEAPPROXMARGINALSBP Computation of approximate marginals using Loopy BP
% M = COMPUTEAPPROXMARGINALSBP(F,E ) returns the approximate marginals over
% each variable in F given the evidence E.
% .
% The Factor list F has the following fields:
% - .var: indices of variables in the specified cluste... |
github | facundoq/courses-master | MCMCInference.m | .m | courses-master/pgm/p5/MCMCInference.m | 5,439 | utf_8 | 768371c66ca6c9cc3282a00351974aac | % MCMCINFERENCE conducts Markov Chain Monte Carlo Inference.
% M = MCMCInference(G, F, E, ...) performs inference given a Markov Net or Bayes Net, G, a list
% of factors F, evidence E, and a list of parameters specifying the type of MCMC to be conducted.
%
% G is a data structure that represents the variables in the... |
github | facundoq/courses-master | test.m | .m | courses-master/pgm/p5/test.m | 10,034 | UNKNOWN | 6a95a3eaf85287a773b908a80b7159ae | function test(partId)
load('exampleIOPA5.mat');
% load intermediate test data
load('additionalINPUT.mat');
load('additionalOUTPUT.mat');
basicTestOnly = true;
partNames = validParts();
%partId = 8;
%promptPart();
len = length(partNames);
partNamesAlligned = char( partNames );
resu... |
github | facundoq/courses-master | AssignmentToIndex.m | .m | courses-master/pgm/p5/AssignmentToIndex.m | 619 | utf_8 | 661382a482d8cf78b002d5c8246997c7 | % AssignmentToIndex Convert assignment to index.
%
% I = AssignmentToIndex(A, D) converts an assignment, A, over variables
% with cardinality D to an index into the .val vector for a factor.
% If A is a matrix then the function converts each row of A to an index.
%
% See also IndexToAssignment.m
% Copyright (C... |
github | facundoq/courses-master | CreateCliqueTree.m | .m | courses-master/pgm/p5/CreateCliqueTree.m | 2,238 | utf_8 | 0b309fb32a6aee40615f6221d60a710e | %CREATECLIQUETREE Takes in a list of factors F, Evidence and returns a
%clique tree after calling ComputeInitialPotentials at the end.
%
% P = CREATECLIQUETREE(F, Evidence) Takes a list of factors and creates a clique
% tree. The value of the cliques should be initialized to
% the initial potential.
% It ret... |
github | facundoq/courses-master | CreateClusterGraph.m | .m | courses-master/pgm/p5/CreateClusterGraph.m | 2,408 | utf_8 | f54239100002ed18dd643b873bf58ac1 | %CREATECLUSTERGRAPH Takes in a list of factors and returns a Bethe cluster
% graph. It also returns an assignment of factors to cliques.
%
% C = CREATECLUSTERGRAPH(F) Takes a list of factors and creates a Bethe
% cluster graph with nodes representing single variable clusters and
% pairwise clusters. The value o... |
github | facundoq/courses-master | MHGibbsTrans.m | .m | courses-master/pgm/p5/MHGibbsTrans.m | 584 | utf_8 | e5aeeac414ae75d32be7c40c9c21ef5b | % MHGIBBSTRANS
%
% MCMC Metropolis-Hastings transition function that
% utilizes the Gibbs sampling distribution for proposals.
% A - The current joint assignment. This should be
% updated to be the next assignment
% G - The network
% F - List of all factors
%
% Copyright (C) Daphne Koller, Stanford Universit... |
github | facundoq/courses-master | SmartGetNextClusters.m | .m | courses-master/pgm/p5/SmartGetNextClusters.m | 1,378 | utf_8 | 7e53a36680e95eff4d3a54ae24fcc195 | %SMARTGETNEXTCLUSTERS Takes in a cluster graph and returns the indices
% of the nodes between which the next message should be passed.
%
% [i j] = SmartGetNextClusters(P,Messages,oldMessages,m,useSmart)
%
% INPUT
% P - our cluster graph
% Messages - the current values of all messages in P
% oldMessage... |
github | facundoq/courses-master | GibbsTrans.m | .m | courses-master/pgm/p5/GibbsTrans.m | 1,226 | utf_8 | bf858a096f35a7a68572a0d655045848 | % GIBBSTRANS
%
% MCMC transition function that performs Gibbs sampling.
% A - The current joint assignment. This should be
% updated to be the next assignment
% G - The network
% F - List of all factors
%
% Copyright (C) Daphne Koller, Stanford University, 2012
function A = GibbsTrans(A, G, F)
for i = 1:le... |
github | facundoq/courses-master | VariableToFactorCorrespondence.m | .m | courses-master/pgm/p5/VariableToFactorCorrespondence.m | 261 | utf_8 | 3753d22d33b7e9d537f0206e9f2b4cef | % Copyright (C) Daphne Koller, Stanford University, 2012
function V2F = VariableToFactorCorrespondence(V, F)
V2F = cell(length(V), 1);
for f = 1:length(F)
for i = 1:length(F(f).var)
v = F(f).var(i);
V2F{v} = union(V2F{v}, f);
end
end
|
github | facundoq/courses-master | EdgeToFactorCorrespondence.m | .m | courses-master/pgm/p5/EdgeToFactorCorrespondence.m | 482 | utf_8 | f19dad067571c11468f37577a9d3cd45 | % Returns a matrix that maps edges to a list of factors in which both ends partake
%
% Copyright (C) Daphne Koller, Stanford University, 2012
function E2F = EdgeToFactorCorrespondence(V, F)
E2F = cell(length(V), length(V));
for f = 1:length(F)
for i = 1:length(F(f).var)
for j = i+1:length(F(f).var)
... |
github | facundoq/courses-master | VisualizeToyImageMarginals.m | .m | courses-master/pgm/p5/VisualizeToyImageMarginals.m | 374 | utf_8 | 602459a57c77c43207714ba7c2946ab5 | % Copyright (C) Daphne Koller, Stanford University, 2012
function VisualizeToyImageMarginals(G, M, chain_num, tname)
n = sqrt(length(G.names));
marginal_vector = [];
for i = 1:length(M)
marginal_vector(end+1) = M(i).val(1);
end
clims = [0, 1];
imagesc(reshape(marginal_vector, n, n), clims);
colormap(gray);
title(... |
github | facundoq/courses-master | CompareData.m | .m | courses-master/pgm/p5/CompareData.m | 13,243 | utf_8 | 902e19647aeaa160c7022598ee7216c1 | function retval = CompareData(data1, data2, context, Params)
% function retval = comparedata(data1, data2, context, Params)
% compares to see if data1 and data2 are roughly recursively equal. "Rough" here is defined by
% the Params. Note that matlabs ISEQUAL function is a test for exact equality. comparedata
% ... |
github | facundoq/courses-master | randi2.m | .m | courses-master/pgm/p5/randi2.m | 833 | utf_8 | dc23d76ba987d86421edec3608801a95 | % Copyright (C) Daphne Koller, Stanford University, 2012
function [num mv] = randi2(arg1,arg2,arg3)
num = -1;
persistent x_i;
persistent p1;
persistent p2;
if(isempty(x_i))
x_i = 1;
p1 = 160481183;
p2 = 179424673;
end
mv=p2;
if(ischar(arg1)==1)
if(strcmp(arg1,'seed'))
if(nargin>1)
x_i = arg2;
... |
github | facundoq/courses-master | ConstructToyNetwork.m | .m | courses-master/pgm/p5/ConstructToyNetwork.m | 1,855 | utf_8 | 4c9893c3a2406aa03035453c960b537c | %
% This is a script that constructs the toy network and outputs toy_network and toy_factors into
% the environment. You should modify this file to change the parameters of the toy network.
%
% In this file, on_diag_weight represents the weight of the on-diagonal elements
% in your pairwise CPDs (weight of agreement) ... |
github | facundoq/courses-master | ObserveEvidence.m | .m | courses-master/pgm/p5/ObserveEvidence.m | 2,255 | utf_8 | 0c1f8aa8be9961574207ad2b51f43813 | % ObserveEvidence Modify a vector of factors given some evidence.
% F = ObserveEvidence(F, E) sets all entries in the vector of factors, F,
% that are not consistent with the evidence, E, to zero. F is a vector of
% factors, each a data structure with the following fields:
% .var Vector of variables in the... |
github | facundoq/courses-master | CheckConvergence.m | .m | courses-master/pgm/p5/CheckConvergence.m | 1,341 | utf_8 | 931f874e1d36552313de0c00ced791b2 | % CHECKCONVERGENCE Ascertain whether the messages indicate that we have converged
% converged = CHECKCONVERGENCE(MNEW,MOLD) compares lists of messages MNEW
% and MOLD. If the values listed in any message differs by more than the
% value 'thresh' then we determine that convergence has not occured and
% return... |
github | facundoq/courses-master | SetValueOfAssignment.m | .m | courses-master/pgm/p5/SetValueOfAssignment.m | 858 | utf_8 | b4bac186301f24d25a5386b74eb3b7d6 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor.
%
% F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment,
% A, in factor F to v. The order of the variables in A are assumed to be the
% same as the order in F.var.
%
% F = SETVALUEOFASSIGNMENT(F, A, v, VO) set... |
github | facundoq/courses-master | GetNextClusters.m | .m | courses-master/pgm/p5/GetNextClusters.m | 1,145 | utf_8 | a84f1fb4fed256545b55f8d59f74ce1c | %GETNEXTCLUSTERS Takes in a cluster graph and returns the indices
% of the nodes between which the next message should be passed.
%
% [i j] = GetNextClusters(P,Messages,oldMessages,m,useSmart)
%
% INPUT
% P - our cluster graph
% Messages - the current values of all messages in P
% oldMessages - the pr... |
github | facundoq/courses-master | IndexToAssignment.m | .m | courses-master/pgm/p1/IndexToAssignment.m | 599 | utf_8 | ae992bdc926d3d43576329d3737682a2 | % IndexToAssignment Convert index to variable assignment.
%
% A = IndexToAssignment(I, D) converts an index, I, into the .val vector
% into an assignment over variables with cardinality D. If I is a vector,
% then the function produces a matrix of assignments, one assignment
% per row.
%
% See also A... |
github | facundoq/courses-master | FactorMarginalization.m | .m | courses-master/pgm/p1/FactorMarginalization.m | 1,687 | utf_8 | c5126cec4ae7e4132f6f79d1a67f284b | % FactorMarginalization Sums given variables out of a factor.
% B = FactorMarginalization(A,V) computes the factor with the variables
% in V summed out. The factor data structure has the following fields:
% .var Vector of variables in the factor, e.g. [1 2 3]
% .card Vector of cardinalities cor... |
github | facundoq/courses-master | FactorProduct.m | .m | courses-master/pgm/p1/FactorProduct.m | 2,717 | utf_8 | 9874fb3791e811eb4adce3da37964b4a | % FactorProduct Computes the product of two factors.
% C = FactorProduct(A,B) computes the product between two factors, A and B,
% where each factor is defined over a set of variables with given dimension.
% The factor data structure has the following fields:
% .var Vector of variables in the factor,... |
github | facundoq/courses-master | submit.m | .m | courses-master/pgm/p1/submit.m | 22,993 | utf_8 | 20f7ffe38819e6ba53c2124ccc45221a | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the pgm-class servers
% SUBMIT() will connect to the pgm-class server and submit your solution
% There is no penalty for submitting, so go ahead and try this!
% Call this function without arguments (i.e. submit). Make sure your working
% ... |
github | facundoq/courses-master | StandardizeFactors.m | .m | courses-master/pgm/p1/StandardizeFactors.m | 581 | utf_8 | 372bcf4422698c44d7cbbec1b0135d85 | % Function that sorts the variables in F and returns an equivalent
% factor G. Used only to standardize output for grading purposes.
function G = StandardizeFactors(F)
G = struct('var', [], 'card', [], 'val', []);
for i = 1:length(F)
G(i) = StandardizeFactor(F(i));
end
function G = StandardizeFactor(F);
G = stru... |
github | facundoq/courses-master | GetValueOfAssignment.m | .m | courses-master/pgm/p1/GetValueOfAssignment.m | 806 | utf_8 | a63908225b529b3a7d605707c809a0a2 | % GetValueOfAssignment Gets the value of a variable assignment in a factor.
%
% v = GetValueOfAssignment(F, A) returns the value of a variable assignment,
% A, in factor F. The order of the variables in A are assumed to be the
% same as the order in F.var.
%
% v = GetValueOfAssignment(F, A, VO) gets the v... |
github | facundoq/courses-master | ComputeMarginal.m | .m | courses-master/pgm/p1/ComputeMarginal.m | 1,359 | utf_8 | 50ec7d9f7ae7c5c7775beb87277420e9 | %ComputeMarginal Computes the marginal over a set of given variables
% M = ComputeMarginal(V, F, E) computes the marginal over variables V
% in the distribution induced by the set of factors F, given evidence E
%
% M is a factor containing the marginal over variables V
% V is a vector containing the variab... |
github | facundoq/courses-master | AssignmentToIndex.m | .m | courses-master/pgm/p1/AssignmentToIndex.m | 601 | utf_8 | 2c6715c575574bb93ebc1dd4a52002ac | % AssignmentToIndex Convert assignment to index.
%
% I = AssignmentToIndex(A, D) converts an assignment, A, over variables
% with cardinality D to an index into the .val vector for a factor.
% If A is a matrix then the function converts each row of A to an index.
%
% See also IndexToAssignment.m and Fact... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/pgm/p1/submitWeb.m | 829 | utf_8 | f9a016a2c73dbb464925709b4f7c2f51 | % submitWeb Creates files from your code and output for web submission.
%
% If the submit function does not work for you, use the web-submission mechanism.
% Call this function to produce a file for the part you wish to submit. Then,
% submit the file to the class servers using the "Web Submission" button on ... |
github | facundoq/courses-master | ComputeJointDistribution.m | .m | courses-master/pgm/p1/ComputeJointDistribution.m | 1,278 | utf_8 | 41b372e9320ee16eaa9223b5ca0c2e6c | %ComputeJointDistribution Computes the joint distribution defined by a set
% of given factors
%
% Joint = ComputeJointDistribution(F) computes the joint distribution
% defined by a set of given factors
%
% Joint is a factor that encapsulates the joint distribution given by F
% F is a vector of factors (s... |
github | facundoq/courses-master | ObserveEvidence.m | .m | courses-master/pgm/p1/ObserveEvidence.m | 2,423 | utf_8 | b76369b00d0a2b324a3d8170874dece5 | % ObserveEvidence Modify a vector of factors given some evidence.
% F = ObserveEvidence(F, E) sets all entries in the vector of factors, F,
% that are not consistent with the evidence, E, to zero. F is a vector of
% factors, each a data structure with the following fields:
% .var Vector of variables in... |
github | facundoq/courses-master | SetValueOfAssignment.m | .m | courses-master/pgm/p1/SetValueOfAssignment.m | 1,155 | utf_8 | 8c432b1246dea3f405d525c595d2a82f | % SetValueOfAssignment Sets the value of a variable assignment in a factor.
%
% F = SetValueOfAssignment(F, A, v) sets the value of a variable assignment,
% A, in factor F to v. The order of the variables in A are assumed to be the
% same as the order in F.var.
%
% F = SetValueOfAssignment(F, A, v, VO) se... |
github | csjunxu/MLP_CVPR2012-master | NoiseLevel.m | .m | MLP_CVPR2012-master/NoiseLevel.m | 4,000 | utf_8 | 6d61ba1830a19d2a759739506e38da76 | % NoiseLevel estimates noise level of input single noisy image.
%
% [nlevel th num] = NoiseLevel(img,patchsize,decim,conf,itr)
%
%Output parameters
% nlevel: estimated noise levels.
% th: threshold to extract weak texture patches at the last iteration.
% num: number of extracted weak texture patches at the last iterat... |
github | csjunxu/MLP_CVPR2012-master | image2cols.m | .m | MLP_CVPR2012-master/image2cols.m | 591 | utf_8 | 395b9b1185e09e6098711da1c2d80898 | % Author: Harold Christopher Burger
% Date: March 19, 2012.
function res = image2cols(im, pSz, stride)
range_y = 1:stride:(size(im,1)-pSz+1);
range_x = 1:stride:(size(im,2)-pSz+1);
if (range_y(end)~=(size(im,1)-pSz+1))
range_y = [range_y (size(im,1)-pSz+1)];
end
if (range_x(end)~=(size(im,2)-pSz+... |
github | csjunxu/MLP_CVPR2012-master | cal_ssim.m | .m | MLP_CVPR2012-master/cal_ssim.m | 6,176 | utf_8 | 1c1d646ff93c59e1688f23f12a368e85 | function ssim = cal_ssim( im1, im2, b_row, b_col )
[h, w, ch] = size( im1 );
ssim = 0;
if ch==1
ssim = ssim_index( im1(b_row+1:h-b_row, b_col+1:w-b_col), im2( b_row+1:h-b_row, b_col+1:w-b_col) );
else
for i = 1:ch
ssim = ssim + ssim_index( im1(b_row+1:h-b_row, b_col+1:w-b_col, i), im2( b_row+1... |
github | csjunxu/MLP_CVPR2012-master | columns2im.m | .m | MLP_CVPR2012-master/columns2im.m | 746 | utf_8 | fb54087c3becffe0c7356d3158da922d | % Author: Harold Christopher Burger
% Date: March 19, 2012.
function res = columns2im(cols, im_sz, stride)
pSz = sqrt(size(cols,1));
res = zeros(im_sz(1), im_sz(2));
w = zeros(im_sz(1), im_sz(2));
range_y = 1:stride:(im_sz(1)-pSz+1);
range_x = 1:stride:(im_sz(2)-pSz+1);
if (range_y(end)~=(im_sz(1)... |
github | csjunxu/MLP_CVPR2012-master | fdenoiseNeural.m | .m | MLP_CVPR2012-master/fdenoiseNeural.m | 5,077 | utf_8 | 7a6566d9e70e544e5818063531fecdf5 | % FDENOISENEURAL Denoise a black and white image corrupted by AWG noise.
% denoisedIm = fdenoiseNeural(noisyIm, sigma, model)
% Given a noisy image, returns a denoised version of that image.
% The noise is assumed additive, white and Gaussian, with known and
% uniform variance.
%
% Inputs
% ------
% noi... |
github | csjunxu/MLP_CVPR2012-master | getPSNR.m | .m | MLP_CVPR2012-master/getPSNR.m | 426 | utf_8 | dc62e452a06fd8ef2f19ea26a77e2a6f | % Author: Harold Christopher Burger
% Date: March 19, 2012.
function PSNR = getPSNR(noisy, clean, maxVal)
%N = noisy;
%N(find(N>maxVal)) = maxVal;
%N(find(N<0)) = 0;
%noisy(noisy<0) = 0;
%noisy(noisy>maxVal) = maxVal;
Diff = noisy - clean;
%Diff = Diff(dx+1:end-dx, dx:1:end-dx);
RMSE = sqrt(mean(Diff(... |
github | Electromaxim/Fuel_consumption_prediction-master | importYearXLS.m | .m | Fuel_consumption_prediction-master/importYearXLS.m | 3,539 | utf_8 | 0ae7514cd0f1880740e31909c3729e0d | function data = importYearXLS(yr, dataDir)
% IMPORTYEARXLS Import fuel economy data (from Excel data files)
% DATA = IMPORTYEARXLS(YR) imports for the year YR. YR can be a scalar or
% a vector of years between 2000 and 2007.
%
% Example:
% data = importYearXLS(2005);
% data = importYearXLS([2000 2004]);... |
github | jte0419/Magic_Wine_Bottle_Holder-master | GUI_MWBH_1Bottle.m | .m | Magic_Wine_Bottle_Holder-master/GUI_MWBH_1Bottle.m | 54,509 | utf_8 | d1dcc291ec6c85a33d37a890cf372c99 | % Magic Wine Bottle Holder - 1 Bottle
% Written by: JoshTheEngineer
% Started: 05/15/16
% Updated: 05/15/16 - Transferring code over from Wine_Bottle_Holder_1Bottle.m
% 05/23/16 - Everything works as expected
% - Bottle angle plotting based on hole diameter works
function varargout = GUI_MWB... |
github | jte0419/Magic_Wine_Bottle_Holder-master | GUI_MWBH_2Bottle.m | .m | Magic_Wine_Bottle_Holder-master/GUI_MWBH_2Bottle.m | 68,045 | utf_8 | c1a603922d969da601e02ee1cd5542b8 | % Magic Wine Bottle Holder - 2 Bottle
% Written by: JoshTheEngineer
% Started: 05/15/16
% Updated: 05/15/16 - Transferring code over from Wine_Bottle_Holder_1Bottle.m
% 05/24/16 - Everything works as expected
% - Bottle angle plotting based on hole diameter works
function varargout = GUI_MWB... |
github | johnnychien85/seq2map-master | monovo.m | .m | seq2map-master/scripts/matlab/monovo.m | 15,997 | utf_8 | 0464e7f3e77fdcc82cd18d76d95f1f75 | % MONOVO presents an implementation of monocular visual odometry using
% feature tracking, motion from essential matrix decomposition,
% motion by solving perspective-n-point and particle filtering.
function [M,egomo,stats,pc] = monovo(seq,cam,alpha)
includes;
if nargin < 2, cam = 1; end
if nargin < 3, alpha = ... |
github | johnnychien85/seq2map-master | demo_bayesian.m | .m | seq2map-master/scripts/matlab/demo/demo_bayesian.m | 705 | utf_8 | 0f0fbbbb303494648e59536a58db79b9 | function demo_bayesian(x0,C0,x1,C1)
K = C0 * inv(C0 + C1);
x = x0 + (x1 - x0) * K';
C = K * C1;
figure; grid on; hold on;
drawEllipsoid(x0,C0,[.4,.4,.4],0.1);
drawEllipsoid(x1,C1,[.4,.4,.4],0.2);
drawEllipsoid(x,C,'red',0.3);
end
function drawEllipsoid(u,C,color,alpha)
[V,D] = eig(C);... |
github | johnnychien85/seq2map-master | demo_epimatch.m | .m | seq2map-master/scripts/matlab/demo/demo_epimatch.m | 2,203 | utf_8 | b1fe1ae7603674fe83b3ca25216cc64b | function [zk,vk,nk] = demo_epimatch(I0,K,I,M,x)
m = size(M,3);
% select a point
figure; imshow(I0); hold on;
if nargin < 5
x = zeros(2,1);
[x(1),x(2)] = ginput(1);
end
plot(x(1),x(2),'ro');
% get fundamental matrices
F = zeros(3,3,m);
for i = 1 : m
F(:,:,i... |
github | johnnychien85/seq2map-master | demo_TwoViews.m | .m | seq2map-master/scripts/matlab/demo/demo_TwoViews.m | 1,311 | utf_8 | 42c822bb0f6f563158ebc8233133dfc1 | function demo_TwoViews
K = [720,0,320;0,720,240;0,0,1];
imageSize = [480,640];
frm = makeFrame(imageSize(1),imageSize(2));
frm = frm * inv(K)';
M0 = eye(4);
M0(1:3,1:3) = angle2dcm(0,deg2rad(-45),0)';
M0(1:3,4) = M0(1:3,1:3) * [ 2,0,0]';
M1 = eye(4);
M1(1:3,1:3) = angle2dcm(0,deg2rad(... |
github | johnnychien85/seq2map-master | demo_emat2mot.m | .m | seq2map-master/scripts/matlab/demo/demo_emat2mot.m | 2,013 | utf_8 | c9a606ab65f875f6cf241c028cca3ea8 | function demo_emat2mot(K)
n = 50;
x = rand(n,3)*3;
x(:,1:2) = bsxfun(@minus,x(:,1:2),mean(x(:,1:2)));
M = eye(4);
M(1:3,1:3) = angle2dcm(deg2rad(rand(1)*5),deg2rad(rand(1)*10),0)';
M(1:3,4) = M(1:3,1:3)' * [1,0,0]';
x0 = homo2eucl(x*K');
x1 = homo2eucl(eucl2homo(x)*M(1:3,:)'*K');
M
M = pts2mot(x0,x1,K)
end
... |
github | johnnychien85/seq2map-master | dp2stx.m | .m | seq2map-master/scripts/matlab/miscs/dp2stx.m | 24,229 | utf_8 | 529b3312ee7a19c3875c091bdf715468 | % STX = dp2stx(DP) builds stixel representation STX from disparity map DP
% following Badino et. al's paper "The Stixel World" published in 2009[1]. The
% built stx is stored as an array of structure that comes with feilds x, y,
% width, height, and d (disparity of stixel). When the disparity-depth ratio is
% known, us... |
github | johnnychien85/seq2map-master | stxcmp.m | .m | seq2map-master/scripts/matlab/miscs/stxcmp.m | 1,202 | utf_8 | cc7f1da5d485721b49875f51428aa10a | % [TP,TN,FP,FN,ERR] = stxcmp(STX,GND,SZ) compares extracted stixels STX against
% ground truth stixels GND. The comparison concludes the differences as
% true positives TP, true negatives TN, false positives FP, and false negatives
% FN. The comparison based on the disparity maps in size SZ converted from both
% stixel... |
github | johnnychien85/seq2map-master | stx2dp.m | .m | seq2map-master/scripts/matlab/miscs/stx2dp.m | 557 | utf_8 | 024cb53d2aae4fc6a4b902de32f918de | % DP = stx2dp(STX,SZ) converts stixels STX to DP the dense disparity-based
% representation. The size of the disparity map is defined by SZ.
%
% See also: dp2stx.
%
function [dp,lbl] = stx2dp(stx,sz)
dp = zeros(sz);
lbl = zeros(sz,'uint16');
for i = 1 : numel(stx)
x0 = max(round(stx(i).x),1);
... |
github | johnnychien85/seq2map-master | cerv.m | .m | seq2map-master/scripts/matlab/miscs/cerv.m | 402 | utf_8 | 0c86aead787c54e33821475e3966135f | % cerv Varient of HSV
% cerv(M), a variant of HSV(M), is an M-bt-3 matrix contraining
% colours start with red (hue=10) and end with dark blue (hue=220).
% An extra pink (hue=285) is inserted in the end to distinguish
% values reaching the maximum of the range.
function rgb = cerv(M)
if nargin < 1, M = 256; end
... |
github | johnnychien85/seq2map-master | val2rgb.m | .m | seq2map-master/scripts/matlab/miscs/val2rgb.m | 390 | utf_8 | fc4accb404daebd578c552ee5e9c6269 | function [rgb,ind] = val2rgb(val,map,lim,toUInt8)
if nargin < 3, lim = [prctile(val,5),prctile(val,95)]; end
if nargin < 4, toUInt8 = false; end
ind = round(satnorm(val,lim(1),lim(2)) * (size(map,1) - 1)) + 1;
rgb = ind2rgb(ind,map);
if toUInt8, rgb = uint8(rgb*255); end
end
function x = satno... |
github | johnnychien85/seq2map-master | slicearray.m | .m | seq2map-master/scripts/matlab/miscs/slicearray.m | 297 | utf_8 | 0ec64148bce384898b66a7af17c6e76e | % [A1,A2,A3,...] = SLICEARRAY(A) slices array A into submatrices A1, A2, A3,...
% along the last dimension of A.
function varargout = slicearray(A)
dims = size(A);
A = reshape(A,[],dims(end));
for k = 1 : size(A,2)
varargout{k} = reshape(A(:,k),[dims(1:end-1),1]);
end
end |
github | johnnychien85/seq2map-master | imblend.m | .m | seq2map-master/scripts/matlab/miscs/imblend.m | 655 | utf_8 | 449d252c04028fee8e2bd278b6521601 | function im = imblend(varargin)
n = numel(varargin);
a = mkmap(n);
for k = 1 : n
Ik = varargin{k};
if size(Ik,3) > 1, Ik = rgb2gray(Ik); end
if k == 1, im = zeros(size(Ik,1),size(Ik,2),3,'uint8'); end
Ik = histeq(Ik);
im(:,:,1) = im(:,:,1) + a(... |
github | johnnychien85/seq2map-master | loadLiDARData.m | .m | seq2map-master/scripts/matlab/io/loadLiDARData.m | 1,636 | utf_8 | bc86014287291ab5d563de9a36e4a638 | function [ld,idx] = loadLiDARData(lid, frame, varargin)
po = parseArgs(varargin{:});
switch lid.Format
case {'VLD64', 'VLD32', 'VLP16'}
[ld.data,ld.theta] = VLDLoadData(lid.DataFiles{frame}, lid.Format);
[~,ld.reflx] = VLDData2RangeReflx(ld.data);
[ld.points,ld.valid... |
github | johnnychien85/seq2map-master | stx2xml.m | .m | seq2map-master/scripts/matlab/io/stx2xml.m | 936 | utf_8 | d862ee141ba97cef2ae6b8975350751d | % stx2xml(STX,XML) stores stixels STX to an xml file XML following the format
% specified by the Daimler's 6D-Vision Ground Truth Stixel Dataset[1].
%
% References:
% [1] http://www.6d-vision.com/ground-truth-stixel-dataset
%
% See also: xml2stx.
%
function stx2xml(stx,xml,stixelWidth)
if nargin < 3
if ~i... |
github | johnnychien85/seq2map-master | raw2seq.m | .m | seq2map-master/scripts/matlab/io/raw2seq.m | 24,296 | utf_8 | 3f716392d0284a974ce34dd167a57c56 | function seq = raw2seq(seqPath)
if nargin < 1, seqPath = uigetdir(); end
fprintf('Loading VO + LiDAR sequence [%s]..\n', seqPath);
kittiCalibPath = fullfile(seqPath, 'calib.txt');
kittiIMUPath = fullfile(seqPath, 'oxts');
ccsadSeqPath = fullfile(seqPath, 'sequence_data.txt');
stixelCamPath =... |
github | johnnychien85/seq2map-master | chkseq.m | .m | seq2map-master/scripts/matlab/io/chkseq.m | 2,784 | utf_8 | 5bf99a351c4f1233c3ebf2a532b9f5f6 | function chkseq(seq,varargin)
po = parseArgs(seq,varargin{:});
cam = seq.cam(po.Camera);
if po.LiDAR > 0, lid = seq.lid(po.LiDAR);
else lid = []; end
if isempty(lid), po.ShowLiDARPoints = false; end
hasVision = exist('vision.VideoPlayer') ~= 0;
hasMotion = size(cam.M,3) > 0;
if ha... |
github | johnnychien85/seq2map-master | xml2stx.m | .m | seq2map-master/scripts/matlab/io/xml2stx.m | 1,665 | utf_8 | d65b2e09e3348e78d5b9e9cefac1ac46 | % STX = xml2stx(XML) reads stixels STX from file XML following the format
% specified by the Daimler's 6D-Vision Ground Truth Stixel Dataset[1].
%
% References:
% [1] http://www.6d-vision.com/ground-truth-stixel-dataset
%
% See also: stx2xml.
%
function stx = xml2stx(xml)
doc = xmlread(xml);
root = doc.getDoc... |
github | johnnychien85/seq2map-master | pts2ply.m | .m | seq2map-master/scripts/matlab/io/pts2ply.m | 2,895 | utf_8 | a71a5d1bd5d2a55b50f5a4f547551814 | function pts2ply(pts,ply,varargin)
po = parseInput(pts,ply,varargin{:});
f = fopen(ply,'wb');
assert(f ~= -1, 'error opening file for writing');
if isemptsy(po.colormap), po.colormap = uint8(jet(64) * 255);
elseif isfloat(po.colormap), po.colormap = uint8(po.colormap * 255);
end
if is... |
github | johnnychien85/seq2map-master | loadFeatures.m | .m | seq2map-master/scripts/matlab/io/loadFeatures.m | 1,909 | utf_8 | 0c4facebcc53f6092845bd24646cf063 | function F = loadFeatures(cam,frame)
filename = cam.FeatureFiles{frame};
f = fopen(filename,'r');
magic = char(fread(f,[1,8],'char'));
if ~strcmp(magic,'IMKPTDSC')
fclose(f);
error 'magic number check failed';
end
keypointFormat = fscanf(f,'%s',1);
descriptorNorm = fscanf(f,'%s',1);
descriptorType = fs... |
github | johnnychien85/seq2map-master | raw2mat.m | .m | seq2map-master/scripts/matlab/io/raw2mat.m | 1,295 | utf_8 | 6b34a0ff5e90adfe1f13e5aee18a565f | function x = raw2mat(from,m,n,s)
f = fopen(from,'r');
if nargin < 2 || isstr(m)
if nargin < 2, x = loadCvMat(f);
else x = loadCvMat(f,m);
end
else
if nargin < 3, s = 'int16'; end;
x = fread(f,[n m],s)';
end
fclose(f);
end
function x = loadCvMat(f,s)
m... |
github | johnnychien85/seq2map-master | compareMotion.m | .m | seq2map-master/scripts/matlab/tests/compareMotion.m | 3,545 | utf_8 | ee7de4866a428914ddf4949fbb166072 | function [ER,Et,Tr,Ta,milestones,fig] = compareMotion(m0,m1,lbl,mks,tn,unit)
if ~iscell(m1), m1 = {m1}; end;
if nargin < 3 || isempty(lbl), for k = 0 : numel(m1), lbl{k+1} = sprintf('M%d', k); end; end
if nargin < 4 || isempty(mks), for k = 0 : numel(m1), mks{k+1} = '-'; end; end
if nargin < 5 || i... |
github | johnnychien85/seq2map-master | submot.m | .m | seq2map-master/scripts/matlab/math/submot.m | 487 | utf_8 | 08cc42eb5c9696ddb841511080ac6e06 | % SUBMOT computes local transformation between two
% frames given a global transformation stack M.
function Mij = submot(M,ti,tj)
% subtract the motion of the subsequence defined by ti
if nargin < 3
Mij = zeros(4,4,numel(ti));
M0 = invmot(M(:,:,ti(1)));
for k = 1 : numel(ti)
... |
github | johnnychien85/seq2map-master | cam2rect.m | .m | seq2map-master/scripts/matlab/math/cam2rect.m | 785 | utf_8 | 92cdb3e39dd5387f24aeb58bdeb4d0cb | % CAM2RECT derives rectified patameters from two cameras in canonical geometry
function rect = cam2rect(pri,sec)
rect.fu = pri.K(1,1);
rect.fv = pri.K(2,2);
rect.uc = pri.K(1,3);
rect.vc = pri.K(2,3);
% verify that both cameras are rectified together
assert(sec.K(1,1) == rect.fu && sec.K(2,2) =... |
github | johnnychien85/seq2map-master | el2hole.m | .m | seq2map-master/scripts/matlab/math/el2hole.m | 2,536 | utf_8 | b5ccb6a2233bbafe377711c50fbb0c1a | % EL2HOLE finds potholes from a DEM.
function holes = el2hole(el,zgrid,xgrid,im,cam,rcs)
% elevation threshold to consider a local peak to be a seed to
% find a possible pothole
Emax = -.025; % focus on cells below -2.5cm of the road surface
% tolerance to consider a cell connected to a pothole cell
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.