Code covered by the BSD License  

Highlights from
Grid-based modeling of images

image thumbnail

Grid-based modeling of images

by

 

These functions enable calculating functions using the grid-based modeling.

mypublishtest.m
% test example
% May 30th, 2010, By Reza Farrahi Moghaddam, Synchromedia Lab, ETS, Montreal, Canada

%% setup

%
clear all;
close all;

% original file name
u_filename = 'P03.tif';

% read files
u = rgb2gray(double(imread(u_filename)) / 255);
[xm ym] = size(u);
% figure, imshow(u)

% grid parameters
s_G = 5;

%% example: standard functions

% calculate the mean on a grid with s_G. 
u_avg_G = get_function_on_grid(u, @mean, s_G, 1);
u_avg = interpolation_a_grid_on_domain(u_avg_G, xm, ym, s_G);

% figures
figure, imshow([u; u_avg])

% calculate the std_dev on a grid with s_G. 
u_std_G = get_function_on_grid(u, @std, s_G, 1);
u_std = interpolation_a_grid_on_domain(u_std_G, xm, ym, s_G);

% figures
figure, imshow([u; u_std])



%% example: functions with some parameters

% function parameters are sent wia prior variable
prior.power = 2;


% example with prior infomration for function
u_avg_G = get_function_on_grid_prior(u, @temp_sample_function_with_prior, s_G, 1, prior);
u_avg = interpolation_a_grid_on_domain(u_avg_G, xm, ym, s_G);

% figures
figure, imshow([u; u_avg])



%% more examples, such as the grid-based Sauvola binarization method, will be submitted via other posts.

Contact us