Exact (pixel) area image resampling

6 visualizaciones (últimos 30 días)
Stefan
Stefan el 13 de Mzo. de 2013
Hello,
I am trying to resample an image with certain boundary conditions and I am sure that there is a suitable matlab algorithm, but yet I'm unable to find it or use it correctly. I have found a good illustration for my problem at pages 24-26 of the following presentation:
Situation:
I have a CCD (intensity) image with 2048*2048 pixels. I call this image I(x,y). This image is projected on a new grid, called I'(x',y') using a certain coordinate transform. I have calculated the coordinates (x,y)=f(x',y') for all 4 (new) pixel corners in the old (')-Matrix. I end up with four pairs of coordinates in the old I'-image which are incommensurate with the pixel coordinates. These corners span a new pixel in the old, measured matrix I (pixel edges are approximately straight lines) that for large values (x',y') is strongly distorted. Furthermore more than 4 "old" pixel might be covered by this new pixel. That's why a simple rectangular pixel approximation fails.
Problem:
The intensity values of the pixels in I(x,y) represent photon numbers and must be preserved, e.g. sum(sum(I)) == sum(sum(I')). I read this is called "exact area image resampling".
I have tried the image transform algorithms as decribed here
but it is clearly not intensity-conserving, maybe due to the fact, that none of the algorithms assumes real-space extended pixels but only points. The above mentioned presentation suggest delaunay-triangulation and Matlab does have some built-in functions for that.
Question:
What I'm looking for is an algorithm that yields the I'-matrix intensity as the sum of area-weigthed pixel values. I wanted to include a possibly finer resampling by artificially shrinking the new pixel size but this is a secondary issue.
Thank you in advance for your replies, Stefan
Example for pixel (x'=1000,y'=1000) is represented by the corner coordinates in the new matrix
coordinates = [1104.3 ,1104.3;1104.4 ,1105.5;1105.7, 1105.7;1105.5,1104.4];
plot(coordinates(:,1),coordinates(:,2),'o-'), grid on,
set(gca,'XLim',[1103 1107], 'YLim', [1103 1107],'XTick',[1104 1105 1106],'YTick',[1104 1105 1106])

Respuestas (2)

Tanner
Tanner el 2 de Ag. de 2013
Did you end up coding a solution to this problem? I'm about to do something similar and wondered if you might have already done it.

Stefan
Stefan el 4 de Ag. de 2013
Actually i dropped almost all my requirements posted above. I restricted the distortion to values so small that only 4 pixels are covered and subsampling is left for someone smarter than me :o
For that simplified problem the solution is just a question of good illustration of the coordinates used during your calculation and the Matlab nomenclature. I ended up with nearest neighbour interpolation which is cheap to program. (subsampling the array in the 4 quadrangles spanned from one corner and the even-pixel center of mass). With lots of loops and far from being performant, it takes about 10 seconds to resample the whole matrix. I could use the central symmetry of my problem and spare 3/4 of calculation efforts.
Hope i could give you a glance of an idea. This problem in general seems to be to far away from the majority of the Matlab community. In the end just look into the restrictions of your calculation. Maybe a quick and dirty solution is better than a complete, tedious algorithm.
good luck, Stefan
  1 comentario
Tanner
Tanner el 6 de Ag. de 2013
Got it, thanks for the reply. I'll see what I can do.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by