As an example I use images from middleburry.
Solution is very dirty and slow.
https://github.com/serge-m/depth_map_occlusion
Solution is very dirty and slow.
https://github.com/serge-m/depth_map_occlusion
# In[1]:
import numpy
import scipy
import matplotlib.pyplot as plt
# In[2]:
from scipy import ndimage
import numpy as np
# kernels for shift
k = np.array([
[[0,0,0],
[0,0,1],
[0,0,0],],
[[0,1,0],
[0,0,0],
[0,0,0],],
[[0,0,0],
[1,0,0],
[0,0,0],],
[[0,0,0],
[0,0,0],
[0,1,0],],
[[1,0,0],
[0,0,0],
[0,0,0],],
[[0,0,1],
[0,0,0],
[0,0,0],],
[[0,0,0],
[0,0,0],
[0,0,1],],
[[0,0,0],
[0,0,0],
[1,0,0],],
])