0

bilinear interpolation으로 이미지의 크기를 조정하고 싶습니다. .. 나는 새로운 강도 값을 발견하지만 난이 .. 코드가있는 아래 내가 작성되어 사용하는 방법을 모르는파이썬에서 bilinear interpolation으로 이미지 크기 조정

def resizeImageBI(im,width,height): 
    temp = np.zeros((height,width),dtype=np.uint8) 
    ratio_1 = float(im.size[0] - 1)/ float(width - 1) 
    ratio_0 = float(im.size[1] - 1)/float(height - 1) 
    xx,yy = np.mgrid[:height, :width] 
    xmap = np.around(xx * ratio_0) 
    ymap = np.around(yy * ratio_1) 

for i in xrange(0, height): 
    for j in xrange(0,width): 
     temp[i][j]=im.getpixel((ymap[i][j], xmap[i][j])) * getNewIntensity(i,j,ratio_1,ratio_0) 

return Image.fromarray(temp) 

먼저 도착 변수 이미지 너비의 비율과 높이 비율

lena.png 0.5 1 

Orginal image is here

That is output accorting to written code

답변

0

내가

... 당신이 연습으로 수동으로이 작업을 수행 할 수 있는지 확실하지 않습니다

만약 그렇다면, 당신이 원하는 것을 할 수있는 가 있습니다.

+0

제가 운동을 시도한다고 말하면서이 기능을 알고 있습니다. –