function Omat = transformI2O(Imat)
% Rechnung
Omat = Imat;

zaehlVektor = ones(1,4);
for jj=1:4
    ii = 9;
    while ii>0 && Imat(ii,2*jj)==2
        ii = ii-1;
    end
    zaehlVektor(jj) = ii+1;
end

[zaehlVektorSortiert, sortierungIndizes] = sort(zaehlVektor,'descend');

for jj=1:4
    Omat(zaehlVektor(sortierungIndizes(jj)):9,2*sortierungIndizes(jj)) = 2+jj;
end

% Plotten
colormap = [
    0, 0, 0;          % Black
    0.5, 0.5, 0.5;    % Gray
    1, 0.82, 0;       % Yellow
    0, 0.62, 0.38;    % Green
    1, 0, 0;          % Red
    0, 0, 1;          % Blue
    0.81, 0.23, 0.53; % Pink
    1, 0.46, 0.09;    % Orange
    0.53, 0.81, 0.92; % Light blue
    0.5, 0, 0.13;     % Dark red
];
imshow(Omat,colormap)

end