tt = imread('/home/cepek/Desktop/matlab-img-demo/tvrz.png');

L  = 3;      % line width
x  = 0:255;

y1 = x;
figure(11)
plot(x,y1, 'LineWidth', L);
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});

figure(21), imshow(tt);
figure(31), imhist(tt);


y2 = 2*x;
y2(y2 > 255) = 255;
figure(12)
plot(x,y2, 'LineWidth', L);
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});

t2 = immultiply(tt, 2); figure(22), imshow(t2);
figure(32), imhist(t2);

H  = 127;
y3 = [2*(0:H) (H+1):255];

figure(13)
plot(x,y3, 'LineWidth', L);
plot(0:H,2*(0:H), 'LineWidth',L);
hold on;
plot(H:255,H:255, 'LineWidth', L);
hold off;
axis([0 255 0 255]);
axis square;
set(gca, 'xTick', [0 255]);
set(gca, 'xTickLabel', {'0', '255'});
set(gca, 'yTick', [0 255]);
set(gca, 'yTickLabel', {'0', '255'});


t3 = tt;
[R S] = size(t3);
for r = 1:R
    for s = 1:S
        pix = t3(r,s);
        if pix <= H
            pix = 2*pix;
        end
        t3(r,s) = (pix);
    end
end

figure(23), imshow(t3);
figure(33), imhist(t3);