primal dual algorithms for image processing


this packet codes are about primal dual algorithms for image processing such as image denoising based on ROF model and TV-L1 and Huber ROF, image restoration like deconvolution, image zooming, image inpainting,optical flow for motion estimation and Mumford-Shah multi-label image segmentation problem. these codes are base on the following paper,"a first-order primal-dual algorithm for convex problems with application to imaging", and are organized corresponding to the structure of this paper, therefore these codes are what so-called sample codes of this paper, so they are really convenient to learn and to use. to use them, what you need to do is just to open a folder, and run the corresponding .m file, then you will collect the processing result. to understand these codes,you are recommended to read the paper first, in this case, you can get a better comprehension about these codes. and before you use them, you are also recommended first to read the instructions included in the zip packet,because in all the codes,the primal variables and dual variables are both vectorized which are different from the general situations. if you have any questions about these codes,don't hesitate to contact me via email: Pock, Thomas:pock@icg.tugraz.at Chen, Yunijn:cheny@icg.tugraz.at enjoy them,and good luck with you.
资源截图
代码片段和文件信息
%%   image denoising based ROF model via AHZC for optimization
%
%   Authors: Chen Yunjin
%
%   If you use this file or package for your work please refer to the
%   following papers:   
%
%   [1] Antonin Chambolle and Thomas Pock A first-order primal-dual
%   algorithm with applications to imaging Technical Report 2010
%
%   License:
%     Copyright (C) 2011 Institute for Computer Graphics and Vision
%                      Graz University of Technology
%%
clear all;close all;clc;
image = imread(‘lina_noise.jpg‘);
gray = im2double(image);
figure(1);
imshow(gray);title(‘noise image‘)
noise_image = gray;
[n_row n_col] = size(noise_image);
N  = n_row * n_col;
%% very important information to read
% generate gradient matrix for nabla operator
% vectorize the original image(n_row by n_col) to a vector with n_row*n_col
% elememts via row-wise scanning way. That is to associate the (ij) element 
% of image matrix with the (i-1)*n_col+j element of the vector
%%
noise_image = reshape(noise_image‘N1);
nabla       = make_nabla(n_coln_row);
%initialization
u      = noise_image;
p      = zeros(2*N1);
head_u = u;
% algorithm parameter
n_iteration = 200;
lambda = 8;

gap = zeros(n_iteration1);
tic;
for n_processing = 1:n_iteration    
    sigma  = 0.2 + 0.08*n_processing;
    tau    = (0.5 - 5/(15 + n_processing))/sigma;
    % update dual
    old_u   = u;
    temp_p  = nabla * old_u * sigma * lambda+ p;
    sqrt_p  = sqrt(temp_p(1:N).^2 + temp_p(N+1:2*N).^2);
    sqrt_p_ = [sqrt_p;sqrt_p];
    p       = temp_p./(max(1sqrt_p_));
    % update primal
    u       = (1 - tau) * old_u + tau * (noise_image - nabla‘ * p/lambda);
    % compute gap
    gap(n_processing) = compute_gap(upnoise_imagelambdanabla);
    fprintf(‘>>>>>: it = %4d  gap = %.5f
‘n_processing gap(n_processing));
end
time = toc
show_image = (reshape(un_coln_row))‘;
figure(2);
imshow(show_image);title(‘denoised image using ROF model via AHZC‘)
figure(3);
plot(gap);title(‘gap curve‘);grid on;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-01-11 02:08  Primal_dual_algorithm[matlab codes]
     目录           0  2012-01-11 02:09  Primal_dual_algorithm[matlab codes]1-ROF
     文件        2052  2012-01-11 01:35  Primal_dual_algorithm[matlab codes]1-ROFAHZC.m
     文件        2603  2012-01-11 01:35  Primal_dual_algorithm[matlab codes]1-ROFalgorithm_1_matrix.m
     文件        2460  2012-01-11 01:36  Primal_dual_algorithm[matlab codes]1-ROFalgorithm_2_matrix.m
     文件        2932  2012-01-11 01:36  Primal_dual_algorithm[matlab codes]1-ROFalgorithm_4_matrix.m
     文件         830  2011-12-16 15:16  Primal_dual_algorithm[matlab codes]1-ROFcompute_gap.m
     文件       47618  2011-12-12 12:01  Primal_dual_algorithm[matlab codes]1-ROFlina.jpg
     文件       88175  2011-12-12 20:55  Primal_dual_algorithm[matlab codes]1-ROFlina_noise.jpg
     文件      146559  2011-12-16 17:01  Primal_dual_algorithm[matlab codes]1-ROFlouvre_noise.jpg
     文件        1230  2011-12-12 18:30  Primal_dual_algorithm[matlab codes]1-ROFmake_nabla.m
     目录           0  2012-01-11 02:08  Primal_dual_algorithm[matlab codes]2-TV-L1
     文件        2424  2012-01-11 01:33  Primal_dual_algorithm[matlab codes]2-TV-L1algorithm_1.m
     文件       82019  2011-12-03 23:03  Primal_dual_algorithm[matlab codes]2-TV-L1louvre.jpg
     文件      146559  2011-12-16 17:01  Primal_dual_algorithm[matlab codes]2-TV-L1louvre_noise.jpg
     文件        1230  2011-12-12 18:30  Primal_dual_algorithm[matlab codes]2-TV-L1make_nabla.m
     目录           0  2012-01-11 02:08  Primal_dual_algorithm[matlab codes]3-Huber-ROF
     文件        2250  2012-01-11 01:32  Primal_dual_algorithm[matlab codes]3-Huber-ROFalgorithm_3.m
     文件         409  2011-12-16 18:53  Primal_dual_algorithm[matlab codes]3-Huber-ROFcompute_gap.m
     文件       88175  2011-12-12 20:55  Primal_dual_algorithm[matlab codes]3-Huber-ROFlina_noise.jpg
     文件        1230  2011-12-12 18:30  Primal_dual_algorithm[matlab codes]3-Huber-ROFmake_nabla.m
     目录           0  2012-01-11 02:08  Primal_dual_algorithm[matlab codes]4-Image Deconvolution
     文件        1230  2011-12-12 18:30  Primal_dual_algorithm[matlab codes]4-Image Deconvolutionmake_nabla.m
     文件        2937  2012-01-10 21:50  Primal_dual_algorithm[matlab codes]4-Image DeconvolutionPDHG_tv_deconv_primal_dual.m
     文件       77212  2012-01-10 16:33  Primal_dual_algorithm[matlab codes]4-Image Deconvolutionsunflower.png
     文件         960  2012-01-10 22:03  Primal_dual_algorithm[matlab codes]4-Image Deconvolution est_deconv.m
     文件        2904  2012-01-10 22:00  Primal_dual_algorithm[matlab codes]4-Image Deconvolution v_deconv_primal_dual.m
     目录           0  2012-01-11 02:08  Primal_dual_algorithm[matlab codes]5-Image Zooming
     文件        3290  2012-01-11 00:20  Primal_dual_algorithm[matlab codes]5-Image Zoomingalgorithm_1.m
     文件      705746  2011-12-18 02:31  Primal_dual_algorithm[matlab codes]5-Image Zoomingicubic interpolation.fig
     文件       31773  2011-12-17 23:48  Primal_dual_algorithm[matlab codes]5-Image Zoomingeye.jpg
............此处省略56个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)