-
大小: 11.11MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-07-28
- 语言: 其他
- 标签:
资源简介
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‘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-ROF\AHZC.m
文件 2603 2012-01-11 01:35 Primal_dual_algorithm[matlab codes]\1-ROF\algorithm_1_matrix.m
文件 2460 2012-01-11 01:36 Primal_dual_algorithm[matlab codes]\1-ROF\algorithm_2_matrix.m
文件 2932 2012-01-11 01:36 Primal_dual_algorithm[matlab codes]\1-ROF\algorithm_4_matrix.m
文件 830 2011-12-16 15:16 Primal_dual_algorithm[matlab codes]\1-ROF\compute_gap.m
文件 47618 2011-12-12 12:01 Primal_dual_algorithm[matlab codes]\1-ROF\lina.jpg
文件 88175 2011-12-12 20:55 Primal_dual_algorithm[matlab codes]\1-ROF\lina_noise.jpg
文件 146559 2011-12-16 17:01 Primal_dual_algorithm[matlab codes]\1-ROF\louvre_noise.jpg
文件 1230 2011-12-12 18:30 Primal_dual_algorithm[matlab codes]\1-ROF\make_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-L1\algorithm_1.m
文件 82019 2011-12-03 23:03 Primal_dual_algorithm[matlab codes]\2-TV-L1\louvre.jpg
文件 146559 2011-12-16 17:01 Primal_dual_algorithm[matlab codes]\2-TV-L1\louvre_noise.jpg
文件 1230 2011-12-12 18:30 Primal_dual_algorithm[matlab codes]\2-TV-L1\make_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-ROF\algorithm_3.m
文件 409 2011-12-16 18:53 Primal_dual_algorithm[matlab codes]\3-Huber-ROF\compute_gap.m
文件 88175 2011-12-12 20:55 Primal_dual_algorithm[matlab codes]\3-Huber-ROF\lina_noise.jpg
文件 1230 2011-12-12 18:30 Primal_dual_algorithm[matlab codes]\3-Huber-ROF\make_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 Deconvolution\make_nabla.m
文件 2937 2012-01-10 21:50 Primal_dual_algorithm[matlab codes]\4-Image Deconvolution\PDHG_tv_deconv_primal_dual.m
文件 77212 2012-01-10 16:33 Primal_dual_algorithm[matlab codes]\4-Image Deconvolution\sunflower.png
文件 960 2012-01-10 22:03 Primal_dual_algorithm[matlab codes]\4-Image Deconvolution\test_deconv.m
文件 2904 2012-01-10 22:00 Primal_dual_algorithm[matlab codes]\4-Image Deconvolution\tv_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 Zooming\algorithm_1.m
文件 705746 2011-12-18 02:31 Primal_dual_algorithm[matlab codes]\5-Image Zooming\bicubic interpolation.fig
文件 31773 2011-12-17 23:48 Primal_dual_algorithm[matlab codes]\5-Image Zooming\eye.jpg
............此处省略56个文件信息
评论
共有 条评论