
oriimg=im2double(oriimg);
figure;
% for cnn
% some other image processing ?

% tf=6 (?), displayTime=1
diffimg=diffuse(oriimg,5,1);

oriu = im2double(max(max(oriimg)));
oril = im2double(min(min(oriimg)));
oriimg = (oriimg-oril)/(oriu-oril)*2-1;
subimg=oriimg-diffimg;
absimg=abs(subimg);
scaleimg=absimg.*absimg;%5*absimg;  % this morning: absimg.*absimg

% tf=100-150 (?)
[fallimg,u,state]=falling(scaleimg,50,1);  % this monring: 50,1

%[fallimg,u,state]=falling(oriimg,50,1); 
%eCnn=edge(oriimg+state,'canny');
%looks interesting

%without masking - this morning and then oriimg + state
%whether we use u+state or u+state+1 doesn't matter that much.
%oriimg+state seems to give good result though.

% pretty much the same to edge -- multiplicative mask
maskimg=subimg.*fallimg;
maskimg2=maskimg+maskimg;
emask2=edge(maskimg2,'canny');
figure;imshow(eCnnmask2);title('maskimg2-alg');

finalimg=maskimg2+0.5*diffimg;
eCnn=edge(finalimg,'canny');
figure;imshow(eCnn);title('eCnnfinal-alg');


