The present disclosure relates to a technique to generate a texture image used to determine the color of three-dimensional shape data of an object.
In recent years, three-dimensional computer graphics has been developing. In the three-dimensional computer graphics, the shape of an object is represented by mesh data (generally also called “3D model”) including a plurality of polygons. Then, the color and material appearance of the object are represented by pasting a texture image to the surface of each polygon configuring the 3D model. It is possible to generate the texture image by dividing the 3D model into a plurality of groups and appending color information to a UV map in which two-dimensional pieces (called “fragments”) generated by performing UV development for each group are arranged. For example, Japanese Patent Laid-Open No. 2021-64334 has disclosed a method of performing UV development for each group by selecting one camera viewpoint for each polygon from among a plurality of camera viewpoints corresponding to the object.
In a case where a camera exists only in the vicinity in the in-plane direction of a polygon configuring a 3D model, the shape of the fragment generated by the UV development becomes a crushed shape like a straight line, and therefore, there is such a problem that it is not possible to append color information. Here, explanation is given by using a specific example.
The image processing apparatus according to the present disclosure is an image processing apparatus including: one or more memories storing instructions; and one or more processors executing the instructions to perform: obtaining three-dimensional shape data of an object captured in a plurality of captured images whose viewpoints are different; dividing elements configuring the three-dimensional shape data into a plurality of groups; associating each of the plurality of groups with viewpoint information representing a specific viewpoint; generating a two-dimensional map based on the plurality of groups and the viewpoint information representing the specific viewpoint, which is associated with each group; and generating a texture image representing a color of the object based on the two-dimensional map, wherein the specific viewpoint includes a virtual viewpoint different from the viewpoint of each of the plurality of captured images.
Further features of the present disclosure will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
Hereinafter, with reference to the attached drawings, the present disclosure is explained in detail in accordance with preferred embodiments. Configurations shown in the following embodiments are merely exemplary and the present disclosure is not limited to the configurations shown schematically.
First, the hardware configuration and the software configuration of an image processing apparatus according to the present embodiment are explained with reference to the drawings.
The CPU 101 is a central processing unit comprehensively controlling the image processing apparatus by executing programs stored in the ROM 102, the RAM 103 or the like. It may also be possible for the image processing apparatus 100 to further have one or a plurality of pieces of dedicated hardware different from the CPU 101 and at least part of the processing in the charge of the CPU 101 may be performed by the dedicated hardware in place of the CPU 101 or in cooperation with the CPU 101. As examples of the dedicated hardware, there are ASIC, FPGA, DSP (Digital Signal Processor) and the like. The ROM 102 is a memory storing programs and the like that do not need to be changed. The RAM 103 is a memory temporarily storing programs or data supplied from the auxiliary storage device 104, or data and the like supplied from the outside via the communication unit 107. The auxiliary storage device 104 includes, for example, a hard disk drive and stores various kinds of data, such as image data or voice data.
The display unit 105 includes, for example, a liquid crystal display, an LED or the like and displays a GUI (Graphical User Interface) or the like for a user to operate the image processing apparatus 100 or browse the state of the processing in the image processing apparatus 100. The operation unit 106 includes, for example, a keyboard, a mouse, a joystick, a touch panel or the like and receives operations by a user and inputs various instructions to the CPU 101. The CPU 101 also operates as a display control unit configured to control the display unit 105 and an operation control unit configured to control the operation unit 106.
The communication unit 107 performs communication, such as transmission and reception of data and the like, with an external device of the image processing apparatus 100. For example, in a case where the image processing apparatus 100 is connected with an external device by wire, a communication cable is connected to the communication unit 107. In a case where the image processing apparatus 100 has a function to wirelessly communicate with an external device, the communication unit 107 comprises an antenna. The bus 108 connects each unit comprised by the image processing apparatus 100 and transmits information. In the present embodiment, explanation is given on the assumption that the display unit 105 and the operation unit 106 exist inside of the image processing apparatus 100, but it may also be possible for at least one of the display unit 105 and the operation unit 106 to exist outside the image processing apparatus 100 as another device.
The data obtaining unit 201 obtains a 3D model (three-dimensional shape data) representing the three-dimensional shape of an object. As the data format of a 3D model, there is mesh data representing the surface shape of an object by a set of polygons, volume data representing the 3D shape of an object by voxels, point cloud data representing the 3D shape of an object by a set of points or the like. In the present embodiment, it is assumed that mesh data representing the surface shape of an object by a set of triangular polygons is obtained as a 3D model. The shape of a polygon is not limited to a triangle, and another polygon, such as a quadrilateral and a pentagon, may be used. Further, the data obtaining unit 201 obtains viewpoint information relating to the image capturing viewpoint of a plurality of imaging devices (in the following, called “real cameras”) arranged in the image capturing space. This viewpoint information is generally called “camera parameter” and intrinsic parameters, such as the focal length and the image center, and extrinsic parameters representing the position, orientation and the like of the camera are included.
The mesh division unit 202 performs processing to put together elements (in the present embodiment, polygons configuring mesh data) configuring the obtained 3D model into a group corresponding to the image capturing viewpoint of a specific real camera.
The camera parameter setting unit 203 sets camera parameters corresponding to the imaging device having an appropriate camera viewpoint (image capturing viewpoint) to each group obtained by the mesh division unit 202. At this time, in a case where the real camera having an appropriate camera viewpoint does not exist among the plurality of arranged real cameras, camera parameters corresponding to a virtual imaging device (in the following, called “virtual camera”) are set, which has an appropriate camera viewpoint but does not exist actually.
The UV development unit 204 develops mesh data, which is three-dimensional information, onto a two-dimensional plane and generates a UV map caused to correspond to the two-dimensional coordinates (horizontal coordinate U and vertical coordinate V). Specifically, first, the UV development unit 204 develops each polygon included in the divided group onto the two-dimensional plane and generates a two-dimensional piece (fragment) corresponding to the group. Then, the UV development unit 204 arranges the generated fragment of each group on the two-dimensional map (UV map) corresponding to mesh data.
A texture image generation unit 206 calculates the pixel value of each pixel configuring the UV map based on the plurality of captured images obtained by the plurality of real cameras and generates a texture image.
Following the above, with reference to the flowcharts shown in
At S301, the data obtaining unit 201 obtains mesh data of an object. Here, it is assumed that the data obtaining unit 201 obtains mesh data obtained by applying the marching cube method to the voxel data generated by applying the visual hull method.
At S302, the data obtaining unit 201 obtains the above-described plurality of captured images and the camera parameters of the plurality of real cameras corresponding to each captured image.
At S303, the mesh division unit 202 performs processing to divide the mesh data obtained at S301 based on the camera parameters of the real camera, which are obtained at S302. By this processing (in the following, called “mesh division processing”), the input mesh data is divided into a plurality of groups corresponding to each camera viewpoint.
At S304, the camera parameter setting unit 203 sets the camera parameters of the camera having a camera viewpoint appropriate for the use in coloring processing, to be described later, to each group divided at S303. Here, in a case where the camera corresponding to “camera having an appropriate camera viewpoint” does not exist among the real cameras, a virtual camera not arranged actually is created. In the example in
At S305, the UV development unit 204 performs UV development for each divided group. Specifically, the UV development unit 204 performs processing to generate a fragment by projecting each group based on the camera viewpoint represented by the camera parameters based on the camera parameters set for each group and arrange the fragment on the two-dimensional map. In this manner, the two-dimensional map (UV map) in which the fragment of each group is arranged and which corresponds to the mesh data is obtained.
At S306, the texture image generation unit 205 generates a texture image by calculating the pixel value of each pixel included within the fragment using the captured image in which the group corresponding to the fragment is captured based on the two-dimensional map generated at S305. Details of the texture image generation processing will be described later.
The above is a rough operation flow in the image processing apparatus 100. It may also be possible to further perform processing to append color information to the surface of the polygon of the mesh data corresponding to each pixel of the texture image after the processing at S306.
Following the above, with reference to the flowchart in
At S401, processing (camera selection processing) to select the real camera having captured the polygon in the best state (in the following, called “best camera”) is performed for ach polygon, which is the element configuring the processing-target mesh data. Details of this camera selection processing will be described later. Determination of whether the image capturing viewpoint of the real camera selected for each polygon is appropriate as the camera viewpoint used in grouping to be described later is also performed and a correspondence table including the results of the viewpoint determination is created and stored. In the example in
At S402, initialization (here, processing to set initial value=0) of the identifier (group ID) for managing a group to be generated from now on is performed.
At S403, one polygon not belonging to any group (not associated with any group ID) yet is selected as a polygon of interest from among each polygon configuring mesh data.
At S404, with reference to the results (here, the above-described correspondence table) of the camera selection processing at S401, the processing to be performed next is allocated in accordance with whether the viewpoint determination results of the real camera of the best camera ID associated with the polygon ID of the polygon of interest are “OK” or “NG”. Here, in a case where the flag value of the polygon of interest is “1” representing OK, the processing at S405 is performed next and in a case where the flag value is “0” representing NG, the processing at S408 is performed next.
At S405, the adjacent polygon satisfying a predetermined condition with the polygon of interest is included in the same group as that of the polygon of interest. Specifically, first, the real camera associated as the best camera of the polygon of interest is identified. Then, from among the polygons with which the same real camera as the identified real camera is associated as the best camera, all the polygons whose viewpoint determination results are “OK” and which are adjacent to the polygon of interest are extracted. Then, a group including the polygon of interest and all the extracted adjacent polygons is created. Here, it is assumed that the condition of the adjacent polygon is that the polygons have one or more the same vertices in common.
At S406, to the polygon of interest belonging to the group created at S405 and the adjacent polygon thereof, a group TD identifying the group is set. Accompanying this, the column of the new group TD is added to the correspondence table described previously and the correspondence table is updated. In the example in
At S407, to the group to which the group TD is set at S406, the real camera associated as the best camera with the polygon of interest belonging to the group and the adjacent polygon thereof is set as the real camera (effective camera) having a viewpoint appropriate to the group. Accompanying this, the correspondence table described previously is updated, the column of “Effective Camera ID”, which is the identifier of the effective camera, is added newly, and information identifying the real camera as the effective camera is input to the column. In the example in
At S408, the adjacent polygon satisfying a predetermined condition with the polygon of interest is included in the same group as that of the polygon of interest. Specifically, first, the real camera associated as the best camera of the polygon of interest is identified. Then, from among the polygons with which the same real camera as the identified real camera is associated as the best camera, all the polygons whose viewpoint determination results are “NG” and which are adjacent to the polygon of interest are extracted. Then, a group including the polygon of interest and all the extracted adjacent polygons is created. Here, it is assumed that the condition of the adjacent polygon is, as at S405 described above, that the polygons have one or more the same vertices in common.
At S409, to the polygon of interest belonging to the group created at S408 and the adjacent polygon thereof, a group ID identifying the group is set. Accompanying this, the correspondence table described previously is updated and the column of the group ID is added newly. In the example in
At S410, whether or not the processing described previously is completed by taking all the polygons configuring the mesh data as a target is determined. In a case where the processing is completed by taking all the polygons as a target, the above-described correspondence table at the point in time of the completion is stored in the RAM 102 as the results of the mesh division processing, and then, this flow is exited. On the other hand, in a case where there is an unprocessed polygon, the number of the group ID is incremented (+1) at S411, and the processing is returned to S403 and the same processing is repeated.
The above is the contents of the mesh division processing (S303). Following the above, with reference to the flowchart in
At S501, from among the polygons configuring the mesh data, one polygon of interest is selected. At next S502, from among the plurality of arranged real cameras, one real camera of interest is selected.
At S503, the angle formed by a normal vector of the polygon of interest selected at S501 and a direction vector of the real cameral of interest selected at S502 is calculated. Here, it is possible to find a normal vector nv of a triangular polygon by the cross product of edge vectors (v1, v2) based on its vertices (p0, p1, p2) and the normal vector nv is expressed by formula (1) below.
In formula (1) described above, the edge vectors v1 and v2 are expressed by formula (2) and formula (3) below, respectively.
Further, in formulas (2) and (3) described above, (x0, y0, z0)=p0, (x1, y1, z1)=p1, and (x2, y2, z2)=p2.
Then, a direction vector cv of the real camera is found from position coordinates pcam of the real camera and a center of gravity ptri of the polygon and expressed by formula (4) below.
In formula (4) described above, (xcam, ycam, zcam)=pcam and (xtri, ytri, ztri)=ptri. Further, (xtri, ytri, ztri) is expressed by formula (5) below.
Then, a formed angle θ is obtained by the inner product of the normal vector nv of the polygon and the direction vector cv of the real camera expressed by formula (6) below
At S504, whether or not the processing at S503 is completed by taking all the arranged real cameras as a target is determined. In a case where the calculation of the formed angle θ described above is completed by taking all the real cameras as a target, the processing at S505 is performed next. On the other hand, in a case where there is a real camera for which the calculation of the formed angle θ described above is not performed yet, the processing returns to S502 and the same processing is repeated.
At S505, among all the arranged real cameras, the real camera whose calculated “formed angle” is the minimum is associated as the best camera for the polygon of interest. Due to this, for example, as in the correspondence table described previously, Polygon ID of the polygon of interest and Best Camera ID indicating the real camera as the best camera are stored in association with each other.
At S506, the processing that is performed next is allocated in accordance with whether or not the angle of “formed angle” (minimum angle) determined to be the minimum at S505 is smaller than or equal to a threshold value set in advance. The threshold value at this time is set in advance based on a rule of thumb and for example, it is preferable for the threshold value to be around 70 degrees. In a case where the minimum formed angle is smaller than or equal to the threshold value, the processing at S507 is performed next and in a case where the minimum formed angle is larger than the threshold value, the processing at S508 is performed next.
At S507, information indicating that the viewpoint of the real camera determined to be the bast camera for the polygon of interest is an appropriate camera viewpoint is set to the polygon of interest. Specifically, in the correspondence table described previously, to the column of “Viewpoint Determination Results” in the record of Polygon ID of the polygon of interest, a flag value of “1” indicating that the viewpoint is an appropriate camera viewpoint is set.
At S508, information indicating that the viewpoint of the real camera determined to be the best camera for the polygon of interest is not an appropriate camera viewpoint is set to the polygon of interest. Specifically, in the correspondence table described previously, to the record of Polygon ID of the polygon of interest, a flag value of “0” indicating that the viewpoint is not an appropriate camera viewpoint is set.
At S509, whether or not the processing described previously is completed by taking all the polygons configuring the mesh data as a target is determined. In a case where the processing is completed by taking all the polygons as a target, the above-described correspondence table at the point in time of the completion is stored in the RAM 102 as the results of the camera selection processing, and then, this flow is exited. On the other hand, in a case where there is an unprocessed polygon, the processing returns to S501 and the same processing is repeated.
The above is the contents of the camera selection processing (S401).
Following the above, with reference to the flowchart in
At S601, from among all the groups obtained by the mesh division processing (S303) described previously, one group of interest is selected.
At S602, with reference to the correspondence table described previously, based on the set value of the “Effective Camera ID” column of the selected group of interest, the processing that is performed next is allocated. Specifically, in a case where the camera ID of the real camera is set to the “Effective Camera ID” column in the record of the group of interest, the processing at S603 is performed next and in a case where nothing is set and the column is blank, the processing at S604 is performed next.
At S603, with reference to the correspondence table described previously, the camera parameters of the real camera identified by the camera ID described in the “Effective Camera ID” column are set to all the polygons belonging to the group of interest.
At S604, for each polygon belonging to the group of interest, the calculation of the normal vector is performed. The normal vector calculation method is the same as that described at S503 described previously. At S605 that follows, the calculation of an average vector of the normal vectors calculated for all the polygons belonging to the group of interest is performed. Then, at S606, along the orientation of the average vector calculated at S605, the camera parameters corresponding to the virtual camera having a camera viewpoint whose line-of-sight direction is opposite are set. In this case, it is sufficient to adjust, and so on, the parameter values, such as the distance from the virtual camera to the object and the resolution of the virtual camera, to those of the peripheral real camera arranged actually.
At S607, whether or not the processing described previously is completed by taking all the groups obtained by the mesh division processing as a target is determined. In a case where the processing is completed by taking all the groups as a target, this flow is exited. On the other hand, in a case where there is an unprocessed group, the processing returns to S601 and the same processing is repeated.
The above is the contents of the camera parameter setting processing (S304).
Following the above, with reference to the flowchart in
At S701, from among the fragments within the UV map, a fragment of interest is selected.
At S702, with reference to the correspondence table described previously, the group corresponding to the fragment of interest is obtained. In the example in
At S703, from among the triangles included in the fragment of interest, a triangle of interest is selected first. Then, with reference to the correspondence table described previously, from among the polygon group corresponding to the group obtained at S702, the polygon corresponding to the triangle of interest is obtained. In the example in
At S704, two-dimensional coordinates of a pixel on the UV map are obtained, which is located inside of the triangle of interest selected at S703. Here, in the example in
At S705, three-dimensional coordinates on the polygon obtained at S703 are calculated, which correspond to all the two-dimensional coordinates obtained at S704. In the example in
First, the coordinates of the center of gravity of the pixel 103 are calculated by using formula (7) below based on the area of three triangles formed by connecting the two-dimensional coordinates (x, y) of the point p representing the pixel center of the pixel 1013 and the three vertices pa, pb, and pc of the triangle 1012.
In formula (7) described above, w1, w2, and w3 each represent the coordinates of the center of gravity and S represents the area of the triangle. Then, by using the calculated coordinates of the center of gravity, the two-dimensional coordinates of the point p in the triangle 1012 are calculated. Here, it is possible to express the two-dimensional coordinates of the point p in the triangle 1012 by formula (8) below.
Further, similarly, it is possible to express the three-dimensional coordinates of the point P in the polygon 1002 by formula (9) below.
As above, it is possible to obtain the three-dimensional coordinates on the polygon, which correspond to the two-dimensional coordinates of the inner pixel in the fragment on the UV map. Explanation is returned to the flowchart in
At S706, with reference to the correspondence table described previously, the two-dimensional coordinates on the captured image are obtained, which correspond to the three-dimensional coordinates calculated at S705. In the example in
At S707, the pixel value at the position indicated by the two-dimensional coordinates on the captured image obtained at S706 is set as the pixel value in the texture image corresponding to the point p on the UV map.
At S708, whether or not the above-described processing is completed for all the triangles included in the fragment of interest is determined. In a case where the processing is completed by taking all the triangles as a target, S709 is performed next. On the other hand, in a case where there is an unprocessed triangle, the processing returns to S703 and the same processing is repeated.
At S709, whether or not the above-described processing is completed by taking all the fragments generated by the UV development at S305 as a fragment of interest is determined. In a case where the processing is completed by taking all the fragments as a target, this flow is exited. On the other hand, in a case where there is an unprocessed fragment, the processing returns to S701 and the same processing is repeated.
The above is the contents of the texture image generation processing (S306).
In the above-described embodiment, as the condition in a case where the best camera in the camera selection processing (S401) is selected, the angle formed by the normal vector of the polygon of interest and the direction vector of the real camera of interest is used (S503), but this is not limited. For example, it may also be possible to use the area of a polygon obtained in a case where the polygon of interest is projected based on the image capturing viewpoint of the real camera of interest as the condition for selection. Specifically, three vertices of the polygon of interest are obtained and the three vertices are projected based on the camera parameters of the real camera of interest and two-dimensional coordinates p0, p1, and p2 are found. Then, from the two-dimensional coordinates p0, p1, and p2 thus found, edge vectors v1 and v2 are calculated and an area s of a triangle whose vertices are the two-dimensional coordinates p0, p1, and p2 is calculated. The area s in this case is expressed by formula (10) below.
As described above, it is sufficient to select the real camera having captured each polygon in the best state and associate the real camera whose calculated “area” is the maximum among all the arranged real cameras as the best camera for the polygon of interest at S505 that follows. Then, it is sufficient to set the flag value “1” indicating that the viewpoint is an appropriate camera viewpoint in a case where the “area” determined to be the maximum is larger than or equal to a threshold value set in advance, and set a flag value indicating that the viewpoint is not an appropriate camera viewpoint in a case where the “area” is smaller than the threshold value. It may be possible to set the threshold value in this case based on the resolution of each real camera, the number of pixels included in the triangle whose area is the maximum, and the like. Alternatively, it may also be possible to skip the threshold value processing because that the camera viewpoint is one at a predetermined level or higher is guaranteed at the point in time at which the calculation of the area succeeds.
As above, according to the present embodiment, by performing grouping of polygons in view of the positional relationship between each polygon configuring the mesh data and the real camera arranged in the image capturing space, the real camera or the virtual camera with an appropriate camera viewpoint is set for each group. Due to this, even in a case where the real camera exists only in the vicinity of the polygon in the in-plane direction, it is made possible to color the fragment generated by the UV development, and as a result of that, it is possible to obtain a texture image of high image quality.
In the first embodiment, whether the angle formed by the real camera direction and the normal vector of each polygon is smaller than or equal to the threshold value is determined and in a case where there is a polygon whose angle formed with any real camera is larger than or equal to the threshold value, the virtual camera is set. Next, an aspect is explained as a second embodiment in which mesh division processing is performed based on the orientation of the normal vector of each polygon of the mesh and UV development processing is performed by setting the virtual camera to all the groups.
The operation of the image processing apparatus 100 according to the present embodiment is explained with reference to the flowcharts shown in
In the flowchart in
At S303′ that follows S302, the mesh division unit 202 performs processing to divide the mesh data obtained at S301 into a plurality of groups.
At S304′, the camera parameter setting unit 203 sets the camera parameters of the virtual camera that are used in the next UV development processing (S305′) to each group divided at S303′. Details of this camera parameter setting processing will be described later.
At S305′, the UV development unit 204 performs UV development for each divided group. In the present embodiment, processing is performed to generate a fragment by performing projection based on the camera viewpoint represented by the camera parameters and arrange the fragment on the two-dimensional map based on the camera parameters of the virtual camera set for each group at S304′. In this manner, the two-dimensional map (UV map) corresponding to mesh data is obtained, on which the fragment of each group is arranged.
At S306′, the texture image generation unit 205 generates a texture image based on the camera parameters of the plurality of real cameras corresponding to each captured image obtained at S302 and the two-dimensional map generated at S305. Details of this texture image generation processing will be described later.
Following the above, with reference to the flowchart in
In the flowchart in
At S1203, a group ID is set to the polygon of interest.
At S1204, from among the adjacent polygons satisfying a predetermined condition with the polygon of interest, one adjacent polygon of interest is selected. It is assumed that the predetermined condition here is that the polygons have one or more the same sides in common.
At S1205, whether or not a group ID is already set to the adjacent polygon of interest is determined. In a case where it is determined that a group ID is set already, the processing moves to the processing at S1209. On the other hand, in a case where it is determined that no group ID is set, the processing moves to the processing at S1206.
At S1206, the angle formed by the normal vector of the polygon of interest and the normal vector of the adjacent polygon of interest is calculated. The calculation method of the angle formed between vectors is the same as that explained at S503 of the first embodiment.
At S1207, whether or not the angle of “formed angle” calculated at S1206 is smaller than or equal to the threshold value set in advance is determined. It is preferable for the threshold value in this case to be set in advance based on a rule of thumb as at S506 of the first embodiment and to be, for example, around 70 degrees. In a case where the angle is determined to be smaller than or equal to the threshold value, the processing moves to the processing at S1208. In a case where the angle is determined to be larger than the threshold value, the processing moves to the processing at S1209.
At S1208, the same group ID as the group ID set to the polygon of interest is set to the adjacent polygon of interest.
At S1209, whether or not the processing described previously is completed by taking all the adjacent polygons satisfying a predetermined condition with the polygon of interest as a target is determined. In a case where the processing is completed by taking all the adjacent polygons as a target, the processing moves to the processing at S1210. On the other hand, in a case where there is an unprocessed adjacent polygon, the processing returns to the processing at S1204, and the next adjacent polygon is selected and the processing is continued.
At S1210, as at S410 of the first embodiment. whether or not the processing described previously is completed by taking all the polygons configuring the mesh data as a target is determined. In a case where the processing is completed by taking all the polygons as a target, the results of the mesh division processing are stored in the RAM 102, and then, this flow is exited. On the other hand, in a case where there is an unprocessed polygon, at S1211, the number of the group ID is incremented (+1) as at S411 of the first embodiment, and the processing returns to S1202 and the same processing is repeated.
The above is the contents of the mesh division processing (S303′). By the above-described processing, the correspondence table as follows is created.
Following the above, with reference to the flowchart in
After the above-described camera parameter setting processing (S304′) is completed, the processing moves to the UV development (S305′) for each group.
At S305′, based on the above-described correspondence table, processing is performed, which generates a fragment by performing projection based on the camera viewpoint represented by the camera parameters and arranges the fragment on the two-dimensional map based on the camera parameters of the virtual camera set for each group. Due to this, to the correspondence table created in the camera parameter setting processing, the column of Fragment ID is added and as the identifier (Fragment ID) of the fragment generated for each group, the same set value as the corresponding group ID is stored. In the example in
Following the above, with reference to the flowchart in
The difference from the camera selection processing (see
At S1601 (S502), from among the plurality of arranged real cameras, one real camera of interest is selected.
At S1602 (S503), the angle formed by the normal vector of the polygon obtained at S703 and the direction vector of the real camera of interest selected at S1601 is calculated.
At S1603 (S504), whether or not the processing at S1602 is completed by taking all the arranged real cameras as a target is determined. In a case where the above-described calculation of the formed angle θ is completed by taking all the real cameras as a target, processing at S1604 is performed next. On the other hand, in a case where there is a real camera for which the above-described calculation of the formed angle θ is not performed yet, the processing returns to S1601 and the same processing is repeated.
At S1604 (S505), among all the arranged real cameras, the real camera whose calculated “formed angle” is the minimum is associated as the best camera for the polygon obtained at S703.
The above is the contents of the camera selection processing according to the present embodiment. Due to this, to the correspondence table created in the UV development described above (S305′), the column of Real Camera ID is added and the real camera ID corresponding to each Polygon ID is set. As a result of that, in the example in
Explanation is returned to the texture image generation processing.
At S1507 (S706), with reference to the correspondence table updated as described above, the two-dimensional coordinates on the captured image are obtained, which correspond to the three-dimensional coordinates calculated at S1505. That is, the two-dimensional coordinates in a case where the three-dimensional coordinates calculated at S1505 (S705) are projected onto the captured image corresponding to the real camera based on the camera viewpoint of the real camera selected at S1506 are obtained. Explanation with the case in
At 51508, the pixel value on the captured image in the two-dimensional coordinates obtained at S1507 is set as the pixel value of the texture image.
The above is the contents of the texture image generation processing (S306′) according to the present embodiment.
According to the present embodiment, first, grouping with the orientation of the normal vector of each polygon configuring the mesh data taken into consideration is performed and the virtual camera is set for each group. Due to this, it is made possible to perform UV development with the shape of the mesh data taken into consideration, and therefore, it is possible to generate a fragment of a higher accuracy.
In the second embodiment, the aspect is explained in which the mesh division processing is performed based on the orientation of the normal vector of each polygon of the mesh and the virtual camera is set to all the groups. Next, an aspect is explained as a third embodiment in which a plurality of virtual cameras is arranged at positions determined in advance and mesh division processing and UV development processing are performed based on each arranged virtual camera.
The operation of the image processing apparatus 100 according to the present embodiment is explained with reference to the flowcharts shown
In the flowchart in
At S1703 that follows S1702, the camera parameter setting unit 203 sets camera parameters of each virtual camera so that the plurality of virtual cameras is arranged at predetermined positions within the image capturing space respectively. Here, as one example, explanation is given by taking a case as an example where the virtual cameras are arranged at uniform intervals with the position of the mesh data obtained at S1701 as a reference.
At S1704, the mesh division unit 202 performs mesh division processing for the mesh data obtained at S1701 based on the camera parameters of the plurality of virtual cameras, which are set at S1702.
Here, with reference to the flowchart in
At S1901, the virtual camera having captured each polygon of the mesh data in the best state is set from among the plurality of virtual cameras set S1703 described above. Subsequent S1902 to S1907 correspond to S402, S403, S405, S406, S410, and S411, respectively, in the flowchart in
Then, at S1904, the adjacent polygon satisfying a predetermined condition with the selected polygon of interest is included in the same group as that of the polygon of interest (S405). In this grouping, first, the virtual camera set to the polygon of interest at S1901 is identified. Next, among other polygons with which the same virtual camera as the identified virtual camera is associated, all the polygons adjacent to the polygon of interest are identified. Then, a group including all the identified adjacent polygons and the polygon of interest is created.
At S1905, to the polygon of interest and the adjacent polygons belonging to the group created at S1904, a group ID identifying the group is set (S406). Then, at S1906, whether all the polygons configuring the mesh data are processed is determined (S410). In a case where there is an unprocessed polygon, the number of the group ID is incremented (S411) at S1907, and the processing returns to S1903 and the same processing is repeated.
The above is the contents of the mesh division processing (S1704) according to the present embodiment. Due to this, it is made possible to perform UV development by the virtual camera not depending on the shape of the mesh data or the arrangement of the real camera, and therefore, it is possible to increase the speed of the fragment generation processing.
Embodiment(s) of the present disclosure can also be realized by a computer of a system or apparatus that reads out and executes computer executable instructions (e.g., one or more programs) recorded on a storage medium (which may also be referred to more fully as a ‘non-transitory computer-readable storage medium’) to perform the functions of one or more of the above-described embodiment(s) and/or that includes one or more circuits (e.g., application specific integrated circuit (ASIC)) for performing the functions of one or more of the above-described embodiment(s), and by a method performed by the computer of the system or apparatus by, for example, reading out and executing the computer executable instructions from the storage medium to perform the functions of one or more of the above-described embodiment(s) and/or controlling the one or more circuits to perform the functions of one or more of the above-described embodiment(s). The computer may comprise one or more processors (e.g., central processing unit (CPU), micro processing unit (MPU)) and may include a network of separate computers or separate processors to read out and execute the computer executable instructions. The computer executable instructions may be provided to the computer, for example, from a network or the storage medium. The storage medium may include, for example, one or more of a hard disk, a random-access memory (RAM), a read only memory (ROM), a storage of distributed computing systems, an optical disk (such as a compact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flash memory device, a memory card, and the like.
According to the present disclosure, it is possible to obtain a texture image of high image quality.
While the present disclosure has been described with reference to exemplary embodiments, it is to be understood that the disclosure is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Applications No. 2023-102776, filed Jun. 22, 2023, and No. 2023-161507, filed Sep. 25, 2023, which are hereby incorporated by reference wherein in their entirety.
Number | Date | Country | Kind |
---|---|---|---|
2023-102776 | Jun 2023 | JP | national |
2023-161507 | Sep 2023 | JP | national |