# Revision history [back]

Hi I have found a good paper about Upsampling and been trying to understand formula in the paper. Here's a part of it. Based on the formula in the screen shot,

I have wrote some c++ codes but I am not sure it is right. Would you guys please tell me if I doing in right way? And Please give me some tips about getting Px..

double Ix, Iy, dI, Nx, Px, t;
t = 3;
Ix = getValueAt(&imageBGR, x+1, y, 0) - getValueAt(&imageBGR, x-1, y, 0);
Iy = getValueAt(&imageBGR, x, y+1, 0) - getValueAt(&imageBGR, x, y-1, 0);
if(Ix == 0) Ix = 0.001;
dI = Iy/Ix;

Nx = sqrt( (Ix*Ix) + (Iy*Iy) );
Px = ??


Thanks, 2 No.2 Revision Kirill Kornyakov 2752 ●13 ●24 ●52

### folmula formula of gradient direction

Hi I have found a good paper about Upsampling and been trying to understand formula in the paper. Here's a part of it. Based on the formula in the screen shot,

I have wrote some c++ codes but I am not sure it is right. Would you guys please tell me if I doing in right way? And Please give me some tips about getting Px..

double Ix, Iy, dI, Nx, Px, t;
t = 3;
Ix = getValueAt(&imageBGR, x+1, y, 0) - getValueAt(&imageBGR, x-1, y, 0);
Iy = getValueAt(&imageBGR, x, y+1, 0) - getValueAt(&imageBGR, x, y-1, 0);
if(Ix == 0) Ix = 0.001;
dI = Iy/Ix;

Nx = sqrt( (Ix*Ix) + (Iy*Iy) );
Px = ??


Thanks,