kett
kett

Reputation: 957

apply a filter on images, to make them appear like they are taken from further away

I want to apply a filter on images, to make them appear like they are taken from further away, as they really are.

For reference:

Left image below is from ~1m away from the plant.

Right image is from 10m away.

enter image description here

Which filters or combination of filters should I use to get the right image from the left one. I suppose I can use some sort of blurring and pixelation. I wanted to ask here, so see if there is kind of a standard way to do this in image processing that gives realistic results.

I need to implement this in python 3 and I know how to implement a blur with opencv.

Upvotes: 0

Views: 450

Answers (1)

BHawk
BHawk

Reputation: 2462

I'd do a cubic downsample, then a nearest neighbor upsample, with a little blur for polish:

img = cv2.imread(impath,-1)
w,h = img.shape[:2]
down = cv2.resize(img,(int(w/3),int(h/3)),interpolation=cv2.INTER_CUBIC)
up = cv2.resize(down,(w,h),interpolation=cv2.INTER_NEAREST)
up = cv2.GaussianBlur(up,(5,5),2.4,2.4)
cv2.imshow('',up)
cv2.imshow('in',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Result:

enter image description here

Upvotes: 2

Related Questions