WO2018192455A1 - 一种生成字幕的方法及装置 - Google Patents

一种生成字幕的方法及装置 Download PDF

Info

Publication number
WO2018192455A1
WO2018192455A1 PCT/CN2018/083244 CN2018083244W WO2018192455A1 WO 2018192455 A1 WO2018192455 A1 WO 2018192455A1 CN 2018083244 W CN2018083244 W CN 2018083244W WO 2018192455 A1 WO2018192455 A1 WO 2018192455A1
Authority
WO
WIPO (PCT)
Prior art keywords
subtitle
character
pixel point
generated
pixel
Prior art date
Application number
PCT/CN2018/083244
Other languages
English (en)
French (fr)
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 WO2018192455A1 publication Critical patent/WO2018192455A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • H04N21/4884Data services, e.g. news ticker for displaying subtitles
    • 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
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/278Subtitling

Definitions

  • the present application relates to the field of video, and in particular, to a method and apparatus for generating subtitles.
  • the panoramic video is a combination of one or more sets of photos taken 360 degrees by the camera ring into a panoramic image, and the plurality of panoramic images are sequentially mapped on the surface of a ball to form a video of a frame image, which can be in the spatial domain.
  • the user can use the player to play the panoramic video, and when playing the panoramic video, the user can change the viewing angle of the video by selecting the viewpoint, thereby improving the user's interactive experience.
  • the current lack of panoramic video is that there are no subtitles.
  • the present application provides a method and apparatus for generating subtitles.
  • the technical solution is as follows:
  • the present application discloses a method of generating a subtitle, the method comprising:
  • the obtaining the first position of the pixel point included in the character to be generated in the plane coordinate system comprises:
  • the obtaining, by the starting position, the first location of the pixel point included in the to-be-generated character in the plane coordinate system includes:
  • Reading from the plane coordinate system, a first position of the pixel point included in the character to be generated in the plane coordinate system.
  • the obtaining, by the starting position, the first location of the pixel point included in the to-be-generated character in the plane coordinate system includes:
  • the calculating, according to the first position of the pixel point, the second position of the pixel point on the subtitle sphere comprising:
  • the method further includes:
  • the rotating shaft passes through a center of the spherical surface of the subtitle, and controls the subtitle spherical surface to rotate around the rotating shaft.
  • the rendering according to the second location of the pixel, the pixel point on the subtitle spherical surface, including:
  • the pixel points are rendered on the subtitle sphere based on the distance between the viewpoint and the character to be generated and the second position of the pixel.
  • the rendering according to the distance between the viewpoint and the to-be-generated character and the second position of the pixel, the pixel point on the subtitle spherical surface, including:
  • Transparency is calculated according to an angle between the first line and the second connection, the first connection is a line connecting the center of the subtitle sphere and the viewpoint, and the second connection is the subtitle sphere a line connecting the center of the sphere to a point in the character to be generated;
  • the pixel points are rendered on the subtitle sphere based on the transparency and the second position of the pixel.
  • the calculating, according to the first position of the pixel point, the second position of the pixel point on the subtitle sphere comprising:
  • N is the total number of subtitle spheres and N is an integer greater than 1, the centers of the N subtitle spheres coincide, and the radii of the N subtitle spheres are not equal to each other.
  • the calculating, according to the first position of the pixel point and the radius of the i-th subtitle spherical surface, the second position of the pixel point on the i-th subtitle spherical surface including:
  • the rendering according to the second location of the pixel, the pixel point on the subtitle spherical surface, including:
  • the pixel point is rendered on the i-th subtitle spherical surface according to the second position of the pixel point on the i-th subtitle spherical surface.
  • the present application discloses an apparatus for generating a subtitle, the apparatus comprising:
  • An acquiring module configured to acquire a first position of a pixel point included in a character to be generated in a plane coordinate system
  • a calculating module configured to calculate, according to the first position of the pixel point, a second position of the pixel point on a subtitle spherical surface
  • a rendering module configured to render the pixel on the subtitle spherical surface according to the second position of the pixel to form the to-be-generated character.
  • the obtaining module is configured to:
  • the obtaining module includes:
  • a generating unit configured to generate a dot matrix of a preset size according to the code of the character to be generated, where the dot matrix includes the character to be generated;
  • a reading unit configured to read, from the plane coordinate system, a first position of a pixel point included in the character to be generated in the plane coordinate system.
  • the obtaining module is configured to:
  • the computing module includes:
  • a first calculating unit configured to calculate an elevation angle and an azimuth angle of the pixel point in a spherical coordinate system according to a first position of the pixel point, where a coordinate origin of the spherical coordinate system coincides with a spherical center of the subtitle spherical surface;
  • a second calculating unit configured to calculate, according to a radius of the subtitle spherical surface, an elevation angle and an azimuth angle of the pixel point, a second position of the pixel point on the subtitle spherical surface.
  • the device further includes:
  • a rotating module configured to determine a rotating shaft, the rotating shaft passes through a center of the spherical surface of the subtitle, and controls the subtitle spherical surface to rotate around the rotating shaft.
  • the rendering module is configured to:
  • the pixel points are rendered on the subtitle sphere based on the distance between the viewpoint and the character to be generated and the second position of the pixel.
  • the calculating module is further configured to calculate a transparency according to an angle between the first connection and the second connection, where the first connection is a connection between a center of the spherical surface of the subtitle and a viewpoint.
  • the second connection is a connection between a center of the subtitle sphere and a point of the character to be generated;
  • the rendering module is configured to render the pixel on the subtitle spherical surface according to the transparency and the second position of the pixel point.
  • the total number of N subtitle spheres and N is an integer greater than 1, the centers of the N subtitle spheres coincide, and the radii of the N subtitle spheres are not equal to each other.
  • the computing module is configured to:
  • the rendering module is configured to render the i-th subtitle spherical surface according to the second position of the pixel point on the i-th subtitle spherical surface in the ith time period. pixel.
  • the present application discloses a computer readable storage medium for storing a computer program, the computer program being loaded by a processor to execute instructions of the method of the first aspect or any of the possible implementations of the first aspect.
  • the present application discloses an apparatus for generating a subtitle, the apparatus comprising:
  • One or more processors are One or more processors.
  • One or more memories are One or more memories
  • the one or more memories store program code, the program code being executed by the one or more processors to:
  • the embodiment of the present application obtains a first position of a pixel point included in a character to be generated in a plane coordinate system; and calculates a second position of the pixel point on the subtitle spherical surface according to the first position of the pixel point; In the second position, the pixel is rendered on the subtitle sphere to form a character to be generated, so that the subtitle of the panoramic video can be displayed on the subtitle sphere.
  • FIG. 1 is a flowchart of a method for generating a subtitle according to an embodiment of the present application
  • 2-1 is a flowchart of a method for generating subtitles according to an embodiment of the present application
  • 2-2 is a schematic diagram of a dot matrix provided by an embodiment of the present application.
  • 2-3 is a schematic diagram of a spherical surface of a subtitle provided by an embodiment of the present application.
  • FIGS. 2-4 are schematic diagrams of multiple subtitle spheres provided by an embodiment of the present application.
  • FIGS. 2-5 are schematic diagrams showing display of subtitles in different views according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an apparatus for generating a subtitle according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of another apparatus for generating subtitles according to an embodiment of the present application.
  • the panoramic video is a video formed by mapping a video image on the surface of the image sphere
  • the panoramic video may include N subtitle spheres, N is an integer greater than or equal to 1, and the spherical center and image of each subtitle sphere in the N subtitle spheres
  • the spherical origin of the spherical surface and the coordinate origin of the spherical coordinate system coincide.
  • the radius of each of the N subtitle spheres is unequal.
  • the execution body of any of the following embodiments provided in the present application may be a terminal, a server, or the like, and the terminal may be a mobile phone, a desktop computer, a notebook computer, a video camera, a camera, or the like.
  • the execution body of any of the following embodiments provided by the present application may be a processor included in a terminal or a server.
  • an embodiment of the present application provides a method for generating a subtitle, where the method includes:
  • Step 101 Acquire a starting position of a character to be generated in a plane coordinate system.
  • Step 102 Acquire, according to the starting position, a first position of a pixel point included in the character to be generated in a plane coordinate system.
  • Step 103 Calculate a second position of the pixel point on the subtitle spherical surface according to the first position of the pixel point.
  • Step 104 Render the pixel on the subtitle sphere according to the second position of the pixel to form a character to be generated.
  • the first position of the pixel to be generated in the plane coordinate system is obtained by acquiring the starting position of the character to be generated in the plane coordinate system; according to the starting position, the first position of the pixel point included in the character to be generated is in the plane coordinate system; a first position, calculating a second position of the pixel on the subtitle sphere; and rendering the pixel on the subtitle sphere according to the second position of the pixel to form a character to be generated, so that the panoramic video can be displayed on the subtitle sphere Subtitles.
  • the embodiment of the present application provides a method for generating a subtitle, which can generate a subtitle of a panoramic video.
  • the method includes:
  • Step 201 Acquire a starting position of a character to be generated in a plane coordinate system.
  • the character to be generated can be a text, a text or an expression image.
  • the acquired character to be generated may be a character input for the user or a character in a subtitle file corresponding to the panoramic video.
  • a panoramic video corresponds to a subtitle file that includes at least one character.
  • the subtitle file may further include a starting position of a part of the at least one character in the plane coordinate system or may include a starting position of each of the at least one character in the plane coordinate system.
  • the starting position of the character in the subtitle file in the plane coordinate system may be set in advance and stored in the subtitle file, or may be stored in the subtitle file after the temporary setting by the user, which is not limited herein.
  • the character to be generated may be any one of the characters in the subtitle file.
  • the obtaining process of the character to be generated and the starting position thereof may be: obtaining a character from the subtitle file as a character to be generated, and if the subtitle file includes a starting position of the character to be generated in the plane coordinate system, the subtitle file may also be obtained. Get the starting position of the character to be generated in the plane coordinate system. If the subtitle file does not include the starting position of the character to be generated in the plane coordinate system, the character having the starting position in the subtitle file, the number of characters to be generated between the character to be generated and the interval between the characters, and two adjacent characters may be used. The spacing between characters and the size of the characters, calculate the starting position of the character to be generated in the plane coordinate system.
  • the panoramic video may be composed of a panoramic video frame of one frame, and the characters included in the subtitle file may be characters corresponding to each panoramic video frame.
  • the character corresponding to the panoramic video frame refers to the character displayed when the panoramic video frame is displayed.
  • the subtitle file may include a starting position of each character corresponding to the target panoramic video frame, or may include a starting position of the first character corresponding to the target panoramic video frame.
  • the subtitle file may not include the starting position of each character corresponding to each of the other panoramic video frames.
  • the target panoramic video frame may be any panoramic video frame in the panoramic video, and may be, for example, a first panoramic video frame, a second panoramic video frame, or a third panoramic video frame in the panoramic video. In this way, the size of the subtitle file can be reduced, and the amount of work required to set the starting position can be reduced.
  • the starting position of the character to be generated can be:
  • the character to be generated is a character displayed in the target panoramic video frame
  • the subtitle file includes a starting position of each character corresponding to the target panoramic video frame or the character to be generated is the first character corresponding to the target panoramic video frame
  • the starting position of the character to be generated can be obtained from the subtitle file. If the subtitle file only includes the starting position of the first character corresponding to the target panoramic video frame and the character to be generated is not the first character, the starting position of the first character, the character to be generated, and the first character may be
  • the starting position of the character to be generated is calculated by the number of characters in the interval between characters, the interval between two adjacent characters, and the size of the character.
  • the character to be generated is a character corresponding to another panoramic video frame other than the target panoramic video frame
  • the first corresponding to the target panoramic video frame may be The starting position of the character is used as the starting position of the character to be generated. If the character to be generated is not the first character corresponding to the other panoramic video frame, the first character corresponding to the first character corresponding to the target panoramic video frame, the character to be generated, and the first character corresponding to the other panoramic video frame
  • the starting position of the character to be generated is calculated by the number of characters in the interval, the interval between two adjacent characters, and the character size.
  • the character to be generated can be a character input by the user, and the user can also input or select the starting position of the character in the plane coordinate system when inputting the character. In this step, the character to be generated input by the user and the starting position of the character to be generated in the plane coordinate system can be directly obtained.
  • the first character when the user inputs a character, for the first character input, the first character can be input to the starting position in the plane coordinate system, for the second character other than the first character, the third character Characters, the fourth character, etc., you do not need to enter the starting position of each character in the plane coordinate system. Therefore, in this step, when the user does not input the start position of the character to be generated input in the plane coordinate system, the number of characters between the character to be generated and the first character input by the user may be obtained, according to the first character.
  • the starting position in the plane coordinate system, the number of characters, the interval between two adjacent characters, and the character size calculate the starting position of the character to be generated in the plane coordinate system.
  • the user can directly select a position click in the plane coordinate system by using the input device (such as a mouse, etc.).
  • the click operation triggered by the input device is detected, the click position of the input device in the plane coordinate system is obtained, and the click position is determined as the starting position of the character.
  • the user can directly select a position click in the plane coordinate system using the finger.
  • the click position corresponding to the click operation is obtained, and the click position is determined as the starting position of the character.
  • Step 202 Generate a dot matrix of a preset size according to the code of the character to be generated, where the dot matrix includes characters to be generated.
  • the code of the character to be generated may be input into a Freetype font library, and a dot matrix of a preset size is generated by the Freetype font library; for each point in the dot matrix, the bit value of the dot is a preset first bit value. Or preset to the second bit value. If the point is a pixel in the character to be generated, the bit value of the point is a preset first bit value. If the point is not a pixel in the character to be generated, the bit value of the point is a preset number. Two-bit value.
  • the first bit value may be 1, and the second bit value may be 0; or, the first bit value may be 0 and the second bit value is 1.
  • the preset size is 24 ⁇ 24
  • the first bit value is assumed to be 1
  • the second bit value is 0.
  • the code of the character "I” to be generated is input into the Freetype font library, and a dot matrix of size 24 ⁇ 24 is generated by the Freetype font library, as shown in the left figure of Fig. 2-2.
  • the first bit value is indicated by black padding
  • the second bit value is represented by colorless padding
  • the dots filled with black are the pixels in the character "I" to be generated.
  • the bit values of the points are all the first bit value 1, and the first bit value is 1 in black in the figure; the pixels filled with no color are not the pixels in the character "I” to be generated, and the bit values of these points are all
  • the two-bit value is 0, and the second bit value is 0 in the figure.
  • Step 203 Fill the dot matrix in the plane coordinate system at the starting position, and read the first position of the pixel point included in the character to be generated in the plane coordinate system from the plane coordinate system.
  • the starting position may be used as a position of a point of the dot matrix, and the point may be an upper left corner vertex, a lower left corner vertex, an upper right corner vertex, a lower right corner vertex, or a center point of the dot matrix. Then fill in the dot matrix in the left image of Figure 2-2 in the plane coordinate system in the right image of Figure 2-2. The first position of each pixel included in the character "I" to be generated is then read from the plane coordinate system.
  • the first location of the pixel point included in the character to be generated in the plane coordinate system is obtained by:
  • a point may be selected from the lattice as a target point, and a first position of the target point in the plane coordinate system is set as a starting position of the character to be generated; and for each pixel point included in the character to be generated, according to the pixel point
  • the first position of the pixel point in the plane coordinate system is calculated by the number of points spaced from the target point and the first position of the target point.
  • the dot matrix shown in the left figure of Figure 2-2 in which each point is a square block of equal size, you can select a point from the dot matrix shown in the left figure of Figure 2-2 as the target. point.
  • a point located at the upper left corner of the dot matrix, a point in the lower left corner position, a point in the upper right corner position, a point in the lower right corner position, or a center point of the dot matrix may be selected. Referring to the left diagram of Fig. 2-2, it is assumed that the point located at the upper left corner is selected as the target point, and then the first position of the target point in the plane coordinate system is set as the starting position of the character to be generated.
  • the P point is calculated in the plane coordinate system. First position.
  • the size of the dot may be the width of the square block.
  • Step 204 Calculate an elevation angle and an azimuth angle of the pixel point in the spherical coordinate system according to the first position of the pixel point, where the coordinate origin of the spherical coordinate system coincides with the spherical center of the subtitle spherical surface.
  • the pixels in the plane coordinate system correspond to one point on the subtitle sphere.
  • point P in the plane coordinate system shown in the right figure of Figure 2-2; see Figure 2-3 the point P corresponds to a Q point on the subtitle sphere, the sphere of the subtitle sphere and the spherical coordinate system xyz
  • the coordinate origin O coincides.
  • the elevation angle of the P point in the spherical coordinate system is substantially the angle ⁇ between the line OQ and the xOz plane of the Q point and the coordinate origin O; the azimuth angle of the P point in the spherical coordinate system is substantially the Q point in the xOz plane.
  • Step 204 can be implemented by: for each pixel included in the character to be generated, assuming P point, the first position of the P point in the plane coordinate system is (u, v), and u is the point of P point in the plane coordinate The abscissa in the system, v is the ordinate of the P point in the plane coordinate system; according to the first position (u, v) of the P point in the plane coordinate system, the P point is calculated in the spherical coordinate system according to the following formula (1) Elevation angle and azimuth angle;
  • is the elevation angle of the P point in the spherical coordinate system
  • is the azimuth angle of the P point in the spherical coordinate system
  • Each of the other pixels in the generated character is the same as the P point, and the elevation angle and azimuth angle of each of the other pixel points in the spherical coordinate system are calculated according to the above formula (1).
  • Step 205 Calculate a second position of the pixel point on the subtitle spherical surface according to the radius of the subtitle spherical surface, the elevation angle and the azimuth angle of the pixel point.
  • the second position of the pixel on the subtitle sphere is substantially the position of the pixel at the corresponding point on the subtitle sphere.
  • the second position of point P on the subtitle sphere is essentially the position of point P at the corresponding Q point on the subtitle sphere.
  • This step may be: for each pixel included in the character to be generated, assuming P point, according to the radius of the subtitle spherical surface, the elevation angle ⁇ of the P point, and the azimuth angle ⁇ , the P point is calculated in the subtitle sphere according to the following formula (2) a second position (x, y, z), the second position (x, y, z) being substantially the position of the Q point;
  • R is the radius of the subtitle sphere
  • x is the abscissa of point P on the subtitle sphere
  • y is the ordinate of point P on the subtitle sphere
  • z is the vertical coordinate of point P on the subtitle sphere.
  • Each of the other pixels in the generated character is the same as the P point, and the second position of each of the other pixel points on the subtitle sphere is calculated according to the above formula (2).
  • the detailed process is:
  • the second position of the pixel on the i-th subtitle sphere can be calculated by the following formula (3).
  • R i is the radius of the i-th subtitle sphere
  • x i is the abscissa of point P on the i-th subtitle sphere
  • y i is the ordinate of point P on the i-th subtitle sphere
  • z i is the vertical coordinate of point P on the i-th subtitle sphere.
  • Step 206 Render the pixel on the subtitle spherical surface according to the second position of the pixel to form a character to be generated.
  • the subtitle character may also include configuration information of each character, and the configuration information of the character may be information such as the color of the character.
  • the configuration information of the character to be generated is obtained from the subtitle file, and for each pixel included in the character to be generated, P point is assumed, and the second position (x, y, z) of the P point on the subtitle spherical surface is substantially Q.
  • the position of the point based on the configuration information, renders a Q point at the Q point position on the subtitle sphere.
  • the corresponding points of each of the other pixel points on the subtitle sphere are rendered in the above manner, so that each pixel on the subtitle sphere constitutes a character to be generated.
  • the subtitle file includes a plurality of characters, each of which is rendered on the subtitle sphere in accordance with the procedures of 201 to 206 above, the subtitle of the panoramic video can be formed.
  • the embodiment may also display the characters to be generated in the following two manners, including:
  • each time segment is rendered on a subtitle sphere and displaying the character to be generated, and the character to be generated can be displayed on the subtitle spherical surface with the largest radius first, and then the display is to be generated backwards as time goes backward.
  • the smaller the radius of the subtitle sphere of the character the subtitle can be displayed from far to near; or, the character to be generated can be displayed on the subtitle sphere with the smallest radius, and then the subtitle sphere of the character to be generated is displayed backwards with time. The larger the radius, the more it can be displayed from near to far.
  • the detailed implementation process can be:
  • the pixel For each pixel included in the character to be generated, in the i-th time period, the pixel is rendered on the i-th subtitle sphere according to the second position of the pixel on the i-th subtitle sphere, The characters to be generated are displayed on the i subtitles sphere.
  • the radius of the i-th subtitle sphere may be smaller than the radius of the i-1th subtitle sphere, or the radius of the i-th subtitle sphere may be greater than the radius of the i-1th subtitle sphere.
  • the radius of the first subtitle sphere is smaller than the radius of the second subtitle sphere
  • the radius of the second subtitle sphere is smaller than the third subtitle sphere
  • the third subtitle sphere is rendered and displayed to generate the character 3; according to the pixel in the second time period In the second position on the second subtitle sphere, the character 2 to be generated is rendered and displayed on the second subtitle sphere; in the third time period, according to the second position of the pixel on the first subtitle sphere, at the first The subtitles are rendered on the spherical surface and the character 1 to be generated is displayed, so that the subtitles are displayed from far to near, which improves the display effect.
  • the transparency is set, and the character to be generated is displayed according to the transparency, so that the farther between the user's viewpoint and the character screen to be generated, the more blurred the character to be generated is generated, and vice versa.
  • the detailed implementation process can be:
  • the pixel For each pixel included in the character to be generated, the pixel is rendered on the subtitle sphere according to the distance between the viewpoint and the character to be generated and the second position of the pixel.
  • the above process may be detailed as follows: for each pixel included in the character to be generated, first determine the first connection and the second connection, and the first connection is a connection between the center of the subtitle sphere and the viewpoint, and the second connection A line connecting the center of the subtitle sphere to a point in the character to be generated, and obtaining an angle between the first line and the second line, and the distance between the viewpoint and the character to be generated may be the angle. Calculating the transparency according to the angle between the first line and the second connection; then, according to the transparency and the position of the pixel on the subtitle sphere, respectively, the pixel is rendered on the subtitle sphere to display on the subtitle sphere Generate characters.
  • the user can select the viewpoint of viewing the video on the image sphere by means of a finger swipe or a mouse, etc., so the viewpoint can be acquired and the first connection between the sphere of the subtitle sphere and the viewpoint can be determined.
  • the user first selects the viewpoint 1 on the image sphere, obtains the viewpoint 1, determines the connection 1 from the center of the sphere to the viewpoint 1, and calculates the transparency according to the angle between the connection 1 and the second connection.
  • the subtitles are displayed according to the transparency.
  • the user can continue to select viewpoint 2, obtain viewpoint 2, determine the connection 2 from the center of the sphere to viewpoint 2, calculate the transparency according to the angle between the connection 2 and the second connection, and display the subtitle according to the transparency.
  • the user can select the viewpoint by tapping the touch screen with a finger, or clicking the video with the mouse, or operating the joystick.
  • the calculation formula may be preset, and the transparency is calculated by the calculation formula according to the angle between the first line and the second connection. For example, it can be realized according to the calculation formula of the angle between the first line and the second line facing the center of the ball and the setting: when the angle is larger, the calculated transparency is smaller, and when the angle is smaller, the angle is smaller. The greater the transparency of the calculation.
  • the calculation formula can be a linear formula or a non-linear formula.
  • a rotation axis can also be determined, and the rotation axis passes through the center of the subtitle spherical surface to control the rotation of the subtitle spherical surface around the rotation axis.
  • the first position of the pixel to be generated in the plane coordinate system is obtained by acquiring the starting position of the character to be generated in the plane coordinate system; according to the starting position, the first position of the pixel point included in the character to be generated is in the plane coordinate system; a first position, calculating a second position of the pixel on the subtitle sphere; and rendering the pixel on the subtitle sphere according to the second position of the pixel to form a character to be generated, so that the panoramic video can be displayed on the subtitle sphere Subtitles.
  • an embodiment of the present application provides an apparatus 300 for generating a subtitle, where the apparatus 300 includes:
  • the obtaining module 301 is configured to obtain a first position of a pixel point included in the character to be generated in a plane coordinate system;
  • the calculating module 302 is configured to calculate, according to the first position of the pixel point, a second position of the pixel point on the subtitle spherical surface;
  • the rendering module 303 is configured to render the pixel on the subtitle spherical surface according to the second position of the pixel to form the to-be-generated character.
  • the obtaining module 301 is configured to obtain a starting position of a character to be generated in a plane coordinate system, and obtain, according to the starting position, a pixel point included in the character to be generated, in the plane coordinate system. The first position.
  • the obtaining module 301 includes:
  • a first generating unit configured to generate a dot matrix of a preset size according to the code of the character to be generated, where the dot matrix includes the character to be generated;
  • a reading unit configured to read, from the plane coordinate system, a first position of a pixel point included in the character to be generated in the plane coordinate system.
  • the obtaining module 301 includes:
  • a second generating unit configured to generate a dot matrix of a preset size according to the code of the character to be generated, where the dot matrix includes the character to be generated;
  • a setting unit configured to select a point from the lattice as a target point, and set a first position of the target point in the plane coordinate system as the starting position
  • a first calculating unit configured to calculate the pixel point in the plane coordinate system according to a first position of the target point and a number of points between a pixel point included in the character to be generated and the target point The first position.
  • the calculating module 302 includes:
  • a second calculating unit configured to calculate an elevation angle and an azimuth angle of the pixel point in a spherical coordinate system according to a first position of the pixel point, where a coordinate origin of the spherical coordinate system coincides with a spherical center of the subtitle spherical surface;
  • a third calculating unit configured to calculate, according to a radius of the subtitle spherical surface, an elevation angle and an azimuth angle of the pixel point, a second position of the pixel point on the subtitle spherical surface.
  • the device further includes:
  • a rotating module configured to determine a rotating shaft, the rotating shaft passes through a center of the spherical surface of the subtitle, and controls the subtitle spherical surface to rotate around the rotating shaft.
  • the rendering module 303 is configured to render the pixel on the subtitle spherical surface according to a distance between a viewpoint and the to-be-generated character and a second position of the pixel.
  • the rendering module 303 is configured to:
  • Transparency is calculated according to an angle between the first line and the second connection, the first connection is a line connecting the center of the subtitle sphere and the viewpoint, and the second connection is the subtitle sphere a line connecting the center of the sphere to a point in the character to be generated;
  • the pixel points are rendered on the subtitle sphere based on the transparency and the second position of the pixel.
  • N subtitle spheres may be set in advance, N is an integer greater than 1, the spheres of the N subtitle spheres coincide, and the radius of the N subtitle spheres are not equal to each other;
  • N time periods for displaying the character to be generated may be set
  • a fourth calculating unit configured to calculate an elevation angle and an azimuth angle of the pixel point in a spherical coordinate system according to the first position of the pixel point, where a coordinate origin of the spherical coordinate system coincides with a spherical center of the subtitle spherical surface;
  • a fifth calculating unit configured to calculate a second position of the pixel point on the i-th subtitle spherical surface according to a radius of the i-th subtitle spherical surface, an elevation angle and an azimuth angle of the pixel point.
  • the rendering module 303 is configured to render the pixel point on the i-th subtitle spherical surface according to the second position of the pixel point on the i-th subtitle spherical surface in the ith time period.
  • the first position of the pixel to be generated in the plane coordinate system is obtained by acquiring the starting position of the character to be generated in the plane coordinate system; according to the starting position, the first position of the pixel point included in the character to be generated is in the plane coordinate system; a first position, calculating a second position of the pixel on the subtitle sphere; and rendering the pixel on the subtitle sphere according to the second position of the pixel to form a character to be generated, so that the panoramic video can be displayed on the subtitle sphere Subtitles.
  • An embodiment of the present application provides an apparatus for generating a subtitle, including:
  • One or more processors are One or more processors.
  • One or more memories are One or more memories
  • the one or more memories store program code, the program code being executed by the one or more processors to:
  • FIG. 4 is a structural block diagram of a terminal 400 provided by an exemplary embodiment of the present application.
  • the terminal 400 can be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), a moving picture experts Group Audio Layer IV, and a dynamic picture experts Group Audio Layer IV. Image experts compress standard audio layers 4) players, laptops or desktops.
  • Terminal 400 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, and the like.
  • the terminal 400 includes a processor 401 and a memory 402.
  • Processor 401 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like.
  • the processor 401 can use at least one of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). achieve.
  • the processor 401 may also include a main processor and a coprocessor.
  • the main processor is a processor for processing data in an awake state, which is also called a CPU (Central Processing Unit); the coprocessor is A low-power processor for processing data in standby.
  • the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and rendering of content that needs to be displayed on the display screen.
  • the processor 401 may also include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
  • AI Artificial Intelligence
  • Memory 402 can include one or more computer readable storage media, which can be non-transitory. Memory 402 can also include high speed random access memory, as well as non-volatile memory, such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer readable storage medium in memory 402 is for storing at least one instruction for execution by processor 401 to implement the generated subtitles provided by the method embodiments of the present application. Methods.
  • the terminal 400 optionally further includes: a peripheral device interface 403 and at least one peripheral device.
  • the processor 401, the memory 402, and the peripheral device interface 403 may be connected by a bus or a signal line.
  • Each peripheral device can be connected to the peripheral device interface 403 via a bus, signal line or circuit board.
  • the peripheral device includes at least one of a radio frequency circuit 404, a touch display screen 405, a camera 406, an audio circuit 407, a positioning component 408, and a power source 409.
  • the peripheral device interface 403 can be used to connect at least one peripheral device associated with an I/O (Input/Output) to the processor 401 and the memory 402.
  • processor 401, memory 402, and peripheral interface 403 are integrated on the same chip or circuit board; in some other embodiments, any of processor 401, memory 402, and peripheral interface 403 or The two can be implemented on a separate chip or circuit board, which is not limited in this embodiment.
  • the RF circuit 404 is configured to receive and transmit an RF (Radio Frequency) signal, also referred to as an electromagnetic signal.
  • Radio frequency circuit 404 communicates with the communication network and other communication devices via electromagnetic signals.
  • the RF circuit 404 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal.
  • the radio frequency circuit 404 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like.
  • Radio frequency circuitry 404 can communicate with other terminals via at least one wireless communication protocol.
  • the wireless communication protocols include, but are not limited to, the World Wide Web, a metropolitan area network, an intranet, generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity) networks.
  • the radio frequency circuit 404 may further include a NFC (Near Field Communication) related circuit, which is not limited in this application.
  • the display screen 405 is used to display a UI (User Interface).
  • the UI can include graphics, text, icons, video, and any combination thereof.
  • display 405 is a touch display
  • display 405 also has the ability to acquire touch signals over the surface or surface of display 405.
  • the touch signal can be input to the processor 401 for processing as a control signal.
  • the display screen 405 can also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards.
  • the display screen 405 may be one, and the front panel of the terminal 400 is disposed; in other embodiments, the display screen 405 may be at least two, respectively disposed on different surfaces of the terminal 400 or in a folded design; In still other embodiments, display screen 405 can be a flexible display screen disposed on a curved surface or a folded surface of terminal 400. Even the display screen 405 can be set to a non-rectangular irregular pattern, that is, a profiled screen.
  • the display screen 405 can be prepared by using an LCD (Liquid Crystal Display) or an OLED (Organic Light-Emitting Diode).
  • Camera component 406 is used to capture images or video.
  • camera assembly 406 includes a front camera and a rear camera.
  • the front camera is placed on the front panel of the terminal, and the rear camera is placed on the back of the terminal.
  • the rear camera is at least two, which are respectively a main camera, a depth camera, a wide-angle camera, and a telephoto camera, so as to realize the background blur function of the main camera and the depth camera, and the main camera Combine with a wide-angle camera for panoramic shooting and VR (Virtual Reality) shooting or other integrated shooting functions.
  • camera assembly 406 can also include a flash.
  • the flash can be a monochrome temperature flash or a two-color temperature flash.
  • the two-color temperature flash is a combination of a warm flash and a cool flash that can be used for light compensation at different color temperatures.
  • the audio circuit 407 can include a microphone and a speaker.
  • the microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for processing to the processor 401 for processing, or input to the RF circuit 404 for voice communication.
  • the microphones may be multiple, and are respectively disposed at different parts of the terminal 400.
  • the microphone can also be an array microphone or an omnidirectional acquisition microphone.
  • the speaker is then used to convert electrical signals from the processor 401 or the RF circuit 404 into sound waves.
  • the speaker can be a conventional film speaker or a piezoelectric ceramic speaker.
  • audio circuit 407 can also include a headphone jack.
  • the location component 408 is used to locate the current geographic location of the terminal 400 to implement navigation or LBS (Location Based Service).
  • the positioning component 408 can be a positioning component based on a US-based GPS (Global Positioning System), a Chinese Beidou system, or a Russian Galileo system.
  • Power source 409 is used to power various components in terminal 400.
  • the power source 409 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery.
  • the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery.
  • a wired rechargeable battery is a battery that is charged by a wired line
  • a wireless rechargeable battery is a battery that is charged by a wireless coil.
  • the rechargeable battery can also be used to support fast charging technology.
  • terminal 400 also includes one or more sensors 410.
  • the one or more sensors 410 include, but are not limited to, an acceleration sensor 411, a gyro sensor 412, a pressure sensor 413, a fingerprint sensor 414, an optical sensor 415, and a proximity sensor 416.
  • the acceleration sensor 411 can detect the magnitude of the acceleration on the three coordinate axes of the coordinate system established by the terminal 400.
  • the acceleration sensor 411 can be used to detect components of gravity acceleration on three coordinate axes.
  • the processor 401 can control the touch display screen 405 to display the user interface in a landscape view or a portrait view according to the gravity acceleration signal collected by the acceleration sensor 411.
  • the acceleration sensor 411 can also be used for the acquisition of game or user motion data.
  • the gyro sensor 412 can detect the body direction and the rotation angle of the terminal 400, and the gyro sensor 412 can cooperate with the acceleration sensor 411 to collect the 3D motion of the user to the terminal 400. Based on the data collected by the gyro sensor 412, the processor 401 can implement functions such as motion sensing (such as changing the UI according to the user's tilting operation), image stabilization at the time of shooting, game control, and inertial navigation.
  • functions such as motion sensing (such as changing the UI according to the user's tilting operation), image stabilization at the time of shooting, game control, and inertial navigation.
  • the pressure sensor 413 can be disposed on the side border of the terminal 400 and/or the lower layer of the touch display screen 405.
  • the pressure sensor 413 When the pressure sensor 413 is disposed on the side frame of the terminal 400, the user's holding signal to the terminal 400 can be detected, and the processor 401 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 413.
  • the operability control on the UI interface is controlled by the processor 401 according to the user's pressure on the touch display screen 405.
  • the operability control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.
  • the fingerprint sensor 414 is used to collect the fingerprint of the user.
  • the processor 401 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, the processor 401 authorizes the user to perform related sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying and changing settings, and the like.
  • the fingerprint sensor 414 can be disposed on the front, back, or side of the terminal 400. When the physical button or vendor logo is provided on the terminal 400, the fingerprint sensor 414 can be integrated with the physical button or the manufacturer logo.
  • Optical sensor 415 is used to collect ambient light intensity.
  • the processor 401 can control the display brightness of the touch display screen 405 based on the ambient light intensity acquired by the optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 405 is raised; when the ambient light intensity is low, the display brightness of the touch display screen 405 is lowered.
  • the processor 401 can also dynamically adjust the shooting parameters of the camera assembly 406 based on the ambient light intensity acquired by the optical sensor 415.
  • Proximity sensor 416 also referred to as a distance sensor, is typically disposed on the front panel of terminal 400. Proximity sensor 416 is used to capture the distance between the user and the front side of terminal 400. In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front side of the terminal 400 is gradually decreasing, the touch screen display 405 is controlled by the processor 401 to switch from the bright screen state to the screen state; when the proximity sensor 416 detects When the distance between the user and the front side of the terminal 400 gradually becomes larger, the processor 401 controls the touch display screen 405 to switch from the screen state to the bright screen state.
  • FIG. 4 does not constitute a limitation to the terminal 400, and may include more or less components than those illustrated, or may be combined with some components or may be arranged with different components.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

本申请实施例公开了一种生成字幕的方法及装置,属于视频领域。所述方法包括:获取待生成字符包括的像素点在平面坐标系中的第一位置;根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。所述装置包括:获取模块、计算模块和渲染模块。本申请实施例能够显示全景视频的字幕。

Description

一种生成字幕的方法及装置
本申请要求于2017年4月18日提交中国国家知识产权局、申请号为201710254051.0、发明名称为“一种生成字幕的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及视频领域,特别涉及一种生成字幕的方法及装置。
背景技术
全景视频是把相机环360度拍摄的一组或多组照片拼接成一个全景图像,并将多个全景图像依次映射在一个球的表面上形成一帧帧图像的视频,它能在空间域上提供给用户360度无死角的新体验,提供虚拟的3D环境。
用户可以使用播放器播放全景视频,且在播放全景视频时用户可以通过选择视点,改变视频播放的视角,提高用户的交互体验。但是目前的全景视频美中不足的是没有字幕。
发明内容
为了为了能够显示全景视频的字幕,本申请提供了一种生成字幕的方法及装置。所述技术方案如下:
第一方面,本申请公开了一种生成字幕的方法,所述方法包括:
获取待生成字符包括的像素点在平面坐标系中的第一位置;
根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
可选的,所述获取待生成字符包括的像素点在平面坐标系中的第一位置,包括:
获取待生成字符在平面坐标系中的起始位置;
根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系 中的第一位置。
可选的,所述根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置,包括:
根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
在所述起始位置处将所述点阵填写在所述平面坐标系中;
从所述平面坐标系中读取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
可选的,所述根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置,包括:
根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
从所述点阵中选择一点作为目标点,并设置所述目标点在所述平面坐标系中的第一位置为所述起始位置;
根据所述目标点的第一位置以及所述待生成字符包括的像素点与所述目标点之间间隔的点数目,计算所述像素点在所述平面坐标系中的第一位置。
可选的,所述根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置,包括:
根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
根据所述字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述字幕球面上的第二位置。
可选的,所述形成所述待生成字符之后,还包括:
确定一转轴,所述转轴经过所述字幕球面的球心,控制所述字幕球面绕所述转轴转动。
可选的,所述根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,所述根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
根据第一连线和第二连接之间的夹角计算透明度,所述第一连线为所述字幕球面的球心与视点之间连线,所述第二连线为所述字幕球面的球心与所述待生成字符中的一点之间的连线;
所述根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
根据所述透明度和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,所述根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置,包括:
根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,i=1、2……N;
其中,N为字幕球面的总数且N为大于1的整数,N个字幕球面的球心重合,所述N个字幕球面的半径互不相等。
可选的,所述根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,包括:
根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
根据第i个字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述第i个字幕球面上的第二位置。
可选的,所述根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
在第i个时间段内,根据所述像素点在所述第i个字幕球面上的第二位置,在所述第i个字幕球面上渲染所述像素点。
第二方面,本申请公开了一种生成字幕的装置,所述装置包括:
获取模块,用于获取待生成字符包括的像素点在平面坐标系中的第一位置;
计算模块,用于根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
渲染模块,用于根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
可选的,所述获取模块,用于:
获取待生成字符在平面坐标系中的起始位置;
根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
可选的,所述获取模块包括:
生成单元,用于根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
填写单元,用于在所述起始位置处将所述点阵填写在所述平面坐标系中;
读取单元,用于从所述平面坐标系中读取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
可选的,所述获取模块,用于:
根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
从所述点阵中选择一点作为目标点,并设置所述目标点在所述平面坐标系中的第一位置为所述起始位置;
根据所述目标点的第一位置以及所述待生成字符包括的像素点与所述目标点之间间隔的点数目,计算所述像素点在所述平面坐标系中的第一位置。
可选的,所述计算模块包括:
第一计算单元,用于根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
第二计算单元,用于根据所述字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述字幕球面上的第二位置。
可选的,所述装置还包括:
转动模块,用于确定一转轴,所述转轴经过所述字幕球面的球心,控制所述字幕球面绕所述转轴转动。
可选的,所述渲染模块,用于:
根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,所述计算模块,还用于根据第一连线和第二连接之间的夹角计算透明度,所述第一连线为所述字幕球面的球心与视点之间连线,所述第二连线 为所述字幕球面的球心与所述待生成字符中的一点之间的连线;
所述渲染模块,用于根据所述透明度和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,所述计算模块,用于根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,i=1、2……N;
其中,N字幕球面的总数且N为大于1的整数,N个字幕球面的球心重合,所述N个字幕球面的半径互不相等。
可选的,所述计算模块,用于:
根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
根据第i个字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述第i个字幕球面上的第二位置。
可选的,所述渲染模块,用于在第i个时间段内,根据所述像素点在所述第i个字幕球面上的第二位置,在所述第i个字幕球面上渲染所述像素点。
第三方面,本申请公开了一种计算机可读存储介质,用于存储计算机程序,所述计算机程序通过处理器进行加载来执行第一方面或第一方面任意可能的实现方式的方法的指令。
第四方面,本申请公开了一种生成字幕的装置,所述装置包括:
一个或多个处理器;和
一个或多个存储器;
所述一个或多个存储器存储有程序代码,所述程序代码由所述一个或多个处理器执行,以实现:
获取待生成字符包括的像素点在平面坐标系中的第一位置;
根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
本申请实施例通过获取待生成字符包括的像素点在平面坐标系中的第一 位置;根据该像素点的第一位置,计算该像素点在字幕球面上的第二位置;根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符,从而可以在字幕球面上显示全景视频的字幕。
附图说明
图1是本申请实施例提供了一种生成字幕的方法流程图;
图2-1是本申请实施例提供的一种生成字幕的方法流程图;
图2-2是本申请实施例提供的点阵示意图;
图2-3是本申请实施例提供的字幕球面示意图;
图2-4是本申请实施例提供的多个字幕球面示意图;
图2-5是本申请实施例提供的在不同视点下显示字幕示意图;
图3是本申请实施例提供的一种生成字幕的装置结构示意图;
图4是本申请实施例提供的另一种生成字幕的装置结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
全景视频是将视频图像映射在图像球面的表面形成的视频,全景视频可以包括N个字幕球面,N是大于或等于1的整数,该N个字幕球面中的每个字幕球面的球心、图像球面的球心和球面坐标系的坐标原点均重合。在本申请的一个可选实施例中该N个字幕球面中的每个字幕球面的半径均不相等。
在本申请提供的如下任一实施例的执行主体可以为终端或服务器等,终端可以为手机、台式电脑、笔记本电脑、摄像机或相机等。
可选的,本申请提供的如下任一实施例的执行主体可以为终端或服务器中包括的处理器。
参见图1,本申请实施例提供了一种生成字幕的方法,所述方法包括:
步骤101:获取待生成字符在平面坐标系中的起始位置。
步骤102:根据该起始位置获取待生成字符包括的像素点在平面坐标系中的第一位置。
步骤103:根据该像素点的第一位置,计算该像素点在字幕球面上的第二位置。
步骤104:根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符。
在本申请实施例中,通过获取待生成字符在平面坐标系中的起始位置;根据该起始位置获取待生成字符包括的像素点在平面坐标系中的第一位置;根据该像素点的第一位置,计算该像素点在字幕球面上的第二位置;根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符,从而可以在字幕球面上显示全景视频的字幕。
本申请实施例提供了一种生成字幕的方法,该方法可以生成全景视频的字幕,参见图2-1,该方法包括:
步骤201:获取待生成字符在平面坐标系中的起始位置。
待生成字符可以为文字、颜文字或表情图像等。获取的待生成字符可以为为用户输入的字符或全景视频对应的字幕文件中的字符等。
假设一个全景视频对应一个字幕文件,该字幕文件包括至少一个字符。该字幕文件还可以包括该至少一个字符中的部分字符在平面坐标系中的起始位置或者可以包括该至少一个字符中的每个字符在平面坐标系中的起始位置。字幕文件中的字符在平面坐标系中的起始位置可以是事先设置的并存储在字幕文件中,或者也可以是用户临时设置后被存储在字幕文件中,在此不做限定。
待生成字符可以是该字幕文件中的任一个字符。待生成字符和其起始位置的获取过程可以为:从字幕文件中获取一个字符作为待生成字符,如果字幕文件中包括待生成字符在平面坐标系中的起始位置,则还可以从字幕文件中获取待生成字符在平面坐标系中的起始位置。如果字幕文件中不包括待生成字符在平面坐标系中的起始位置,则可以根据字幕文件中的具有起始位置的字符、待生成字符与该字符之间的间隔的字符数目、相邻两字符之间的间隔和字符大小,计算出待生成字符在平面坐标系中的起始位置。
全景视频可以由一帧帧的全景视频帧组成,该字幕文件包括的字符可以是各全景视频帧对应的字符。所谓全景视频帧对应的字符是指在显示该全景视频帧时显示的字符。
在显示不同全景视频帧对应的字符时,每个全景视频帧对应的第一字符的 显示位置可以相同。所以该字幕文件可以包括目标全景视频帧对应的每个字符的起始位置,或者可以包括目标全景视频帧对应的第一个字符的起始位置。对于除目标全景视频帧以外的其他全景视频帧,该字幕文件可以不包括其他各全景视频帧对应的各字符的起始位置。
其中,目标全景视频帧可以是全景视频中的任一全景视频帧,例如可以是全景视频中的第一个全景视频帧、第二个全景视频帧或第三个全景视频帧等。这样即可以减小该字幕文件的大小,又可以减小设置起始位置所需要的工作量。
相应的,获取待生成字符的起始位置,可以为:
当待生成字符是目标全景视频帧中显示的字符时,如果该字幕文件包括目标全景视频帧对应的每个字符的起始位置或者待生成字符是目标全景视频帧对应的第一个字符,则可以从字幕文件中获取待生成字符的起始位置。如果该字幕文件只包括目标全景视频帧对应的第一个字符的起始位置且待生成字符不是该第一个字符,则可以根据该第一个字符的起始位置、待生成字符与该第一个字符之间的间隔的字符数目、相邻两字符之间的间隔和字符大小,计算出待生成字符的起始位置。
当待生成字符是除目标全景视频帧以外的其他全景视频帧对应的字符时,如果待生成字符为该其他全景视频帧对应的第一个字符,则可以将目标全景视频帧对应的第一个字符的起始位置作为待生成字符的起始位置。如果待生成字符不是该其他全景视频帧对应的第一个字符时,则根据目标全景视频帧对应的第一个字符的起始位置、待生成字符与该其他全景视频帧对应的第一个字符之间的间隔的字符数目、相邻两字符之间的间隔和字符大小,计算出待生成字符的起始位置。
待生成字符可以为用户输入的字符,用户在输入字符时还可以输入或选择该字符在平面坐标系中的起始位置。在本步骤中,可以直接获取用户输入的待生成字符和待生成字符在平面坐标系中的起始位置。
另外,用户在输入字符时,对于输入的第一个字符,可以为第一个字符输入在平面坐标系中的起始位置,对于输入的除第一个字符以外的第二个字符、第三个字符、第四个字符等字符,可以不用一一输入各字符在平面坐标系中的起始位置。因此在本步骤中,用户没有输入待生成字符输入在平面坐标系中的起始位置时,可以获取待生成字符与用户输入的第一个字符之间间隔的字符数 目,根据第一个字符在平面坐标系中的起始位置、该字符数目、相邻两字符之间的间隔和字符大小计算待生成字符在平面坐标系中的起始位置。
其中,对于用户输入字符时选择该字符在平面坐标系中的起始位置的操作,在实现时用户可以直接使用输入设备(如鼠标等)在平面坐标系中选择一个位置点击。相应的,在检测到输入设备触发的点击操作时,获取该输入设备在平面坐标系的点击位置,将该点击位置确定为该字符的起始位置。或者,在使用具有触摸屏的设备显示平面坐标系时,用户可以直接使用手指在平面坐标系中选择一个位置点击。相应的,在检测到触摸屏被点击触发的点击操作时,获取该点击操作对应的点击位置,将该点击位置确定为该字符的起始位置。
步骤202:根据待生成字符的编码生成预设大小的点阵,该点阵包括待生成字符。
可以将待生成字符的编码输入到Freetype字体库中,通过该Freetype字体库生成预设大小的点阵;对于该点阵中的每个点,该点的比特值为预设第一比特值,或者为预设第二比特值。其中,如果该点是待生成字符中的像素点,则该点的比特值为预设第一比特值,如果该点不是待生成字符中的像素点,则该点的比特值为预设第二比特值。
第一比特值可以为1,第二比特值可以为0;或者,第一比特值可以为0,第二比特值为1。
例如,假设待生成字符为字符“我”,预设大小为24×24,以及假设第一比特值为1,第二比特值为0。将待生成字符“我”的编码输入到Freetype字体库中,通过Freetype字体库生成大小为24×24的点阵,该点阵如图2-2的左图所示。
图2-2左图所示意的点阵中,用黑色填充表示第一比特值,用无色填充表示第二比特值,填充黑色的点都为待生成字符“我”中的像素点,这些点的比特值均为第一比特值1,在图中用黑色表示第一比特值1;填充无色的点均不是待生成字符“我”中的像素点,这些点的比特值均为第二比特值0,在图中用无色表示第二比特值0。
步骤203:在该起始位置处将该点阵填写在平面坐标系中,从平面坐标系中读取待生成字符包括的像素点在平面坐标系中的第一位置。
例如,参见图2-2,可以将该起始位置作为该点阵的一点的位置,该点可以为左上角顶点、左下角顶点、右上角顶点、右下角顶点或点阵的中心点等, 然后将图2-2左图中的点阵填写图2-2右图中的平面坐标系中。然后从平面坐标系中读取待生成字符“我”包括的每个像素点的第一位置。
可选的,在本实施例中,还可以通过如下方式获取待生成字符包括的像素点在平面坐标系中的第一位置,包括:
可以从该点阵中选择一个点作为目标点,将目标点在平面坐标系中的第一位置设置为待生成字符的起始位置;对于待生成字符包括的每个像素点,根据该像素点与目标点之间间隔的点数目和目标点的第一位置,计算出该像素点在平面坐标系中的第一位置。
例如,参数图2-2左图所示的点阵,在该点阵中每个点均为等大小的方形块,可以从图2-2左图所示的点阵中选择一个点作为目标点。可选的,可以选择位于点阵左上角位置的点、左下角位置的点、右上角位置的点、右下角位置的点或点阵的中心点等。参见图2-2的左图,假设选择位于左上角位置的点作为目标点,然后将目标点在平面坐标系中的第一位置设置为待生成字符的起始位置。对于待生成字符中的每个像素点,假设为P点,根据P点与目标点之间间隔的点数目、点的大小和目标点的第一位置,计算出P点在平面坐标系中的第一位置。其中,点的大小可以为方形块的宽度。
步骤204:根据该像素点的第一位置计算该像素点在球面坐标系中的仰角和方位角,该球面坐标系的坐标原点与字幕球面的球心重合。
平面坐标系中的像素点在字幕球面上都对应一个点。例如,参见图2-2右图所示的平面坐标系中的P点;参见图2-3,该P点在字幕球面上对应一个Q点,该字幕球面的球心与该球面坐标系xyz的坐标原点O重合。
该P点在球面坐标系中的仰角实质为Q点和坐标原点O的连线OQ与xOz平面之间的夹角α;该P点在球面坐标系中的方位角实质为Q点在xOz平面上的投影点R和坐标原点O的连线OR与x轴之间的夹角γ。
步骤204可以通过下述方式实现:对于待生成字符包括的每个像素点,假设为P点,P点在平面坐标系中的第一位置为(u,v),u为P点在平面坐标系中的横坐标,v为P点在平面坐标系中的纵坐标;根据P点在平面坐标系中的第一位置(u,v)按如下公式(1)计算该P点在球面坐标系中的仰角和方位角;
Figure PCTCN2018083244-appb-000001
在公式(1)中,α为P点在球面坐标系中的仰角,γ为P点在球面坐标系中的方位角。
例如,假设P点在平面坐标系中的第一位置为(0.75,0.125),根据第一位置(0.75,0.125)按上述公式(1)计算P点在球面坐标系中的仰角α=0.25π和方位角γ=0.25π。
对待生成字符中的其他每个像素点,都同P点一样,按上述公式(1)计算出其他每个像素点在球面坐标系中的仰角和方位角。
步骤205:根据字幕球面的半径、该像素点的仰角和方位角,计算该像素点在字幕球面上的第二位置。
该像素点在字幕球面上的第二位置实质是该像素点在字幕球面上对应的点的位置。例如,参见图2-2和2-3,P点在字幕球面上的第二位置实质是P点在字幕球面上对应的Q点的位置。
本步骤可以为:对于待生成字符包括的每个像素点,假设为P点,根据字幕球面的半径、该P点的仰角α和方位角γ,按如下公式(2)计算P点在字幕球面上的第二位置(x,y,z),该第二位置(x,y,z)实质为Q点的位置;
Figure PCTCN2018083244-appb-000002
在公式(2)中,R为字幕球面的半径,x为P点在字幕球面上的横坐标,y为P点在字幕球面上的纵坐标,z为P点在字幕球面上的竖坐标。
例如,P点在球面坐标系中的仰角α=0.25π和方位角γ=0.25π。假设R=2,则P点在字幕球面上的第二位置中的x=2*cos0.25π*cos0.25π=1,y=2*cos0.25π*sin0.25π=1,
Figure PCTCN2018083244-appb-000003
即得到P点在字幕球面上的第二位置为
Figure PCTCN2018083244-appb-000004
对待生成字符中的其他每个像素点,都同P点一样,按上述公式(2)计算出其他每个像素点在字幕球面上的第二位置。
对于包括多个字幕球面的情况,即N为大于1的整数,此时需要根据该像素点的第一位置和第i个字幕球面的半径,计算该像素点在第i个字幕球面上的第二位置,i=1、2……N。详细过程为:
根据该像素点在平面坐标系中的第一位置计算该像素点在球面坐标系中的仰角和方位角(详细计算过程参见步骤204中的内容),然后根据第i个字幕 球面的半径、该像素点的仰角和方位角,计算该像素点在第i个字幕球面上的第二位置。
可以通过如下的公式(3)计算该像素点在第i个字幕球面上的第二位置。
Figure PCTCN2018083244-appb-000005
在公式(3)中,R i为第i个字幕球面的半径,x i为P点在第i个字幕球面上的横坐标,y i为P点在第i个字幕球面上的纵坐标,z i为P点在第i个字幕球面上的竖坐标。
步骤206:根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符。
字幕字符中还可以包括每个字符的配置信息,字符的配置信息可以为该字符的颜色等信息。
例如,从字幕文件中获取待生成字符的配置信息,对于待生成字符包括的每个像素点,假设为P点,P点在字幕球面上的第二位置(x,y,z)实质为Q点的位置,根据该配置信息在字幕球面上的Q点位置处渲染出一个Q点。对于待生成字符包括的其他每个像素点,同P点一样,按上述方式渲染其他每个像素点在字幕球面上对应的点,从而由字幕球面上的每个像素点组成待生成字符。
这样,如果字幕文件中包括多个字符,每个字符都按上述201至206的过程渲染在字幕球面上,就可以形成了全景视频的字幕。
为了提高字幕显示的视觉效度,本实施例还可以采用如下两种方式来显示待生成字符,包括:
第一、设置N个时间段,每个时间段在一个字幕球面上渲染并显示待生成字符,可以先在半径最大的字幕球面上显示待生成字符,然后随着时间越向后,显示待生成字符的字幕球面的半径越小,这样可以实现字幕由远到近显示;或者,可以先在半径最小的字幕球面上显示待生成字符,然后随着时间越向后,显示待生成字符的字幕球面的半径越大,这样可以实现由近到远显示。详细实现过程可以为:
对于待生成字符包括的每个像素点,在第i个时间段内,根据该像素点在第i个字幕球面上的第二位置,在第i个字幕球面上渲染该像素点,以在第i 个字幕球面上显示待生成字符。其中,第i个字幕球面的半径可以小于第i-1个字幕球面的半径,或者,第i个字幕球面的半径可以大于第i-1个字幕球面的半径。
例如,参见图2-4,假设存在第一字幕球面、第二字幕球面和第三字幕球面,第一字幕球面的半径小于第二字幕球面的半径,第二字幕球面的半径小于第三字幕球面半径;设置三个时间段,在第一个时间段内根据该像素点在第一字幕球面上的第二位置,在第一字幕球面上渲染并显示待生成字符1;在第二个时间段内根据该像素点在第二字幕球面上的第二位置,在第二字幕球面上渲染并显示待生成字符2;在第三个时间段内根据该像素点在第三字幕球面上的第二位置,在第三字幕球面上渲染并显示待生成字符3,这样实现字幕由近到远显示。
又例如,在第一个时间段内根据该像素点在第三字幕球面上的第二位置,在第三字幕球面上渲染并显示待生成字符3;在第二个时间段内根据该像素点在第二字幕球面上的第二位置,在第二字幕球面上渲染并显示待生成字符2;在第三个时间段内根据该像素点在第一字幕球面上的第二位置,在第一字幕球面上渲染并显示待生成字符1,这样实现字幕由远到近显示,提高了显示效果。
第二、根据用户视点与待生成字符之间的远近来设置透明度,根据该透明度来显示待生成字符,这样可以实现当用户视点与待生成字符幕之间越远,待生成字符越模糊,反之,越清晰。详细实现过程可以为:
对于待生成字符包括的每个像素点,根据视点与待生成字符之间的距离和该像素点的第二位置,在字幕球面上渲染该像素点。
上述过程可以详细为:对于待生成字符包括的每个像素点,先确定第一连线和第二连线,第一连线为字幕球面的球心与视点之间连线,第二连线为字幕球面的球心与待生成字符中的一点之间的连线,获取第一连线和第二连线之间的夹角,视点与待生成字符之间的距离可以为该夹角,根据第一连线和第二连接之间的夹角计算透明度;然后,根据该透明度和该像素点在字幕球面上的位置,在字幕球面上分别渲染该像素点,以在字幕球面上显示待生成字符。
用户可以通过手指滑动或鼠标等设备在图像球面上选择观看视频的视点,所以可以获取到该视点并确定出字幕球面的球心与该视点之间的第一连线。例如,参见图2-5,用户先在图像球面上选择视点1,获取视点1,确定球心到视点1的连线1,根据连线1与第二连线之间的夹角计算透明度,根据该透明度 显示字幕。用户可以继续选择视点2,获取视点2,确定球心到视点2的连线2,根据连线2与第二连线之间的夹角计算透明度,根据该透明度显示字幕。
用户可以通过手指点击触摸屏、或者鼠标点击视频、或者操作操纵杆等方式选择视点。
可以预设计算公式,根据第一连线和第二连接之间的夹角,通过该计算公式计算透明度。例如,可以根据第一连线和第二连线之间面向球心的夹角和设置的该计算公式实现:当该夹角越大时,计算出的透明度越小,当该夹角越小时,计算的透明度越大。该计算公式可以是线性公式或非线性公式。
第一连线和第二连接之间的夹角越大表明用户视点与待生成字符之间越远,反之,表明用户视点与待生成字符之间越近。这样可以实现当用户视点与待生成字符之间越远,待生成字符越模糊,反之,越清晰,提高了显示效果。
为了提高显示效果,在生成待生成字符后,还可以确定一转轴,该转轴经过字幕球面的球心,控制字幕球面绕该转轴转动。
这样就能够在360度观看全景视频的同时观看到全视角范围的字幕。
在本申请实施例中,通过获取待生成字符在平面坐标系中的起始位置;根据该起始位置获取待生成字符包括的像素点在平面坐标系中的第一位置;根据该像素点的第一位置,计算该像素点在字幕球面上的第二位置;根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符,从而可以在字幕球面上显示全景视频的字幕。
参见图3,本申请实施例提供了一种生成字幕的装置300,所述装置300包括:
获取模块301,用于获取待生成字符包括的像素点在平面坐标系中的第一位置;
计算模块302,用于根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
渲染模块303,用于根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
可选的,所述获取模块301,具体用于获取待生成字符在平面坐标系中的起始位置;根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
可选的,所述获取模块301包括:
第一生成单元,用于根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
填写单元,用于在所述起始位置处将所述点阵填写在所述平面坐标系中;
读取单元,用于从所述平面坐标系中读取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。或者,
可选的,所述获取模块301包括:
第二生成单元,用于根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
设置单元,用于从所述点阵中选择一点作为目标点,并设置所述目标点在所述平面坐标系中的第一位置为所述起始位置;
第一计算单元,用于根据所述目标点的第一位置以及所述待生成字符包括的像素点与所述目标点之间间隔的点数目,计算所述像素点在所述平面坐标系中的第一位置。
可选的,所述计算模块302包括:
第二计算单元,用于根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
第三计算单元,用于根据所述字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述字幕球面上的第二位置。
可选的,所述装置还包括:
转动模块,用于确定一转轴,所述转轴经过所述字幕球面的球心,控制所述字幕球面绕所述转轴转动。
可选的,所述渲染模块303用于根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,所述渲染模块303用于:
根据第一连线和第二连接之间的夹角计算透明度,所述第一连线为所述字幕球面的球心与视点之间连线,所述第二连线为所述字幕球面的球心与所述待生成字符中的一点之间的连线;
根据所述透明度和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
可选的,可以事先设置N个字幕球面,N为大于1的整数,所述N个字幕球面的球心重合,所述N个字幕球面的半径互不相等;
所述计算模块302,用于根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,i=1、2……N。
可选的,可以设置N个用于显示所述待生成字符的时间段;
可选的,所述计算模块302,
第四计算单元,用于根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
第五计算单元,用于根据第i个字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述第i个字幕球面上的第二位置。
所述渲染模块303,用于在第i个时间段内,根据所述像素点在所述第i个字幕球面上的第二位置,在所述第i个字幕球面上渲染所述像素点。
在本申请实施例中,通过获取待生成字符在平面坐标系中的起始位置;根据该起始位置获取待生成字符包括的像素点在平面坐标系中的第一位置;根据该像素点的第一位置,计算该像素点在字幕球面上的第二位置;根据该像素点的第二位置,在字幕球面上渲染该像素点,以形成待生成字符,从而可以在字幕球面上显示全景视频的字幕。
本申请实施例提供一种生成字幕的装置,包括:
一个或多个处理器;和
一个或多个存储器;
所述一个或多个存储器存储有程序代码,所述程序代码由所述一个或多个处理器执行,以实现:
获取待生成字符包括的像素点在平面坐标系中的第一位置;
根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
图4示出了本申请一个示例性实施例提供的终端400的结构框图。该终端400可以是便携式移动终端,比如:智能手机、平板电脑、MP3播放器(Moving  Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、笔记本电脑或台式电脑。终端400还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。
通常,终端400包括有:处理器401和存储器402。
处理器401可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器401可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器401也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器401可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器401还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。
存储器402可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器402还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器402中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器401所执行以实现本申请中方法实施例提供的生成字幕的方法。
在一些实施例中,终端400还可选包括有:外围设备接口403和至少一个外围设备。处理器401、存储器402和外围设备接口403之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口403相连。具体地,外围设备包括:射频电路404、触摸显示屏405、摄像头406、音频电路407、定位组件408和电源409中的至少一种。
外围设备接口403可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器401和存储器402。在一些实施例中,处理器401、存储器402和外围设备接口403被集成在同一芯片或电路板上;在一些其他实施例中,处理器401、存储器402和外围设备接口403中的任意一个或两个可 以在单独的芯片或电路板上实现,本实施例对此不加以限定。
射频电路404用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路404通过电磁信号与通信网络以及其他通信设备进行通信。射频电路404将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路404包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路404可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路404还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。
显示屏405用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏405是触摸显示屏时,显示屏405还具有采集在显示屏405的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器401进行处理。此时,显示屏405还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏405可以为一个,设置终端400的前面板;在另一些实施例中,显示屏405可以为至少两个,分别设置在终端400的不同表面或呈折叠设计;在再一些实施例中,显示屏405可以是柔性显示屏,设置在终端400的弯曲表面上或折叠面上。甚至,显示屏405还可以设置成非矩形的不规则图形,也即异形屏。显示屏405可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。
摄像头组件406用于采集图像或视频。可选地,摄像头组件406包括前置摄像头和后置摄像头。通常,前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件406还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。
音频电路407可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器401进行处理,或者输入至射频电路404以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端400的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器401或射频电路404的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路407还可以包括耳机插孔。
定位组件408用于定位终端400的当前地理位置,以实现导航或LBS(Location Based Service,基于位置的服务)。定位组件408可以是基于美国的GPS(Global Positioning System,全球定位系统)、中国的北斗系统或俄罗斯的伽利略系统的定位组件。
电源409用于为终端400中的各个组件进行供电。电源409可以是交流电、直流电、一次性电池或可充电电池。当电源409包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。
在一些实施例中,终端400还包括有一个或多个传感器410。该一个或多个传感器410包括但不限于:加速度传感器411、陀螺仪传感器412、压力传感器413、指纹传感器414、光学传感器415以及接近传感器416。
加速度传感器411可以检测以终端400建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器411可以用于检测重力加速度在三个坐标轴上的分量。处理器401可以根据加速度传感器411采集的重力加速度信号,控制触摸显示屏405以横向视图或纵向视图进行用户界面的显示。加速度传感器411还可以用于游戏或者用户的运动数据的采集。
陀螺仪传感器412可以检测终端400的机体方向及转动角度,陀螺仪传感器412可以与加速度传感器411协同采集用户对终端400的3D动作。处理器401根据陀螺仪传感器412采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。
压力传感器413可以设置在终端400的侧边框和/或触摸显示屏405的下 层。当压力传感器413设置在终端400的侧边框时,可以检测用户对终端400的握持信号,由处理器401根据压力传感器413采集的握持信号进行左右手识别或快捷操作。当压力传感器413设置在触摸显示屏405的下层时,由处理器401根据用户对触摸显示屏405的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。
指纹传感器414用于采集用户的指纹,由处理器401根据指纹传感器414采集到的指纹识别用户的身份,或者,由指纹传感器414根据采集到的指纹识别用户的身份。在识别出用户的身份为可信身份时,由处理器401授权该用户执行相关的敏感操作,该敏感操作包括解锁屏幕、查看加密信息、下载软件、支付及更改设置等。指纹传感器414可以被设置终端400的正面、背面或侧面。当终端400上设置有物理按键或厂商Logo时,指纹传感器414可以与物理按键或厂商Logo集成在一起。
光学传感器415用于采集环境光强度。在一个实施例中,处理器401可以根据光学传感器415采集的环境光强度,控制触摸显示屏405的显示亮度。具体地,当环境光强度较高时,调高触摸显示屏405的显示亮度;当环境光强度较低时,调低触摸显示屏405的显示亮度。在另一个实施例中,处理器401还可以根据光学传感器415采集的环境光强度,动态调整摄像头组件406的拍摄参数。
接近传感器416,也称距离传感器,通常设置在终端400的前面板。接近传感器416用于采集用户与终端400的正面之间的距离。在一个实施例中,当接近传感器416检测到用户与终端400的正面之间的距离逐渐变小时,由处理器401控制触摸显示屏405从亮屏状态切换为息屏状态;当接近传感器416检测到用户与终端400的正面之间的距离逐渐变大时,由处理器401控制触摸显示屏405从息屏状态切换为亮屏状态。
本领域技术人员可以理解,图4中示出的结构并不构成对终端400的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储 于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (23)

  1. 一种生成字幕的方法,其特征在于,所述方法包括:
    获取待生成字符包括的像素点在平面坐标系中的第一位置;
    根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
    根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
  2. 如权利要求1所述的方法,其特征在于,所述获取待生成字符包括的像素点在平面坐标系中的第一位置,包括:
    获取待生成字符在平面坐标系中的起始位置;
    根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
  3. 如权利要求2所述的方法,其特征在于,所述根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置,包括:
    根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
    在所述起始位置处将所述点阵填写在所述平面坐标系中;
    从所述平面坐标系中读取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
  4. 如权利要求2所述的方法,其特征在于,所述根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置,包括:
    根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
    从所述点阵中选择一点作为目标点,并设置所述目标点在所述平面坐标系中的第一位置为所述起始位置;
    根据所述目标点的第一位置以及所述待生成字符包括的像素点与所述目标点之间间隔的点数目,计算所述像素点在所述平面坐标系中的第一位置。
  5. 如权利要求1所述的方法,其特征在于,所述根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置,包括:
    根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
    根据所述字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述字幕球面上的第二位置。
  6. 如权利要求1所述的方法,其特征在于,所述形成所述待生成字符之后,还包括:
    确定一转轴,所述转轴经过所述字幕球面的球心,控制所述字幕球面绕所述转轴转动。
  7. 如权利要求1所述的方法,其特征在于,所述根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
    根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
  8. 如权利要求7所述的方法,其特征在于,所述根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
    根据第一连线和第二连接之间的夹角计算透明度,所述第一连线为所述字幕球面的球心与视点之间连线,所述第二连线为所述字幕球面的球心与所述待生成字符中的一点之间的连线;
    根据所述透明度和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
  9. 如权利要求1所述的方法,其特征在于,所述根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置,包括:
    根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,i=1、2……N;
    其中,N为字幕球面的总数且N为大于1的整数,N个字幕球面的球心重 合,所述N个字幕球面的半径互不相等。
  10. 如权利要求9所述的方法,其特征在于,所述根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,包括:
    根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
    根据第i个字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述第i个字幕球面上的第二位置。
  11. 如权利要求9所述的方法,其特征在于,所述根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,包括:
    在第i个时间段内,根据所述像素点在所述第i个字幕球面上的第二位置,在所述第i个字幕球面上渲染所述像素点。
  12. 一种生成字幕的装置,其特征在于,所述装置包括:
    获取模块,用于获取待生成字符包括的像素点在平面坐标系中的第一位置;
    计算模块,用于根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
    渲染模块,用于根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
  13. 如权利要求12所述的装置,其特征在于,所述获取模块,用于:
    获取待生成字符在平面坐标系中的起始位置;
    根据所述起始位置获取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
  14. 如权利要求13所述的装置,其特征在于,所述获取模块包括:
    第一生成单元,用于根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
    填写单元,用于在所述起始位置处将所述点阵填写在所述平面坐标系中;
    读取单元,用于从所述平面坐标系中读取所述待生成字符包括的像素点在所述平面坐标系中的第一位置。
  15. 如权利要求13所述的装置,其特征在于,所述获取模块,包括:
    第二生成单元,用于根据所述待生成字符的编码生成预设大小的点阵,所述点阵包括所述待生成字符;
    设置单元,用于从所述点阵中选择一点作为目标点,并设置所述目标点在所述平面坐标系中的第一位置为所述起始位置;
    第一计算单元,用于根据所述目标点的第一位置以及所述待生成字符包括的像素点与所述目标点之间间隔的点数目,计算所述像素点在所述平面坐标系中的第一位置。
  16. 如权利要求12所述的装置,其特征在于,所述计算模块包括:
    第二计算单元,用于根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
    第三计算单元,用于根据所述字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述字幕球面上的第二位置。
  17. 如权利要求12所述的装置,其特征在于,所述装置还包括:
    转动模块,用于确定一转轴,所述转轴经过所述字幕球面的球心,控制所述字幕球面绕所述转轴转动。
  18. 如权利要求12所述的装置,其特征在于,所述渲染模块,用于:
    根据视点与所述待生成字符之间的距离和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
  19. 如权利要求18所述的装置,其特征在于,所述渲染模块,用于:
    根据第一连线和第二连接之间的夹角计算透明度,所述第一连线为所述字幕球面的球心与视点之间连线,所述第二连线为所述字幕球面的球心与所述待生成字符中的一点之间的连线;
    根据所述透明度和所述像素点的第二位置,在所述字幕球面上渲染所述像素点。
  20. 如权利要求12所述的装置,其特征在于,
    所述计算模块,用于根据所述像素点的第一位置和第i个字幕球面的半径,计算所述像素点在所述第i个字幕球面上的第二位置,i=1、2……N;
    其中,N为字幕球面的总数且N为大于1的整数,N个字幕球面的球心重合,所述N个字幕球面的半径互不相等。
  21. 如权利要求20所述的装置,其特征在于,所述计算模块,用于:
    第四计算单元,用于根据所述像素点的第一位置计算所述像素点在球面坐标系中的仰角和方位角,所述球面坐标系的坐标原点与所述字幕球面的球心重合;
    第五计算单元,用于根据第i个字幕球面的半径、所述像素点的仰角和方位角,计算所述像素点在所述第i个字幕球面上的第二位置。
  22. 如权利要求20所述的装置,其特征在于,
    所述渲染模块,用于在第i个时间段内,根据所述像素点在所述第i个字幕球面上的第二位置,在所述第i个字幕球面上渲染所述像素点。
  23. 一种生成字幕的装置,其特征在于,所述装置包括:
    一个或多个处理器;和
    一个或多个存储器;
    所述一个或多个存储器存储有程序代码,所述程序代码由所述一个或多个处理器执行,以实现:
    获取待生成字符包括的像素点在平面坐标系中的第一位置;
    根据所述像素点的第一位置,计算所述像素点在字幕球面上的第二位置;
    根据所述像素点的第二位置,在所述字幕球面上渲染所述像素点,以形成所述待生成字符。
PCT/CN2018/083244 2017-04-18 2018-04-16 一种生成字幕的方法及装置 WO2018192455A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710254051.0A CN108737907B (zh) 2017-04-18 2017-04-18 一种生成字幕的方法及装置
CN201710254051.0 2017-04-18

Publications (1)

Publication Number Publication Date
WO2018192455A1 true WO2018192455A1 (zh) 2018-10-25

Family

ID=63855575

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/083244 WO2018192455A1 (zh) 2017-04-18 2018-04-16 一种生成字幕的方法及装置

Country Status (2)

Country Link
CN (1) CN108737907B (zh)
WO (1) WO2018192455A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019772A (zh) * 2020-09-07 2020-12-01 中图云创智能科技(北京)有限公司 一种全景视频中纠正字幕桶状变形的方法
CN112532962A (zh) * 2020-11-24 2021-03-19 聚好看科技股份有限公司 一种全景视频字幕显示方法及显示设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923813A (zh) * 2009-06-11 2010-12-22 阳一鸣 点阵文字图形贴装置及方法
CN102256154A (zh) * 2011-07-28 2011-11-23 中国科学院自动化研究所 实现三维全景视频的定位与播放的方法及系统
WO2016159166A1 (ja) * 2015-03-31 2016-10-06 大和ハウス工業株式会社 映像表示システム及び映像表示方法
CN106527857A (zh) * 2016-10-10 2017-03-22 成都斯斐德科技有限公司 一种基于虚拟现实的全景视频交互方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101902582B (zh) * 2010-07-09 2012-12-19 清华大学 一种立体视频字幕添加方法及装置
WO2013152784A1 (en) * 2012-04-10 2013-10-17 Huawei Technologies Co., Ltd. Method and apparatus for providing a display position of a display object and for displaying a display object in a three-dimensional scene

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923813A (zh) * 2009-06-11 2010-12-22 阳一鸣 点阵文字图形贴装置及方法
CN102256154A (zh) * 2011-07-28 2011-11-23 中国科学院自动化研究所 实现三维全景视频的定位与播放的方法及系统
WO2016159166A1 (ja) * 2015-03-31 2016-10-06 大和ハウス工業株式会社 映像表示システム及び映像表示方法
CN106527857A (zh) * 2016-10-10 2017-03-22 成都斯斐德科技有限公司 一种基于虚拟现实的全景视频交互方法

Also Published As

Publication number Publication date
CN108737907A (zh) 2018-11-02
CN108737907B (zh) 2020-05-12

Similar Documents

Publication Publication Date Title
US11205282B2 (en) Relocalization method and apparatus in camera pose tracking process and storage medium
US11224810B2 (en) Method and terminal for displaying distance information in virtual scene
US11231845B2 (en) Display adaptation method and apparatus for application, and storage medium
CN108245893B (zh) 三维虚拟环境中虚拟对象的姿态确定方法、装置及介质
KR102595150B1 (ko) 다수의 가상 캐릭터를 제어하는 방법, 기기, 장치 및 저장 매체
WO2019141100A1 (zh) 附加对象显示方法、装置、计算机设备及存储介质
CN108710525B (zh) 虚拟场景中的地图展示方法、装置、设备及存储介质
CN111324250B (zh) 三维形象的调整方法、装置、设备及可读存储介质
WO2022134632A1 (zh) 作品处理方法及装置
CN111897429A (zh) 图像显示方法、装置、计算机设备及存储介质
CN110853128A (zh) 虚拟物体显示方法、装置、计算机设备及存储介质
WO2019192061A1 (zh) 图形码的识别及生成方法、装置及计算机可读存储介质
US20220291791A1 (en) Method and apparatus for determining selected target, device, and storage medium
WO2018192455A1 (zh) 一种生成字幕的方法及装置
CN110728744B (zh) 一种体绘制方法、装置及智能设备
CN112967261B (zh) 图像融合方法、装置、设备及存储介质
CN112882094B (zh) 初至波的获取方法、装置、计算机设备及存储介质
CN109685881B (zh) 一种体绘制方法、装置及智能设备
CN109388732B (zh) 音乐地图的生成和显示方法、装置及存储介质
CN108881739B (zh) 图像生成方法、装置、终端及存储介质
CN112732133A (zh) 消息处理的方法、装置、电子设备及存储介质
CN113160031B (zh) 图像处理方法、装置、电子设备及存储介质
CN112150554B (zh) 画面显示方法、装置、终端和存储介质
WO2022199102A1 (zh) 图像处理方法及装置
CN110660031B (zh) 图像锐化方法及装置、存储介质

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: 18787155

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: 18787155

Country of ref document: EP

Kind code of ref document: A1