kunzmi / ImageStackAlignator

Implementation of Google's Handheld Multi-Frame Super-Resolution algorithm (from Pixel 3 and Pixel 4 camera)
GNU General Public License v3.0
392 stars 65 forks source link

Gradient structure tensor size #14

Open TingfengTang opened 3 years ago

TingfengTang commented 3 years ago

The paper said that the gradient is computed at a quater of the full resolution(In section 5.1.2, we create a single pixel from a 2 × 2 Bayer quad by combining four different color channels together. This way, we can operate on single channel luminance images and perform the computation at a quarter of the full resolution cost and with improved signal-to-noise ratio), but the code allocation size is still the RawWidth*Rawheight(the snippet in class prepareAccumulation : _structureTensor4=new NPPImage_32fC4(_pefFiles[refImage].RawWidth,_pefFiles[refImage].Height)). Can you tell me what is the difference between your relization and the description in the paper, thanks!

kunzmi commented 3 years ago

There are two main differences: First I'm doing all calculations at full resolution, and second is the averaging of the structure tensor: In the original paper they seem to take a 2x2 box and take the average of the x^2-derivative, y^2-derivative and the xy-diagonals. So they obtain one tensor for a 2x2 block of an image of half the size: that makes the quarter of full resolution. Me on the other hand, as I said, I compute the derivatives on a gaussian smoothed full resolution image and then I apply another gaussian filter to the x^2,y^2,xy components of the structure tensor for the averaging.