WO2017113850A1 - Method and apparatus for obtaining parallax parameters of stereoscopic film source - Google Patents

Method and apparatus for obtaining parallax parameters of stereoscopic film source Download PDF

Info

Publication number
WO2017113850A1
WO2017113850A1 PCT/CN2016/097696 CN2016097696W WO2017113850A1 WO 2017113850 A1 WO2017113850 A1 WO 2017113850A1 CN 2016097696 W CN2016097696 W CN 2016097696W WO 2017113850 A1 WO2017113850 A1 WO 2017113850A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
parallax
parameter
stereoscopic
eye image
Prior art date
Application number
PCT/CN2016/097696
Other languages
French (fr)
Chinese (zh)
Inventor
楚明磊
Original Assignee
乐视控股(北京)有限公司
乐视致新电子科技(天津)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视致新电子科技(天津)有限公司 filed Critical 乐视控股(北京)有限公司
Publication of WO2017113850A1 publication Critical patent/WO2017113850A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N13/00Stereoscopic video systems; Multi-view video systems; Details thereof
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N13/00Stereoscopic video systems; Multi-view video systems; Details thereof
    • H04N13/10Processing, recording or transmission of stereoscopic or multi-view image signals
    • H04N13/106Processing image signals
    • H04N13/167Synchronising or controlling image signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N13/00Stereoscopic video systems; Multi-view video systems; Details thereof
    • H04N13/10Processing, recording or transmission of stereoscopic or multi-view image signals
    • H04N13/106Processing image signals
    • H04N13/128Adjusting depth or disparity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N13/00Stereoscopic video systems; Multi-view video systems; Details thereof
    • H04N13/10Processing, recording or transmission of stereoscopic or multi-view image signals
    • H04N13/194Transmission of image signals

Definitions

  • the present application relates to the field of image processing, for example, to a method and apparatus for acquiring stereo disc source parallax parameters.
  • 3Dimensional (3D) technology With the development of 3Dimensional (3D) technology, the number of stereoscopic sources is increasing, and more and more devices supporting viewing stereoscopic sources are also available.
  • the principle of 3D technology is to simultaneously capture the same object through two shooting devices at the same horizontal line but separated by a certain horizontal distance, and obtain two images of the left and right corresponding to the object.
  • the stereoscopic film source When the stereoscopic film source is played, the left side of the left and right eyes respectively allows the user to view the left image and the right eye to view the right image. Since there is a horizontal interval between the photographing devices for simulating the pupil distance of the human eye, there is a certain parallax between the objects respectively presented by the left and right images.
  • the left and right images are simultaneously transmitted to the brain through the retina, and the brain uses the parallax to generate the depth of field effect of the object, thereby obtaining a stereoscopic effect.
  • the stereo source itself does not provide a parallax parameter, and manual calculation is required to obtain the parallax parameter.
  • the relevant person finds the same object in the left and right images respectively, for example, finds the object "water cup” in the left and right images, and then manually calculates the number of pixels in the horizontal direction of the two "cups" to obtain the horizontal distance on the X axis. , thus obtaining the parallax parameter between the two "cups".
  • the stereoscopic degree of different objects in the 3D image is different, so the horizontal distances of different objects in the left and right images are different from each other.
  • the parallax parameters are acquired, the professional needs to select and calculate different objects separately, and obtain multiple parallax parameters. And select the maximum and minimum values of the parallax parameters to determine the range of parallax variation of the stereoscopic source.
  • the related technology mainly relies on the subjective recognition and judgment of the relevant personnel to perform object selection, and the calculation of the horizontal distance is also manually performed by a professional, when the number of objects in the 3D image is large, the efficiency of acquiring the parallax parameter is very low.
  • the related method can still process static stereoscopic pictures, but for stereoscopic video composed of hundreds of thousands of frames or even millions of frames, if the parallax parameters of each frame are manually obtained manually, the time cost will be very high. Big.
  • the present application provides a method and apparatus for obtaining a parallax parameter of a stereoscopic slice source, and solves the problem of inefficiently obtaining a parallax parameter of a stereoscopic slice source.
  • the embodiment of the present application provides a method for obtaining a parallax parameter of a stereoscopic slice, including:
  • Reading an image frame from the stereoscopic source file the image frame including a left eye image and a right eye image;
  • the maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
  • the embodiment of the present application further provides an apparatus for acquiring a parallax parameter of a stereoscopic slice, including:
  • a reading unit configured to read an image frame from the stereoscopic source file, the image frame including a left eye image and a right eye image;
  • a region determining unit configured to determine a plurality of first image regions in one of a left eye image and a right eye image
  • a searching unit configured to search for a plurality of second image regions corresponding to the plurality of first image region contents in another of the left eye image and the right eye image, the first image region and the second image region size corresponding to each other the same;
  • a calculating unit configured to separately calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters
  • the parameter determining unit is configured to determine a maximum parallax parameter and a minimum parallax parameter to obtain a parallax variation range of the stereoscopic slice source.
  • an embodiment of the present application further provides an electronic device, including:
  • At least one processor and,
  • the memory stores instructions executable by the one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
  • the maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
  • the embodiment of the present application further provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions, where the computer instructions are used to cause the computer to execute the above A method of obtaining a stereoscopic source parallax parameter.
  • the embodiment of the present application further provides a computer program product, including a computing program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer And causing the computer to perform the above-described method of acquiring a stereoscopic source parallax parameter.
  • the method and device for acquiring a stereoscopic source parallax parameter can automatically read an image frame from a stereoscopic source file, and determine a plurality of identical and one-to-one correspondences in the left and right eye images in the image frame. a first image area and a second image area, respectively calculating a horizontal distance of each pair of the first and second image areas, obtaining a parallax parameter corresponding to each pair of the first and second image areas, and then from the plurality of parallax parameters A maximum parallax parameter and a minimum parallax parameter are determined, thereby obtaining a parallax variation range of the stereoscopic sheet source.
  • the time taken to obtain parallax parameters is greatly shortened, and the processing efficiency is improved.
  • FIG. 1 is a flowchart of a method for obtaining a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure
  • FIG. 2 is a flowchart of another method for obtaining a stereoscopic source parallax parameter according to an embodiment of the present disclosure
  • FIG. 3 is a flowchart of still another method for obtaining a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure
  • 4a to 4d are schematic diagrams of determining a first image area according to an embodiment of the present application.
  • 4 e is a schematic diagram of determining a second image area according to an embodiment of the present application.
  • 5a to 5d are schematic diagrams of determining pixel points according to an embodiment of the present application.
  • FIG. 6 is a structural block diagram of an apparatus for acquiring a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure
  • FIG. 7 is a structural block diagram of another apparatus for acquiring a stereoscopic source parallax parameter according to an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a physical structure of an electronic device for acquiring a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure.
  • An embodiment of the present application provides a method for obtaining a parallax parameter of a stereoscopic slice. As shown in FIG. 1 , the method includes:
  • step 110 an image frame is read from the stereoscopic source file.
  • the stereoscopic source in this embodiment may be a stereoscopic image or a stereoscopic video.
  • the stereoscopic source file usually includes only one image, and for stereoscopic video, the stereoscopic source file generally includes many images. frame.
  • the embodiment refers to an image in a stereoscopic picture as an image frame.
  • the stereoscopic film source is obtained by two imaging devices at the same horizontal line and separated by a certain distance, so whether it is a stereoscopic picture or a stereoscopic video, each image frame is composed of a left eye image and a The right eye image is composed of. Since there is a horizontal interval between the two imaging devices for simulating the eyelid distance of the human eye, both the left eye image and the right eye image have a certain positional offset in the horizontal direction, and this positional offset is the implementation.
  • the computer can read the stereoscopic source file from the storage area or the database according to the default storage path, or directly receive the stereoscopic source file sent by the network side through the preset application interface, or through a preset operation.
  • the interface receives the stereoscopic source file uploaded by the user. This embodiment does not specifically limit the manner in which the stereoscopic source file is obtained.
  • step 120 a plurality of first image regions are determined in one of the left eye image and the right eye image.
  • a prerequisite for obtaining the parallax parameter is to determine two image regions corresponding to the same content, that is, the first image region and the second image region, respectively, in the left and right images.
  • the first image region is first determined therein based on any one of the left and right images, and then the second image region is determined correspondingly in the other image.
  • the present embodiment will be described by taking the first image region in the left eye image as an example. Of course, in the actual application, the first image region may be first determined based on the right eye image.
  • the manner of obtaining the parallax parameter is the same as that of the former method, and the present embodiment does not repeat the description.
  • the disparity of all content in the left and right images should be consistent, that is, pedestrian 1 and pedestrian 2 (note: pedestrian 1 is the pedestrian in the left eye image, pedestrian 2 is the corresponding pedestrian in the right eye image, the same) Parallax, the parallax of car 1 and car 2 should be the same, but because the depth of field of different objects is different, the disparity of different content may be different in actual situation, which needs to be determined in the left eye image.
  • a plurality of first image regions are determined, and a plurality of second image regions are correspondingly determined in the subsequent right eye images, and thereby a plurality of parallax parameters are calculated.
  • the objects in the left eye image can be identified by image recognition technology, and then different first image regions including different objects are determined according to the position and size of the different objects.
  • the parallax parameters between the objects can be accurately calculated from the naturally formed objects, but because of the use of image recognition technology, a large amount of calculation is involved in practical applications.
  • the first image region may also be subjected to blur determination in the embodiment, that is, the first image region is directly determined without the object recognition as a premise requirement for determining the first image region.
  • a plurality of first image regions are determined by randomly selecting positions in the left eye image, or several first image regions are determined at specific positions according to the size ratio of the left eye image. This method does not require recognition of the content of the image, and is faster to implement.
  • step 130 a plurality of second image regions corresponding to the plurality of first image region contents are searched for in another of the left eye image and the right eye image.
  • the content correspondence means that the content displayed in the second image area is the same as the content displayed in the first image area. From the perspective of the control variable, only the difference in position between the same content and the left and right images can be used to reflect the disparity of the content in the left and right images. Therefore, the content in the first and second image regions is required in this embodiment. It is corresponding. Under this premise, the first image area and the second image area should be identical at least in the following aspects: 1. The content is the same; 2. The size of the area is the same; 3. The number of areas is the same.
  • the computer can find the content corresponding to the content of the first image region in the right eye image through an image matching technology (for example, the method provided in OpenCV), and determine the location of the second image region according to the found content.
  • an image matching technology for example, the method provided in OpenCV
  • the second image region is determined in the right eye image
  • the content in the right eye image needs to be identified by the image matching technology, and the purpose is to make the determined second image region and the left eye image.
  • the first image regions correspond to each other in content, and as a precondition for calculating the parallax parameters, such a process of content recognition is necessary.
  • the image recognition process in step 120 may be omitted to improve the processing speed. .
  • step 140 a horizontal distance between each of the first image regions and the second image region corresponding thereto is separately calculated to obtain a plurality of parallax parameters.
  • step 120 After obtaining the first image area and the second image area of equal numbers, respectively calculating a horizontal distance between the first image area and the second image area corresponding to the content, thereby obtaining a parallax parameter corresponding to each pair of the first/second image areas .
  • a parallax parameter corresponding to each pair of the first/second image areas Exemplarily, assuming that four first image regions are determined in step 120, then corresponding four second image regions are determined in step 130.
  • the parallax parameter c between the two image regions 3 and the parallax parameter d between the first image region 4 and the second image region 4 obtain four parallax parameters equal in number to the first image region or the second image region.
  • the horizontal distance may be calculated based on a certain pixel point in the first image area and the second image area, or the horizontal distance may be calculated based on the same area edge of the first image area and the second image area.
  • the horizontal distance may also be calculated based on the entirety of the first image area and the second image area. This embodiment does not specifically limit the object for calculating the horizontal distance reference.
  • the horizontal distance refers to the difference in distance between the first image area and the second image area on X
  • the unit may be the number of pixels, or may be a unit of length in a general sense, such as millimeters, centimeters, and the like. This embodiment does not limit this, but in general, the distance difference is positive and negative.
  • step 150 the maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
  • the disparity between different content may be different.
  • obtaining the parallax variation range of the entire image frame is more practical than obtaining the parallax parameter of each region in the image frame. Therefore, in this step, the computer finds a maximum parallax parameter and a minimum parallax parameter from all the obtained parallax parameters, and determines the parallax variation range of the image frame as the upper and lower boundary values of the parallax variation range.
  • the range of parallax variation obtained in this step is the range of parallax variation of the stereoscopic source; for stereoscopic video, since it contains many image frames, all can be All the parallax parameters in the image frame are put together, and a maximum parallax parameter and a minimum parallax parameter are found out to determine the range of parallax variation of the stereoscopic video.
  • the embodiment of the present application will provide a method for performing parallax parameter acquisition on a stereoscopic slice source including a plurality of image frames.
  • a stereoscopic source containing a plurality of image frames is usually a stereoscopic video, but it is not excluded that a partial stereoscopic image is composed of at least two image frames, and the latter is equally applicable to the method.
  • the method includes:
  • step 210 at least two image frames are extracted from the stereoscopic source file as sample frames.
  • the computer calculates a parallax parameter for at least two image frames in the stereoscopic source file, and puts the parallax parameters of all the image frames together, and selects a maximum parallax parameter and a minimum parallax parameter.
  • the computer extracts image frames from the stereoscopic source file in accordance with predetermined rules. Extracting several image frames and extracting which image frames are defined by the preset rule. The following two implementations of extracting image stitches are given:
  • Mode 1 is extracted according to sampling interval
  • the image frames have a certain order in the stereo source files. This order is generally determined by the order in which the image frames are played.
  • at least two sampling frames may be extracted according to the predetermined sampling interval based on the ranking.
  • the sampling interval may be an interval frame number or an interval time.
  • it may be specified that one image frame is extracted every four image frames from the first image frame, or one image frame is extracted every 100 image frames; for the latter implementation, the image frame may be played according to the image frame. Timing, starting with the moment when the first image frame is played, extracting one image frame every 100 milliseconds, or extracting one image frame every 15000 milliseconds.
  • the specific numerical values in this mode are for illustrative purposes only and are not intended as a limitation of the actual application.
  • the computer can extract the sampled frames using a random number generation algorithm.
  • the computer randomly generates a random number whose value is not greater than the total number of image frames by using a random number generating function, and extracts an image frame with the same image frame number and the random number as the extracted frame.
  • the computer may randomly generate a floating-point random number greater than 0 and less than or equal to 1 by using a random number generating function, and then multiply the random number by the total number of image frames to obtain a random extraction.
  • the number of image frames this method needs to optimize the algorithm to ensure that the product of the random number and the total number of image frames is a positive integer.
  • the computer can also receive the extraction rule set by the staff through a preset human-computer interaction mode, and the extraction rule can only limit the number of extracted image frames, and can also specifically define which specific image frames are extracted. This embodiment does not limit this. In an extreme mode of this embodiment, all image frames in the stereoscopic source file can be extracted.
  • step 220 parallax parameters for each sample frame are obtained separately.
  • the computer performs step 120 to step 140 in FIG. 1 for each sample frame to obtain the parallax parameters of each sample frame.
  • step 120 to step 140 in FIG. 1 for each sample frame to obtain the parallax parameters of each sample frame.
  • each sampling frame needs to calculate 4 parallax parameters, that is, 4 first/second image regions are respectively determined in the left and right images of each sampling frame.
  • the number of parallax parameters obtained by calculating each sampling frame may be For the same, for example, four of the above examples, the number of differentiated parallax parameters may also be determined for different sampling frames, for example, three parallax parameters are acquired for a partial sampling frame, and seven parallax parameters are acquired for another partial sampling frame.
  • This embodiment does not limit the number of disparity parameters acquired in each sampling frame, and does not limit the number of disparity parameters acquired in each sampling frame to be the same.
  • the computer may obtain the parallax parameters for each sampling frame according to the sampling frame number from small to large, or may obtain the parallax parameters according to the sequence of the extracted sampling frames. In practical applications, when there are enough idle computing resources, the computer can simultaneously obtain parallax parameters for some or all of the sampled frames through a preset number of parallel threads.
  • step 230 among the parallax parameters of all the sampling frames, the maximum parallax parameter and the minimum parallax parameter are determined, and the parallax variation range of the stereoscopic slice source is obtained.
  • the maximum disparity parameter and the minimum disparity parameter are selected from all disparity parameters of all sample frames.
  • the computer selects one of the 520 parallax parameters with the largest parallax parameter and the smallest value parallax parameter.
  • the embodiment of the present application further provides a method for obtaining a parallax parameter of a stereoscopic slice source.
  • the method is described in terms of obtaining parallax parameters from an image frame. It should be clarified that although the expression angle has certain limitations, it does not affect the application of the method in the case of FIG. As shown in FIG. 3, the method includes:
  • step 310 an image frame is read from the stereoscopic source file.
  • step 320 a plurality of preset image size first regions are determined at preset positions in one of the left eye image and the right eye image.
  • the computer determines a plurality of preset image first image regions from preset positions in the left eye image.
  • Variables that can be automatically set by the computer or manually set manually include: 1. coordinates of the preset position; 2. the number of preset positions (ie, the number of first image areas); 3. size of the first image area .
  • the computer randomly selects three rectangular regions in the left eye image by using a random algorithm, and determines the first image region (the length and width values of the rectangle are not shown). .
  • the computer selects four square regions according to the layout position of the four-square grid, and determines the first image region.
  • the size of the square is reduced by a preset ratio based on the size of the square grid (the square length value of the square is not shown).
  • the computer is arranged according to the layout of the nine squares. Position, 9 square areas are selected and determined as the first image area. The size of the square is reduced by a preset ratio based on the size of the nine squares (the square length value of the square is not shown).
  • the computer selects eight square regions in the diagonal position of the left eye image, and determines the first image region (the square length value of the square is not shown). Out).
  • step 330 the first image area is filtered to eliminate the first image area whose pixel chromaticity is less than a predetermined degree of dispersion.
  • the determined first image region may be filtered to remove the image region with a single chroma.
  • a single chrominance image region for example, an all white or all green image region
  • the chromaticities of the respective pixels in the image region are the same or similar
  • the horizontal offset of the image cannot be accurately determined, thereby making the calculated parallax parameter larger or smaller than the actual parallax parameter. Therefore, in this step, the first image region with a single chroma can be eliminated, thereby eliminating inaccurate parallax parameters.
  • the image region of a single chromaticity includes not only an image region (for example, an all white region) involving only one chromaticity, but also an image region involving a plurality of chromaticities but relatively close chromaticity.
  • image region involving blue sky and white clouds although it contains both white and blue hues, in some specific climatic conditions, the chromaticity of white clouds is very similar to the chromaticity of the blue sky as the background, there is no obvious difference between the two. For this image area, this step will also be rejected.
  • the computer can cull the first image region of a single chrominance by calculating the degree of dispersion of the pixel chromaticity.
  • the degree of dispersion of pixel chrominance reflects the degree of chromaticity difference between pixels in the image region. The greater the degree of dispersion, the greater the difference in pixel chromaticity.
  • the preset dispersion degree is used as a boundary condition for distinguishing a single chrominance image region and an image region whose chromaticity dispersion degree satisfies the calculation requirement. In actual application, the preset dispersion degree can be obtained by the computer according to the accuracy of the historical parallax parameter, and also It can be obtained by the staff based on experience.
  • the degree of dispersion of pixel chrominance can be quantified by standard deviation, and the standard deviation is used to characterize the degree of deviation of all values relative to the average, wherein the average is the average of all values.
  • the value, the degree of deviation is derived from the individual difference contribution of each value to the mean. Therefore, the standard deviation can be reflected as a whole for the degree of dispersion of all values (relative mean).
  • the computer calculates that each pixel in the first image region corresponds to a standard difference of three color components of red, green, and blue, and obtains three differences of a red standard deviation value, a green standard deviation value, and a blue standard deviation value. Value parameter.
  • the standard deviation reflects the degree of deviation of the red color chromaticity mean between different pixels on the red component. The larger the red standard deviation, the greater the dispersion of each pixel on the red component. The chromaticity of the entire image region on the red component is not uniform.
  • the computer sums the three to obtain the comprehensive standard deviation value, and then compares the integrated standard deviation value with the preset standard deviation threshold value. The first image area whose integrated standard deviation is less than the standard deviation threshold is eliminated.
  • is the standard deviation value
  • N is the number of pixel points in the first image region
  • x i is the chromaticity value of the ith pixel point
  • is the chromaticity mean of all the pixel points.
  • the computer calculates the standard deviation of all pixels on the red component by the following formula:
  • ⁇ r is the standard deviation of the first image region on the red component
  • x ri is the chromaticity value of the i-th pixel on the red component
  • ⁇ r is the red component of all pixels The average of the chromaticity.
  • the computer calculates the standard deviation of all pixels on the green component by the following formula:
  • ⁇ g is the standard deviation of the first image region on the green component
  • x gi is the chromaticity value of the ith pixel on the green component
  • ⁇ g is the pixel on all the green components The average of the chromaticity.
  • the computer then calculates the standard deviation of all pixels on the blue component by the following formula:
  • ⁇ b is the standard deviation of the first image region on the blue component
  • x bi is the chromaticity value of the ith pixel on the blue component
  • ⁇ b is the pixel of all pixels The chromaticity mean on the blue component.
  • the computer obtains standard deviation values ⁇ r , ⁇ g and ⁇ b corresponding to the three color components of the first image region. Then ⁇ r , ⁇ g and ⁇ b are summed to obtain a comprehensive standard deviation ⁇ c . Finally, the computer compares ⁇ c with a preset standard deviation threshold. If ⁇ c is greater than the standard deviation threshold, the dispersion of the pixel chromaticity in the first image region is sufficiently large to retain the first image region; If ⁇ c is smaller than the standard deviation threshold, it indicates that the degree of dispersion of the pixel chromaticity in the first image region is not large enough, and the first image region is eliminated. This completes the screening of the first image area. In the example shown in Figure 4a, the first image area in the lower right corner will be rejected.
  • V is the average difference of a certain color component
  • the characters and arithmetic symbols in the absolute value symbol correspond to the content in the foregoing formula.
  • the average difference algorithm can reduce the calculation amount of the computer to some extent, but the accuracy of the standard deviation algorithm is higher from the perspective of reflecting the degree of color deviation.
  • the edge of the object in the image may be identified according to the degree of change in the brightness of the pixel, and the first image region containing less objects may be removed accordingly.
  • step 330 is an optional step in FIG. 3, and in actual application, step 340 may be directly executed after step 320 is performed, that is, the first image area is not filtered.
  • step 340 a plurality of second image regions corresponding to the plurality of first image region contents are searched for in the other of the left eye image and the right eye image.
  • the other image is a right eye image
  • the computer determines a plurality of second image regions in the right eye image, the number and size of the second image regions, and the number and size of the first image regions in the left eye image. the same.
  • the position of the second image area in the right eye image is generally different from the position of the first image area in the left eye image due to the horizontal spacing between the left and right images.
  • the positions of the two image regions in the left and right images are the same.
  • the computer needs to ensure that the content involved in the second image area is the same as the content involved in the first image area, and the computer searches for the content involved in the first image area in the right eye image through image matching technology, and then in the content Upper, the second image area is determined according to the size of the first image area.
  • FIG. 4e shows the second image area determined in the right eye image, and it can be seen that the two correspond to the same number, size and content as compared with the first image area in the left eye image. However, due to the horizontal spacing, the position of the second image area is slightly to the left relative to the first image area.
  • step 350 in the first image region and the second image region corresponding to each other, select the same Pixels.
  • the computer selects the same pixel point from the two image areas respectively.
  • the same pixel refers to a pixel having the same relative coordinate in the image region, for example, the fourth row and the fifth pixel in the first image region, and the fourth row and the fifth pixel in the second image region. Two pixels belong to the same pixel. Since the sizes of the first image area and the second image area are the same, the concept of using relative coordinates ensures that the selected pixels are the same.
  • the computer determined pixel points may be as shown in Figure 5a.
  • it is also possible to select pixels at a particular location such as a pixel on the four corners of the image area, a central pixel in the image area, or a pixel on the edge of the image area. The latter three cases are shown in Figures 5b, 5c and 5d, respectively.
  • step 360 the coordinate difference of the pixel on the X-axis is calculated to obtain a parallax parameter.
  • the computer After determining the pixel point, the computer calculates the coordinate difference value of the two pixel points on the X-axis, that is, obtains the parallax parameter corresponding to the pair of first/second image regions.
  • the computer sequentially performs steps 350 and 360 for each pair of first/second image regions to obtain a plurality of parallax parameters corresponding to the number of first/second image regions.
  • the computer can obtain the absolute coordinates of the two pixel points in the left and right images, and then subtract the X-axis component values of the two absolute coordinates to obtain the coordinate difference of the pixel points on the X-axis.
  • step 370 the maximum parallax parameter and the minimum parallax parameter that exceed the reasonable range of the preset parallax are eliminated.
  • the parallax parameter has positive and negative points. This difference is used to reflect whether the second image area is shifted to the left or to the right relative to the first image area. Based on different reference standards, the leftward and rightward offsets visually represent the object protrusions and depressions, respectively, or the object depressions and protrusions, respectively.
  • the absolute value of the parallax parameter reflects the stereoscopic degree of the object protruding or concave.
  • the stereoscopic degree of the object in the stereoscopic source is limited, and the degree of convexity and concavity is too large to make the user's eyes feel uncomfortable. Based on this, when the maximum parallax parameter obtained in the above step is too large, or the minimum parallax parameter is too small (negative value), the calculation result of the parallax parameter is inaccurate, and this part needs to be regarded as The difference parameter is removed.
  • the computer searches for all the parallax parameters whose value is greater than 0, and calculates the first parallax average value, and takes the preset multiple of the first parallax average value as the boundary condition for rejecting the maximum parallax parameter. If the maximum parallax parameter is less than a preset multiple of the first disparity average, the maximum disparity parameter is retained, otherwise the maximum disparity parameter is eliminated. After rejecting the maximum parallax parameter that does not meet the requirement, the computer further searches for the maximum parallax parameter in the remaining parallax parameters, and performs the tradeoff according to the above manner until there is no parallax parameter larger than the above boundary condition, and the computer will remain the parallax at this time. The parallax parameter with the largest value in the parameter is determined as the final maximum parallax parameter.
  • the computer searches for all the parallax parameters whose value is less than 0, and outputs the second parallax average value, and takes the preset multiple of the second parallax average value as the boundary condition for eliminating the minimum parallax parameter. If the minimum disparity parameter is less than a preset multiple of the second disparity average, the minimum disparity parameter is retained, otherwise the minimum disparity parameter is eliminated. After rejecting the minimum parallax parameter that does not meet the requirement, the computer further finds the minimum parallax parameter in the remaining parallax parameters, and performs the tradeoff according to the above manner until the parallax parameter less than the above boundary condition does not exist, and the computer will remain the parallax at this time. The parallax parameter with the smallest value in the parameter is determined as the final minimum parallax parameter.
  • the above preset multiple can take “1" or "2".
  • An example of this step is given below:
  • the computer obtains six parallax parameters, "+3", “+6”, “+30”, “-1”, “-2”, and “-12”.
  • the parallax parameters "+3”, “+6”, and “+30” are averaged to obtain a first parallax average "+13", and then the first parallax average "+13” is multiplied by a preset multiple "2" Get "+26". Compared with "+26", the parallax parameter "+30" exceeds this value, and the computer rejects it.
  • the parallax parameter "+6” does not exceed this value, and the computer determines it as the maximum parallax parameter.
  • the computer then averages the parallax parameters "-1", "-2", and "-12” to obtain a second parallax average "-5", and then sets the second parallax average "-5" with a preset multiple "2". Multiply by "-10". Compared with “-10”, the parallax parameter "-12” exceeds this value, and the computer rejects it. The parallax parameter "-2" does not exceed this value, and the computer determines it as the minimum parallax parameter.
  • step 370 also pertains to the optional steps in the flow shown in FIG.
  • step 380 is directly executed after step 360 is performed; when step 370 is performed, the range of parallax variation obtained by the process shown in FIG. 3 is more accurate.
  • a parallax variation range of the stereoscopic slice source is defined based on the obtained maximum parallax parameter and minimum parallax parameter.
  • the final determined maximum parallax parameter is "+6" and the minimum parallax parameter is "-2", whereby the parallax variation range of the stereoscopic sheet source can be obtained as [-2, +6].
  • the embodiment of the present application further provides an apparatus for acquiring a parallax parameter of a stereoscopic slice source.
  • the device may be integrated in the form of software or hardware on the client side, or on the server side, to perform the calculation of the inspection parameters for the stereoscopic source provided by the local storage or the external database.
  • the apparatus includes: a reading unit 610, an area determining unit 620, a searching unit 630, a calculating unit 640, and a parameter determining unit 650;
  • the reading unit 610 is configured to read an image frame from the stereoscopic source file, the image frame including a left eye image and a right eye image;
  • the area determining unit 620 is configured to determine a plurality of first image areas in one of the left eye image and the right eye image;
  • the searching unit 630 is configured to search, in another of the left eye image and the right eye image, a plurality of second image regions corresponding to the plurality of first image region contents, the first image region and the second image region corresponding to each other Same size;
  • the calculating unit 640 is configured to separately calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters;
  • the parameter determining unit 650 is configured to determine the maximum parallax parameter and the minimum parallax parameter to obtain a parallax variation range of the stereoscopic slice source.
  • the device further includes:
  • the extracting unit 660 is configured to: when there are multiple image frames in the stereoscopic source file, extract at least two image frames from the stereoscopic source file as sampling frames;
  • the calculating unit 640 is configured to obtain a parallax parameter of each sampling frame separately;
  • the parameter determining unit 650 is configured to determine a maximum parallax parameter and a minimum parallax parameter among the parallax parameters of all the sampling frames to obtain a parallax variation range of the stereoscopic slice source.
  • the extracting unit 660 includes:
  • the interval extraction sub-unit 6610 is configured to extract at least two sampling frames according to a preset sampling interval based on the ordering of the image frames in the stereoscopic source file, and the sampling interval includes the interval frame number and/or the interval duration; or
  • the random extraction sub-unit 6620 is arranged to randomly extract at least two sample frames by a random number generation algorithm.
  • the area determining unit 620 is configured to determine a plurality of preset image size first regions in a preset position in one of the left eye image and the right eye image; wherein the preset position is randomly determined, or Calculate according to the size ratio of the image.
  • the device further includes:
  • the screening unit 670 is configured to perform the first image region after determining the plurality of first image regions The first image area in which the degree of dispersion of the pixel chromaticity is less than the preset degree of dispersion is excluded.
  • the screening unit 670 includes:
  • the first calculating sub-unit 6710 is configured to calculate a standard difference value of the three color components corresponding to the red, green and blue pixels in the first image region;
  • the second calculating subunit 6720 is configured to perform a summation calculation on the red standard deviation value, the green standard deviation value, and the blue standard deviation value to obtain a comprehensive standard deviation value;
  • the culling sub-unit 6730 is arranged to reject the first image region whose integrated standard deviation is less than the standard deviation threshold.
  • the computing unit 640 is configured to:
  • the parameter determining unit 650 is configured to reject the maximum parallax parameter and the minimum parallax parameter that exceed a reasonable range of the preset parallax.
  • the parameter determining unit 650 includes:
  • the first determining subunit 6510 is configured to calculate an average value of all the disparity parameters whose value is greater than 0, to obtain a first disparity average value, and retain the maximum parallax parameter when the maximum disparity parameter is less than a preset multiple of the first disparity average value, otherwise Eliminate the maximum parallax parameter;
  • the second determining subunit 6520 is configured to calculate an average value of all the disparity parameters whose value is less than 0, to obtain a second disparity average value, and when the minimum disparity parameter is greater than a preset multiple of the second disparity average value, retain the minimum parallax parameter, otherwise Eliminate the minimum parallax parameter.
  • the apparatus for acquiring the stereoscopic source parallax parameter can automatically read an image frame from the stereoscopic source file, and determine a plurality of identical and one-to-one correspondences in the left and right eye images in the image frame.
  • An image area and a second image area respectively calculate a horizontal distance of each pair of the first and second image areas, obtain a parallax parameter corresponding to each pair of the first and second image areas, and then determine one from the plurality of parallax parameters The maximum parallax parameter and a minimum parallax parameter, thereby obtaining a parallax variation range of the stereoscopic sheet source.
  • the processes of acquiring an image frame, determining an image area, and calculating a parallax parameter in the embodiment of the present application are all automatically completed by a computer, and the relevant personnel only need to provide a storage path of the stereoscopic source file to the computer. Since the manual operation is not involved, the embodiment of the present application can greatly shorten the time-consuming of obtaining parallax parameters and improve the processing efficiency, especially when processing stereoscopic video.
  • the functions of the unit or the subunit used in the embodiment of the present application can be implemented by a hardware processor.
  • FIG. 8 is a schematic diagram of a physical structure of an electronic device for acquiring a stereoscopic source parallax parameter according to an embodiment of the present application.
  • the electronic device may include: a processor 810 , A communication interface 820, a memory 830, and a bus 840, wherein the processor 810, the communication interface 820, and the memory 830 complete communication with each other through the bus 840.
  • Communication interface 820 can be arranged to transmit and/or receive information over a communication network.
  • the processor 810 can call the logic instructions in the memory 830 to perform any of the above methods for acquiring the stereoscopic source parallax parameters, including: reading an image frame from the stereoscopic source file, the image frame including the left eye image and the right eye image Determining a plurality of first image regions in the left eye image or the right eye image; searching a plurality of second image regions corresponding to the plurality of first image region contents in the other image, the first image regions corresponding to each other, and the first image region The two image regions have the same size; respectively calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters; determine a maximum parallax parameter and a minimum parallax parameter, and obtain a parallax variation of the stereoscopic source range.
  • the logic instructions in the memory 830 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium.
  • the technical solution of the embodiment of the present application may be embodied in the form of a software product stored in a storage medium, including a plurality of instructions for causing a computer device (which may be a personal computer, a server, Or a network device or the like) performs all or part of the steps of the method described in the embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like.
  • the embodiment of the present application further provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions for causing the computer to execute any one of the above A method of obtaining a stereoscopic source parallax parameter.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • the above embodiments can be implemented by means of software and a general hardware platform, and of course, by hardware.
  • the above technical solution may be embodied in the form of a software product, which may be stored in a computer readable storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including a plurality of fingers.
  • the method described in some of the above-described embodiments or embodiments is performed to cause a computer device (which may be a personal computer, server, or network device, etc.).
  • a computer device which may be a personal computer, server, or network device, etc.
  • various features in the embodiments of the present application may be arbitrarily combined with each other, and the technical solutions after the combination still fall within the protection scope of the present application.
  • the embodiment of the present application provides a method and a device for acquiring a parallax parameter of a stereoscopic slice source, which solves the problem of low efficiency when acquiring a parallax parameter of a stereoscopic slice source.

Abstract

A method and an apparatus for obtaining parallax parameters of a stereoscopic film source. The method comprises: reading an image frame from a stereoscopic film source file, wherein the image frame comprises a left-eye image and a right-eye image; determining multiple first image areas in one of the left-eye image and the right-eye image; searching the other one of the left-eye image and the right-eye image for multiple second image areas corresponding to contents of the multiple first image areas, wherein the first image area and the second image area that correspond to each other have a same size; separately calculating a horizontal distance between each first image area and a second image area corresponding thereto, to obtain multiple parallax parameters; and determining a maximum parallax parameter and a minimum parallax parameter, to obtain a variation range of parallax of a stereoscopic film source.

Description

获取立体片源视差参数的方法及装置Method and device for obtaining stereoscopic source parallax parameters
本申请要求在2015年12月28日提交中国专利局、申请号为2015110009115、发明名称为“获取立体片源视差参数的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 2015110009115, entitled "Method and Apparatus for Obtaining Stereoscopic Source Parallax Parameters", filed on December 28, 2015, the entire contents of which are incorporated herein by reference. In this application.
技术领域Technical field
本申请涉及图像处理领域,例如涉及一种获取立体片源视差参数的方法及装置。The present application relates to the field of image processing, for example, to a method and apparatus for acquiring stereo disc source parallax parameters.
背景技术Background technique
随着3Dimensional(3D)技术的发展,立体片源的数量越来越多,支持观看立体片源的设备也越来越多。3D技术的原理在于,通过两台处于同一水平线但是间隔一定水平距离的拍摄设备对同一物体同时进行拍摄,获得对应该物体的左右两张图像。在播放立体片源时,通过左右眼分别对应的偏光镜使用户左眼观看左边图像,右眼观看右边图像。由于拍摄设备之间存在用于模拟人眼瞳距的水平间距,因此左右图像分别呈现的物体之间具有一定的视差。用户在观看立体片源时,左右图像经视网膜同时传递到大脑中,大脑利用该视差产生物体远近的景深效果,从而获得立体感。With the development of 3Dimensional (3D) technology, the number of stereoscopic sources is increasing, and more and more devices supporting viewing stereoscopic sources are also available. The principle of 3D technology is to simultaneously capture the same object through two shooting devices at the same horizontal line but separated by a certain horizontal distance, and obtain two images of the left and right corresponding to the object. When the stereoscopic film source is played, the left side of the left and right eyes respectively allows the user to view the left image and the right eye to view the right image. Since there is a horizontal interval between the photographing devices for simulating the pupil distance of the human eye, there is a certain parallax between the objects respectively presented by the left and right images. When the user views the stereoscopic source, the left and right images are simultaneously transmitted to the brain through the retina, and the brain uses the parallax to generate the depth of field effect of the object, thereby obtaining a stereoscopic effect.
为了播放出较好的立体效果,需要预先获得立体片源的视差参数。而立体片源本身并不提供视差参数,若要获得视差参数就需要人工进行计算。相关人员在左右图像中分别查找同一个物体,例如分别在左右图像中查找物体“水杯”,然后手动计算两个“水杯”在水平方向上间隔的像素点个数,获得X轴上的水平距离,从而得到两个“水杯”之间的视差参数。通常,3D图像中不同物体的立体程度有所差异,因此左右图像中不同物体的水平距离互不相同,在获取视差参数时就需要专业人员对不同物体分别进行选取和计算,获得多个视差参数,并从中选取视差参数的最大值和最小值以确定立体片源的视差变动范围。In order to play a better stereoscopic effect, it is necessary to obtain the parallax parameter of the stereoscopic sheet source in advance. The stereo source itself does not provide a parallax parameter, and manual calculation is required to obtain the parallax parameter. The relevant person finds the same object in the left and right images respectively, for example, finds the object "water cup" in the left and right images, and then manually calculates the number of pixels in the horizontal direction of the two "cups" to obtain the horizontal distance on the X axis. , thus obtaining the parallax parameter between the two "cups". Generally, the stereoscopic degree of different objects in the 3D image is different, so the horizontal distances of different objects in the left and right images are different from each other. When the parallax parameters are acquired, the professional needs to select and calculate different objects separately, and obtain multiple parallax parameters. And select the maximum and minimum values of the parallax parameters to determine the range of parallax variation of the stereoscopic source.
由于相关技术主要依靠相关人员的主观识别和判断进行物体选取,并且计算水平距离也是由专业人员手动完成的,因此当3D图像中的物体较多时,获取视差参数的效率会非常低。相关方式尚且能够对静态的立体图片进行处理,但是对于由几十万帧、甚至上百万帧组成的立体视频来说,如果人工手动获取每一帧的视差参数,那么耗费的时间成本将非常大。 Since the related technology mainly relies on the subjective recognition and judgment of the relevant personnel to perform object selection, and the calculation of the horizontal distance is also manually performed by a professional, when the number of objects in the 3D image is large, the efficiency of acquiring the parallax parameter is very low. The related method can still process static stereoscopic pictures, but for stereoscopic video composed of hundreds of thousands of frames or even millions of frames, if the parallax parameters of each frame are manually obtained manually, the time cost will be very high. Big.
发明内容Summary of the invention
本申请提供了一种获取立体片源视差参数的方法及装置,解决获取立体片源视差参数效率低下的问题。The present application provides a method and apparatus for obtaining a parallax parameter of a stereoscopic slice source, and solves the problem of inefficiently obtaining a parallax parameter of a stereoscopic slice source.
一方面,本申请实施例提供了一种获取立体片源视差参数的方法,包括:In one aspect, the embodiment of the present application provides a method for obtaining a parallax parameter of a stereoscopic slice, including:
从立体片源文件中读取图像帧,图像帧包括左眼图像和右眼图像;Reading an image frame from the stereoscopic source file, the image frame including a left eye image and a right eye image;
在左眼图像和右眼图像中的一个图像中确定多个第一图像区域;Determining a plurality of first image regions in one of a left eye image and a right eye image;
在左眼图像和右眼图像中的另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;Searching, in another image of the left eye image and the right eye image, a plurality of second image regions corresponding to the plurality of first image region contents, wherein the first image region and the second image region corresponding to each other have the same size;
分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及Calculating a horizontal distance between each of the first image regions and the second image region corresponding thereto, respectively, to obtain a plurality of parallax parameters;
确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
另一方面,本申请实施例还提供了一种获取立体片源视差参数的装置,包括:On the other hand, the embodiment of the present application further provides an apparatus for acquiring a parallax parameter of a stereoscopic slice, including:
读取单元,设置为从立体片源文件中读取图像帧,图像帧包括左眼图像和右眼图像;a reading unit configured to read an image frame from the stereoscopic source file, the image frame including a left eye image and a right eye image;
区域确定单元,设置为在左眼图像和右眼图像中的一个图像中确定多个第一图像区域;a region determining unit configured to determine a plurality of first image regions in one of a left eye image and a right eye image;
查找单元,设置为在左眼图像和右眼图像中的另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;a searching unit configured to search for a plurality of second image regions corresponding to the plurality of first image region contents in another of the left eye image and the right eye image, the first image region and the second image region size corresponding to each other the same;
计算单元,设置为分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;a calculating unit, configured to separately calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters;
参数确定单元,设置为确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The parameter determining unit is configured to determine a maximum parallax parameter and a minimum parallax parameter to obtain a parallax variation range of the stereoscopic slice source.
另一方面,本申请实施例还提供了一种电子设备,包括:On the other hand, an embodiment of the present application further provides an electronic device, including:
至少一个处理器;以及,At least one processor; and,
与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein
所述存储器存储有可被所述一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:The memory stores instructions executable by the one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
从立体片源文件中读取图像帧,所述图像帧包括左眼图像和右眼图像;Reading an image frame from a stereoscopic source file, the image frame including a left eye image and a right eye image;
在所述左眼图像和所述右眼图像中的一个图像中确定多个第一图像区域;Determining a plurality of first image regions in one of the left eye image and the right eye image;
在所述左眼图像和右眼图像中的另一个图像中查找与所述多个第一图像区 域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;Finding and the plurality of first image regions in another of the left eye image and the right eye image a plurality of second image regions corresponding to the domain content, wherein the first image region and the second image region corresponding to each other have the same size;
分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及Calculating a horizontal distance between each of the first image regions and the second image region corresponding thereto, respectively, to obtain a plurality of parallax parameters;
确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
另一方面,本申请实施例还提供了一种非暂态计算机可读存储介质,其中,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行上述的获取立体片源视差参数的方法。In another aspect, the embodiment of the present application further provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions, where the computer instructions are used to cause the computer to execute the above A method of obtaining a stereoscopic source parallax parameter.
另一方面,本申请实施例还提供了一种计算机程序产品,包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述的获取立体片源视差参数的方法。In another aspect, the embodiment of the present application further provides a computer program product, including a computing program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer And causing the computer to perform the above-described method of acquiring a stereoscopic source parallax parameter.
本申请实施例提供的获取立体片源视差参数的方法及装置,能够自动从立体片源文件中读取图像帧,并在图像帧中的左右眼图像中分别确定多个数量相同并且一一对应的第一图像区域和第二图像区域,分别计算每一对第一和第二图像区域的水平距离,获得对应每一对第一和第二图像区域的视差参数,然后从多个视差参数中确定一个最大视差参数和一个最小视差参数,由此获得立体片源的视差变动范围。大大缩短获取视差参数的耗时,提高处理效率。The method and device for acquiring a stereoscopic source parallax parameter provided by the embodiments of the present application can automatically read an image frame from a stereoscopic source file, and determine a plurality of identical and one-to-one correspondences in the left and right eye images in the image frame. a first image area and a second image area, respectively calculating a horizontal distance of each pair of the first and second image areas, obtaining a parallax parameter corresponding to each pair of the first and second image areas, and then from the plurality of parallax parameters A maximum parallax parameter and a minimum parallax parameter are determined, thereby obtaining a parallax variation range of the stereoscopic sheet source. The time taken to obtain parallax parameters is greatly shortened, and the processing efficiency is improved.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为本申请实施例提供的一种获取立体片源视差参数的方法流程图;FIG. 1 is a flowchart of a method for obtaining a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure;
图2为本申请实施例提供的另一种获取立体片源视差参数的方法流程图;FIG. 2 is a flowchart of another method for obtaining a stereoscopic source parallax parameter according to an embodiment of the present disclosure;
图3为本申请实施例提供的又一种获取立体片源视差参数的方法流程图;FIG. 3 is a flowchart of still another method for obtaining a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure;
图4a至图4d为本申请实施例提供的一种确定第一图像区域的示意图;4a to 4d are schematic diagrams of determining a first image area according to an embodiment of the present application;
图4e为本申请实施例提供的一种确定第二图像区域的示意图;4 e is a schematic diagram of determining a second image area according to an embodiment of the present application;
图5a至图5d为本申请实施例提供的一种确定像素点的示意图;5a to 5d are schematic diagrams of determining pixel points according to an embodiment of the present application;
图6为本申请实施例提供的一种获取立体片源视差参数的装置的组成框图;FIG. 6 is a structural block diagram of an apparatus for acquiring a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure;
图7为本申请实施例提供的另一种获取立体片源视差参数的装置的组成框图; FIG. 7 is a structural block diagram of another apparatus for acquiring a stereoscopic source parallax parameter according to an embodiment of the present application;
图8为本申请实施例提供的一种获取立体片源视差参数的电子设备的实体结构示意图。FIG. 8 is a schematic diagram of a physical structure of an electronic device for acquiring a parallax parameter of a stereoscopic slice according to an embodiment of the present disclosure.
实施方式Implementation
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application. It is a part of the embodiments of the present application, and not all of the embodiments.
本申请实施例提供了一种获取立体片源视差参数的方法,如图1所示,该方法包括:An embodiment of the present application provides a method for obtaining a parallax parameter of a stereoscopic slice. As shown in FIG. 1 , the method includes:
在步骤110中、从立体片源文件中读取图像帧。In step 110, an image frame is read from the stereoscopic source file.
本实施例中的立体片源可以是立体图片或者立体视频,当为立体图片时,立体片源文件中通常只包括一个图像,而对于立体视频而言,立体片源文件中一般会包含许多图像帧。为便于统一表述,本实施例将立体图片中的图像一并称为图像帧。The stereoscopic source in this embodiment may be a stereoscopic image or a stereoscopic video. When a stereoscopic image is used, the stereoscopic source file usually includes only one image, and for stereoscopic video, the stereoscopic source file generally includes many images. frame. In order to facilitate the unified expression, the embodiment refers to an image in a stereoscopic picture as an image frame.
如前所述,立体片源是通过两个处于同一水平线并且间隔一定距离的两个摄像设备拍摄获得的,因此不论是立体图片还是立体视频,每一个图像帧都是由一个左眼图像和一个右眼图像组成的。由于两个摄像设备之间存在用于模拟人眼瞳距的水平间隔,所以左眼图像和右眼图像两者在水平方向上存在一定的位置偏移量,这个位置偏移量即为本实施例中要计算的视差参数。As mentioned above, the stereoscopic film source is obtained by two imaging devices at the same horizontal line and separated by a certain distance, so whether it is a stereoscopic picture or a stereoscopic video, each image frame is composed of a left eye image and a The right eye image is composed of. Since there is a horizontal interval between the two imaging devices for simulating the eyelid distance of the human eye, both the left eye image and the right eye image have a certain positional offset in the horizontal direction, and this positional offset is the implementation. The parallax parameter to be calculated in the example.
本步骤中,计算机可以按照默认的存储路径从存储区域或数据库中读取立体片源文件,也可以通过预设的应用程序接口直接接收网络侧发送的立体片源文件,或者通过预设的操作界面接收用户上传的立体片源文件,本实施例不对立体片源文件的获取方式进行具体限制。In this step, the computer can read the stereoscopic source file from the storage area or the database according to the default storage path, or directly receive the stereoscopic source file sent by the network side through the preset application interface, or through a preset operation. The interface receives the stereoscopic source file uploaded by the user. This embodiment does not specifically limit the manner in which the stereoscopic source file is obtained.
在步骤120中、在左眼图像和右眼图像中的一个图像中确定多个第一图像区域。In step 120, a plurality of first image regions are determined in one of the left eye image and the right eye image.
获取视差参数的前提条件是,分别在左右图像中确定对应同一内容的两个图像区域,即第一图像区域和第二图像区域。本实施例中,首先以左右图像中的任意一个图像为基准在其中确定第一图像区域,然后在另一个图像中对应的确定第二图像区域。为便于表述,本实施例后续将以在左眼图像中确定第一图像区域为例进行说明,当然,实际应用中也可以首先以右眼图像为基准在其中确定第一图像区域,对于后者方式,获取视差参数的方式与前者方式相同,本实施例后续不作重复说明。A prerequisite for obtaining the parallax parameter is to determine two image regions corresponding to the same content, that is, the first image region and the second image region, respectively, in the left and right images. In this embodiment, the first image region is first determined therein based on any one of the left and right images, and then the second image region is determined correspondingly in the other image. For convenience of description, the present embodiment will be described by taking the first image region in the left eye image as an example. Of course, in the actual application, the first image region may be first determined based on the right eye image. The manner of obtaining the parallax parameter is the same as that of the former method, and the present embodiment does not repeat the description.
通常,左右图像中会涉及多种不同的内容,例如对于街景图像而言,其中 就会包括行人、汽车、树木、街道以及商店等。虽然理论上左右图像中所有内容的视差应当是一致的,即行人1与行人2(注:行人1为左眼图像中的行人,行人2为右眼图像中对应的这个行人,后同)的视差、汽车1与汽车2的视差等均应当是相同的,但是由于不同物体的景深各有差异,因此实际情况中不同内容的视差有可能是不相同的,这就需要在左眼图像中确定多个第一图像区域,并在后续在右眼图像中对应的确定多个第二图像区域,并由此计算出多个视差参数。Usually, a variety of different content is involved in the left and right images, such as for Street View images, where It will include pedestrians, cars, trees, streets, and shops. Although theoretically, the disparity of all content in the left and right images should be consistent, that is, pedestrian 1 and pedestrian 2 (note: pedestrian 1 is the pedestrian in the left eye image, pedestrian 2 is the corresponding pedestrian in the right eye image, the same) Parallax, the parallax of car 1 and car 2 should be the same, but because the depth of field of different objects is different, the disparity of different content may be different in actual situation, which needs to be determined in the left eye image. A plurality of first image regions are determined, and a plurality of second image regions are correspondingly determined in the subsequent right eye images, and thereby a plurality of parallax parameters are calculated.
本实施例中,可以通过图像识别技术对左眼图像中的物体进行识别,然后根据不同物体的位置和大小,确定包含不同物体的不同第一图像区域。这种方式可以以自然形成的物体为对象准确的计算物体之间的视差参数,但是因为使用到图像识别技术,所以实际应用中会涉及巨大的计算量。为降低计算机的处理负荷,提高视差参数的获取速度,本实施例中也可以对第一图像区域进行模糊确定,即不以物体识别作为确定第一图像区域的前提要求而直接确定第一图像区域。例如在左眼图像中随机选取位置,确定几个第一图像区域,或者按照左眼图像的尺寸比例,在特殊位置上确定几个第一图像区域。这种方式无需对图像的内容进行识别,实现起来速度较快。In this embodiment, the objects in the left eye image can be identified by image recognition technology, and then different first image regions including different objects are determined according to the position and size of the different objects. In this way, the parallax parameters between the objects can be accurately calculated from the naturally formed objects, but because of the use of image recognition technology, a large amount of calculation is involved in practical applications. In order to reduce the processing load of the computer and improve the acquisition speed of the parallax parameter, the first image region may also be subjected to blur determination in the embodiment, that is, the first image region is directly determined without the object recognition as a premise requirement for determining the first image region. . For example, a plurality of first image regions are determined by randomly selecting positions in the left eye image, or several first image regions are determined at specific positions according to the size ratio of the left eye image. This method does not require recognition of the content of the image, and is faster to implement.
在步骤130中、在左眼图像和右眼图像中的另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域。In step 130, a plurality of second image regions corresponding to the plurality of first image region contents are searched for in another of the left eye image and the right eye image.
所谓内容对应是指第二图像区域中显示的内容与第一图像区域中显示的内容相同。从控制变量的角度讲,只有衡量同一个内容分别在左右图像中的位置差别,才能够体现出该内容在左右图像中的视差,因此本实施例中要求第一和第二图像区域中的内容是对应的。在该前提下,第一图像区域和第二图像区域之间应当至少在下述几个方面是相同的:1、内容相同;2、区域的尺寸相同;3、区域的数量相同。The content correspondence means that the content displayed in the second image area is the same as the content displayed in the first image area. From the perspective of the control variable, only the difference in position between the same content and the left and right images can be used to reflect the disparity of the content in the left and right images. Therefore, the content in the first and second image regions is required in this embodiment. It is corresponding. Under this premise, the first image area and the second image area should be identical at least in the following aspects: 1. The content is the same; 2. The size of the area is the same; 3. The number of areas is the same.
本步骤中,计算机可以通过图像匹配技术(例如OpenCV中提供的方法)在右眼图像中查找与第一图像区域内容相对应的内容,并根据查找到的内容确定第二图像区域的位置。In this step, the computer can find the content corresponding to the content of the first image region in the right eye image through an image matching technology (for example, the method provided in OpenCV), and determine the location of the second image region according to the found content.
需要说明的是,当在右眼图像中确定第二图像区域时,需要通过图像匹配技术对右眼图像中的内容进行识别,其目的在于使确定出的第二图像区域与左眼图像中的第一图像区域在内容上相互对应,作为计算视差参数的前提条件,这种内容识别的过程是必要的。而在120中,在确定第一图像区域时进行的图像识别,由于无需要求第一图像区域的内容与某些内容对应,因此为提高处理速度,在步骤120中的图像识别过程是可省略的。 It should be noted that when the second image region is determined in the right eye image, the content in the right eye image needs to be identified by the image matching technology, and the purpose is to make the determined second image region and the left eye image. The first image regions correspond to each other in content, and as a precondition for calculating the parallax parameters, such a process of content recognition is necessary. In 120, in the image recognition performed when determining the first image region, since the content of the first image region is not required to correspond to some content, the image recognition process in step 120 may be omitted to improve the processing speed. .
在步骤140中、分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数。In step 140, a horizontal distance between each of the first image regions and the second image region corresponding thereto is separately calculated to obtain a plurality of parallax parameters.
在获得数量相等的第一图像区域和第二图像区域后,分别计算内容对应的第一图像区域和第二图像区域之间水平距离,从而得到对应每对第一/第二图像区域的视差参数。示例性的,假设在步骤120中确定了4个第一图像区域,那么在步骤130中就会确定出相对应的4个第二图像区域。在步骤140中,分别计算第一图像区域1和第二图像区域1之间的视差参数a、第一图像区域2和第二图像区域2之间的视差参数b、第一图像区域3和第二图像区域3之间的视差参数c以及第一图像区域4和第二图像区域4之间的视差参数d,获得与第一图像区域或第二图像区域数量相等的4个视差参数。After obtaining the first image area and the second image area of equal numbers, respectively calculating a horizontal distance between the first image area and the second image area corresponding to the content, thereby obtaining a parallax parameter corresponding to each pair of the first/second image areas . Exemplarily, assuming that four first image regions are determined in step 120, then corresponding four second image regions are determined in step 130. In step 140, the parallax parameter a between the first image region 1 and the second image region 1, the parallax parameter b between the first image region 2 and the second image region 2, the first image region 3, and the first The parallax parameter c between the two image regions 3 and the parallax parameter d between the first image region 4 and the second image region 4 obtain four parallax parameters equal in number to the first image region or the second image region.
本实施例中,可以以第一图像区域和第二图像区域中的某个像素点为基准计算水平距离,也可以以第一图像区域和第二图像区域的同一个区域边缘为基准计算水平距离,还可以以第一图像区域和第二图像区域整体为基准计算水平距离,本实施例对计算水平距离参考的对象不作具体限制。In this embodiment, the horizontal distance may be calculated based on a certain pixel point in the first image area and the second image area, or the horizontal distance may be calculated based on the same area edge of the first image area and the second image area. The horizontal distance may also be calculated based on the entirety of the first image area and the second image area. This embodiment does not specifically limit the object for calculating the horizontal distance reference.
本实施例中,水平距离是指第一图像区域和第二图像区域在X上的距离差值,其单位可以是像素点数量,也可以是一般意义上的长度单位,例如毫米、厘米等,本实施例对此不作限制,但是一般情况下该距离差值是存在正负之分的。In this embodiment, the horizontal distance refers to the difference in distance between the first image area and the second image area on X, and the unit may be the number of pixels, or may be a unit of length in a general sense, such as millimeters, centimeters, and the like. This embodiment does not limit this, but in general, the distance difference is positive and negative.
在步骤150中、确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。In step 150, the maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
如前所述,不同内容之间视差可能不同,实际应用中获取图像帧整体的视差变动范围相比获得该图像帧中每个区域的视差参数更有实际价值。因此本步骤中,计算机从获取的所有视差参数中找出一个最大的视差参数以及一个最小的视差参数,作为视差变动范围的上下边界值,确定出图像帧的视差变动范围。As mentioned above, the disparity between different content may be different. In practice, obtaining the parallax variation range of the entire image frame is more practical than obtaining the parallax parameter of each region in the image frame. Therefore, in this step, the computer finds a maximum parallax parameter and a minimum parallax parameter from all the obtained parallax parameters, and determines the parallax variation range of the image frame as the upper and lower boundary values of the parallax variation range.
对于立体图片而言,由于其只包含一个图像帧,因此本步骤中获得的视差变动范围即为立体片源的视差变动范围;对于立体视频而言,由于其包含许多图像帧,所以可以将所有图像帧中的所有视差参数放在一起,从中找出一个最大视差参数和一个最小视差参数,确定出立体视频的视差变动范围。For a stereoscopic picture, since it only contains one image frame, the range of parallax variation obtained in this step is the range of parallax variation of the stereoscopic source; for stereoscopic video, since it contains many image frames, all can be All the parallax parameters in the image frame are put together, and a maximum parallax parameter and a minimum parallax parameter are found out to determine the range of parallax variation of the stereoscopic video.
下面,本申请实施例将给出一个对包含多个图像帧的立体片源进行视差参数获取的方法。实际应用中,包含多个图像帧的立体片源通常为立体视频,但是也不排除部分立体图片由至少两个图像帧组成,对于后者情况同样适用于该方法。如图2所示,该方法包括:In the following, the embodiment of the present application will provide a method for performing parallax parameter acquisition on a stereoscopic slice source including a plurality of image frames. In practical applications, a stereoscopic source containing a plurality of image frames is usually a stereoscopic video, but it is not excluded that a partial stereoscopic image is composed of at least two image frames, and the latter is equally applicable to the method. As shown in Figure 2, the method includes:
在步骤210中、从立体片源文件中抽取至少两个图像帧作为抽样帧。 In step 210, at least two image frames are extracted from the stereoscopic source file as sample frames.
本实施例中,计算机对立体片源文件中的至少两个图像帧计算视差参数,并将所有图像帧的视差参数放在一起,选取最大视差参数和最小视差参数。In this embodiment, the computer calculates a parallax parameter for at least two image frames in the stereoscopic source file, and puts the parallax parameters of all the image frames together, and selects a maximum parallax parameter and a minimum parallax parameter.
在本步骤中,计算机按照预定的规则从立体片源文件中抽取图像帧。抽取几个图像帧,以及抽取哪些图像帧由该预设规则限定。下面给出两种抽取图像针的实现方式:In this step, the computer extracts image frames from the stereoscopic source file in accordance with predetermined rules. Extracting several image frames and extracting which image frames are defined by the preset rule. The following two implementations of extracting image stitches are given:
方式一按照抽样间隔进行抽取Mode 1 is extracted according to sampling interval
通常图像帧在立体片源文件中具有一定的排列顺序,这个顺序一般是由图像帧播放的先后顺序决定的。在本方式中,可以基于该排序,按照预设的抽样间隔抽取至少两个抽样帧。所述抽样间隔可以是间隔帧数,也可以是间隔时间。对于前者实现方式,可以规定从第一个图像帧开始,每间隔4个图像帧抽取一个图像帧,或者每间隔100个图像帧抽取一个图像帧;对于后者实现方式,可以依据图像帧的播放时序,以播放第一个图像帧的时刻为起始时刻,每间隔100毫秒抽取一个图像帧,或者每间隔15000毫秒抽取一个图像帧。本方式中的具体数值仅用作示例性说明,不作为对实际应用的具体限制。Usually, the image frames have a certain order in the stereo source files. This order is generally determined by the order in which the image frames are played. In this manner, at least two sampling frames may be extracted according to the predetermined sampling interval based on the ranking. The sampling interval may be an interval frame number or an interval time. For the former implementation manner, it may be specified that one image frame is extracted every four image frames from the first image frame, or one image frame is extracted every 100 image frames; for the latter implementation, the image frame may be played according to the image frame. Timing, starting with the moment when the first image frame is played, extracting one image frame every 100 milliseconds, or extracting one image frame every 15000 milliseconds. The specific numerical values in this mode are for illustrative purposes only and are not intended as a limitation of the actual application.
方式二随机抽取Mode 2 random extraction
计算机可以采用随机数生成算法对抽样帧进行抽取。在本方式的一个示例中,计算机通过随机数发生函数多次随机生成数值不大于图像帧总数量的随机数,将图像帧编号与该随机数相同的图像帧抽取出来作为抽取帧,该示例中需要保证生成的随机数为正整数。而在本方式的另一个示例中,计算机还可以通过随机数发生函数多次随机生成大于0、小于等于1的浮点型随机数,然后将随机数乘以图像帧总数,即可得到随机抽取的图像帧的编号,这种方式需要对算法进行优化,以保证随机数与图像帧总数的乘积为正整数。The computer can extract the sampled frames using a random number generation algorithm. In an example of the mode, the computer randomly generates a random number whose value is not greater than the total number of image frames by using a random number generating function, and extracts an image frame with the same image frame number and the random number as the extracted frame. In this example, You need to ensure that the generated random number is a positive integer. In another example of the method, the computer may randomly generate a floating-point random number greater than 0 and less than or equal to 1 by using a random number generating function, and then multiply the random number by the total number of image frames to obtain a random extraction. The number of image frames, this method needs to optimize the algorithm to ensure that the product of the random number and the total number of image frames is a positive integer.
除上述两种方式外,计算机也可以通过预设的人机交互方式接收工作人员设定的抽取规则,该抽取规则可以仅限定抽取的图像帧数量,也可以详细限定抽取哪些具体的图像帧,本实施例对此不作限制。在本实施例的一种极端方式中,可以将立体片源文件中所有的图像帧全部进行抽取。In addition to the above two methods, the computer can also receive the extraction rule set by the staff through a preset human-computer interaction mode, and the extraction rule can only limit the number of extracted image frames, and can also specifically define which specific image frames are extracted. This embodiment does not limit this. In an extreme mode of this embodiment, all image frames in the stereoscopic source file can be extracted.
在步骤220中、分别获得每个抽样帧的视差参数。In step 220, parallax parameters for each sample frame are obtained separately.
在本步骤中,计算机针对每一个抽样帧分别执行图1中的步骤120至步骤140,获得每个抽样帧的视差参数。示例性的,假设有130个抽样帧,每个抽样帧需要计算4个视差参数,即每个抽样帧的左右图像中分别确定有4个第一/第二图像区域。那么在对每个抽样帧分别执行步骤120至步骤140后,总共获得了4*130=520个视差参数。In this step, the computer performs step 120 to step 140 in FIG. 1 for each sample frame to obtain the parallax parameters of each sample frame. Exemplarily, it is assumed that there are 130 sampling frames, and each sampling frame needs to calculate 4 parallax parameters, that is, 4 first/second image regions are respectively determined in the left and right images of each sampling frame. Then, after performing step 120 to step 140 for each sample frame, a total of 4*130=520 parallax parameters are obtained.
需要说明的是,实际应用中,每个抽样帧计算获得的视差参数数量可以是 相同的,例如上述示例中的4个,也可以针对不同抽样帧制定差异化的视差参数数量,例如对部分抽样帧获取3个视差参数,对另一部分抽样帧获取7个视差参数。本实施例不对每个抽样帧中获取的视差参数的数量进行限制,同时也不限制每个抽样帧中获取的视差参数数量一定相同。It should be noted that, in practical applications, the number of parallax parameters obtained by calculating each sampling frame may be For the same, for example, four of the above examples, the number of differentiated parallax parameters may also be determined for different sampling frames, for example, three parallax parameters are acquired for a partial sampling frame, and seven parallax parameters are acquired for another partial sampling frame. This embodiment does not limit the number of disparity parameters acquired in each sampling frame, and does not limit the number of disparity parameters acquired in each sampling frame to be the same.
本步骤中,计算机可以按照抽样帧编号由小到大的顺序分别对各个抽样帧获取视差参数,也可以按照抽取抽样帧的先后顺序进行视差参数的获取。而在实际应用中,当闲置的计算资源足够多时,计算机也可以通过预设数量的并行线程,对部分或全部抽样帧同时进行视差参数获取。In this step, the computer may obtain the parallax parameters for each sampling frame according to the sampling frame number from small to large, or may obtain the parallax parameters according to the sequence of the extracted sampling frames. In practical applications, when there are enough idle computing resources, the computer can simultaneously obtain parallax parameters for some or all of the sampled frames through a preset number of parallel threads.
在步骤230中、在所有抽样帧的视差参数中,确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。In step 230, among the parallax parameters of all the sampling frames, the maximum parallax parameter and the minimum parallax parameter are determined, and the parallax variation range of the stereoscopic slice source is obtained.
所述最大视差参数和最小视差参数是从所有抽样帧的所有视差参数中选择出来的。在上述示例中,当对130个抽样帧获取了共520个视差参数时,计算机从这520个视差参数中选择一个数值最大的视差参数和一个数值最小的视差参数。The maximum disparity parameter and the minimum disparity parameter are selected from all disparity parameters of all sample frames. In the above example, when a total of 520 parallax parameters are acquired for 130 sample frames, the computer selects one of the 520 parallax parameters with the largest parallax parameter and the smallest value parallax parameter.
可选的,作为对图1和图2所示方法的细化,本申请实施例还提供了一种获取立体片源视差参数的方法。为便于表述,该方法以从一个图像帧中获取视差参数的角度进行说明,应当明确,虽然表述角度具有一定的局限性,但是并不影响该方法在图2情况下的应用。如图3所示,该方法包括:Optionally, as a refinement of the method shown in FIG. 1 and FIG. 2, the embodiment of the present application further provides a method for obtaining a parallax parameter of a stereoscopic slice source. For ease of description, the method is described in terms of obtaining parallax parameters from an image frame. It should be clarified that although the expression angle has certain limitations, it does not affect the application of the method in the case of FIG. As shown in FIG. 3, the method includes:
在步骤310中、从立体片源文件中读取图像帧。In step 310, an image frame is read from the stereoscopic source file.
在步骤320中、在左眼图像和右眼图像中的一个图像中的预设位置上,确定多个预设尺寸的第一图像区域。In step 320, a plurality of preset image size first regions are determined at preset positions in one of the left eye image and the right eye image.
以从左眼图像中选择第一图像区域为例,计算机从左眼图像中的预设位置上确定多个预设尺寸的第一图像区域。其中可以由计算机自动设定或人工手动设定的变量包括:1、预设位置的坐标;2、预设位置的数量(亦即第一图像区域的数量);3、第一图像区域的尺寸。下面给出本实施例中几种确定第一图像区域的示例:Taking the first image region from the left eye image as an example, the computer determines a plurality of preset image first image regions from preset positions in the left eye image. Variables that can be automatically set by the computer or manually set manually include: 1. coordinates of the preset position; 2. the number of preset positions (ie, the number of first image areas); 3. size of the first image area . Several examples of determining the first image area in this embodiment are given below:
如图4a所示,在本实施例的一种实现方式中,计算机通过随机算法在左眼图像中随机选取了3个矩形区域,确定为第一图像区域(矩形的长宽数值未示出)。As shown in FIG. 4a, in an implementation manner of the embodiment, the computer randomly selects three rectangular regions in the left eye image by using a random algorithm, and determines the first image region (the length and width values of the rectangle are not shown). .
如图4b所示,在本实施例的另一种实现方式中,计算机按照四宫格的布局位置,选取了4个正方形区域,确定为第一图像区域。其中正方形的尺寸以四宫格的尺寸为基础按预设比例缩小(正方形的边长数值未示出)。As shown in FIG. 4b, in another implementation manner of the embodiment, the computer selects four square regions according to the layout position of the four-square grid, and determines the first image region. The size of the square is reduced by a preset ratio based on the size of the square grid (the square length value of the square is not shown).
如图4c所示,在本实施例的另一种实现方式中,计算机按照九宫格的布局 位置,选取了9个正方形区域,确定为第一图像区域。其中正方形的尺寸以九宫格的尺寸为基础按预设比例缩小(正方形的边长数值未示出)。As shown in FIG. 4c, in another implementation manner of this embodiment, the computer is arranged according to the layout of the nine squares. Position, 9 square areas are selected and determined as the first image area. The size of the square is reduced by a preset ratio based on the size of the nine squares (the square length value of the square is not shown).
如图4d所示,在本实施例的另一种实现方式中,计算机在左眼图像的对角线位置上选取了8个正方形区域,确定为第一图像区域(正方形的边长数值未示出)。As shown in FIG. 4d, in another implementation manner of the embodiment, the computer selects eight square regions in the diagonal position of the left eye image, and determines the first image region (the square length value of the square is not shown). Out).
在步骤330中、对第一图像区域进行筛选,剔除像素色度的离散程度小于预设离散程度的第一图像区域。In step 330, the first image area is filtered to eliminate the first image area whose pixel chromaticity is less than a predetermined degree of dispersion.
为提高计算视差参数的准确度,在本实施例的可选方案中,可以对确定出的第一图像区域进行筛选,将色度单一的图像区域剔除掉。实际应用中,对于单一色度的图像区域而言(例如全白或者全绿的图像区域)由于图像区域中各个像素的色度相同或相近,因此在后续与第二图像区域进行比对时,无法准确确定图像的水平偏移量,由此使得计算出来的视差参数会大于或小于实际的视差参数。因此在本步骤中,可以将色度单一的第一图像区域剔除掉,从而消除不准确的视差参数。需要说明的是,所谓单一色度的图像区域不仅仅包括只涉及一种色度的图像区域(例如全白区域),也包括涉及多种色度但是色度之间较为相近的图像区域。例如涉及蓝天白云的图像区域,虽然其包含了白蓝两种色度,但是在一些特定的气候条件下,白云的色度跟作为背景的蓝天的色度十分相近,两者没有明显的区别,对于这种图像区域,本步骤同样会将其剔除。In order to improve the accuracy of calculating the parallax parameter, in the alternative of the embodiment, the determined first image region may be filtered to remove the image region with a single chroma. In practical applications, for a single chrominance image region (for example, an all white or all green image region), since the chromaticities of the respective pixels in the image region are the same or similar, when subsequently comparing with the second image region, The horizontal offset of the image cannot be accurately determined, thereby making the calculated parallax parameter larger or smaller than the actual parallax parameter. Therefore, in this step, the first image region with a single chroma can be eliminated, thereby eliminating inaccurate parallax parameters. It should be noted that the image region of a single chromaticity includes not only an image region (for example, an all white region) involving only one chromaticity, but also an image region involving a plurality of chromaticities but relatively close chromaticity. For example, the image area involving blue sky and white clouds, although it contains both white and blue hues, in some specific climatic conditions, the chromaticity of white clouds is very similar to the chromaticity of the blue sky as the background, there is no obvious difference between the two. For this image area, this step will also be rejected.
计算机可以通过计算像素色度离散程度的方式,将单一色度的第一图像区域剔除掉。像素色度的离散程度反映了图像区域中各个像素之间的色度差异程度,离散程度越大表示像素色度差异越大。预设离散程度用作于区分单一色度图像区域和色度离散程度满足计算要求的图像区域的边界条件,实际应用中,预设离散程度可以由计算机根据历史视差参数的准确率调教获得,也可以由工作人员根据经验设定获得。The computer can cull the first image region of a single chrominance by calculating the degree of dispersion of the pixel chromaticity. The degree of dispersion of pixel chrominance reflects the degree of chromaticity difference between pixels in the image region. The greater the degree of dispersion, the greater the difference in pixel chromaticity. The preset dispersion degree is used as a boundary condition for distinguishing a single chrominance image region and an image region whose chromaticity dispersion degree satisfies the calculation requirement. In actual application, the preset dispersion degree can be obtained by the computer according to the accuracy of the historical parallax parameter, and also It can be obtained by the staff based on experience.
在本实施例的一种实现方式中,像素色度的离散程度可以通过标准差值量化体现,标准差值用于对所有数值相对平均值的偏差程度进行表征,其中平均值是所有数值的平均值,偏差程度由每一个数值相对平均值的个体差异贡献得出。因此,标准差值可以从整体上对所有数值(相对均值)的离散程度进行反映。在本方式中,计算机计算第一图像区域中每一个像素分别对应红、绿、蓝三种颜色分量的标准差值,获得红色标准差值、绿色标准差值及蓝色标准差值三个差值参数。其中以红色标准差值为例,该标准差值体现了不同像素点在红色分量上相对红色色度均值的偏差程度,红色标准差值越大,表示各个像素在红色分量上的离散程度越大,图像区域整体在红色分量上的色度越不单一。在 获得红色标准差值、绿色标准差值及蓝色标准差值后,计算机对三者进行求和,获得综合标准差值,然后将该综合标准差值与预设的标准差值阈值进行比较,将综合标准差值小于标准差值阈值的第一图像区域剔除掉。In an implementation of this embodiment, the degree of dispersion of pixel chrominance can be quantified by standard deviation, and the standard deviation is used to characterize the degree of deviation of all values relative to the average, wherein the average is the average of all values. The value, the degree of deviation is derived from the individual difference contribution of each value to the mean. Therefore, the standard deviation can be reflected as a whole for the degree of dispersion of all values (relative mean). In this mode, the computer calculates that each pixel in the first image region corresponds to a standard difference of three color components of red, green, and blue, and obtains three differences of a red standard deviation value, a green standard deviation value, and a blue standard deviation value. Value parameter. Taking the red standard deviation as an example, the standard deviation reflects the degree of deviation of the red color chromaticity mean between different pixels on the red component. The larger the red standard deviation, the greater the dispersion of each pixel on the red component. The chromaticity of the entire image region on the red component is not uniform. In After obtaining the red standard deviation value, the green standard deviation value and the blue standard deviation value, the computer sums the three to obtain the comprehensive standard deviation value, and then compares the integrated standard deviation value with the preset standard deviation threshold value. The first image area whose integrated standard deviation is less than the standard deviation threshold is eliminated.
可选的,标准差值的计算公式如下:Alternatively, the standard deviation is calculated as follows:
Figure PCTCN2016097696-appb-000001
Figure PCTCN2016097696-appb-000001
其中,σ为标准差值,N为第一图像区域中的像素点个数,xi为第i个像素点的色度值,μ为所有像素点的色度均值。Where σ is the standard deviation value, N is the number of pixel points in the first image region, x i is the chromaticity value of the ith pixel point, and μ is the chromaticity mean of all the pixel points.
首先,计算机通过下述公式计算所有像素点在红色分量上的标准差值:First, the computer calculates the standard deviation of all pixels on the red component by the following formula:
Figure PCTCN2016097696-appb-000002
Figure PCTCN2016097696-appb-000002
其中,r代表红色分量,σr为第一图像区域在红色分量上的标准差值,xri为第i个像素点在红色分量上的色度值,μr为所有像素点在红色分量上的色度均值。Where r represents the red component, σ r is the standard deviation of the first image region on the red component, x ri is the chromaticity value of the i-th pixel on the red component, and μ r is the red component of all pixels The average of the chromaticity.
其次,计算机通过下述公式计算所有像素点在绿色分量上的标准差值:Second, the computer calculates the standard deviation of all pixels on the green component by the following formula:
Figure PCTCN2016097696-appb-000003
Figure PCTCN2016097696-appb-000003
其中,g代表绿色分量,σg为第一图像区域在绿色分量上的标准差值,xgi为第i个像素点在绿色分量上的色度值,μg为所有像素点在绿色分量上的色度均值。Where g is the green component, σ g is the standard deviation of the first image region on the green component, x gi is the chromaticity value of the ith pixel on the green component, and μ g is the pixel on all the green components The average of the chromaticity.
然后,计算机通过下述公式计算所有像素点在蓝色分量上的标准差值:The computer then calculates the standard deviation of all pixels on the blue component by the following formula:
Figure PCTCN2016097696-appb-000004
Figure PCTCN2016097696-appb-000004
其中,b代表蓝色分量,σb为第一图像区域在蓝色分量上的标准差值,xbi为第i个像素点在蓝色分量上的色度值,μb为所有像素点在蓝色分量上的色度均值。Where b represents the blue component, σ b is the standard deviation of the first image region on the blue component, x bi is the chromaticity value of the ith pixel on the blue component, and μ b is the pixel of all pixels The chromaticity mean on the blue component.
需要说明的是,计算标准差值时,需要对每个像素点相对均值的离散程度进行计算,但是得到的标准差值则是反映所有像素点整体偏离程度的数值,因此在一个颜色分量上,一个图像区域对应个标准差值。It should be noted that when calculating the standard deviation, it is necessary to calculate the degree of dispersion of the relative mean of each pixel, but the obtained standard deviation is a value reflecting the degree of overall deviation of all the pixels, and therefore, on one color component, An image area corresponds to a standard deviation.
由此,计算机就获得了第一图像区域对应三个颜色分量的标准差值σr、σg和σb。然后将σr、σg和σb进行求和,获得综合标准差值σc。最后,计算机将σc与预设的标准差值阈值进行比较,如果σc大于标准差值阈值,则说明第一图像区 域中像素色度的离散程度足够大,保留该第一图像区域;如果σc小于标准差值阈值,则说明第一图像区域中像素色度的离散程度不够大,剔除该第一图像区域。由此完成第一图像区域的筛选。在图4a所示的示例中,右下角的第一图像区域会被剔除掉。Thereby, the computer obtains standard deviation values σ r , σ g and σ b corresponding to the three color components of the first image region. Then σ r , σ g and σ b are summed to obtain a comprehensive standard deviation σ c . Finally, the computer compares σ c with a preset standard deviation threshold. If σ c is greater than the standard deviation threshold, the dispersion of the pixel chromaticity in the first image region is sufficiently large to retain the first image region; If σ c is smaller than the standard deviation threshold, it indicates that the degree of dispersion of the pixel chromaticity in the first image region is not large enough, and the first image region is eliminated. This completes the screening of the first image area. In the example shown in Figure 4a, the first image area in the lower right corner will be rejected.
上述方式仅仅是筛选第一图像区域的一种实现方式之一,实际应用中,也可以使用更为简便的算法筛选第一图像区域。例如,按照下述公式分别计算各个颜色分量的平均差值:The above method is only one of the implementation methods for screening the first image region. In practical applications, a simpler algorithm can also be used to filter the first image region. For example, calculate the average difference of each color component according to the following formula:
Figure PCTCN2016097696-appb-000005
Figure PCTCN2016097696-appb-000005
其中,V是某个颜色分量的平均差值,绝对值符号中的字符和运算符号与前述公式中的内容对应相同。相对于标准差值算法而言,平均差值算法能够在一定程度上减小计算机的计算量,但是从反映颜色偏离程度的角度而言,标准差值算法的准确度更高。此外,实际应用中,还可以根据像素点的亮度变化度对图像中的物体边缘进行识别,并据此将包含物体较少的第一图像区域剔除掉。Where V is the average difference of a certain color component, and the characters and arithmetic symbols in the absolute value symbol correspond to the content in the foregoing formula. Compared with the standard deviation algorithm, the average difference algorithm can reduce the calculation amount of the computer to some extent, but the accuracy of the standard deviation algorithm is higher from the perspective of reflecting the degree of color deviation. In addition, in practical applications, the edge of the object in the image may be identified according to the degree of change in the brightness of the pixel, and the first image region containing less objects may be removed accordingly.
需要说明的是,步骤330是图3中的可选步骤,实际应用中也可以在执行完步骤320后直接执行步骤340,即不对第一图像区域进行筛选。It should be noted that step 330 is an optional step in FIG. 3, and in actual application, step 340 may be directly executed after step 320 is performed, that is, the first image area is not filtered.
在步骤340中、在左眼图像和右眼图像中的另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域。In step 340, a plurality of second image regions corresponding to the plurality of first image region contents are searched for in the other of the left eye image and the right eye image.
本实施例中,另一图像为右眼图像,计算机在右眼图像中确定出多个第二图像区域,第二图像区域的数量和尺寸与左眼图像中的第一图像区域的数量和尺寸相同。但是值得注意的是,由于左右图像之间存在水平间距,因此第二图像区域在右眼图像中的位置一般不同于第一图像区域在左眼图像中的位置。当然,对于不体现立体效果的物体,两图像区域分别在左右图像中的位置是相同的。In this embodiment, the other image is a right eye image, and the computer determines a plurality of second image regions in the right eye image, the number and size of the second image regions, and the number and size of the first image regions in the left eye image. the same. However, it is worth noting that the position of the second image area in the right eye image is generally different from the position of the first image area in the left eye image due to the horizontal spacing between the left and right images. Of course, for an object that does not exhibit a stereoscopic effect, the positions of the two image regions in the left and right images are the same.
本步骤中,计算机需要保证第二图像区域中涉及的内容与第一图像区域中涉及的内容相同,计算机通过图像匹配技术在右眼图像中查找第一图像区域中涉及的内容,然后在该内容上,按照第一图像区域的尺寸确定出第二图像区域。示例性的,图4e示出了在右眼图像中确定出的第二图像区域,可以看出,与左眼图像中的第一图像区域相比,两者在数量、尺寸及内容上对应相同,但是由于存在水平间距,所以第二图像区域的位置相对第一图像区域而言稍稍偏左一些。In this step, the computer needs to ensure that the content involved in the second image area is the same as the content involved in the first image area, and the computer searches for the content involved in the first image area in the right eye image through image matching technology, and then in the content Upper, the second image area is determined according to the size of the first image area. Illustratively, FIG. 4e shows the second image area determined in the right eye image, and it can be seen that the two correspond to the same number, size and content as compared with the first image area in the left eye image. However, due to the horizontal spacing, the position of the second image area is slightly to the left relative to the first image area.
在步骤350中、在相互对应的第一图像区域和第二图像区域中,选取同一 个像素点。In step 350, in the first image region and the second image region corresponding to each other, select the same Pixels.
对于左右图像中相互对应的第一图像区域和第二图像区域(即左右图像中涉及同一内容的第一图像区域和第二图像区域),计算机分别从两个图像区域中选取同一个像素点作为计算视差参数的参考依据。所谓同一个像素点是指在图像区域中的相对坐标相同的像素点,例如第一图像区域中的第4行第5个像素,与第二图像区域中的第4行第5个像素,这两个像素点就属于相同的像素点。由于第一图像区域和第二图像区域的尺寸相同,因此使用相对坐标的概念可以保证选取的像素点是相同的。但需要说明的是,实际应用中不宜使用左右图像中的绝对坐标概念选择像素点,这是因为第一图像区域和第二图像区域两者之间本身存在水平间距,两者在左右图像中的位置有所差异,如果使用相对图像整体的绝对坐标概念,那么选择出来的两个像素点在第一/第二图像区域中的位置就会有所不同。For the first image area and the second image area corresponding to each other in the left and right images (ie, the first image area and the second image area involving the same content in the left and right images), the computer selects the same pixel point from the two image areas respectively. Calculate the reference basis for the parallax parameter. The same pixel refers to a pixel having the same relative coordinate in the image region, for example, the fourth row and the fifth pixel in the first image region, and the fourth row and the fifth pixel in the second image region. Two pixels belong to the same pixel. Since the sizes of the first image area and the second image area are the same, the concept of using relative coordinates ensures that the selected pixels are the same. However, it should be noted that in practical applications, it is not appropriate to use the absolute coordinate concept in the left and right images to select pixel points, because there is a horizontal spacing between the first image area and the second image area, and the two are in the left and right images. The position is different. If the absolute coordinate concept of the relative image is used, the position of the selected two pixels in the first/second image area will be different.
在本实施例的一个示例中,计算机确定的像素点可以如图5a所示。实际应用中,还可以选取特殊位置上的像素点,例如图像区域四角上的像素点、图像区域中心像素点、或者图像区域边缘上的像素点。后三种情况分别如图5b、5c和5d所示。In one example of this embodiment, the computer determined pixel points may be as shown in Figure 5a. In practical applications, it is also possible to select pixels at a particular location, such as a pixel on the four corners of the image area, a central pixel in the image area, or a pixel on the edge of the image area. The latter three cases are shown in Figures 5b, 5c and 5d, respectively.
在步骤360中、计算像素点在X轴上的坐标差值,获得视差参数。In step 360, the coordinate difference of the pixel on the X-axis is calculated to obtain a parallax parameter.
在确定像素点后,计算机计算两个像素点在X轴上的坐标差值,即得到对应一对第一/第二图像区域的视差参数。计算机针对每一对第一/第二图像区域分别顺序执行步骤350和步骤360,获得对应第一/第二图像区域数量的多个视差参数。After determining the pixel point, the computer calculates the coordinate difference value of the two pixel points on the X-axis, that is, obtains the parallax parameter corresponding to the pair of first/second image regions. The computer sequentially performs steps 350 and 360 for each pair of first/second image regions to obtain a plurality of parallax parameters corresponding to the number of first/second image regions.
本实施例中计算机可以获得两个像素点分别在左右图像中的绝对坐标,然后将两个绝对坐标的X轴分量值相减,即可获得像素点在X轴上的坐标差值。In this embodiment, the computer can obtain the absolute coordinates of the two pixel points in the left and right images, and then subtract the X-axis component values of the two absolute coordinates to obtain the coordinate difference of the pixel points on the X-axis.
在步骤370中、剔除超出预设视差合理范围的最大视差参数和最小视差参数。In step 370, the maximum parallax parameter and the minimum parallax parameter that exceed the reasonable range of the preset parallax are eliminated.
实际应用中,视差参数存在正负之分,这种区别用于体现第二图像区域相对第一图像区域而言是向左偏移了,还是向右偏移了。基于不同的参考标准,向左偏移及向右偏移在视觉上分别体现物体凸出及凹陷,或者分别体现物体凹陷及凸出。In practical applications, the parallax parameter has positive and negative points. This difference is used to reflect whether the second image area is shifted to the left or to the right relative to the first image area. Based on different reference standards, the leftward and rightward offsets visually represent the object protrusions and depressions, respectively, or the object depressions and protrusions, respectively.
一般情况下,视差参数的绝对值反映了物体凸出或凹陷的立体程度,通常立体片源中物体的立体程度是有一定限制的,凸凹程度过大会使用户的眼睛感到难受。基于此,当上述步骤中获取的最大视差参数过于大,或者最小视差参数过于小(负值)时,说明视差参数的计算结果是不准确的,需要将这部分视 差参数剔除掉。In general, the absolute value of the parallax parameter reflects the stereoscopic degree of the object protruding or concave. Generally, the stereoscopic degree of the object in the stereoscopic source is limited, and the degree of convexity and concavity is too large to make the user's eyes feel uncomfortable. Based on this, when the maximum parallax parameter obtained in the above step is too large, or the minimum parallax parameter is too small (negative value), the calculation result of the parallax parameter is inaccurate, and this part needs to be regarded as The difference parameter is removed.
对于最大视差参数的取舍,计算机查找所有数值大于0的视差参数,并计算出第一视差平均值,将第一视差平均值的预设倍数作为剔除最大视差参数的边界条件。若最大视差参数小于第一视差平均值的预设倍数,则保留最大视差参数,否则剔除最大视差参数。在剔除不符合要求的最大视差参数后,计算机在剩余的视差参数中进一步查找最大视差参数,并按照上述方式进行取舍,直至不存在大于上述边界条件的视差参数为止,计算机将此时剩余的视差参数中数值最大的视差参数确定为最终的最大视差参数。For the tradeoff of the maximum parallax parameter, the computer searches for all the parallax parameters whose value is greater than 0, and calculates the first parallax average value, and takes the preset multiple of the first parallax average value as the boundary condition for rejecting the maximum parallax parameter. If the maximum parallax parameter is less than a preset multiple of the first disparity average, the maximum disparity parameter is retained, otherwise the maximum disparity parameter is eliminated. After rejecting the maximum parallax parameter that does not meet the requirement, the computer further searches for the maximum parallax parameter in the remaining parallax parameters, and performs the tradeoff according to the above manner until there is no parallax parameter larger than the above boundary condition, and the computer will remain the parallax at this time. The parallax parameter with the largest value in the parameter is determined as the final maximum parallax parameter.
对于最小视差参数的取舍,计算机查找所有数值小于0的视差参数,并出第二视差平均值,将第二视差平均值的预设倍数作为剔除最小视差参数的边界条件。若最小视差参数小于第二视差平均值的预设倍数,则保留最小视差参数,否则剔除最小视差参数。在剔除不符合要求的最小视差参数后,计算机在剩余的视差参数中进一步查找最小视差参数,并按照上述方式进行取舍,直至不存在小于上述边界条件的视差参数为止,计算机将此时剩余的视差参数中数值最小的视差参数确定为最终的最小视差参数。For the tradeoff of the minimum parallax parameter, the computer searches for all the parallax parameters whose value is less than 0, and outputs the second parallax average value, and takes the preset multiple of the second parallax average value as the boundary condition for eliminating the minimum parallax parameter. If the minimum disparity parameter is less than a preset multiple of the second disparity average, the minimum disparity parameter is retained, otherwise the minimum disparity parameter is eliminated. After rejecting the minimum parallax parameter that does not meet the requirement, the computer further finds the minimum parallax parameter in the remaining parallax parameters, and performs the tradeoff according to the above manner until the parallax parameter less than the above boundary condition does not exist, and the computer will remain the parallax at this time. The parallax parameter with the smallest value in the parameter is determined as the final minimum parallax parameter.
实际应用中,上述预设倍数可以取“1”或者“2”。下面给出本步骤的一个示例:计算机获得了6个视差参数,分别为“+3”、“+6”、“+30”、“-1”、“-2”和“-12”。将视差参数“+3”、“+6”和“+30”求均值获得第一视差平均值“+13”,然后将第一视差平均值“+13”与预设倍数“2”相乘得到“+26”。与“+26”相比,视差参数“+30”超出了该数值,计算机将其剔除,视差参数“+6”没有超出该数值,计算机将其确定为最大视差参数。然后计算机将视差参数“-1”、“-2”和“-12”求均值获得第二视差平均值“-5”,然后将第二视差平均值“-5”与预设倍数“2”相乘得到“-10”。与“-10”相比,视差参数“-12”超出了该数值,计算机将其剔除,视差参数“-2”没有超出该数值,计算机将其确定为最小视差参数。In practical applications, the above preset multiple can take "1" or "2". An example of this step is given below: The computer obtains six parallax parameters, "+3", "+6", "+30", "-1", "-2", and "-12". The parallax parameters "+3", "+6", and "+30" are averaged to obtain a first parallax average "+13", and then the first parallax average "+13" is multiplied by a preset multiple "2" Get "+26". Compared with "+26", the parallax parameter "+30" exceeds this value, and the computer rejects it. The parallax parameter "+6" does not exceed this value, and the computer determines it as the maximum parallax parameter. The computer then averages the parallax parameters "-1", "-2", and "-12" to obtain a second parallax average "-5", and then sets the second parallax average "-5" with a preset multiple "2". Multiply by "-10". Compared with "-10", the parallax parameter "-12" exceeds this value, and the computer rejects it. The parallax parameter "-2" does not exceed this value, and the computer determines it as the minimum parallax parameter.
与步骤330类似的,步骤370同样属于图3所示流程中的可选步骤。当不执行步骤370时,在执行完步骤360后直接执行步骤380;当执行步骤370时,图3所示流程所获得的视差变动范围更加准确。Similar to step 330, step 370 also pertains to the optional steps in the flow shown in FIG. When step 370 is not performed, step 380 is directly executed after step 360 is performed; when step 370 is performed, the range of parallax variation obtained by the process shown in FIG. 3 is more accurate.
在步骤380中、根据获得的最大视差参数和最小视差参数,界定立体片源的视差变动范围。In step 380, a parallax variation range of the stereoscopic slice source is defined based on the obtained maximum parallax parameter and minimum parallax parameter.
在上述示例中,最终确定的最大视差参数为“+6”,最小视差参数为“-2”,由此可以得到立体片源的视差变动范围为[-2,+6]。 In the above example, the final determined maximum parallax parameter is "+6" and the minimum parallax parameter is "-2", whereby the parallax variation range of the stereoscopic sheet source can be obtained as [-2, +6].
可选的,作为对上述图1、图2及图3所示方法的实现,本申请实施例还提供了一种获取立体片源视差参数的装置。该装置可以以软件或硬件的形态集成在客户端侧,或者服务器侧,以对本地存储或外部数据库提供的立体片源进行视察参数的计算。如图6所示,该装置包括:读取单元610、区域确定单元620、查找单元630、计算单元640以及参数确定单元650;其中Optionally, as an implementation of the method shown in FIG. 1 , FIG. 2 , and FIG. 3 , the embodiment of the present application further provides an apparatus for acquiring a parallax parameter of a stereoscopic slice source. The device may be integrated in the form of software or hardware on the client side, or on the server side, to perform the calculation of the inspection parameters for the stereoscopic source provided by the local storage or the external database. As shown in FIG. 6, the apparatus includes: a reading unit 610, an area determining unit 620, a searching unit 630, a calculating unit 640, and a parameter determining unit 650;
读取单元610,设置为从立体片源文件中读取图像帧,图像帧包括左眼图像和右眼图像;The reading unit 610 is configured to read an image frame from the stereoscopic source file, the image frame including a left eye image and a right eye image;
区域确定单元620,设置为在左眼图像和右眼图像中的一个图像中确定多个第一图像区域;The area determining unit 620 is configured to determine a plurality of first image areas in one of the left eye image and the right eye image;
查找单元630,设置为在左眼图像和右眼图像中的另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;The searching unit 630 is configured to search, in another of the left eye image and the right eye image, a plurality of second image regions corresponding to the plurality of first image region contents, the first image region and the second image region corresponding to each other Same size;
计算单元640,设置为分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及The calculating unit 640 is configured to separately calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters;
参数确定单元650,设置为确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The parameter determining unit 650 is configured to determine the maximum parallax parameter and the minimum parallax parameter to obtain a parallax variation range of the stereoscopic slice source.
可选的,如图7所示,该装置还包括:Optionally, as shown in FIG. 7, the device further includes:
抽取单元660,设置为当立体片源文件中存在多个图像帧时,从立体片源文件中抽取至少两个图像帧作为抽样帧;The extracting unit 660 is configured to: when there are multiple image frames in the stereoscopic source file, extract at least two image frames from the stereoscopic source file as sampling frames;
计算单元640,设置为分别获得每个抽样帧的视差参数;The calculating unit 640 is configured to obtain a parallax parameter of each sampling frame separately;
参数确定单元650,设置为在所有抽样帧的视差参数中,确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The parameter determining unit 650 is configured to determine a maximum parallax parameter and a minimum parallax parameter among the parallax parameters of all the sampling frames to obtain a parallax variation range of the stereoscopic slice source.
可选的,如图7所示,抽取单元660,包括:Optionally, as shown in FIG. 7, the extracting unit 660 includes:
间隔抽取子单元6610,设置为基于图像帧在立体片源文件中的排序,按照预设的抽样间隔抽取至少两个抽样帧,抽样间隔包括间隔帧数和/或间隔时长;或者,The interval extraction sub-unit 6610 is configured to extract at least two sampling frames according to a preset sampling interval based on the ordering of the image frames in the stereoscopic source file, and the sampling interval includes the interval frame number and/or the interval duration; or
随机抽取子单元6620,设置为通过随机数生成算法随机抽取至少两个抽样帧。The random extraction sub-unit 6620 is arranged to randomly extract at least two sample frames by a random number generation algorithm.
可选的,区域确定单元620设置为在左眼图像和右眼图像中的一个图像中的预设位置上,确定多个预设尺寸的第一图像区域;其中,预设位置随机确定,或者按照图像的尺寸比例计算确定。Optionally, the area determining unit 620 is configured to determine a plurality of preset image size first regions in a preset position in one of the left eye image and the right eye image; wherein the preset position is randomly determined, or Calculate according to the size ratio of the image.
可选的,如图7所示,该装置还包括:Optionally, as shown in FIG. 7, the device further includes:
筛选单元670,设置为在确定多个第一图像区域之后,对第一图像区域进行 筛选,剔除像素色度的离散程度小于预设离散程度的第一图像区域。The screening unit 670 is configured to perform the first image region after determining the plurality of first image regions The first image area in which the degree of dispersion of the pixel chromaticity is less than the preset degree of dispersion is excluded.
可选的,如图7所示,筛选单元670,包括:Optionally, as shown in FIG. 7, the screening unit 670 includes:
第一计算子单元6710,设置为计算第一图像区域中像素点分别对应红、绿、蓝三种颜色分量的标准差值;The first calculating sub-unit 6710 is configured to calculate a standard difference value of the three color components corresponding to the red, green and blue pixels in the first image region;
第二计算子单元6720,设置为对红色标准差值、绿色标准差值及蓝色标准差值进行求和计算,获得综合标准差值;The second calculating subunit 6720 is configured to perform a summation calculation on the red standard deviation value, the green standard deviation value, and the blue standard deviation value to obtain a comprehensive standard deviation value;
剔除子单元6730,设置为剔除综合标准差值小于标准差值阈值的第一图像区域。The culling sub-unit 6730 is arranged to reject the first image region whose integrated standard deviation is less than the standard deviation threshold.
可选的,计算单元640设置为:Optionally, the computing unit 640 is configured to:
在相互对应的第一图像区域和第二图像区域中,选取同一个像素点;Selecting the same pixel point in the first image area and the second image area corresponding to each other;
计算像素点在X轴上的坐标差值,获得视差参数。Calculate the coordinate difference of the pixel on the X-axis to obtain the parallax parameter.
可选的,参数确定单元650设置为剔除超出预设视差合理范围的最大视差参数和最小视差参数。Optionally, the parameter determining unit 650 is configured to reject the maximum parallax parameter and the minimum parallax parameter that exceed a reasonable range of the preset parallax.
可选的,如图7所示,参数确定单元650,包括:Optionally, as shown in FIG. 7, the parameter determining unit 650 includes:
第一确定子单元6510,设置为计算数值大于0的所有视差参数的平均值,获得第一视差平均值,当最大视差参数小于第一视差平均值的预设倍数时,保留最大视差参数,否则剔除最大视差参数;The first determining subunit 6510 is configured to calculate an average value of all the disparity parameters whose value is greater than 0, to obtain a first disparity average value, and retain the maximum parallax parameter when the maximum disparity parameter is less than a preset multiple of the first disparity average value, otherwise Eliminate the maximum parallax parameter;
第二确定子单元6520,设置为计算数值小于0的所有视差参数的平均值,获得第二视差平均值,当最小视差参数大于第二视差平均值的预设倍数时,保留最小视差参数,否则剔除最小视差参数。The second determining subunit 6520 is configured to calculate an average value of all the disparity parameters whose value is less than 0, to obtain a second disparity average value, and when the minimum disparity parameter is greater than a preset multiple of the second disparity average value, retain the minimum parallax parameter, otherwise Eliminate the minimum parallax parameter.
本申请实施例提供的获取立体片源视差参数的装置,能够自动从立体片源文件中读取图像帧,并在图像帧中的左右眼图像中分别确定多个数量相同并且一一对应的第一图像区域和第二图像区域,分别计算每一对第一和第二图像区域的水平距离,获得对应每一对第一和第二图像区域的视差参数,然后从多个视差参数中确定一个最大视差参数和一个最小视差参数,由此获得立体片源的视差变动范围。与相关技术相比,本申请实施例中获取图像帧、确定图像区域、计算视差参数等过程全部由计算机自动完成,相关人员仅需向计算机提供立体片源文件的存储路径即可。由于不涉及人工操作,因此本申请实施例能够大大缩短获取视差参数的耗时,提高处理效率,特别是在对立体视频进行处理时优势较明显。The apparatus for acquiring the stereoscopic source parallax parameter provided by the embodiment of the present application can automatically read an image frame from the stereoscopic source file, and determine a plurality of identical and one-to-one correspondences in the left and right eye images in the image frame. An image area and a second image area respectively calculate a horizontal distance of each pair of the first and second image areas, obtain a parallax parameter corresponding to each pair of the first and second image areas, and then determine one from the plurality of parallax parameters The maximum parallax parameter and a minimum parallax parameter, thereby obtaining a parallax variation range of the stereoscopic sheet source. Compared with the related art, the processes of acquiring an image frame, determining an image area, and calculating a parallax parameter in the embodiment of the present application are all automatically completed by a computer, and the relevant personnel only need to provide a storage path of the stereoscopic source file to the computer. Since the manual operation is not involved, the embodiment of the present application can greatly shorten the time-consuming of obtaining parallax parameters and improve the processing efficiency, especially when processing stereoscopic video.
需要说明的是,针对上述获取立体片源视差参数的装置,凡是本申请实施例中使用到的单元或子单元的功能都可以通过硬件处理器(hardware processor)来实现。 It should be noted that, for the foregoing apparatus for acquiring the stereoscopic source source parallax parameter, the functions of the unit or the subunit used in the embodiment of the present application can be implemented by a hardware processor.
示例性的,如图8所示,图8示出了本申请实施例提供的一种获取立体片源视差参数的电子设备的实体结构示意图,该电子设备可以包括:处理器(processor)810、通信接口(Communications Interface)820、存储器(memory)830和总线840,其中,处理器810、通信接口820、存储器830通过总线840完成相互间的通信。通信接口820可以设置为通过通信网络传输和/或接收信息。处理器810可以调用存储器830中的逻辑指令,以执行上述任意一种获取立体片源视差参数的方法,包括:从立体片源文件中读取图像帧,图像帧包括左眼图像和右眼图像;在左眼图像或右眼图像中确定多个第一图像区域;在另一个图像中查找与多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。Exemplarily, as shown in FIG. 8 , FIG. 8 is a schematic diagram of a physical structure of an electronic device for acquiring a stereoscopic source parallax parameter according to an embodiment of the present application. The electronic device may include: a processor 810 , A communication interface 820, a memory 830, and a bus 840, wherein the processor 810, the communication interface 820, and the memory 830 complete communication with each other through the bus 840. Communication interface 820 can be arranged to transmit and/or receive information over a communication network. The processor 810 can call the logic instructions in the memory 830 to perform any of the above methods for acquiring the stereoscopic source parallax parameters, including: reading an image frame from the stereoscopic source file, the image frame including the left eye image and the right eye image Determining a plurality of first image regions in the left eye image or the right eye image; searching a plurality of second image regions corresponding to the plurality of first image region contents in the other image, the first image regions corresponding to each other, and the first image region The two image regions have the same size; respectively calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto, to obtain a plurality of parallax parameters; determine a maximum parallax parameter and a minimum parallax parameter, and obtain a parallax variation of the stereoscopic source range.
此外,上述的存储器830中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the logic instructions in the memory 830 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium. Based on the understanding, the technical solution of the embodiment of the present application may be embodied in the form of a software product stored in a storage medium, including a plurality of instructions for causing a computer device (which may be a personal computer, a server, Or a network device or the like) performs all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
本申请实施例还提供了一种非暂态性计算机可读存储介质,其中,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行上述任意一种获取立体片源视差参数的方法。The embodiment of the present application further provides a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions for causing the computer to execute any one of the above A method of obtaining a stereoscopic source parallax parameter.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施方式可借助软件和通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指 令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行上述实施例或者实施例的某些部分所述的方法。此外在不冲突的情况下,本申请实施例中的多种特征可以相互任意组合,组合之后的技术方案仍落入本申请的保护范围。Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiments can be implemented by means of software and a general hardware platform, and of course, by hardware. Based on such understanding, the above technical solution may be embodied in the form of a software product, which may be stored in a computer readable storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including a plurality of fingers. The method described in some of the above-described embodiments or embodiments is performed to cause a computer device (which may be a personal computer, server, or network device, etc.). In addition, in the case of no conflict, various features in the embodiments of the present application may be arbitrarily combined with each other, and the technical solutions after the combination still fall within the protection scope of the present application.
工业实用性Industrial applicability
本申请实施例提供了一种获取立体片源视差参数的方法及装置,解决了在获取立体片源视差参数时效率低下的问题。 The embodiment of the present application provides a method and a device for acquiring a parallax parameter of a stereoscopic slice source, which solves the problem of low efficiency when acquiring a parallax parameter of a stereoscopic slice source.

Claims (21)

  1. 一种获取立体片源视差参数的方法,应用于电子设备包括:A method for obtaining a parallax parameter of a stereoscopic sheet source, the method for applying to an electronic device includes:
    从立体片源文件中读取图像帧,所述图像帧包括左眼图像和右眼图像;Reading an image frame from a stereoscopic source file, the image frame including a left eye image and a right eye image;
    在所述左眼图像和所述右眼图像中的一个图像中确定多个第一图像区域;Determining a plurality of first image regions in one of the left eye image and the right eye image;
    在所述左眼图像和所述右眼图像中的另一个图像中查找与所述多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;Searching a plurality of second image regions corresponding to the plurality of first image region contents in the other of the left eye image and the right eye image, the first image region and the second image region corresponding to each other Same size;
    分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及Calculating a horizontal distance between each of the first image regions and the second image region corresponding thereto, respectively, to obtain a plurality of parallax parameters;
    确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
  2. 根据权利要求1所述的方法,其中,当所述立体片源文件中存在多个图像帧时,从所述立体片源文件中抽取至少两个图像帧作为抽样帧;The method according to claim 1, wherein when there are a plurality of image frames in the stereoscopic slice source file, at least two image frames are extracted from the stereoscopic slice source file as sampling frames;
    分别获得每个抽样帧的视差参数;以及Obtaining parallax parameters for each sample frame separately;
    在所有抽样帧的视差参数中,确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。Among the parallax parameters of all the sampling frames, the maximum parallax parameter and the minimum parallax parameter are determined, and the parallax variation range of the stereoscopic slice source is obtained.
  3. 根据权利要求2所述的方法,其中,所述从所述立体片源文件中抽取至少两个图像帧作为抽样帧,包括:The method of claim 2, wherein the extracting at least two image frames from the stereoscopic source file as sample frames comprises:
    基于图像帧在立体片源文件中的排序,按照预设的抽样间隔抽取至少两个抽样帧,所述抽样间隔包括间隔帧数和/或间隔时长;或者,And extracting at least two sampling frames according to a preset sampling interval, where the sampling interval includes an interval frame number and/or an interval duration, or based on the sorting of the image frames in the stereoscopic source file; or
    通过随机数生成算法随机抽取至少两个抽样帧。At least two sampling frames are randomly extracted by a random number generation algorithm.
  4. 根据权利要求1-3任一项所述的方法,其中,所述在所述左眼图像和所述右眼图像中的一个图像中确定多个第一图像区域,包括:The method according to any one of claims 1 to 3, wherein the determining the plurality of first image regions in one of the left eye image and the right eye image comprises:
    在所述左眼图像和所述右眼图像中的一个图像中的预设位置上,确定多个预设尺寸的第一图像区域;其中,所述预设位置随机确定,或者按照图像的尺寸比例计算确定。Determining a plurality of preset image size first regions in a preset position in one of the left eye image and the right eye image; wherein the preset position is randomly determined, or according to an image size The scale calculation is determined.
  5. 根据权利要求1所述的方法,在确定多个第一图像区域之后,所述方法还包括:The method of claim 1, after determining the plurality of first image regions, the method further comprising:
    对所述第一图像区域进行筛选,剔除像素色度的离散程度小于预设离散程度的第一图像区域。The first image area is filtered to eliminate the first image area whose pixel chromaticity is less than a predetermined degree of dispersion.
  6. 根据权利要求5所述的方法,其中,所述对所述第一图像区域进行筛选,剔除像素色度的离散程度小于预设离散程度的第一图像区域,包括:The method according to claim 5, wherein the filtering the first image region to eliminate the first image region in which the degree of dispersion of the pixel chromaticity is less than a predetermined degree of dispersion comprises:
    计算所述第一图像区域中像素点分别对应红、绿、蓝三种颜色分量的标准差值;Calculating, by the pixel points in the first image region, standard deviation values corresponding to three color components of red, green, and blue;
    对红色标准差值、绿色标准差值及蓝色标准差值进行求和计算,获得综合 标准差值;以及Calculate the sum of the red standard deviation, the green standard deviation, and the blue standard deviation to obtain a comprehensive Standard difference;
    剔除综合标准差值小于标准差值阈值的第一图像区域。The first image region whose integrated standard deviation is less than the standard deviation threshold is rejected.
  7. 根据权利要求1-6任一项所述的方法,其中,所述分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数,包括:The method according to any one of claims 1 to 6, wherein the calculating the horizontal distance between each of the first image regions and the second image region corresponding thereto to obtain a plurality of parallax parameters comprises:
    在相互对应的第一图像区域和第二图像区域中,选取同一个像素点;以及Selecting the same pixel point in the first image area and the second image area corresponding to each other;
    计算所述像素点在X轴上的坐标差值,获得视差参数。A coordinate difference value of the pixel on the X-axis is calculated to obtain a parallax parameter.
  8. 根据权利要求1-7任一项所述的方法,其中,所述确定最大视差参数和最小视差参数,包括:The method of any one of claims 1 to 7, wherein said determining a maximum parallax parameter and a minimum parallax parameter comprises:
    剔除超出预设视差合理范围的最大视差参数和最小视差参数。The maximum parallax parameter and the minimum parallax parameter that exceed the reasonable range of the preset parallax are excluded.
  9. 根据权利要求8所述的方法,其中,所述剔除超出预设视差合理范围的最大视差参数和最小视差参数,包括:The method according to claim 8, wherein the culling the maximum parallax parameter and the minimum parallax parameter beyond a reasonable range of the preset parallax comprises:
    计算数值大于0的所有视差参数的平均值,获得第一视差平均值;Calculating an average of all the parallax parameters whose values are greater than 0, and obtaining a first parallax average value;
    若所述最大视差参数小于所述第一视差平均值的预设倍数,则保留所述最大视差参数,否则剔除所述最大视差参数;If the maximum disparity parameter is less than a preset multiple of the first disparity average, retaining the maximum disparity parameter, otherwise rejecting the maximum disparity parameter;
    计算数值小于0的所有视差参数的平均值,获得第二视差平均值;以及Calculating an average of all parallax parameters whose values are less than 0 to obtain a second parallax average;
    若所述最小视差参数大于所述第二视差平均值的预设倍数,则保留所述最小视差参数,否则剔除所述最小视差参数。If the minimum disparity parameter is greater than a preset multiple of the second disparity average, the minimum disparity parameter is retained, otherwise the minimum disparity parameter is eliminated.
  10. 一种获取立体片源视差参数的装置,包括:An apparatus for obtaining a parallax parameter of a stereoscopic sheet source, comprising:
    读取单元,设置为从立体片源文件中读取图像帧,所述图像帧包括左眼图像和右眼图像;a reading unit configured to read an image frame from a stereoscopic sheet source file, the image frame including a left eye image and a right eye image;
    区域确定单元,设置为在所述左眼图像和所述右眼图像中的一个图像中确定多个第一图像区域;a region determining unit configured to determine a plurality of first image regions in one of the left eye image and the right eye image;
    查找单元,设置为在所述左眼图像和所述右眼图像中的另一个图像中查找与所述多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;a searching unit configured to search for a plurality of second image regions corresponding to the plurality of first image region contents in the other of the left eye image and the right eye image, and the first image regions corresponding to each other Same size as the second image area;
    计算单元,设置为分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及a calculating unit configured to separately calculate a horizontal distance between each of the first image regions and the second image region corresponding thereto to obtain a plurality of parallax parameters;
    参数确定单元,设置为确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The parameter determining unit is configured to determine a maximum parallax parameter and a minimum parallax parameter to obtain a parallax variation range of the stereoscopic slice source.
  11. 根据权利要求10所述的装置,还包括:The apparatus of claim 10 further comprising:
    抽取单元,设置为当所述立体片源文件中存在多个图像帧时,从所述立体片源文件中抽取至少两个图像帧作为抽样帧;The extracting unit is configured to: when there are multiple image frames in the stereoscopic source file, extract at least two image frames from the stereoscopic source file as sampling frames;
    所述计算单元,设置为分别获得每个抽样帧的视差参数;以及 The calculating unit is configured to obtain a parallax parameter of each sample frame separately;
    所述参数确定单元,设置为在所有抽样帧的视差参数中,确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The parameter determining unit is configured to determine a maximum parallax parameter and a minimum parallax parameter among the parallax parameters of all the sampling frames to obtain a parallax variation range of the stereoscopic slice source.
  12. 根据权利要求11所述的装置,其中,所述抽取单元,包括:The apparatus according to claim 11, wherein the extracting unit comprises:
    间隔抽取子单元,设置为基于图像帧在立体片源文件中的排序,按照预设的抽样间隔抽取至少两个抽样帧,所述抽样间隔包括间隔帧数和/或间隔时长;或者,The interval extraction subunit is configured to extract at least two sampling frames according to a preset sampling interval based on the order of the image frames in the stereoscopic source file, where the sampling interval includes the interval frame number and/or the interval duration; or
    随机抽取子单元,设置为通过随机数生成算法随机抽取至少两个抽样帧。A random extraction sub-unit is arranged to randomly extract at least two sampling frames by a random number generation algorithm.
  13. 根据权利要求10-12任一项所述的装置,其中,所述区域确定单元设置为在所述左眼图像和所述右眼图像中的一个图像中的预设位置上,确定多个预设尺寸的第一图像区域;其中,所述预设位置随机确定,或者按照图像的尺寸比例计算确定。The apparatus according to any one of claims 10 to 12, wherein the area determining unit is configured to determine a plurality of pre-positions at preset positions in one of the left-eye image and the right-eye image The first image area of the size is set; wherein the preset position is randomly determined or determined according to the size ratio of the image.
  14. 根据权利要求10所述的装置,还包括:The apparatus of claim 10 further comprising:
    筛选单元,设置为在确定多个第一图像区域之后,对所述第一图像区域进行筛选,剔除像素色度的离散程度小于预设离散程度的第一图像区域。The screening unit is configured to filter the first image region after determining the plurality of first image regions, and reject the first image region in which the degree of dispersion of the pixel chromaticity is less than a preset degree of dispersion.
  15. 根据权利要求14所述的装置,其中,所述筛选单元,包括:The apparatus of claim 14, wherein the screening unit comprises:
    第一计算子单元,设置为计算所述第一图像区域中像素点分别对应红、绿、蓝三种颜色分量的标准差值;a first calculating subunit, configured to calculate a standard difference value of the three color components corresponding to the red, green, and blue pixels in the first image region;
    第二计算子单元,设置为对红色标准差值、绿色标准差值及蓝色标准差值进行求和计算,获得综合标准差值;a second calculating subunit, configured to perform a summation calculation on the red standard deviation value, the green standard deviation value, and the blue standard deviation value to obtain a comprehensive standard deviation value;
    剔除子单元,设置为剔除综合标准差值小于标准差值阈值的第一图像区域。The culling subunit is set to reject the first image region where the integrated standard deviation is less than the standard deviation threshold.
  16. 根据权利要求10-15任一项所述的装置,其中,所述计算单元设置为:The apparatus of any of claims 10-15, wherein the computing unit is configured to:
    在相互对应的第一图像区域和第二图像区域中,选取同一个像素点;以及Selecting the same pixel point in the first image area and the second image area corresponding to each other;
    计算所述像素点在X轴上的坐标差值,获得视差参数。A coordinate difference value of the pixel on the X-axis is calculated to obtain a parallax parameter.
  17. 根据权利要求10-16任一项所述的装置,其中,所述参数确定单元设置为剔除超出预设视差合理范围的最大视差参数和最小视差参数。The apparatus according to any one of claims 10-16, wherein the parameter determination unit is configured to reject the maximum parallax parameter and the minimum parallax parameter that exceed a reasonable range of the preset parallax.
  18. 根据权利要求17所述的装置,其中,所述参数确定单元,包括:The device according to claim 17, wherein the parameter determining unit comprises:
    第一确定子单元,设置为计算数值大于0的所有视差参数的平均值,获得第一视差平均值,当所述最大视差参数小于所述第一视差平均值的预设倍数时,保留所述最大视差参数,否则剔除所述最大视差参数;a first determining subunit, configured to calculate an average value of all the disparity parameters whose value is greater than 0, to obtain a first disparity average value, when the maximum disparity parameter is less than a preset multiple of the first disparity average value, retaining the Maximum parallax parameter, otherwise the maximum parallax parameter is eliminated;
    第二确定子单元,设置为计算数值小于0的所有视差参数的平均值,获得第二视差平均值,当所述最小视差参数大于所述第二视差平均值的预设倍数时,保留所述最小视差参数,否则剔除所述最小视差参数。a second determining subunit, configured to calculate an average value of all the disparity parameters whose value is less than 0, to obtain a second disparity average value, when the minimum disparity parameter is greater than a preset multiple of the second disparity average value, retaining the The minimum parallax parameter, otherwise the minimum parallax parameter is eliminated.
  19. 一种电子设备,包括: An electronic device comprising:
    至少一个处理器;以及,At least one processor; and,
    与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein
    所述存储器存储有可被所述一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:The memory stores instructions executable by the one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
    从立体片源文件中读取图像帧,所述图像帧包括左眼图像和右眼图像;Reading an image frame from a stereoscopic source file, the image frame including a left eye image and a right eye image;
    在所述左眼图像和所述右眼图像中的一个图像中确定多个第一图像区域;Determining a plurality of first image regions in one of the left eye image and the right eye image;
    在所述左眼图像和所述右眼图像中的另一个图像中查找与所述多个第一图像区域内容对应的多个第二图像区域,相互对应的第一图像区域和第二图像区域尺寸相同;Searching a plurality of second image regions corresponding to the plurality of first image region contents in the other of the left eye image and the right eye image, the first image region and the second image region corresponding to each other Same size;
    分别计算每个第一图像区域和与其对应的第二图像区域之间的水平距离,获得多个视差参数;以及Calculating a horizontal distance between each of the first image regions and the second image region corresponding thereto, respectively, to obtain a plurality of parallax parameters;
    确定最大视差参数和最小视差参数,获得立体片源的视差变动范围。The maximum parallax parameter and the minimum parallax parameter are determined to obtain a parallax variation range of the stereoscopic slice source.
  20. 一种非暂态计算机可读存储介质,其中,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1-9任一项所述的获取立体片源视差参数的方法。A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the acquisition of any one of claims 1-9 A method of stereoscopic source parallax parameters.
  21. 一种计算机程序产品,包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1-9任一项所述的获取立体片源视差参数的方法。 A computer program product comprising a computing program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform claims 1-9 A method of obtaining a stereoscopic source parallax parameter according to any one of the preceding claims.
PCT/CN2016/097696 2015-12-28 2016-08-31 Method and apparatus for obtaining parallax parameters of stereoscopic film source WO2017113850A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201511000911.5A CN105872516A (en) 2015-12-28 2015-12-28 Method and device for obtaining parallax parameters of three-dimensional film source
CN201511000911.5 2015-12-28

Publications (1)

Publication Number Publication Date
WO2017113850A1 true WO2017113850A1 (en) 2017-07-06

Family

ID=56624389

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/097696 WO2017113850A1 (en) 2015-12-28 2016-08-31 Method and apparatus for obtaining parallax parameters of stereoscopic film source

Country Status (2)

Country Link
CN (1) CN105872516A (en)
WO (1) WO2017113850A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026641A (en) * 2019-11-14 2020-04-17 北京云聚智慧科技有限公司 Picture comparison method and electronic equipment

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105872516A (en) * 2015-12-28 2016-08-17 乐视致新电子科技(天津)有限公司 Method and device for obtaining parallax parameters of three-dimensional film source
CN110007475A (en) * 2019-04-17 2019-07-12 万维云视(上海)数码科技有限公司 Utilize the method and apparatus of virtual depth compensation eyesight
CN112255536B (en) * 2020-09-21 2023-05-26 山东产研鲲云人工智能研究院有限公司 Switch fault detection method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102254348A (en) * 2011-07-25 2011-11-23 北京航空航天大学 Block matching parallax estimation-based middle view synthesizing method
US20120014590A1 (en) * 2010-06-25 2012-01-19 Qualcomm Incorporated Multi-resolution, multi-window disparity estimation in 3d video processing
US20120062548A1 (en) * 2010-09-14 2012-03-15 Sharp Laboratories Of America, Inc. Reducing viewing discomfort
CN102714751A (en) * 2010-01-13 2012-10-03 夏普株式会社 Methods and a display device for displaying a pair of stereoscopic images on a display for reducing viewing discomfort
CN104065954A (en) * 2014-07-03 2014-09-24 中国传媒大学 Method for quickly detecting parallax scope of high-definition stereoscopic video
US20150138323A1 (en) * 2011-08-03 2015-05-21 Sony Corporation Image processing device and method, and program
CN105872516A (en) * 2015-12-28 2016-08-17 乐视致新电子科技(天津)有限公司 Method and device for obtaining parallax parameters of three-dimensional film source

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006493A (en) * 2010-11-26 2011-04-06 北京新岸线网络技术有限公司 Parallax adjustment method and device for 3D video image
JP5769248B2 (en) * 2011-09-20 2015-08-26 Necソリューションイノベータ株式会社 Stereo matching processing device, stereo matching processing method, and program
CN102999939B (en) * 2012-09-21 2016-02-17 魏益群 Coordinate acquiring device, real-time three-dimensional reconstructing system and method, three-dimensional interactive device
CN104320647B (en) * 2014-10-13 2017-10-10 深圳超多维光电子有限公司 Stereoscopic image generation method and display device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102714751A (en) * 2010-01-13 2012-10-03 夏普株式会社 Methods and a display device for displaying a pair of stereoscopic images on a display for reducing viewing discomfort
US20120014590A1 (en) * 2010-06-25 2012-01-19 Qualcomm Incorporated Multi-resolution, multi-window disparity estimation in 3d video processing
US20120062548A1 (en) * 2010-09-14 2012-03-15 Sharp Laboratories Of America, Inc. Reducing viewing discomfort
CN102254348A (en) * 2011-07-25 2011-11-23 北京航空航天大学 Block matching parallax estimation-based middle view synthesizing method
US20150138323A1 (en) * 2011-08-03 2015-05-21 Sony Corporation Image processing device and method, and program
CN104065954A (en) * 2014-07-03 2014-09-24 中国传媒大学 Method for quickly detecting parallax scope of high-definition stereoscopic video
CN105872516A (en) * 2015-12-28 2016-08-17 乐视致新电子科技(天津)有限公司 Method and device for obtaining parallax parameters of three-dimensional film source

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026641A (en) * 2019-11-14 2020-04-17 北京云聚智慧科技有限公司 Picture comparison method and electronic equipment
CN111026641B (en) * 2019-11-14 2023-06-20 北京云聚智慧科技有限公司 Picture comparison method and electronic equipment

Also Published As

Publication number Publication date
CN105872516A (en) 2016-08-17

Similar Documents

Publication Publication Date Title
CN105023249B (en) Bloom image repair method and device based on light field
CN105243371B (en) A kind of detection method, system and the camera terminal of face U.S. face degree
WO2020151489A1 (en) Living body detection method based on facial recognition, and electronic device and storage medium
CN105279372B (en) A kind of method and apparatus of determining depth of building
WO2017092431A1 (en) Human hand detection method and device based on skin colour
CN104756491B (en) Depth cue based on combination generates depth map from monoscopic image
WO2017113850A1 (en) Method and apparatus for obtaining parallax parameters of stereoscopic film source
US10463257B2 (en) System and method for identifying physical properties of feet
WO2018082389A1 (en) Skin colour detection method and apparatus, and terminal
US9881202B2 (en) Providing visual effects for images
WO2018082388A1 (en) Skin color detection method and device, and terminal
CN106210522B (en) A kind of image processing method, device, mobile terminal and readable storage medium storing program for executing
TWI691937B (en) Method and device for filtering light spot, computer readable storage medium, processor, gaze tracking equipment
WO2016206344A1 (en) White balance correction method, device and computer storage medium
WO2021098486A1 (en) Garment color recognition processing method, device, apparatus, and storage medium
US10091490B2 (en) Scan recommendations
CN107622480A (en) A kind of Kinect depth image Enhancement Method
CN109427038A (en) A kind of cell phone pictures display methods and system
CN110111347A (en) Logos extracting method, device and storage medium
KR101513931B1 (en) Auto-correction method of composition and image apparatus with the same technique
KR101315464B1 (en) Image processing method
CN106408617A (en) Interactive single image material acquiring system based on YUV color space and method
CN105160329B (en) A kind of tooth recognition methods, system and camera terminal based on YUV color spaces
CN117218398A (en) Data processing method and related device
JP6608311B2 (en) Image evaluation apparatus and image evaluation program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16880643

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16880643

Country of ref document: EP

Kind code of ref document: A1