Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There's no single function solution. The final result depends on various conditions. I would do the folowing:

  1. Compute disparity map with left and right images (with using cv::StereoSGBM). Note that disparity relates to the left image.

  2. (Optional) postprocess disparity map. Fill gaps etc.

  3. Recompute disparity to the middle view.

There's no single function solution. The final result depends on various conditions. I would do the folowing:

  1. Compute disparity map with left and right images (with using cv::StereoSGBM). Note that disparity relates to the left image.

  2. (Optional) postprocess disparity map. Fill gaps etc.

  3. Recompute disparity map to the middle view.view (DispM). First init middle disparity with negative (invalid values). Then reproject left disparity to middle:

d = DispL[x,y] / 2 # divide by two because disparity for middle view less then for right view

if x-d > 0 and DispM[x-d,y] < d: DispM[x-d,y] = d

  1. Possible postprocess DispM to fill gaps

  2. Remap left image to the middle view with cv::remap. The tables for remapping calculated with folowing:

mapy[x,y] = y

mapx[x,y] = x - DispM[x,y]

There's no single function solution. The final result depends on various conditions. I would do the folowing:

  1. Compute disparity map with left and right images (with using cv::StereoSGBM). Note that disparity relates to the left image.

  2. (Optional) postprocess disparity map. Fill gaps etc.

  3. Recompute disparity map to the middle view (DispM). First init middle disparity with negative (invalid values). Then reproject left disparity to middle:

d = DispL[x,y] / 2 # divide by two because disparity for middle view less then for right view

if x-d > 0 and DispM[x-d,y] < d: DispM[x-d,y] = d

  1. Possible postprocess DispM to fill gaps

  2. Remap left image to the middle view with cv::remap. The tables for remapping calculated with folowing:

mapy[x,y] = y

mapx[x,y] = x - DispM[x,y]