%% Test out the possibily of creating color gaussians that will be applied % on inpout image. Color is class-dependent and intensity length-dependent. % white - white space % black - text % red - stamps % green - tables % blue - signatures % Also - the window width and height is equal to average w&h from database clc close all clear all % load image input.image = im2double(imread('../database/signed_docs/10.jpg')); [input.w, input.h, ~] = size(input.image); % window size window.w = 100; window.h = 100; % step == half of window's size? step.w = window.w / 2; step.h = window.h / 2; % std sigma = 25; % create gaussian mask mask.gs = fspecial('gaussian', [window.h window.w], sigma); mask.gs = mask.gs ./ max(mask.gs(:)); % create color masks mask.white = ones(window.h, window.w, 3); mask.black = zeros(window.h, window.w, 3); mask.red = cat(3, ones(window.h, window.w), zeros(window.h, window.w),... zeros(window.h, window.w)); mask.green = cat(3, zeros(window.h, window.w), ones(window.h, window.w),... zeros(window.h, window.w)); mask.blue = cat(3, zeros(window.h, window.w), zeros(window.h, window.w),... ones(window.h, window.w)); fn = fieldnames(mask); %loop through image and apply mask randomly for i = 1 : step.h : input.h - window.h-step.h for j = 1 : step.w : input.w - window.w-step.w % extract part of the image window.current = input.image(i : i + window.h - 1, j : j + window.w - 1, :); % apply mask randomly color = round(rand(1) * 5) + 1; mask.current = mask.(fn{color}); % apply end end