The resized stereo image for our method is a pair of rectified images I_{L} and I_{R}. The proposed method retargets I_{L} and I_{R} into a new size. The new stereo image is composed of paired images I′_{L} and I′_{R}.
In this paper, we described the method focusing on reducing the stereo image width. Carving and inserting are reciprocal, and horizontal resizing is similar as vertical resizing.
The proposed method resized the stereo image as follows:

1.
Calculate the disparity map (D) of the stereo image, then segment the main content base on D and Panum's fusional area of the stereo image, [D _{b}, D _{f}].

2.
Calculate and select the seam of the left image (S _{L}), then pick the seam of the right image (S _{R}) with the disparity, D. Respectively carve S _{L} and S _{R} from I _{L} and I _{R}.

3.
Repeat step 2 according to the image width which needs to be reduced.
3.1. Main content segmentation
According to whether the disparity of corresponding objects is in Panum's fusional area ([D_{b}, D_{f}]), the image was segmented into the main content and background.
The disparity map (D) of the stereo image is calculated by the belief propagation (BP) algorithm [9]. We consider the disparity map with respect to I_{L}, which is taken to be the reference image. The disparity map (D) is shown in Figure 2.
The BP algorithm we used for calculating the disparity map was based on belief propagation and mean shift segmentation [10]. The disparity map and the reference image (I_{L}) are segmented into some objects. The objects and the average disparity of these objects are denoted by {o}_{\mathrm{L}}^{i} and {d}_{\mathrm{L}}^{i}, respectively, i = 1, 2,…, m. If {d}_{\mathrm{L}}^{i} is in [D_{b}, D_{f}], {o}_{\mathrm{L}}^{i} is regarded as the main content, {o}_{\mathrm{L}}^{i}\in {O}_{\mathrm{main}\phantom{\rule{0.25em}{0ex}}\mathrm{content}}. If {d}_{\mathrm{L}}^{i} is not in [D_{b}, D_{f}], {o}_{\mathrm{L}}^{i} is regarded as the background, {o}_{\mathrm{L}}^{i}\in {O}_{\mathrm{background}}. That is,
{o}_{\mathrm{L}}^{i}\in \left\{\begin{array}{c}\hfill {O}_{\mathrm{main}\phantom{\rule{0.25em}{0ex}}\mathrm{content}}{d}_{\mathrm{L}}^{i}\in \left[{D}_{\mathrm{b}},{D}_{\mathrm{f}}\right]\hfill \\ \hfill {O}_{\mathrm{background}}{d}_{\mathrm{L}}^{i}\notin \left[{D}_{\mathrm{b}},{D}_{\mathrm{f}}\right]\hfill \end{array}\right..
(5)
Figure 3 depicts the result of the main content segmentation. The main objects are reserved, and the background is removed from the left image.
3.2. Seam selection and carving
A seam is an optimal eightconnected path of pixels on a single image from top to bottom (vertical) and consisted of one and only one pixel in each row, which guarantees that the image keeps a rectangle when the seams are removed. In [1], an energy function defines the cost of a seam. The optimal seam S^{*} which minimizes this seam cost is selected:
{S}^{*}=\underset{s}{\mathrm{min}}E\left(s\right)=\underset{s}{\mathrm{min}}{\displaystyle \sum}_{j=1}^{n}{e}_{\mathrm{HoG}}\left(I\left({s}_{i}\right)\right),
(6)
where e_{HoG} is the energy with Histogram of Gradients, which is defined as follows:
{e}_{\mathrm{HoG}}\left(I\right)=\frac{\left\frac{\partial}{\partial x}I\right+\left\frac{\partial}{\partial y}I\right}{\mathrm{max}\left(\mathit{HoG}\left(I\left(x,y\right)\right)\right)}.
(7)
In our method, the seam is selected by both energy function and main content protection. Main content protection lets the seam bypass the main content without hurting the proportion.
Let S_{L} denote the seam in I_{L} and S_{R} denote the seam in I_{R}. S_{L} and S_{R} are correlative by the disparity map D. The disparity map shows the correspondence of each pixel in the left and right images. So S_{R} can be obtained by S_{L} and D.
S_{L} is computed by the energy function. The energy function based on the gradient was used to select the energy which the pixels in the seams have, which is called the backward energy at first. The minimum energy tried to minimize the artifacts introduced in the generated image.
If it does not cross the main content, S_{L} and its correlative seam S_{R} will be removed for retargeting the stereo image.
If S_{L} crosses the main content, its crossing part will be replaced. Let S_{cross} be the parts that cross the main content and S_{not cross} be the parts that do not cross the object of the main content. Let S_{E} denote the new part of the seam used to replace S_{cross}. S_{E} is selected beside the edge of the object; the vertical height of S_{E} and S_{cross} is the same, and the start points and end points of S_{E} and S_{cross} have the same ordinate value. That is, assuming that S_{cross} starts from point a(i_{1}, j_{1}) to point b(i_{2}, j_{2}) to end, S_{E} will start from point c(k_{1}, j_{1}) to point d(k_{2}, j_{2}). Let S′_{L} denote the new seam that consists of S_{E} and S_{not cross}. By S′_{L} and D, the new seam of the right image (S′_{R}) is obtained. Figure 4 shows the coupled seams S′_{L} and S′_{R}. S′_{L} and S′_{R} are not necessarily continuous:
{S}^{\text{'}}{}_{\mathrm{L}}=\left\{\begin{array}{ll}{S}_{\mathrm{L}}& \mathrm{if}\phantom{\rule{0.25em}{0ex}}{S}_{\mathrm{L}}\mathrm{does}\phantom{\rule{0.25em}{0ex}}\mathrm{not}\phantom{\rule{0.25em}{0ex}}\mathrm{cross}\phantom{\rule{0.25em}{0ex}}\mathrm{the}\phantom{\rule{0.25em}{0ex}}\mathrm{main}\phantom{\rule{0.25em}{0ex}}\mathrm{content}\\ {S}_{\mathrm{L}}{S}_{\mathrm{cross}}+{S}_{\mathrm{E}}& \mathrm{if}\phantom{\rule{0.25em}{0ex}}{S}_{\mathrm{L}}\mathrm{crosses}\phantom{\rule{0.25em}{0ex}}\mathrm{the}\phantom{\rule{0.25em}{0ex}}\mathrm{main}\phantom{\rule{0.25em}{0ex}}\mathrm{content}\end{array}\right.\phantom{\rule{1.7em}{0ex}}.
Since the left and right images are captured from different views, some pixels around objects are occluded [11]. Therefore, removing S′_{L} and S′_{R} takes a little effect on depth perception.
The energy function calculates the changing intensities of gradients. When the change of aspect ratio is large, many seams need to be removed from the stereo image. In this scenario, some seams may intensively appear around the objects with smooth gradients and lead to cracks in the resized stereo image. In order to prevent this condition, when n seams need to be removed, we calculate 2n − 1 seams at once and alternately remove n seams from the 2n − 1 seams.
For some stereo images with large main content, the excessive main content protection will cause overflow or seriously distort the global structure of stereo images. To address this problem, we set a ratio based on the image content. If the reduced width is more than the ratio of the image, the seams of the left image will be defined only by the energy function, without considering main content protection.