%% 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
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}