Here is my attempt to recreate this using OpenCV Python. This is a rather hacky solution that requires large computational resources, but it certainly does its job.
First, create a mask where pixels that are zero correspond to those pixels that you want to keep in high resolution and pixels that one correspond to those pixels that you want to blur. For simplicity, I would create a circle of dark pixels that define high resolution pixels.
, , , - . . , , .
, , . , - , - - , , . , . , .
, . , M x M M:
M = d / S
d - , S - , d . , , . M x M , .
, , , , , , , , .
. Camera Man, . :

, 70 100, 25. . .
import cv2 # Import relevant libraries
import cv
import numpy as np
img = cv2.imread('cameraman.png', 0) # Read in image
height = img.shape[0] # Get the dimensions
width = img.shape[1]
mask = 255*np.ones(img.shape, dtype='uint8')
cv2.circle(mask, (100, 70), 25, 0, -1)
out = cv2.distanceTransform(mask, cv.CV_DIST_L2, 3)
scale_factor = 10
filtered = img.copy()
img_float = img.copy().astype('float')
if len(img_float.shape) == 3:
num_chan = img_float.shape[2]
else:
num_chan = 1
img_float = img_float[:,:,None]
filtered = filtered[:,:,None]
for y in range(height):
for x in range(width):
if out[y,x] == 0.0:
continue
mask_val = np.ceil(out[y,x] / scale_factor)
if mask_val <= 3:
mask_val = 3
beginx = x-int(mask_val/2)
if beginx < 0:
beginx = 0
beginy = y-int(mask_val/2)
if beginy < 0:
beginy = 0
endx = x+int(mask_val/2)
if endx >= width:
endx = width-1
endy = y+int(mask_val/2)
if endy >= height:
endy = height-1
xvals = np.arange(beginx, endx+1)
yvals = np.arange(beginy, endy+1)
(col_neigh,row_neigh) = np.meshgrid(xvals, yvals)
col_neigh = col_neigh.astype('int')
row_neigh = row_neigh.astype('int')
for ii in range(num_chan):
chan = img_float[:,:,ii]
pix = chan[row_neigh, col_neigh].ravel()
filtered[y,x,ii] = int(np.mean(pix))
if num_chan == 1:
filtered = filtered[:,:,0]
cv2.imshow('Output', filtered)
cv2.waitKey(0)
cv2.destroyAllWindows()
:
