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 | smahanthi/Video-Stabilization-in-Matlab-master | exindex.m | .m | Video-Stabilization-in-Matlab-master/exindex.m | 9,558 | utf_8 | 346f70c9838845286b1533cf6bcef65a | function arr = exindex(arr, varargin)
%EXINDEX extended array indexing
% ARROUT = EXINDEX(ARRIN, S1, S2, ...) indexes a virtual array made by
% extending ARRIN with zeros in all directions, using subscripts S1, S2
% etc.
%
% ARROUT = EXINDEX(ARRIN, S1, R1, S2, R2, ...) extends ARRIN using rule
% R1 on the fir... |
github | smahanthi/Video-Stabilization-in-Matlab-master | affine_flowdisplay.m | .m | Video-Stabilization-in-Matlab-master/affine_flowdisplay.m | 2,998 | utf_8 | b23c3e4af5fcf7ede18af8440be73639 | function affine_flowdisplay(flow, im, step, col)
%AFFINE_FLOWDISPLAY Display affine flow field.
% AFFINE_FLOWDISPLAY(FLOW, IM) takes FLOW, a structure returned by
% AFFINE_FLOW and an image IM. Vectors are drawn on the image
% representing the flow at selection of points. The point at which the
% flow is comput... |
github | MASSmagic/MASSmagic-master | spaceflight.m | .m | MASSmagic-master/spaceflight.m | 16,479 | utf_8 | 8cd2be271a8276245b22fb48cd3f0914 | function varargout = spaceflight(varargin)
% SPACEFLIGHT MATLAB code for spaceflight.fig
% SPACEFLIGHT, by itself, creates a new SPACEFLIGHT or raises the existing
% singleton*.
%
% H = SPACEFLIGHT returns the handle to a new SPACEFLIGHT or the handle to
% the existing singleton*.
%
% SPACEFLIG... |
github | MASSmagic/MASSmagic-master | plot_google_map.m | .m | MASSmagic-master/plot_google_map.m | 19,735 | utf_8 | 8e6315b4e274d0b0a35ac7396a3411a6 | function varargout = plot_google_map(varargin)
% function h = plot_google_map(varargin)
% Plots a google map on the current axes using the Google Static Maps API
%
% USAGE:
% h = plot_google_map(Property, Value,...)
% Plots the map on the given axes. Used also if no output is specified
%
% Or:
% [lonVec latVec imag] = ... |
github | MASSmagic/MASSmagic-master | gui.m | .m | MASSmagic-master/MassMusic/gui.m | 4,936 | utf_8 | ed119c2547efbcf165bf65ff8961886c | function varargout = gui(varargin)
% GUI MATLAB code for gui.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% ... |
github | runngezhang/retarget-toolkit-master | random_sampling.m | .m | retarget-toolkit-master/VideoMontage/release/random_sampling.m | 1,027 | utf_8 | 557586d8d5b5f0bd61957001977879da | % random sampling patches from an image
function A = random_sampling(img, patch_size, patch_increment)
d = size(img);
width = d(2);
height = d(1);
channel = d(3);
% size of the patch, each channel will be align and merge into 1 column
patch_total = patch_size * patch_size * channel;
% number of patches in the... |
github | runngezhang/retarget-toolkit-master | col_convert.m | .m | retarget-toolkit-master/VideoMontage/release/col_convert.m | 635 | utf_8 | 665c84f8cc48ac8bcfa6c88cd9cb25ec | % convert an matrix to col
% input number of channel of the matrix for efficiency
% matrix = [col1, col2 .. coln] x 3 channel
% output =
% col1 (channel1)
% col2
% ..
% coln
% col1 (channel2)
% etc
%
function col = col_convert(matrix)
d = size(matrix);
width = d(2);
height = d(1);
cha... |
github | runngezhang/retarget-toolkit-master | col_to_matrix.m | .m | retarget-toolkit-master/VideoMontage/release/col_to_matrix.m | 431 | utf_8 | 05690aa1c220f2ecda57d9a41c3fb489 | % convert a col of pixel to matrix
function matrix = col_to_matrix(col, width, height, channel)
matrix = ones(height, width, channel);
for ch = 1:1:channel
for i = 1:1:width
for j = 1:1:height
index = col_index(i, j, ch, width, height, ... |
github | runngezhang/retarget-toolkit-master | extend_img_sparsecoding.m | .m | retarget-toolkit-master/VideoMontage/release/extend_img_sparsecoding.m | 1,971 | utf_8 | 1ab941f8dae83dff52b321c744fdb730 | % extend the image by 1 pixel using sparse coding method
% - A: dictionary
% - overlap_A_left: dictionary when consider only a left region as roi
% - size: size of the patch
function img = extend_img_sparsecoding(input_img, A, roi_A_left, patch_size)
addpath('CVPR08SR/Sparse Coding');
d = size(input... |
github | runngezhang/retarget-toolkit-master | roi_matrix_left.m | .m | retarget-toolkit-master/VideoMontage/release/roi_matrix_left.m | 717 | utf_8 | 8031736dc1f53453e51a7a62d802e025 | % extract a left region of a patch
% input:
% - size: size of the patch
% - channel: number of channel
% - reduce_size: new size ( < size)
% usage: create new (reduced) Dictionary
% matrix * D = new_D;
function matrix = roi_matrix_left(size, channel, reduce_size)
old_size = size * size * channel;
new_... |
github | runngezhang/retarget-toolkit-master | col_index.m | .m | retarget-toolkit-master/VideoMontage/release/col_index.m | 397 | utf_8 | 2eafb2cd767b0670ab90ca9863b624ad | % calculate the col_index of a pixel after converting to col
% - width/height/channel: width, height and number of channels of a patch
% - x, y, ch: position and channel of the pixel (start from 1)
function index = col_index(x, y, ch, width, height, channel)
index = 0;
index = index + width * height * (ch ... |
github | runngezhang/retarget-toolkit-master | extraction_matrix.m | .m | retarget-toolkit-master/VideoMontage/release/extraction_matrix.m | 874 | utf_8 | fc0573b0b996cb896bdec10071d70a2e | % form a extraction matrix base on a mask
% e.g mask:
% [ 1 1 1 1 1
% 1 1 1 0 0
% 1 1 1 0 0 ]
% -> omit all 0's entries
% extraction matrix is used to extract from column
% by cascade col of the target matrix
% @param: number of channel
function matrix = extraction_matrix(mask_matrix)
[height, width, ... |
github | runngezhang/retarget-toolkit-master | get_identical_pixel.m | .m | retarget-toolkit-master/VideoMontage/release/get_identical_pixel.m | 420 | utf_8 | 2d33455b47f294a8b0d4c4a9dc7ac0dd | % take 2 images, measure the number of pixels which are identical
function [id_pixel] = get_identical_pixel(img1, img2)
[height, width, channel] = size(img1);
id_pixel = 0;
for w = 1:1:width
for h = 1:1:height
diff = img1(h,w,1) - img2(h,w,1);
if(diff == 0)
id_pixel = id_pixel + ... |
github | runngezhang/retarget-toolkit-master | countElement.m | .m | retarget-toolkit-master/VideoMontage/release/countElement.m | 400 | utf_8 | 24bf367c52c3584dc57b74e428effbc2 | % count number of occurence of 'element' in matrix
function count = countElement(matrix, element)
[height, width, channel] = size(matrix);
count = 0;
for x = 1:1:width
for y = 1:1:height
for z = 1:1:channel
if matrix(y, x, z) == element
count =... |
github | runngezhang/retarget-toolkit-master | rnd_smp_dictionary.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/rnd_smp_dictionary.m | 2,976 | utf_8 | 9adf036e93a1415368dd635300ac528d | function [Xh, Xl] = rnd_smp_dictionary(tr_dir, patch_size, zooming, num_patch)
fpath = fullfile(tr_dir, '*.bmp');
img_dir = dir(fpath);
Xh = [];
Xl = [];
img_num = length(img_dir);
nums = zeros(1, img_num);
for num = 1:length(img_dir),
im = imread(fullfile(tr_dir, img_dir(num).name));
nums(num)... |
github | runngezhang/retarget-toolkit-master | l2ls_learn_basis_dual.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/Sparse coding/l2ls_learn_basis_dual.m | 2,371 | utf_8 | c186ba98bb109153d97867df8489ca4b | function B = l2ls_learn_basis_dual(X, S, l2norm, Binit)
% Learning basis using Lagrange dual (with basis normalization)
%
% This code solves the following problem:
%
% minimize_B 0.5*||X - B*S||^2
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% The detail of the algorithm is describe... |
github | runngezhang/retarget-toolkit-master | l1ls_featuresign.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/Sparse coding/l1ls_featuresign.m | 7,403 | utf_8 | 45a3b69aedbcba3d4d2655651475961d | function Xout = l1ls_featuresign (A, Y, gamma, Xinit)
% The feature-sign search algorithm
% L1-regularized least squares problem solver
%
% This code solves the following problem:
%
% minimize_s 0.5*||y - A*x||^2 + gamma*||x||_1
%
% The detail of the algorithm is described in the following paper:
% 'Effic... |
github | runngezhang/retarget-toolkit-master | sparse_coding.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/Sparse coding/sparse_coding.m | 7,494 | utf_8 | 78d19babbcc5196c187226e728042870 | function [B S stat] = sparse_coding(X_total, num_bases, beta, sparsity_func, epsilon, num_iters, batch_size, fname_save, pars, Binit, resample_size)
% Fast sparse coding algorithms
%
% minimize_B,S 0.5*||X - B*S||^2 + beta*sum(abs(S(:)))
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% T... |
github | runngezhang/retarget-toolkit-master | feature_sign.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/Solver/feature_sign.m | 3,030 | utf_8 | 7e22735a12749708aa0c8d1b6d2ed847 | % Feature sign search
% code by Wang Jinjun @ NEC Research Lab America
% reference
% Efficient sparse coding algorithms
% Honglak Lee Alexis Battle Rajat Raina Andrew Y. Ng
% Computer Science Department
% Stanford University
% Stanford, CA 94305
function [x]=feature_sign(B,y,lambda,init_x)... |
github | runngezhang/retarget-toolkit-master | SolveLasso.m | .m | retarget-toolkit-master/VideoMontage/release/CVPR08SR/Solver/SolveLasso.m | 10,877 | utf_8 | 154185b8b87a985e0a059e49009b60dd | function [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType, maxIters, lambdaStop, resStop, solFreq, verbose, OptTol)
% SolveLasso: Implements the Lars/Lasso algorithms
% Usage
% [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType,
% maxIters, lambdaStop, resStop, solFreq, verbose, ... |
github | runngezhang/retarget-toolkit-master | A_fhp.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Measurements/A_fhp.m | 576 | utf_8 | 546e3a8b121df921d171522cafec09af | % A_fhp.m
%
% Takes measurements in the upper half-plane of the 2D Fourier transform.
%
% Usage: b = A_fhp(x, OMEGA)
%
% x - N vector
%
% b - K vector = [mean; real part(OMEGA); imag part(OMEGA)]
%
% OMEGA - K/2-1 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept... |
github | runngezhang/retarget-toolkit-master | At_fhp.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Measurements/At_fhp.m | 613 | utf_8 | e42938636cace8af895181b10ca2fa1c | % At_fhp.m
%
% Adjoint of At_fhp (2D Fourier half plane measurements).
%
% Usage: x = At_fhp(b, OMEGA, n)
%
% b - K vector = [mean; real part(OMEGA); imag part(OMEGA)]
%
% OMEGA - K/2-1 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% n - Image is nxn pixe... |
github | runngezhang/retarget-toolkit-master | A_f.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Measurements/A_f.m | 659 | utf_8 | 21e5a10a1fc2848a7455f0901d893064 | % A_f.m
%
% Takes "scrambled Fourier" measurements.
%
% Usage: b = A_f(x, OMEGA, P)
%
% x - N vector
%
% b - K vector = [real part; imag part]
%
% OMEGA - K/2 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% P - Permutation to apply to the input vector. F... |
github | runngezhang/retarget-toolkit-master | LineMask.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Measurements/LineMask.m | 832 | utf_8 | 42787892f182a5dbbca55315f88daaec | % LineMask.m
%
% Returns the indicator of the domain in 2D fourier space for the
% specified line geometry.
% Usage : [M,Mh,mi,mhi] = LineMask(L,N)
%
% Written by : Justin Romberg
% Created : 1/26/2004
% Revised : 12/2/2004
function [M,Mh,mi,mhi] = LineMask(L,N)
thc = linspace(0, pi-pi/L, L);
%thc = linspace(pi/(2... |
github | runngezhang/retarget-toolkit-master | At_f.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Measurements/At_f.m | 718 | utf_8 | c3639ceb479abeddedfe954c615b1f6d | % At_f.m
%
% Adjoint for "scrambled Fourier" measurements.
%
% Usage: x = At_f(b, N, OMEGA, P)
%
% b - K vector = [real part; imag part]
%
% N - length of output x
%
% OMEGA - K/2 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% P - Permutation to apply to... |
github | runngezhang/retarget-toolkit-master | l1qc_newton.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/l1qc_newton.m | 4,179 | utf_8 | cdde96758d798b69058786d513ccd590 | % l1qc_newton.m
%
% Newton algorithm for log-barrier subproblems for l1 minimization
% with quadratic constraints.
%
% Usage:
% [xp,up,niter] = l1qc_newton(x0, u0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,u0 - starting points
%
% A - Either a handle to a... |
github | runngezhang/retarget-toolkit-master | tvqc_newton.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tvqc_newton.m | 5,563 | utf_8 | 145140735523055b7609d25a8002b8b7 | % tvqc_newton.m
%
% Newton algorithm for log-barrier subproblems for TV minimization
% with quadratic constraints.
%
% Usage:
% [xp,tp,niter] = tvqc_newton(x0, t0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,t0 - starting points
%
% A - Either a handle to a... |
github | runngezhang/retarget-toolkit-master | cgsolve.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/cgsolve.m | 1,691 | utf_8 | d1e3c459a716b242d537a40c89e6f823 | % cgsolve.m
%
% Solve a symmetric positive definite system Ax = b via conjugate gradients.
%
% Usage: [x, res, iter] = cgsolve(A, b, tol, maxiter, verbose)
%
% A - Either an NxN matrix, or a function handle.
%
% b - N vector
%
% tol - Desired precision. Algorithm terminates when
% norm(Ax-b)/norm(b) < tol .
%
% ma... |
github | runngezhang/retarget-toolkit-master | tvdantzig_newton.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tvdantzig_newton.m | 5,985 | utf_8 | 98f96bec8c5aacc8fd99b2b69f412564 | % tvdantzig_newton.m
%
% Newton iterations for TV Dantzig log-barrier subproblem.
%
% Usage : [xp, tp, niter] = tvdantzig_newton(x0, t0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,t0 - Nx1 vectors, initial points.
%
% A - Either a handle to a f... |
github | runngezhang/retarget-toolkit-master | l1eq_pd.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/l1eq_pd.m | 5,311 | utf_8 | 73af9d721e0a46b4e78ee82491bce30e | % l1eq_pd.m
%
% Solve
% min_x ||x||_1 s.t. Ax = b
%
% Recast as linear program
% min_{x,u} sum(u) s.t. -u <= x <= u, Ax=b
% and use primal-dual interior point method
%
% Usage: xp = l1eq_pd(x0, A, At, b, pdtol, pdmaxiter, cgtol, cgmaxiter)
%
% x0 - Nx1 vector, initial point.
%
% A - Either a handle to a function t... |
github | runngezhang/retarget-toolkit-master | l1decode_pd.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/l1decode_pd.m | 4,844 | utf_8 | fdd14a32e87c75e30099109739d8751a | % l1decode_pd.m
%
% Decoding via linear programming.
% Solve
% min_x ||b-Ax||_1 .
%
% Recast as the linear program
% min_{x,u} sum(u) s.t. -Ax - u + y <= 0
% Ax - u - y <= 0
% and solve using primal-dual interior point method.
%
% Usage: xp = l1decode_pd(x0, A, At, y, pdtol, pdmaxiter, cgtol... |
github | runngezhang/retarget-toolkit-master | l1dantzig_pd.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/l1dantzig_pd.m | 6,017 | utf_8 | 6c6a1e8bd7348312267353fefc0838b6 | % l1dantzig_pd.m
%
% Solves
% min_x ||x||_1 subject to ||A'(Ax-b)||_\infty <= epsilon
%
% Recast as linear program
% min_{x,u} sum(u) s.t. x - u <= 0
% -x - u <= 0
% A'(Ax-b) - epsilon <= 0
% -A'(Ax-b) - epsilon <= 0
% and use primal-dual interior point method.
%
% U... |
github | runngezhang/retarget-toolkit-master | tveq_newton.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tveq_newton.m | 5,214 | utf_8 | 556feedd0e843f2f7d71c3dab6b3b2b6 | % tveq_newton.m
%
% Newton algorithm for log-barrier subproblems for TV minimization
% with equality constraints.
%
% Usage:
% [xp,tp,niter] = tveq_newton(x0, t0, A, At, b, tau,
% newtontol, newtonmaxiter, slqtol, slqmaxiter)
%
% x0,t0 - starting points
%
% A - Either a handle to a functio... |
github | runngezhang/retarget-toolkit-master | tvqc_logbarrier.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tvqc_logbarrier.m | 2,880 | utf_8 | 499f5d621ce6b9b3e4be179379f14874 | % tvqc_logbarrier.m
%
% Solve quadractically constrained TV minimization
% min TV(x) s.t. ||Ax-b||_2 <= epsilon.
%
% Recast as the SOCP
% min sum(t) s.t. ||D_{ij}x||_2 <= t, i,j=1,...,n
% ||Ax - b||_2 <= epsilon
% and use a log barrier algorithm.
%
% Usage: xp = tvqc_logbarrier(x0, A, At, b, epsil... |
github | runngezhang/retarget-toolkit-master | l1qc_logbarrier.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/l1qc_logbarrier.m | 2,763 | utf_8 | d61d80b6ece7a8138a1d095074a22573 | % l1qc_logbarrier.m
%
% Solve quadratically constrained l1 minimization:
% min ||x||_1 s.t. ||Ax - b||_2 <= \epsilon
%
% Reformulate as the second-order cone program
% min_{x,u} sum(u) s.t. x - u <= 0,
% -x - u <= 0,
% 1/2(||Ax-b||^2 - \epsilon^2) <= 0
% and use a log barrier al... |
github | runngezhang/retarget-toolkit-master | tvdantzig_logbarrier.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tvdantzig_logbarrier.m | 2,915 | utf_8 | 839a9a05fdff38e2b0d9abbc37392300 | % tvdantzig_logbarrier.m
%
% Solve the total variation Dantzig program
%
% min_x TV(x) subject to ||A'(Ax-b)||_\infty <= epsilon
%
% Recast as the SOCP
% min sum(t) s.t. ||D_{ij}x||_2 <= t, i,j=1,...,n
% <a_{ij},Ax - b> <= epsilon i,j=1,...,n
% and use a log barrier algorithm.
%
% Usage: xp = tvd... |
github | runngezhang/retarget-toolkit-master | tveq_logbarrier.m | .m | retarget-toolkit-master/VideoMontage/release/l1magic/Optimization/tveq_logbarrier.m | 2,729 | utf_8 | a5c35f5f917e99a4f47c53a7ec323009 | % tveq_logbarrier.m
%
% Solve equality constrained TV minimization
% min TV(x) s.t. Ax=b.
%
% Recast as the SOCP
% min sum(t) s.t. ||D_{ij}x||_2 <= t, i,j=1,...,n
% Ax=b
% and use a log barrier algorithm.
%
% Usage: xp = tveq_logbarrier(x0, A, At, b, lbtol, mu, slqtol, slqmaxiter)
%
% x0 - Nx1 vec... |
github | runngezhang/retarget-toolkit-master | spgdemo.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/spgdemo.m | 16,195 | utf_8 | 629972a6bc0f55788ac56dda78d403a2 | function spgdemo(interactive)
%DEMO Demonstrates the use of the SPGL1 solver
%
% See also SPGL1.
% demo.m
% $Id: spgdemo.m 1079 2008-08-20 21:34:15Z ewout78 $
%
% ----------------------------------------------------------------------
% This file is part of SPGL1 (Spectral Projected Gradient for L1).
%
% ... |
github | runngezhang/retarget-toolkit-master | spg_mmv.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/spg_mmv.m | 2,868 | utf_8 | f3a431d79f903de5c0e56f477785dc0b | function [x,r,g,info] = spg_mmv( A, B, sigma, options )
%SPG_MMV Solve multi-measurement basis pursuit denoise (BPDN)
%
% SPG_MMV is designed to solve the basis pursuit denoise problem
%
% (BPDN) minimize ||X||_1,2 subject to ||A X - B||_2,2 <= SIGMA,
%
% where A is an M-by-N matrix, B is an M-by-G matrix, a... |
github | runngezhang/retarget-toolkit-master | get_code.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/get_code.m | 462 | utf_8 | 97020ec43495bd70d550d9519bedd025 | % distance should be <= size
% code is an array of shifting all possible positions of 2 signals
% which have distance of 'distance'
function [code] = get_code(size, distance)
freq = size / distance;
freq = floor(freq);
code = zeros(size, distance);
for i = 1:1:distance
code(i, i) = 1;
... |
github | runngezhang/retarget-toolkit-master | spgl1.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/spgl1.m | 30,332 | utf_8 | f7f6959f57ef11b01dcce62b88b2af57 | function [x,r,g,info] = spgl1( A, b, tau, sigma, x, options )
%SPGL1 Solve basis pursuit, basis pursuit denoise, and LASSO
%
% [x, r, g, info] = spgl1(A, b, tau, sigma, x0, options)
%
% ---------------------------------------------------------------------
% Solve the basis pursuit denoise (BPDN) problem
%
% (BPDN) m... |
github | runngezhang/retarget-toolkit-master | oneProjectorMex.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/private/oneProjectorMex.m | 3,747 | utf_8 | f6b6e7a8a040a1d86d7a7df0a386fec6 | function [x, itn] = oneProjectorMex(b,d,tau)
% [x, itn] = oneProjectorMex(b,d,tau)
% Return the orthogonal projection of the vector b >=0 onto the
% (weighted) L1 ball. In case vector d is specified, matrix D is
% defined as diag(d), otherwise the identity matrix is used.
%
% On exit,
% x solves minimize ||b-x... |
github | runngezhang/retarget-toolkit-master | lsqr.m | .m | retarget-toolkit-master/VideoMontage/release/spgl1-1.6/private/lsqr.m | 11,849 | utf_8 | b60925c5944249161e00049c67d30868 | function [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ]...
= lsqr( m, n, A, b, damp, atol, btol, conlim, itnlim, show )
%
% [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ]...
% = lsqr( m, n, A, b, damp, atol, btol, conlim, itnlim, show );
%
% LSQR solves Ax = b or mi... |
github | runngezhang/retarget-toolkit-master | feature_sign.m | .m | retarget-toolkit-master/VideoMontage/release/Solver/feature_sign.m | 3,030 | utf_8 | 7e22735a12749708aa0c8d1b6d2ed847 | % Feature sign search
% code by Wang Jinjun @ NEC Research Lab America
% reference
% Efficient sparse coding algorithms
% Honglak Lee Alexis Battle Rajat Raina Andrew Y. Ng
% Computer Science Department
% Stanford University
% Stanford, CA 94305
function [x]=feature_sign(B,y,lambda,init_x)... |
github | runngezhang/retarget-toolkit-master | SolveLasso.m | .m | retarget-toolkit-master/VideoMontage/release/Solver/SolveLasso.m | 10,877 | utf_8 | 154185b8b87a985e0a059e49009b60dd | function [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType, maxIters, lambdaStop, resStop, solFreq, verbose, OptTol)
% SolveLasso: Implements the Lars/Lasso algorithms
% Usage
% [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType,
% maxIters, lambdaStop, resStop, solFreq, verbose, ... |
github | runngezhang/retarget-toolkit-master | nn_match.m | .m | retarget-toolkit-master/bd_summary/nn_match.m | 1,896 | utf_8 | 20c994cb74e26f7ac525222ce6c11d79 | % function [complete_matchId,cohere_matchId]=nn_match(S_patches,T_patches)
function [complete_matchId,cohere_matchId]=NN_match(S_patches,T_patches,pre_S_matchId,pre_T_matchId)
complete_matchId = []; complete_min_val = [];
for i = 1 : 10000 : size(S_patches.features,1)
if (i+9999>size(S_patches.features,1))
... |
github | runngezhang/retarget-toolkit-master | random_sampling.m | .m | retarget-toolkit-master/SaliencyViaClassification/random_sampling.m | 1,011 | utf_8 | d6576bf8477e9fdd91ffe5cd386b1926 | % random sampling patches from an image
function A = random_sampling(img, patch_size, patch_increment)
d = size(img);
width = d(2);
height = d(1);
channel = d(3);
% size of the patch, each channel will be align and merge into 1 column
patch_total = patch_size * patch_size * channel;
% number of patches in the... |
github | runngezhang/retarget-toolkit-master | EuclideanDistance.m | .m | retarget-toolkit-master/SaliencyViaClassification/EuclideanDistance.m | 273 | utf_8 | 2a10f87b81b167873ee82db44ef51ce6 | % calculate Euclidean distance between 2 vector
function distance = EuclideanDistance(vector1, vector2)
d = size(vector1);
distance = 0;
for i = 1:d(1)
distance = distance + (vector1(i) - vector2(i))^2;
end
distance = sqrt(distance);
end |
github | runngezhang/retarget-toolkit-master | col_convert.m | .m | retarget-toolkit-master/SaliencyViaClassification/col_convert.m | 635 | utf_8 | 665c84f8cc48ac8bcfa6c88cd9cb25ec | % convert an matrix to col
% input number of channel of the matrix for efficiency
% matrix = [col1, col2 .. coln] x 3 channel
% output =
% col1 (channel1)
% col2
% ..
% coln
% col1 (channel2)
% etc
%
function col = col_convert(matrix)
d = size(matrix);
width = d(2);
height = d(1);
cha... |
github | runngezhang/retarget-toolkit-master | col_to_matrix.m | .m | retarget-toolkit-master/SaliencyViaClassification/col_to_matrix.m | 431 | utf_8 | 05690aa1c220f2ecda57d9a41c3fb489 | % convert a col of pixel to matrix
function matrix = col_to_matrix(col, width, height, channel)
matrix = ones(height, width, channel);
for ch = 1:1:channel
for i = 1:1:width
for j = 1:1:height
index = col_index(i, j, ch, width, height, ... |
github | runngezhang/retarget-toolkit-master | PatchPosition.m | .m | retarget-toolkit-master/SaliencyViaClassification/PatchPosition.m | 686 | utf_8 | bbbe144f2458f6ddc84e10ee3c41b0ac | % recover the top left position of the patch
% assuming the scan is from top->bottom and left-right
function [x, y] = PatchPosition(patch_index, patch_size, overlap, image_size)
% how many patches are there in the row?
row_no = floor((image_size(2) - patch_size + 2)/overlap);
% how many patches are th... |
github | runngezhang/retarget-toolkit-master | col_index.m | .m | retarget-toolkit-master/SaliencyViaClassification/col_index.m | 397 | utf_8 | 2eafb2cd767b0670ab90ca9863b624ad | % calculate the col_index of a pixel after converting to col
% - width/height/channel: width, height and number of channels of a patch
% - x, y, ch: position and channel of the pixel (start from 1)
function index = col_index(x, y, ch, width, height, channel)
index = 0;
index = index + width * height * (ch ... |
github | runngezhang/retarget-toolkit-master | RotateMinDistance.m | .m | retarget-toolkit-master/SaliencyViaClassification/RotateMinDistance.m | 398 | utf_8 | e40c68ddbf85b20b6dd9fbfadc91561e | % calculating minimum distance between 2 vectors by rotating them
function distance = RotateMinDistance(vector1, vector2)
d = size(vector1);
distance = 10000000;
for i = 1:d(1)
temp_vector = RotateVector(vector1, i);
temp_distance = EuclideanDistance(temp_vector, vector2);
if(... |
github | runngezhang/retarget-toolkit-master | ZeroNorm.m | .m | retarget-toolkit-master/SaliencyViaClassification/ZeroNorm.m | 197 | utf_8 | ba15e7d443ea23f13d8ceae1adad625d | % calculate the zero norm of a vector
function norm = ZeroNorm(a)
[w, h] = size(a);
norm = 0;
for i = 1:1:w
if(a(i,1) > 0)
norm = norm + 1;
end
end
end |
github | runngezhang/retarget-toolkit-master | get_overlapped_patches_horizon.m | .m | retarget-toolkit-master/Matlab/PatchTool/get_overlapped_patches_horizon.m | 643 | utf_8 | 32e6873957eb75671afe2ed43f309a99 | % get overlapped patches with size w * w
% return patches = w * w * d * n matrix, n is the size
function patches = get_overlapped_patches_horizon(img, x, y, w, h, increment)
[width, height, d] = size(img);
% invalid case
if(x < 0 || y < 0 || x + w > width || y + h > height)
patches = 0;
... |
github | runngezhang/retarget-toolkit-master | surrounding_patch.m | .m | retarget-toolkit-master/Matlab/PatchTool/surrounding_patch.m | 486 | utf_8 | b555e6d0a4f464ec0d01c4b4e88739bf | % Get surrounding patches in column
function A = surrounding_patch(image, x, y, patch_size, increment)
%get surrouding patch
surrounding = get_surrounding_patches(image, x, y, patch_size, overlap);
% convert to col
[w, h, d, n] = size(surrounding);
col_surrounding = ones(patch_size * patch_siz... |
github | runngezhang/retarget-toolkit-master | col_convert.m | .m | retarget-toolkit-master/Matlab/PatchTool/col_convert.m | 635 | utf_8 | 665c84f8cc48ac8bcfa6c88cd9cb25ec | % convert an matrix to col
% input number of channel of the matrix for efficiency
% matrix = [col1, col2 .. coln] x 3 channel
% output =
% col1 (channel1)
% col2
% ..
% coln
% col1 (channel2)
% etc
%
function col = col_convert(matrix)
d = size(matrix);
width = d(2);
height = d(1);
cha... |
github | runngezhang/retarget-toolkit-master | col_to_matrix.m | .m | retarget-toolkit-master/Matlab/PatchTool/col_to_matrix.m | 431 | utf_8 | 05690aa1c220f2ecda57d9a41c3fb489 | % convert a col of pixel to matrix
function matrix = col_to_matrix(col, width, height, channel)
matrix = ones(height, width, channel);
for ch = 1:1:channel
for i = 1:1:width
for j = 1:1:height
index = col_index(i, j, ch, width, height, ... |
github | runngezhang/retarget-toolkit-master | get_surrounding_patches.m | .m | retarget-toolkit-master/Matlab/PatchTool/get_surrounding_patches.m | 815 | utf_8 | d5bc826359803caf1232f73f96179fc7 | % get surrouding patches inform of size*size*n matrix
% extending the patches by 'size' and overlap
% n is number of patches
% bouding IS NOT handle,
function patches = get_surrouding_patches(img, x, y, size, increment)
% calculate the starting position of the surrounding
x_surrouding = x - size;
y_... |
github | runngezhang/retarget-toolkit-master | euclidean_distance.m | .m | retarget-toolkit-master/Matlab/PatchTool/euclidean_distance.m | 274 | utf_8 | c91fea053aa5af694d4d81a16a6ad590 | % calculate Euclidean distance between 2 vector
function distance = euclidean_distance(vector1, vector2)
d = size(vector1);
distance = 0;
for i = 1:d(1)
distance = distance + (vector1(i) - vector2(i))^2;
end
distance = sqrt(distance);
end |
github | runngezhang/retarget-toolkit-master | patch_position.m | .m | retarget-toolkit-master/Matlab/PatchTool/patch_position.m | 656 | utf_8 | 95114f736013954299f4e91d585ef2e7 | % recover the top left position of the patch
% assuming the scan is from top->bottom and left-right
function [x, y] = patch_position(patch_index, patch_size, overlap, image_size)
% how many patches are there in the row?
row_no = floor((image_size(2) - patch_size + 2)/overlap);
% how many patches are t... |
github | runngezhang/retarget-toolkit-master | draw_patch.m | .m | retarget-toolkit-master/Matlab/PatchTool/draw_patch.m | 325 | utf_8 | 117bf6814fcfa63bfbec781e6a859ea4 | % depends on ..\Visual\drawRectangle.mat
function result = draw_patch(image, patch_size, increment, patch_index, color)
addpath('..\Visual');
addpath('..\PatchTool');
d = size(image);
[x,y] = PatchPosition(patch_index, patch_size, increment, d);
result = DrawRectangle(x, y, patch_size, patch_size, image, color); ... |
github | runngezhang/retarget-toolkit-master | surrounding_cols.m | .m | retarget-toolkit-master/Matlab/PatchTool/surrounding_cols.m | 490 | utf_8 | 93e2181b27e735e26ccd24d0c598e602 | % Get surrounding patches in column
function A = surrounding_cols(image, x, y, patch_size, overlap)
[h, w, channel] = size(image);
%get surrouding patch
surrounding = get_surrouding_patches(image, x, y, patch_size, overlap);
% convert to col
[w, h, d, n] = size(surrounding);
A = ones(patc... |
github | runngezhang/retarget-toolkit-master | col_index.m | .m | retarget-toolkit-master/Matlab/PatchTool/col_index.m | 396 | utf_8 | 204e5c51b6b2aeddfaa9c696a7f875fb | % calculate the col_index of a pixel after converting to col
% - width/height/channel: width, height and number of channels of a patch
% - x, y, ch: position and channel of the pixel (start from 1)
function index = ColIndex(x, y, ch, width, height, channel)
index = 0;
index = index + width * height * (ch -... |
github | runngezhang/retarget-toolkit-master | dense_sampling.m | .m | retarget-toolkit-master/Matlab/PatchTool/dense_sampling.m | 1,009 | utf_8 | 176db7aa1f5f9a97f5c8d003b5c643d9 | % dense sampling patches from an image
function A = dense_sampling(img, patch_size, patch_increment)
d = size(img);
width = d(2);
height = d(1);
channel = d(3);
% size of the patch, each channel will be align and merge into 1 column
patch_total = patch_size * patch_size * channel;
% number of patches in the i... |
github | runngezhang/retarget-toolkit-master | get_overlapped_patches_vertical.m | .m | retarget-toolkit-master/Matlab/PatchTool/get_overlapped_patches_vertical.m | 641 | utf_8 | a0bdb1fcb6fa45c2efd9dcce54098f93 | % get overlapped patches with size w * w
% return patches = w * w * d * n matrix, n is the size
function patches = get_overlapped_patches_vertical(img, x, y, w, h, increment)
[width, height, d] = size(img);
% invalid case
if(x < 0 || y < 0 || x + w > width || y + h > height)
patches = 0;
... |
github | runngezhang/retarget-toolkit-master | zero_norm.m | .m | retarget-toolkit-master/Matlab/PatchTool/zero_norm.m | 198 | utf_8 | 4af8f2a6f3fbb2295a7ddb0dddbcc66e | % calculate the zero norm of a vector
function norm = zero_norm(a)
[w, h] = size(a);
norm = 0;
for i = 1:1:w
if(a(i,1) > 0)
norm = norm + 1;
end
end
end |
github | runngezhang/retarget-toolkit-master | SolveLasso.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/SolveLasso.m | 11,214 | utf_8 | 5c947ea75751e02069055ae7c79cd204 | function [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType, maxIters, lambdaStop, resStop, solFreq, verbose, OptTol)
% SolveLasso: Implements the Lars/Lasso algorithms
% Usage
% [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType,
% maxIters, lambdaStop, resStop, solFreq, verbo... |
github | runngezhang/retarget-toolkit-master | random_sampling.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/random_sampling.m | 1,027 | utf_8 | 557586d8d5b5f0bd61957001977879da | % random sampling patches from an image
function A = random_sampling(img, patch_size, patch_increment)
d = size(img);
width = d(2);
height = d(1);
channel = d(3);
% size of the patch, each channel will be align and merge into 1 column
patch_total = patch_size * patch_size * channel;
% number of patches in the... |
github | runngezhang/retarget-toolkit-master | extend_img_sparsecoding2.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/extend_img_sparsecoding2.m | 3,163 | utf_8 | 622151288d34448672c12011485b8ede | % extend the image to the left
% using patch_size and overlap
function img = extend_img_sparsecoding2(input_img, A, patch_size, overlap)
addpath('CVPR08SR/Sparse Coding');
lamba = 0.1;
[height, width, channel] = size(input_img);
% create new image
img = ones(height, width + 1, channel... |
github | runngezhang/retarget-toolkit-master | col_convert.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/col_convert.m | 635 | utf_8 | 665c84f8cc48ac8bcfa6c88cd9cb25ec | % convert an matrix to col
% input number of channel of the matrix for efficiency
% matrix = [col1, col2 .. coln] x 3 channel
% output =
% col1 (channel1)
% col2
% ..
% coln
% col1 (channel2)
% etc
%
function col = col_convert(matrix)
d = size(matrix);
width = d(2);
height = d(1);
cha... |
github | runngezhang/retarget-toolkit-master | col_to_matrix.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/col_to_matrix.m | 431 | utf_8 | 05690aa1c220f2ecda57d9a41c3fb489 | % convert a col of pixel to matrix
function matrix = col_to_matrix(col, width, height, channel)
matrix = ones(height, width, channel);
for ch = 1:1:channel
for i = 1:1:width
for j = 1:1:height
index = col_index(i, j, ch, width, height, ... |
github | runngezhang/retarget-toolkit-master | extend_img_sparsecoding.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/extend_img_sparsecoding.m | 1,983 | utf_8 | 622c5cf52efd0e8c8071f09271ba4d65 | % extend the image by 1 pixel using sparse coding method
% - A: dictionary
% - overlap_A_left: dictionary when consider only a left region as roi
% - size: size of the patch
function img = extend_img_sparsecoding(input_img, A, roi_A_left, patch_size)
addpath('CVPR08SR/Sparse Coding');
overlap = 4;
d ... |
github | runngezhang/retarget-toolkit-master | roi_matrix_left.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/roi_matrix_left.m | 717 | utf_8 | 8031736dc1f53453e51a7a62d802e025 | % extract a left region of a patch
% input:
% - size: size of the patch
% - channel: number of channel
% - reduce_size: new size ( < size)
% usage: create new (reduced) Dictionary
% matrix * D = new_D;
function matrix = roi_matrix_left(size, channel, reduce_size)
old_size = size * size * channel;
new_... |
github | runngezhang/retarget-toolkit-master | col_index.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/col_index.m | 397 | utf_8 | 2eafb2cd767b0670ab90ca9863b624ad | % calculate the col_index of a pixel after converting to col
% - width/height/channel: width, height and number of channels of a patch
% - x, y, ch: position and channel of the pixel (start from 1)
function index = col_index(x, y, ch, width, height, channel)
index = 0;
index = index + width * height * (ch ... |
github | runngezhang/retarget-toolkit-master | extraction_matrix.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/extraction_matrix.m | 874 | utf_8 | fc0573b0b996cb896bdec10071d70a2e | % form a extraction matrix base on a mask
% e.g mask:
% [ 1 1 1 1 1
% 1 1 1 0 0
% 1 1 1 0 0 ]
% -> omit all 0's entries
% extraction matrix is used to extract from column
% by cascade col of the target matrix
% @param: number of channel
function matrix = extraction_matrix(mask_matrix)
[height, width, ... |
github | runngezhang/retarget-toolkit-master | get_identical_pixel.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/get_identical_pixel.m | 420 | utf_8 | 2d33455b47f294a8b0d4c4a9dc7ac0dd | % take 2 images, measure the number of pixels which are identical
function [id_pixel] = get_identical_pixel(img1, img2)
[height, width, channel] = size(img1);
id_pixel = 0;
for w = 1:1:width
for h = 1:1:height
diff = img1(h,w,1) - img2(h,w,1);
if(diff == 0)
id_pixel = id_pixel + ... |
github | runngezhang/retarget-toolkit-master | countElement.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/countElement.m | 400 | utf_8 | 24bf367c52c3584dc57b74e428effbc2 | % count number of occurence of 'element' in matrix
function count = countElement(matrix, element)
[height, width, channel] = size(matrix);
count = 0;
for x = 1:1:width
for y = 1:1:height
for z = 1:1:channel
if matrix(y, x, z) == element
count =... |
github | runngezhang/retarget-toolkit-master | rnd_smp_dictionary.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/rnd_smp_dictionary.m | 2,976 | utf_8 | 9adf036e93a1415368dd635300ac528d | function [Xh, Xl] = rnd_smp_dictionary(tr_dir, patch_size, zooming, num_patch)
fpath = fullfile(tr_dir, '*.bmp');
img_dir = dir(fpath);
Xh = [];
Xl = [];
img_num = length(img_dir);
nums = zeros(1, img_num);
for num = 1:length(img_dir),
im = imread(fullfile(tr_dir, img_dir(num).name));
nums(num)... |
github | runngezhang/retarget-toolkit-master | l2ls_learn_basis_dual.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/Sparse coding/l2ls_learn_basis_dual.m | 2,371 | utf_8 | c186ba98bb109153d97867df8489ca4b | function B = l2ls_learn_basis_dual(X, S, l2norm, Binit)
% Learning basis using Lagrange dual (with basis normalization)
%
% This code solves the following problem:
%
% minimize_B 0.5*||X - B*S||^2
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% The detail of the algorithm is describe... |
github | runngezhang/retarget-toolkit-master | l1ls_featuresign.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/Sparse coding/l1ls_featuresign.m | 7,403 | utf_8 | 45a3b69aedbcba3d4d2655651475961d | function Xout = l1ls_featuresign (A, Y, gamma, Xinit)
% The feature-sign search algorithm
% L1-regularized least squares problem solver
%
% This code solves the following problem:
%
% minimize_s 0.5*||y - A*x||^2 + gamma*||x||_1
%
% The detail of the algorithm is described in the following paper:
% 'Effic... |
github | runngezhang/retarget-toolkit-master | sparse_coding.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/Sparse coding/sparse_coding.m | 7,494 | utf_8 | 78d19babbcc5196c187226e728042870 | function [B S stat] = sparse_coding(X_total, num_bases, beta, sparsity_func, epsilon, num_iters, batch_size, fname_save, pars, Binit, resample_size)
% Fast sparse coding algorithms
%
% minimize_B,S 0.5*||X - B*S||^2 + beta*sum(abs(S(:)))
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% T... |
github | runngezhang/retarget-toolkit-master | feature_sign.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/Solver/feature_sign.m | 3,030 | utf_8 | 7e22735a12749708aa0c8d1b6d2ed847 | % Feature sign search
% code by Wang Jinjun @ NEC Research Lab America
% reference
% Efficient sparse coding algorithms
% Honglak Lee Alexis Battle Rajat Raina Andrew Y. Ng
% Computer Science Department
% Stanford University
% Stanford, CA 94305
function [x]=feature_sign(B,y,lambda,init_x)... |
github | runngezhang/retarget-toolkit-master | SolveLasso.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/CVPR08SR/Solver/SolveLasso.m | 10,877 | utf_8 | 154185b8b87a985e0a059e49009b60dd | function [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType, maxIters, lambdaStop, resStop, solFreq, verbose, OptTol)
% SolveLasso: Implements the Lars/Lasso algorithms
% Usage
% [sols, numIters, activationHist, duals] = SolveLasso(A, y, N, algType,
% maxIters, lambdaStop, resStop, solFreq, verbose, ... |
github | runngezhang/retarget-toolkit-master | A_fhp.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Measurements/A_fhp.m | 576 | utf_8 | 546e3a8b121df921d171522cafec09af | % A_fhp.m
%
% Takes measurements in the upper half-plane of the 2D Fourier transform.
%
% Usage: b = A_fhp(x, OMEGA)
%
% x - N vector
%
% b - K vector = [mean; real part(OMEGA); imag part(OMEGA)]
%
% OMEGA - K/2-1 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept... |
github | runngezhang/retarget-toolkit-master | At_fhp.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Measurements/At_fhp.m | 613 | utf_8 | e42938636cace8af895181b10ca2fa1c | % At_fhp.m
%
% Adjoint of At_fhp (2D Fourier half plane measurements).
%
% Usage: x = At_fhp(b, OMEGA, n)
%
% b - K vector = [mean; real part(OMEGA); imag part(OMEGA)]
%
% OMEGA - K/2-1 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% n - Image is nxn pixe... |
github | runngezhang/retarget-toolkit-master | A_f.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Measurements/A_f.m | 659 | utf_8 | 21e5a10a1fc2848a7455f0901d893064 | % A_f.m
%
% Takes "scrambled Fourier" measurements.
%
% Usage: b = A_f(x, OMEGA, P)
%
% x - N vector
%
% b - K vector = [real part; imag part]
%
% OMEGA - K/2 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% P - Permutation to apply to the input vector. F... |
github | runngezhang/retarget-toolkit-master | LineMask.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Measurements/LineMask.m | 832 | utf_8 | 42787892f182a5dbbca55315f88daaec | % LineMask.m
%
% Returns the indicator of the domain in 2D fourier space for the
% specified line geometry.
% Usage : [M,Mh,mi,mhi] = LineMask(L,N)
%
% Written by : Justin Romberg
% Created : 1/26/2004
% Revised : 12/2/2004
function [M,Mh,mi,mhi] = LineMask(L,N)
thc = linspace(0, pi-pi/L, L);
%thc = linspace(pi/(2... |
github | runngezhang/retarget-toolkit-master | At_f.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Measurements/At_f.m | 718 | utf_8 | c3639ceb479abeddedfe954c615b1f6d | % At_f.m
%
% Adjoint for "scrambled Fourier" measurements.
%
% Usage: x = At_f(b, N, OMEGA, P)
%
% b - K vector = [real part; imag part]
%
% N - length of output x
%
% OMEGA - K/2 vector denoting which Fourier coefficients to use
% (the real and imag parts of each freq are kept).
%
% P - Permutation to apply to... |
github | runngezhang/retarget-toolkit-master | l1qc_newton.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/l1qc_newton.m | 4,179 | utf_8 | cdde96758d798b69058786d513ccd590 | % l1qc_newton.m
%
% Newton algorithm for log-barrier subproblems for l1 minimization
% with quadratic constraints.
%
% Usage:
% [xp,up,niter] = l1qc_newton(x0, u0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,u0 - starting points
%
% A - Either a handle to a... |
github | runngezhang/retarget-toolkit-master | tvqc_newton.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/tvqc_newton.m | 5,563 | utf_8 | 145140735523055b7609d25a8002b8b7 | % tvqc_newton.m
%
% Newton algorithm for log-barrier subproblems for TV minimization
% with quadratic constraints.
%
% Usage:
% [xp,tp,niter] = tvqc_newton(x0, t0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,t0 - starting points
%
% A - Either a handle to a... |
github | runngezhang/retarget-toolkit-master | cgsolve.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/cgsolve.m | 1,691 | utf_8 | d1e3c459a716b242d537a40c89e6f823 | % cgsolve.m
%
% Solve a symmetric positive definite system Ax = b via conjugate gradients.
%
% Usage: [x, res, iter] = cgsolve(A, b, tol, maxiter, verbose)
%
% A - Either an NxN matrix, or a function handle.
%
% b - N vector
%
% tol - Desired precision. Algorithm terminates when
% norm(Ax-b)/norm(b) < tol .
%
% ma... |
github | runngezhang/retarget-toolkit-master | tvdantzig_newton.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/tvdantzig_newton.m | 5,985 | utf_8 | 98f96bec8c5aacc8fd99b2b69f412564 | % tvdantzig_newton.m
%
% Newton iterations for TV Dantzig log-barrier subproblem.
%
% Usage : [xp, tp, niter] = tvdantzig_newton(x0, t0, A, At, b, epsilon, tau,
% newtontol, newtonmaxiter, cgtol, cgmaxiter)
%
% x0,t0 - Nx1 vectors, initial points.
%
% A - Either a handle to a f... |
github | runngezhang/retarget-toolkit-master | l1eq_pd.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/l1eq_pd.m | 5,311 | utf_8 | 73af9d721e0a46b4e78ee82491bce30e | % l1eq_pd.m
%
% Solve
% min_x ||x||_1 s.t. Ax = b
%
% Recast as linear program
% min_{x,u} sum(u) s.t. -u <= x <= u, Ax=b
% and use primal-dual interior point method
%
% Usage: xp = l1eq_pd(x0, A, At, b, pdtol, pdmaxiter, cgtol, cgmaxiter)
%
% x0 - Nx1 vector, initial point.
%
% A - Either a handle to a function t... |
github | runngezhang/retarget-toolkit-master | l1decode_pd.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/l1decode_pd.m | 4,844 | utf_8 | fdd14a32e87c75e30099109739d8751a | % l1decode_pd.m
%
% Decoding via linear programming.
% Solve
% min_x ||b-Ax||_1 .
%
% Recast as the linear program
% min_{x,u} sum(u) s.t. -Ax - u + y <= 0
% Ax - u - y <= 0
% and solve using primal-dual interior point method.
%
% Usage: xp = l1decode_pd(x0, A, At, y, pdtol, pdmaxiter, cgtol... |
github | runngezhang/retarget-toolkit-master | l1dantzig_pd.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/l1dantzig_pd.m | 6,017 | utf_8 | 6c6a1e8bd7348312267353fefc0838b6 | % l1dantzig_pd.m
%
% Solves
% min_x ||x||_1 subject to ||A'(Ax-b)||_\infty <= epsilon
%
% Recast as linear program
% min_{x,u} sum(u) s.t. x - u <= 0
% -x - u <= 0
% A'(Ax-b) - epsilon <= 0
% -A'(Ax-b) - epsilon <= 0
% and use primal-dual interior point method.
%
% U... |
github | runngezhang/retarget-toolkit-master | tveq_newton.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/tveq_newton.m | 5,214 | utf_8 | 556feedd0e843f2f7d71c3dab6b3b2b6 | % tveq_newton.m
%
% Newton algorithm for log-barrier subproblems for TV minimization
% with equality constraints.
%
% Usage:
% [xp,tp,niter] = tveq_newton(x0, t0, A, At, b, tau,
% newtontol, newtonmaxiter, slqtol, slqmaxiter)
%
% x0,t0 - starting points
%
% A - Either a handle to a functio... |
github | runngezhang/retarget-toolkit-master | tvqc_logbarrier.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/tvqc_logbarrier.m | 2,880 | utf_8 | 499f5d621ce6b9b3e4be179379f14874 | % tvqc_logbarrier.m
%
% Solve quadractically constrained TV minimization
% min TV(x) s.t. ||Ax-b||_2 <= epsilon.
%
% Recast as the SOCP
% min sum(t) s.t. ||D_{ij}x||_2 <= t, i,j=1,...,n
% ||Ax - b||_2 <= epsilon
% and use a log barrier algorithm.
%
% Usage: xp = tvqc_logbarrier(x0, A, At, b, epsil... |
github | runngezhang/retarget-toolkit-master | l1qc_logbarrier.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/l1qc_logbarrier.m | 2,763 | utf_8 | d61d80b6ece7a8138a1d095074a22573 | % l1qc_logbarrier.m
%
% Solve quadratically constrained l1 minimization:
% min ||x||_1 s.t. ||Ax - b||_2 <= \epsilon
%
% Reformulate as the second-order cone program
% min_{x,u} sum(u) s.t. x - u <= 0,
% -x - u <= 0,
% 1/2(||Ax-b||^2 - \epsilon^2) <= 0
% and use a log barrier al... |
github | runngezhang/retarget-toolkit-master | tvdantzig_logbarrier.m | .m | retarget-toolkit-master/Matlab/SparseCodingLib/sparsecode/l1magic/Optimization/tvdantzig_logbarrier.m | 2,915 | utf_8 | 839a9a05fdff38e2b0d9abbc37392300 | % tvdantzig_logbarrier.m
%
% Solve the total variation Dantzig program
%
% min_x TV(x) subject to ||A'(Ax-b)||_\infty <= epsilon
%
% Recast as the SOCP
% min sum(t) s.t. ||D_{ij}x||_2 <= t, i,j=1,...,n
% <a_{ij},Ax - b> <= epsilon i,j=1,...,n
% and use a log barrier algorithm.
%
% Usage: xp = tvd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.