Three-dimensional image repositioning method
Technical Field
The present invention relates to a method for processing image signals, and more particularly, to a method for repositioning stereoscopic images.
Background
With the rapid development of the stereoscopic display technology, various terminal devices with different stereoscopic display functions are widely available, but because the stereoscopic display terminals are various and have different width/height ratio specifications, if an image with a certain width/height ratio is displayed on different stereoscopic display terminals, the image size must be adjusted first to achieve the stereoscopic display effect. Conventional image scaling methods scale by cropping or by a fixed scale, which may result in reduced content in the image or significant object deformation.
For a stereoscopic image, stretching or reducing in the horizontal or vertical direction may seriously affect the stereoscopic effect, cause a change in binocular parallax, and thus cause a change in stereoscopic depth perception, and may cause visual discomfort in severe cases, and therefore, how to scale the left viewpoint image and the right viewpoint image of the stereoscopic image to reduce image deformation; how to ensure the consistency of parallax/depth distribution of the zoomed left viewpoint image and the zoomed right viewpoint image, thereby reducing visual discomfort and enhancing depth feeling; how to adaptively control the scaling of an object to highlight salient content according to the selection of a user is a problem that needs to be researched and solved in the process of repositioning a stereoscopic image.
Disclosure of Invention
The invention aims to provide a three-dimensional image repositioning method which accords with remarkable semantic features and can effectively adjust the size of a three-dimensional image.
The technical scheme adopted by the invention for solving the technical problems is as follows: a stereoscopic image repositioning method, characterized by comprising the steps of:
① left, right, and left parallax images of a stereoscopic image of width W and height H to be processed are denoted by { L (x, y) }, { R (x, y) }, and { dL(x, y) }; wherein x is more than or equal to 1 and less than or equal to W, y is more than or equal to 1 and less than or equal to H, W and H can be evenly divided by 8, L (x, y) represents the pixel value of the pixel point with the coordinate position (x, y) in { L (x, y) }, R (x, y) represents the pixel value of the pixel point with the coordinate position (x, y) in { R (x, y) }, dL(x, y) represents { d }LThe coordinate position in (x, y) is the pixel value of the pixel point of (x, y);
② divide { L (x, y) } intoEach non-overlapping quadrilateral grid with the size of 8 multiplied by 8; then all quadrilateral grids in { L (x, y) } form a set, which is marked as VL,VL={UL,kL 1 is more than or equal to k and less than or equal to M }; wherein, UL,kDenotes the kth quadrilateral mesh in { L (x, y) }, described by a set of 4 mesh vertices upper left, lower left, upper right, and lower right of the quadrilateral mesh,k is a positive integer, k is not less than 1 and not more than M, M represents the total number of quadrilateral meshes contained in L (x, y),corresponds to and represents UL,kA left upper grid vertex as a 1 st grid vertex, a left lower grid vertex as a 2 nd grid vertex, a right upper grid vertex as a 3 rd grid vertex, a right lower grid vertex as a 4 th grid vertex,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,
③ calculates the top left, bottom left, top right and bottom right 4 mesh vertices of each quadrilateral mesh in { L (x, y) } respectivelyThe depth values of (2) are correspondingly recorded asThen the top left, bottom left, top right and bottom right meshes of all quadrilateral meshes in { L (x, y) } are selectedThe depth values of the grid vertices form a set, denoted as ZL,ZL={zL,kL 1 is more than or equal to k and less than or equal to M }; wherein e represents a stereoscopic image to be processedD represents the left and right viewpoints and the display of the stereoscopic image to be processedViewing distance between displays, WdRepresenting the horizontal width of the display, R representing the horizontal resolution of the display, representingIs calculated, is represented by a disparity value, z is a disparity valueL,kIn order to form a set of such components,
④ extracting a saliency map of { L (x, y) } as { SM (SM) } by using a visual saliency model based on graph theoryL(x, y) }; then according to { SML(x, y) } and { dL(x,y)},Obtain a visual saliency map of { L (x, y) }, denoted as { SL(x, y) }, will { SLThe pixel value of the pixel point with the coordinate position (x, y) in (x, y) is marked as SL(x,y),Wherein, SML(x, y) denotes { SMLThe coordinate position in (x, y) is the pixel value of the pixel point of (x, y),representation SMLThe weight of (x, y),denotes dLThe weight of (x, y),
⑤ denotes a set of all target quadrilateral meshes of { L (x, y) } asAnd the set of depth values of the top left, bottom left, top right and bottom right grid vertices of all target quadrilateral grids of { L (x, y) } is recorded as a setThen, according to target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, carrying out similarity transformation on each quadrilateral grid in the { L (x, y) }, so that the transformation error of the target quadrilateral grid obtained after the similarity transformation is carried out on the original quadrilateral grid and the original quadrilateral grid is minimum, a similarity transformation matrix of the target quadrilateral grid corresponding to each quadrilateral grid in the { L (x, y) }isobtained, and the U is processedL,kCorresponding target quadrilateral meshIs recorded as a similarity transformation matrixWherein,corresponding representationA left upper grid vertex as a 1 st grid vertex, a left lower grid vertex as a 2 nd grid vertex, a right upper grid vertex as a 3 rd grid vertex, a right lower grid vertex as a 4 th grid vertex,to representI-1, 2,3,4,corresponding representationThe respective depth value of the depth map is,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representation(ii) a horizontal coordinate position and a vertical coordinate position of (A)L,k)TIs AL,kTranspose of (A) ((A)L,k)TAL,k)-1Is (A)L,k)TAL,kThe inverse of (1);
⑥ according to the similarity transformation matrix of the target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) } and combining the { SL(x, y) }, calculating the image quality energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the image quality energy as EQ;
According to the depth value of each grid vertex of each quadrilateral grid in the { L (x, y) } and the depth value of each grid vertex of the target quadrilateral grid corresponding to each quadrilateral grid in the { L (x, y) }, calculating the three-dimensional mass energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and marking the three-dimensional mass energy as ES;
Calculating all four sides in L (x, y) according to the size scaling and depth scaling of the important content selected by the userThe important content energy of the target quadrilateral mesh corresponding to the shape mesh is marked as EI;
⑦, calculating the total energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the total energy as Etotal,Etotal=EQ+λS×ES+λI×EI(ii) a Then solving by least squares optimizationObtaining a set formed by the optimal target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } and a set formed by the depth values of the top left grid, the bottom left grid, the top right grid and the bottom right grid which correspond to all quadrilateral grids in the { L (x, y) } and correspondingly marking as the depth values of the top left grid, the bottom left grid, the top right grid and the bottom right grid which correspond to all quadrilateral grids in the { L (x, y) }Andthen according toCalculating a similarity transformation matrix of the optimal target quadrilateral grids corresponding to each quadrilateral grid in the { L (x, y) }, and converting U into UL,kCorresponding optimal target quadrilateral meshIs recorded as a similarity transformation matrixAnd according toCalculating a depth transformation matrix of the optimal target quadrilateral grids corresponding to each quadrilateral grid in the { L (x, y) }, and converting U into UL,kCorresponding optimal target quadrilateral meshIs recorded as a depth transformation matrixWherein λ isSAnd λIAre all weighting parameters, min () is a function taking the minimum value,represents UL,kThe corresponding optimal target quadrilateral mesh is selected from the set of target quadrilateral meshes,to representThe depth values of the top left, bottom left, top right and bottom right grid vertexes of the grid,(BL,k)Tis BL,kTranspose of (B) ((B)L,k)TBL,k)-1Is (B)L,k)TBL,kThe inverse of (a) is, corresponding representationThe respective depth values of the top left, bottom left, top right and bottom right grid vertices;
⑧ calculating the horizontal coordinate position and the vertical coordinate position of each pixel point in each quadrilateral mesh in the { L (x, y) } after the similarity transformation rectangular transformation according to the similarity transformation matrix of the optimal target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) }, and converting the U into the U-shaped U-L,kThe position of the middle horizontal coordinate is x'L,kAnd hang downRectilinear coordinate position y'L,kThe correspondence of the horizontal coordinate position and the vertical coordinate position of the pixel point after the similarity transformation matrix transformation is recorded asAnd then, according to the horizontal coordinate position and the vertical coordinate position of each pixel point in each quadrilateral grid in the { L (x, y) } after similarity transformation and rectangular transformation, acquiring a repositioned left viewpoint image, and recording the repositioned left viewpoint image as a repositioned left viewpoint imageWherein x is not less than 1'L,k≤W,1≤y'L,k≤H,X 'is more than or equal to 1 and less than or equal to W', y 'is more than or equal to 1 and less than or equal to H, W' represents the width of the repositioned three-dimensional image, H is also the height of the repositioned three-dimensional image,to representThe pixel value of the pixel point with the middle coordinate position (x ', y');
and according to the depth transformation matrix of the optimal target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) }, calculating the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) }afterthe depth value is subjected to depth transformation rectangular transformation, and converting the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) } into a UL,kThe position of the middle horizontal coordinate is x'L,kAnd vertical coordinate position y'L,kDepth value z 'of pixel point'L,kThe depth value after the transformation of the depth transformation matrix is recorded asThen, according to the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) }, obtaining a repositioned left viewpoint depth map which is recorded as a depth value after depth transformation rectangular transformationThen according toObtaining the repositioned left parallax image and recording the repositioned left parallax imageWill be provided withThe pixel value of the pixel point with the middle coordinate position (x ', y') is recorded as Wherein, B'L,k=[z'L,k 1],To representThe pixel value of the pixel point with the middle coordinate position (x ', y');
⑨ are in accordance withAndobtaining the repositioned right viewpoint image and recording asWill be provided withThe pixel value of the pixel point with the middle coordinate position (x ', y') is recorded as Then will beAndforming a repositioned stereoscopic image; wherein x 'is more than or equal to 1 and less than or equal to W', y 'is more than or equal to 1 and less than or equal to H, W' represents the width of the repositioned three-dimensional image, H is also the height of the repositioned three-dimensional image,to representThe middle coordinate position isThe pixel value of the pixel point of (1).
E in the step ⑥QThe calculation process of (2) is as follows:
⑥ _1a, calculating the shape protection energy of the target quadrilateral meshes corresponding to all quadrilateral meshes in the { L (x, y) }, and marking as ESD,Wherein S isL(k) Represents UL,kIs the mean of the visual saliency values of all pixels in (1), i.e. representing { S }L(x,y)And U inL,kThe symbol "| | |" is the symbol of solving euclidean distance, which is the mean of the pixel values of all the pixel points in the corresponding region;
and calculates the boundary curvature energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) },is marked as ELBWherein e isL,kRepresents UL,kOf all mesh vertices ofA matrix of edges, (e)L,k)TIs eL,kTranspose of (e) ((e)L,k)TeL,k)-1Is (e)L,k)TeL,kThe inverse of (c), the matrix of edges of all mesh vertices represented,
⑥ _2a, according to ESDAnd ELBCalculating the image quality energy E of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } gridQ,EQ=ESD+λLBELB(ii) a Wherein λ isLBAre weighting parameters.
E in the step ⑥SThe calculation process of (2) is as follows:
⑥ _1b, calculating the shape scaling energy of the target quadrilateral meshes corresponding to all quadrilateral meshes in the { L (x, y) }, and recording the shape scaling energy as ESC,Wherein the symbol "| | |" is a euclidean distance-solving symbol,to representIs used to form a matrix of edges of all mesh vertices,represents UL,kIth mesh vertex of (2)The depth value of (a) is determined,to representDepth value of eL,kRepresents UL,kIs used to form a matrix of edges of all mesh vertices,
and calculating the depth control energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the depth control energy as EDC, Wherein exp () represents an exponential function with a natural base e as a base, the symbol "|" is an absolute value symbol, zmaxDenotes the maximum depth value of { L (x, y) }, zminDenotes the minimum depth value of { L (x, y) }, CVZminA minimum comfortable viewing zone range is indicated,e denotes a horizontal baseline distance between the left and right viewpoints of the stereoscopic image to be processed, D denotes a viewing distance between the left and right viewpoints of the stereoscopic image to be processed and the display, η1Indicating minimum comfortable viewing angle, CVZmaxIndicating the maximum comfortable viewing zone range,η2represents a maximum comfortable viewing angle;
⑥ _2b, according to ESCAnd EDCCalculating the solid mass energy E of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } gridS,ES=ESC+λDCEDC(ii) a Wherein λ isDCAre weighting parameters.
E in the step ⑥IThe calculation process of (2) is as follows:wherein,a rectangular area range, x, in which important contents selected by a user are locatedi,jDenotes a horizontal coordinate position, x, of a mesh vertex, jth in the horizontal direction and ith in the vertical direction, of { L (x, y) }i,j+1Denotes a horizontal coordinate position, z, of a mesh vertex of { L (x, y) } which is j +1 th in the horizontal direction and i-th in the vertical directioni,jDenotes a depth value of a mesh vertex of { L (x, y) } that is jth in the horizontal direction and ith in the vertical direction,denotes a horizontal coordinate position of a mesh vertex in the target quadrangular mesh, of a mesh vertex which is jth in the horizontal direction and ith in the vertical direction in { L (x, y) },denotes the horizontal coordinate position of the mesh vertex in the target quadrangular mesh of the mesh vertex of j +1 th in the horizontal direction and i th in the vertical direction in { L (x, y) },denotes a depth value, s ', of a mesh vertex in the target quadrangular mesh of a mesh vertex j' th in the horizontal direction and i 'th in the vertical direction in { L (x, y) } is'xRepresenting a user-specified horizontal scaling factor,s'zRepresenting a user-specified depth scaling factor, λDSAre weighting parameters.
Compared with the prior art, the invention has the advantages that:
1) the method extracts the image quality energy, the three-dimensional quality energy and the important content energy corresponding to the left viewpoint image, and obtains the optimal similarity transformation matrix and the depth value set by optimizing so as to ensure that the obtained repositioning three-dimensional image can better reserve important significant semantic information and keep visual comfort, and the zooming ratio of the important content can be controlled in a self-adaptive manner according to the selection of a user.
2) The method simultaneously adjusts the horizontal coordinate position, the vertical coordinate position and the depth value of the three-dimensional image, thereby retaining the important significant information of the repositioned left viewpoint image, simultaneously ensuring that the repositioned left viewpoint image is matched with the repositioned right viewpoint image obtained according to the repositioned left parallax image, and further ensuring the comfort and the depth feeling of the repositioned three-dimensional image.
Drawings
FIG. 1 is a block diagram of an overall implementation of the method of the present invention;
FIG. 2a is a "red/green" view of the original stereo Image of "Image 1";
FIG. 2b is a "red/green" view of "Image 1" repositioned to 60% of the width of the original stereo Image;
FIG. 3a is a "red/green" view of the original stereo Image of "Image 2";
FIG. 3b is a "red/green" view of "Image 2" repositioned to 60% of the width of the original stereo Image;
FIG. 4a is a "red/green" view of the original stereo Image of "Image 3";
FIG. 4b is a "red/green" view of "Image 3" repositioned to 60% of the width of the original stereoscopic Image;
FIG. 5a is a "red/green" view of the original stereo Image of "Image 4";
FIG. 5b is a "red/green" view of "Image 4" repositioned to 60% of the width of the original stereo Image.
Detailed Description
The invention is described in further detail below with reference to the accompanying examples.
The general implementation block diagram of the stereo image repositioning method provided by the invention is shown in fig. 1, and the method comprises the following steps:
① left, right, and left parallax images of a stereoscopic image of width W and height H to be processed are denoted by { L (x, y) }, { R (x, y) }, and { dL(x, y) }; wherein x is more than or equal to 1 and less than or equal to W, y is more than or equal to 1 and less than or equal to H, W and H can be evenly divided by 8, L (x, y) represents the pixel value of the pixel point with the coordinate position (x, y) in { L (x, y) }, R (x, y) represents the pixel value of the pixel point with the coordinate position (x, y) in { R (x, y) }, dL(x, y) represents { d }LAnd the coordinate position in the (x, y) is the pixel value of the pixel point of (x, y).
② divide { L (x, y) } intoEach non-overlapping quadrilateral grid with the size of 8 multiplied by 8; then all quadrilateral grids in { L (x, y) } form a set, which is marked as VL,VL={UL,kL 1 is more than or equal to k and less than or equal to M }; wherein, UL,kDenotes the kth quadrilateral mesh in { L (x, y) }, described by a set of 4 mesh vertices upper left, lower left, upper right, and lower right of the quadrilateral mesh,k is a positive integer, k is not less than 1 and not more than M, M represents the total number of quadrilateral meshes contained in L (x, y),corresponds to and represents UL,kA left upper grid vertex as a 1 st grid vertex, a left lower grid vertex as a 2 nd grid vertex, a right upper grid vertex as a 3 rd grid vertex, a right lower grid vertex as a 4 th grid vertex,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,to be provided withHorizontal coordinate position ofAnd vertical coordinate positionTo be described, the method has the advantages that,
③ calculates the top left, bottom left, top right and bottom right 4 mesh vertices of each quadrilateral mesh in { L (x, y) } respectivelyThe depth values of (2) are correspondingly recorded asThen the top left, bottom left, top right and bottom right meshes of all quadrilateral meshes in { L (x, y) } are selectedThe depth values of the grid vertices form a set, denoted as ZL,ZL={zL,kL 1 is more than or equal to k and less than or equal to M }; wherein e represents a stereoscopic image to be processedD represents the left and right viewpoints and the display of the stereoscopic image to be processedViewing distance between displays, WdRepresenting the horizontal width of the display and R the horizontal resolution of the display, in this embodimentTaking e 65 mm, D1200 mm, Wd750 mm and 1920 mm, the disparity value, i.e.
{dLThe pixel value of the pixel point with the coordinate position of (x, y) } represents the parallax value, namely { d }L(x,y) the value of the pixel at the coordinate position of the pixel, i.e. the disparity value, i.e. dL(x, y) } inThe pixel value of the pixel point with the coordinate position, namely { d } representing the parallax valueL(x, y) } middle coordinatePixel value of pixel point of which position isL,kIn order to form a set of such components,
④ extracting a significance map of { L (x, y) } by using the existing Graph-Based Visual significance (GBVS) model, and marking the significance map as { SM (x, y) }L(x, y) }; then according to { SML(x, y) } and { dL(x, y) }, acquiring a visual saliency map of { L (x, y) }, and marking as { S }L(x, y) }, will { SLThe pixel value of the pixel point with the coordinate position (x, y) in (x, y) is marked as SL(x,y),Wherein, SML(x, y) denotes { SMLThe coordinate position in (x, y) is the pixel value of the pixel point of (x, y),representation SMLThe weight of (x, y),denotes dLThe weight of (x, y),in this example take
⑤ denotes a set of all target quadrilateral meshes of { L (x, y) } asAnd the set of depth values of the top left, bottom left, top right and bottom right grid vertices of all target quadrilateral grids of { L (x, y) } is recorded as a setThen, according to target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, carrying out similarity transformation on each quadrilateral grid in the { L (x, y) }, so that the transformation error of the target quadrilateral grid obtained after the similarity transformation is carried out on the original quadrilateral grid and the original quadrilateral grid is minimum, a similarity transformation matrix of the target quadrilateral grid corresponding to each quadrilateral grid in the { L (x, y) }isobtained, and the U is processedL,kCorresponding target quadrilateral meshIs recorded as a similarity transformation matrixWherein,corresponding representationA left upper grid vertex as a 1 st grid vertex, a left lower grid vertex as a 2 nd grid vertex, a right upper grid vertex as a 3 rd grid vertex, a right lower grid vertex as a 4 th grid vertex,to representI-1, 2,3,4,corresponding representationThe respective depth value of the depth map is,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representationA horizontal coordinate position and a vertical coordinate position of,andcorresponding representation(ii) a horizontal coordinate position and a vertical coordinate position of (A)L,k)TIs AL,kTranspose of (A) ((A)L,k)TAL,k)-1Is (A)L,k)TAL,kThe inverse of (c).
⑥ when changing the size or width and height of the stereo imageIn contrast, in order to protect the important object concerned by the user from tensile deformation, the image quality needs to be maintained as much as possible in the mesh deformation process, so the method combines the similarity transformation matrix of the target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) } with the { S (S) } according to the similarity transformation matrix of the target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) } in the inventionL(x, y) }, calculating the image quality energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the image quality energy as EQ。
In this embodiment, E in step ⑥QThe calculation process of (2) is as follows:
⑥ _1a, calculating the shape protection energy of the target quadrilateral meshes corresponding to all quadrilateral meshes in the { L (x, y) }, and marking as ESD,Wherein S isL(k) Represents UL,kIs the mean of the visual saliency values of all pixels in (1), i.e. representing { S }L(x, y) } neutralization of UL,kThe sign "| | |" is the sign of solving euclidean distance, which is the mean of the pixel values of all the pixel points in the corresponding region.
And calculates the boundary curvature energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) },is marked as ELBWherein e isL,kRepresents UL,kOf all mesh vertices ofA matrix of edges, (e)L,k)TIs eL,kTranspose of (e) ((e)L,k)TeL,k)-1Is (e)L,k)TeL,kThe inverse of (c), the matrix of edges of all mesh vertices represented,
⑥ _2a, according to ESDAnd ELBCalculating the image quality energy E of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } gridQ,EQ=ESD+λLBELB(ii) a Wherein λ isLBFor weighting the parameters, in this example λ is takenLB=1.25。
In order to ensure visual comfort and depth sense of repositioning a stereoscopic image, the invention calculates the stereoscopic quality energy of the target quadrangular meshes corresponding to all the quadrangular meshes in the (L (x, y) } according to the depth value of each mesh vertex of each quadrangular mesh in the (L (x, y) } and the depth value of each mesh vertex of the target quadrangular meshes corresponding to each quadrangular mesh in the (L (x, y) }, and records the stereoscopic quality energy as ES。
In this embodiment, E in step ⑥SThe calculation process of (2) is as follows:
⑥ _1b, calculating the shape scaling energy of the target quadrilateral meshes corresponding to all quadrilateral meshes in the { L (x, y) }, and recording the shape scaling energy as ESC,Wherein the symbol "| | |" is a euclidean distance-solving symbol,to representIs used to form a matrix of edges of all mesh vertices,represents UL,kIth mesh vertex of (2)The depth value of (a) is determined,to representDepth value of eL,kRepresents UL,kOf all mesh verticesThe number of the arrays is determined,
and calculating the depth control energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the depth control energy as EDC, Where exp () represents an exponential function with a natural base e as the base, e is 2.71828183 …, the symbol "|" is an absolute value symbol, z ismaxDenotes the maximum depth value of { L (x, y) }, zminDenotes the minimum depth value of { L (x, y) }, CVZminA minimum comfortable viewing zone range is indicated,e denotes a horizontal baseline distance between the left and right viewpoints of the stereoscopic image to be processed, D denotes a viewing distance between the left and right viewpoints of the stereoscopic image to be processed and the display, η1Indicating a minimum comfortable viewing angle, in this example η1=-1°,CVZmaxIndicating the maximum comfortable viewing zone range,η2indicating the maximum comfortable viewing angle, in this example η2=1°。
⑥ _2b, according to ESCAnd EDCCalculating the solid mass energy E of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } gridS,ES=ESC+λDCEDC(ii) a Wherein λ isDCFor weighting the parameters, in this example λ is takenDC=0.25。
To ensure comfort and depth perception of repositioning stereoscopic imagesAccording to the size scaling ratio and the depth scaling ratio of the important content selected by the user, the important content energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } is calculated and recorded as EI。
In this embodiment, E in step ⑥IThe calculation process of (2) is as follows:wherein,a rectangular area range, x, in which important contents selected by a user are locatedi,jDenotes a horizontal coordinate position, x, of a mesh vertex, jth in the horizontal direction and ith in the vertical direction, of { L (x, y) }i,j+1Denotes a horizontal coordinate position, z, of a mesh vertex of { L (x, y) } which is j +1 th in the horizontal direction and i-th in the vertical directioni,jDenotes a depth value of a mesh vertex of { L (x, y) } that is jth in the horizontal direction and ith in the vertical direction,denotes a horizontal coordinate position of a mesh vertex in the target quadrangular mesh, of a mesh vertex which is jth in the horizontal direction and ith in the vertical direction in { L (x, y) },denotes the horizontal coordinate position of the mesh vertex in the target quadrangular mesh of the mesh vertex of j +1 th in the horizontal direction and i th in the vertical direction in { L (x, y) },denotes a depth value, s ', of a mesh vertex in the target quadrangular mesh of a mesh vertex j' th in the horizontal direction and i 'th in the vertical direction in { L (x, y) } is'xRepresenting a user-specified horizontal scaling factor, s'zRepresents a depth scaling factor specified by the user, and is taken as s 'in this embodiment'x1 and s'z1, i.e. maintaining the original size and depth of the important content, λDSFor weighting the parameters, in this example λ is takenDS=0.025。
⑦, calculating the total energy of the target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) }, and recording the total energy as Etotal,Etotal=EQ+λS×ES+λI×EI(ii) a Then solving by least squares optimizationObtaining a set formed by the optimal target quadrilateral grids corresponding to all quadrilateral grids in the { L (x, y) } and a set formed by the depth values of the top left grid, the bottom left grid, the top right grid and the bottom right grid which correspond to all quadrilateral grids in the { L (x, y) } and correspondingly marking as the depth values of the top left grid, the bottom left grid, the top right grid and the bottom right grid which correspond to all quadrilateral grids in the { L (x, y) }Andthen according toCalculating a similarity transformation matrix of the optimal target quadrilateral grids corresponding to each quadrilateral grid in the { L (x, y) }, and converting U into UL,kCorresponding optimal target quadrilateral meshIs recorded as a similarity transformation matrixAnd according toCalculating a depth transformation matrix of the optimal target quadrilateral grids corresponding to each quadrilateral grid in the { L (x, y) }, and converting U into UL,kCorresponding optimal target quadrilateralGrid meshIs recorded as a depth transformation matrixWherein λ isSAnd λIAre all weighted parameters, in this example, take λS1.5 and λI1.25, min () is the take minimum function,represents UL,kThe corresponding optimal target quadrilateral mesh is selected from the set of target quadrilateral meshes,to representThe depth values of the top left, bottom left, top right and bottom right grid vertexes of the grid,(BL,k)Tis BL,kTranspose of (B) ((B)L,k)TBL,k)-1Is (B)L,k)TBL,kThe inverse of (a) is,corresponding representationThe respective depth values of the top left, bottom left, top right and bottom right grid vertices.
⑧ calculating the horizontal coordinate position and the vertical coordinate position of each pixel point in each quadrilateral mesh in the { L (x, y) } after the similarity transformation rectangular transformation according to the similarity transformation matrix of the optimal target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) }, and converting the U into the U-shaped U-L,kThe position of the middle horizontal coordinate is x'L,kAnd vertical coordinate position y'L,kThe correspondence of the horizontal coordinate position and the vertical coordinate position of the pixel point after the similarity transformation matrix transformation is recorded asAnd then, according to the horizontal coordinate position and the vertical coordinate position of each pixel point in each quadrilateral grid in the { L (x, y) } after similarity transformation and rectangular transformation, acquiring a repositioned left viewpoint image, and recording the repositioned left viewpoint image as a repositioned left viewpoint imageWherein x is not less than 1'L,k≤W,1≤y'L,k≤H,X 'is more than or equal to 1 and less than or equal to W', y 'is more than or equal to 1 and less than or equal to H, W' represents the width of the repositioned three-dimensional image, H is also the height of the repositioned three-dimensional image,to representAnd the pixel value of the pixel point with the middle coordinate position of (x ', y').
And according to the depth transformation matrix of the optimal target quadrilateral mesh corresponding to each quadrilateral mesh in the { L (x, y) }, calculating the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) }afterthe depth value is subjected to depth transformation rectangular transformation, and converting the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) } into a UL,kThe position of the middle horizontal coordinate is x'L,kAnd vertical coordinate position y'L,kDepth value z 'of pixel point'L,kThe depth value after the transformation of the depth transformation matrix is recorded asThen, according to the depth value of each pixel point in each quadrilateral mesh in the { L (x, y) }, obtaining a repositioned left viewpoint depth map which is recorded as a depth value after depth transformation rectangular transformationThen according toObtaining the repositioned left parallax image and recording the repositioned left parallax imageWill be provided withThe pixel value of the pixel point with the middle coordinate position (x ', y') is recorded as Wherein, B'L,k=[z'L,k 1],To representAnd the pixel value of the pixel point with the middle coordinate position of (x ', y').
⑨ are in accordance withAndobtaining the repositioned right viewpoint image and recording asWill be provided withThe pixel value of the pixel point with the middle coordinate position (x ', y') is recorded as Then will beAndforming a repositioned stereoscopic image; wherein x 'is more than or equal to 1 and less than or equal to W', y 'is more than or equal to 1 and less than or equal to H, W' represents the width of the repositioned three-dimensional image, H is also the height of the repositioned three-dimensional image,to representThe middle coordinate position isThe pixel value of the pixel point of (1).
To further illustrate the feasibility and effectiveness of the method of the present invention, the method of the present invention was tested.
The following experiments were performed using the method of the present invention to reposition four stereo images, Image1, Image2, Image3, and Image 4. FIG. 2a shows a "red/green" view of the original stereoscopic Image of "Image 1", and FIG. 2b shows a "red/green" view of "Image 1" repositioned to 60% of the width of the original stereoscopic Image; FIG. 3a shows a "red/green" view of the original stereoscopic Image of "Image 2", and FIG. 3b shows a "red/green" view of "Image 2" repositioned to 60% of the width of the original stereoscopic Image; FIG. 4a shows a "red/green" view of the original stereoscopic Image of "Image 3", and FIG. 4b shows a "red/green" view of "Image 3" repositioned to 60% of the width of the original stereoscopic Image; fig. 5a shows a "red/green" view of the original stereoscopic Image of "Image 4", and fig. 5b shows a "red/green" view of "Image 4" repositioned to 60% of the width of the original stereoscopic Image. As can be seen from fig. 2a to 5b, the repositioned stereoscopic image obtained by the method of the present invention can better retain important significant semantic information, and can also ensure the consistency of the left viewpoint image and the right viewpoint image.