imcollin() direct image collineation with none interpolation

Petr Sladek (sladep1) & Milan Kratochvil (kratom4) at CTU Prague

Contents

fcn body

%function [imout, To] = imcollin(A,imin);
  % allocate mem
  paddm = 200;
  paddn = 200;
  [sizem sizen] = size(imin);
  imout = ones(sizem+2*paddm,sizen+2*paddn)*255; % white space plus  padding
  im = 1:1:sizem;
  in = 1:1:sizen;
  % allocate
  indexM = ones(sizem,sizen);
  indexN = ones(sizem,sizen);
  % meshgrid
  [index(:,:,1) index(:,:,2)] = meshgrid(1:1:sizen, 1:1:sizem);

collineate - T is direct point-to-ponit collin table

  T=collin(A,index);
  % min, max points.
  a = min(min(T(:,:,1))); b =max(max(T(:,:,1)));
  fprintf('1: min= %d max= %d \n',a,b);
  a = min(min(T(:,:,2))); b =max(max(T(:,:,2)));
  fprintf('2: min= %d max= %d \n',a,b);
  To=T;
  T(:,:,1) = T(:,:,1)+paddm;
  T(:,:,2) = T(:,:,2)+paddn;
  % check min&max, if out of border cut.
  [im in]=size(imout(:,:,1));
1: min= 1.842812e+002 max= 8.791675e+002 
2: min= -4.450391e+001 max= 6.688200e+002 

transform collin table into vector & round

  Tindex = round(reshape(T(:,:,1),1,sizem*sizen)).*im +round(reshape(T(:,:,2),1,sizem*sizen));
  Iindex = 1:1:(sizem*sizen);
  if length(Tindex)==length(Iindex)
Error: This statement is incomplete.

apply collineation to image

    imout(Tindex(:))=imin(Iindex(:));
  else
    fprintf('something is wrong');
  end