An image processing apparatus includes, a first data generation unit configured to generate triangular data by analyzing straight line contours and curved contours with respect to vector format graphic data and making the straight line contours and the curved contours triangles, a second data generation unit configured to generate stencil data from the triangular data on the basis of a drawing order of vertices of the triangular data generated from straight line contours and curved contours, and a third data generation unit configured to generate raster format graphic data with reference to the stencil data.
|
9. A computer-implemented method of image processing comprising the operations, performed by a computer, of:
generating, at the computer, triangular data which includes first triangular data generated by analyzing straight line contours with respect to vector format graphic data and second triangular data generated by analyzing curved contours with respect to the vector format graphic data;
generating, at the computer, a stencil data from the triangular data by determining a numerical value for separate enclosed regions formed within each of the first triangular data and the second triangular data on the basis of a drawing order of the vertices of the first triangular data and the second triangular data, and by determining regions of the triangular data to be included in the stencil data which correspond to specified numerical values obtained by overlapping the first triangular data with the second triangular data and adding together the numerical values determined for the first triangular data with the numerical valued determined for the second triangular data, wherein numerical values for overlapping regions of the first triangular data and the second triangular data are added together; and
generating, at the computer, raster format graphic data referring to the stencil data,
wherein the straight line contours define a configuration of a polygon which is obtained by ignoring a control point of each curve contour and connecting starting points and end points of a straight line and curve of each straight line contour, and the curved contours are a group of the triangles in which three points of a starting point, end point and control point of a parameter curve of each curved contour are connected.
1. An image processing apparatus comprising:
a first data generation unit configured to generate triangular data which includes first triangular data generated by analyzing straight line contours with respect to vector format graphic data and second triangular data generated by analyzing curved contours with respect to the vector format graphic data;
a second data generation unit configured to generate stencil data from the triangular data by determining a numerical value for separate enclosed regions formed within each of the first triangular data and the second triangular data on the basis of a drawing order of vertices of the first triangular data and the second triangular data, and by determining regions of the triangular data to be included in the stencil data which correspond to specified numerical values obtained by overlapping the first triangular data with the second triangular data and adding together the numerical values determined for the first triangular data with the numerical values determined for the second triangular data, wherein numerical values for overlapping regions of the first triangular data and the second triangular data are added together; and
a third data generation unit configured to generate raster format graphic data with reference to the stencil data,
wherein the straight line contours define a configuration of a polygon which is obtained by ignoring a control point of each curve contour and connecting starting points and end points of a straight line and curve of each straight line contour, and the curved contours are a group of the triangles in which three points of a starting point, end point and control point of a parameter curve of each curved contour are connected.
2. The apparatus according to
a first storage unit configured to store the vector format graphic data;
a second storage unit configured to store the triangular data generated by the first data generation unit;
a third storage unit configured to store the stencil data generated by the second data generation unit; and
a fourth storage unit configured to store the raster format graphic data generated by the third data generation unit.
3. The apparatus according to
4. The apparatus according to
5. The apparatus according to
6. The apparatus according to
8. The apparatus according to
|
This application is based upon and claims the benefit of priority from prior Japanese Patent Application No. 2006-132726, filed May 11, 2006, the entire contents of which are incorporated herein by reference.
1. Field of the Invention
The invention relates to a drawing technology such as an image processing apparatus, image processing method and image processing program, particularly to for generating raster format graphic data from vector format graphic data.
2. Description of the Background Art
Images configured by combining geometric graphics primitives such as points, straight lines, curves, rectangles, and ellipses are called vector graphics. On the other hand, images configured by arrays of points (pixels or dots) are called raster graphics.
Generally, images which are displayed on displays or are printed by printers are raster graphics. Therefore, when vector graphics are handled by these devices, processing for transforming those into raster graphics (i.e., rasterizing) is required. The processing cost of rasterizing is high, and a high-performance computer is required for rasterizing complicated vector graphics.
Because proper-resolution raster graphics can be generated every time vector graphics are displayed, there is no case in which the image qualities of contours and the like are deteriorated due to enlargement, reduction, and deformation of images. For this reason, artificial images such as illustrations and drawings, whose contours are clear, are handled as vector graphics in many cases. On the other hand, natural images such as photographs are handled as raster graphics in many cases.
As the most familiar example of the utility of vector graphics, fonts have been known. In early personal computers (hereinafter referred to as “PC”), raster format fonts (bitmap fonts) have been used due to the restrictions on the CPU performances. However, in bitmap fonts, it is necessary to store font data at each resolution, and thus, a large quantity of storage capacity is required.
In accordance with improvement in subsequent CPU performances, current PCs can display high-quality fonts with a less storage capacity in such a manner that vector format font (outline font) data independent of resolution are stored in advance, and fonts at appropriate resolution corresponding to a display or a printer are generated in each case. However, CPUs built into mobile telephones, car navigation systems, or the like have relatively low processing capacities. Hence, there has been an object that arithmetic costs required for rasterizing vector graphics are reduced.
In recent years, graphics processing units (GPUs) have been used in order to achieve the above object. In a rasterizing technique using the GPU, a curve is approximated by using a plurality of triangles. For this reason, when raster graphics are enlarged, the raster graphics have the rough looks. Because it is necessary to improve the approximate accuracy of a curve by using a large number of triangles in order to smoothly rasterize vector graphics, the increases in the storage capacity and the processing cost are inevitable.
To solve these problems, a reference (C. Loop and J. Blinn, Resolution Independent Curve Rendering using Programmable Graphics Hardware, SIGGRAPH 2005) proposes the method which can rasterise the curve always smoothly without depending on the resolution by processing a curve part of the vector graphics for each pixel near the curve not a triangular unit. Since neither the memory capacity nor the processing cost depend on the resolution in this technique, neither the memory capacity nor the processing cost increase.
The reference discloses an even-odd rule as the rasterise method. Here, two kinds of rules such as an even-odd rule and a non-zero rule are widely known as a filling rule when the figure of the vector format is rasterised.
The even-odd rule is as follows: a half-line is drawn from an arbitrary point of in closed region aiming at an arbitrary direction in each closed region inside the figure. The closed region is filled only when the number that the half-lines and contours of the figure intersect is odd number.
On the other hand, in the non-zero rule, a half-line is drawn from an arbitrary point in the closed region aiming at an arbitrary direction in each closed region in the figure, and the counter is incremented and/or decremented according to the direction where the contour of the figure intersects the half-line. For example, when the contour of the figure intersects the half-line from the left to the right for traveling direction of the half-line, the counter is incremented (+1), and when the contour thereof intersects the half-line from the right to the left, the counter is decremented (−1). Increment or decrement of the counter is performed as mentioned above for all intersections of the half-lines and the contours of the figure. As a result, only when the value of the counter is not 0, the closed region is filled.
In a simple figure, the filling result based on these two kinds of rules of the even-odd rule and non-zero rule becomes equal. However, the filling result might be different in a figure which includes the self-intersection and includes a different figure inside thereof (for example, a figure having a hole).
An image processing apparatus according to an aspect of the invention is characterized by comprising: a first data generation unit configured to generate triangular data by analyzing straight line contours and curved contours with respect to vector format graphic data and making the straight line contours and the curved contours triangles; a second data generation unit configured to generate stencil data from the triangular data on the basis of a drawing order of vertices of the triangular data generated from straight line contours and curved contours; and a third data generation unit configured to generate raster format graphic data with reference to the stencil data. The invention is not limited to only the invention of the apparatus as mentioned above, and may be applied to an invention of the method or the computer readable program.
Embodiments will be described with reference to the drawings.
The apparatus in an embodiment comprises a vector data storage unit 1, a triangular data generation unit 2, a triangular data storage unit 3, a stencil data generation unit 4, a stencil data storage unit 5, a raster data generation unit 6, a raster data storage unit 7, and a presentation unit 8. A data flow with respect to each block is also shown in
The vector data storage unit 1 stores vector format graphic data.
The triangular data generation unit 2 reads the vector format graphic data (Hereafter, it may be called as a “vector data”) stored in the vector data storage unit 1, and generates triangular data as will be described later in detail.
The triangular data storage unit 3 stores the triangular data generated by the triangular data generation unit 2.
The stencil data generation unit 4 reads the triangular data stored in the triangular data storage unit 3, and generates stencil data.
The stencil data storage unit 5 stores the stencil data generated by the stencil data generation unit 4.
The raster data generation unit 6 generates raster format data (Hereinafter, it may be called as a “raster data”) with reference to the stencil data stored in the stencil data storage unit 5 as will be described later in detail.
The raster data storage unit 7 stores the raster data generated by the raster data generation unit 6.
The presentation unit 8 presents the raster data stored in the raster data storage unit 7.
In
Hereinafter, when the vector graphics including the self-intersection and the parameter curve shown in
[Vector Data Storage Unit 1]
The vector data storage unit 1 stores vector data to be rasterized. As described in
[Triangular Data Generation Unit 2]
The vector data shown in
The triangular data generation unit 2 analyzes straight line contours of the vector data (step S201). The straight line contours configure a polygon which is obtained by connecting a starting point and an end point of the straight line and the curve included in the vector data by the segment as shown in
Next, making the straight line contours triangles is performed (step S202). Specifically, first, an arbitrary vertex among the plurality of vertices of the respective polygons configuring the straight line contours obtained in step S201 is selected (in this specification, this point is referred to as “pivot”). Then, a plurality of triangles with the pivot being as one vertex are generated such that the pivot and all the other vertices are connected with straight lines, and two vertices coupled to each other become a side of one triangle. The two vertices coupled to each other mean two vertices connected with a side of a polygon.
For example, in
And, the curved contours of the vector data are analyzed (step S203). In this processing, the curved contours is a group of the triangles in which three points of the starting point and the end point of the parameter curve and the control point are connected as shown in
Here, curved contours is classified into two kinds of curved contours shown in
The triangular data of the straight line contours (
In the above procedure, the triangles may be generated at the same time when analyzing the straight line contours, by carrying out the processing of step S201 and step 202 concurrently. The triangular data is configured from a position coordinate of three points which configures each triangular, texture coordinates, and connection relationship, etc. However, the triangular data configuration is not limited to this format, but may include other data which is used in the field of the graphics, generally.
[Stencil Data Generation Unit 4]
In the flowchart of
This stencil data is an image data with the same resolution as the resolution finally presented in the presentation unit 8. The stencil data is held in the stencil data storage unit 5. Moreover, the numerical value having about several bits is assigned to each pixel of the stencil data, and is initialized by 0 before all image processing for every frame.
The stencil data generation unit 4 reads and rasterises the triangular data of the straight line contours (
Rasterising based on the even-odd rule is described in the reference document. In the embodiment, to achieve rasterising based on the non-zero rule, the pixel value included in the triangle drawn in clockwise (hereinafter, it is called as a “clockwise triangle”) is incremented (+1) and the pixel value included in the triangle drawn in anti-clockwise (hereinafter, it is called as a “anti-clockwise triangle”) is decremented (−1) among pixels rasterised by the stencil data generation unit 4.
In this case, the clockwise triangle means a triangle that the three vectors in which the vertices are sequentially connected form a clockwise loop among each triangle projected to the projection plane. On the other hand, the triangle that forms an anti-clockwise loop on the projection plane is called as the anti-clockwise triangle. In this case, it is assumed that the direction of the vector is decided in the order of defining the vertices which are shown by the numerical order as shown in
The pixel value is not limited to +1 and −1 in the case of clockwise and anti-clockwise. The pixel value of a part which is not filled may be set to 0 or a predetermined value.
According to the setting as described above, the triangle formed by sequentially connecting points 0-2-4 is a clockwise triangle among three triangles of
On the other hand, only a pixel which belongs to the convex region of the curve is rasterised among pixels inside the triangular about the triangle of the curved contour. Then, as well as the case of the straight line contours, the pixel value included in a clockwise triangle is incremented (+1), and the pixel value included in an anti-clockwise triangle is decremented (−1) among pixels which belong to the convex region of the curve rasterised by the stencil data generation unit 4.
For example, among five triangles shown in
Then, when the rasterised result of the triangle of the straight line contours shown in
There is no order dependent in processing of rasterizing the triangular data. In
The stencil data (
As described above, the stencil data is image data having the same resolution as that finally presented to the presentation unit 8. However, the configuration of the stencil data is not limited to this format, and may include other data generally utilized in the field of computer graphics.
[Raster Data Generation Unit 6]
The raster data generation unit 6 generates raster data such that only areas whose pixel values are numeric values other than zero (the areas filled with black in
The raster data is image data having the same resolution as that finally presented to the presentation unit 8, and is stored in the raster data storage unit 7. Numeric values of about several bits are assigned to the respective pixels of the raster data for each of a plurality of color components (for example, RGBA).
As shown in
As described above, the raster data is image data having the same resolution as that finally presented to the presentation unit 8. However, the configuration of the raster data is not limited to this format, and may include other data generally utilized in the field of computer graphics.
[Presentation Unit 8]
The presentation unit 8 is configured by a display, a printer, or the like for presenting the raster data held in the raster data storage unit 7 to a user.
As mentioned above, according to the embodiment, the figure including the self-intersection can be rasterised on the basis of the non-zero rule. The figure including the self-intersection is exemplified in the above-mentioned embodiment, but the figure which includes a different figure inside thereof (for example, figure having the hole) can be rasterises on the basis of the non-zero rule similarly.
In the above-mentioned embodiment, as the examples of the curve contours, the figure including the secondary parameter curve is described as an example, but it is similarly applicable also in the tertiary parameter curve. The explanation thereof will be performed simply.
The figure shown in
The triangular data generation unit 2 analyzes the vector data shown in
For example, in the above-mentioned embodiment, a case where the raster format graphic data of the character is generated from the vector format graphic data is described. When other figure, for instance, the map data are given by the vector format, the present invention can also be applied to when the raster format graphic data is generated from the map data.
According to the present invention, it becomes possible to rasterise the figure including the self-intersection and the figure including a different figure internally (for example, the figure having hole) on the basis of the non-zero rule, and the pretreatment cost can be greatly reduced.
Additional advantages and modifications will readily occur to those skilled in the art. Therefore, the present invention in its broader aspects is not limited to the specific details, representative devices, and illustrated examples shown and described herein. Accordingly, various modifications may be made without departing from the spirit or scope of the general inventive concept as defined by the appended claims and their equivalents.
Patent | Priority | Assignee | Title |
10186053, | Apr 23 2014 | Samsung Electronics Co., Ltd. | Method and apparatus for performing path rendering |
Patent | Priority | Assignee | Title |
4901251, | Apr 03 1986 | GLOBALFOUNDRIES Inc | Apparatus and methodology for automated filling of complex polygons |
7239319, | Aug 27 2004 | Microsoft Technology Licensing, LLC | Rendering outline fonts |
20030016221, | |||
20040257607, | |||
JP11288261, | |||
JP200666274, | |||
JP6168339, | |||
JP772847, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Mar 19 2007 | Kabushiki Kaisha Toshiba | (assignment on the face of the patent) | / | |||
Mar 30 2007 | KOKOJIMA, YOSHIYUKI | Kabushiki Kaisha Toshiba | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 019370 | /0050 | |
Dec 22 2015 | Toshiba Corporation | SAMSUNG ELECTRONICS CO , LTD | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 037536 | /0743 |
Date | Maintenance Fee Events |
Jan 17 2013 | ASPN: Payor Number Assigned. |
Mar 26 2014 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Oct 07 2016 | ASPN: Payor Number Assigned. |
Oct 07 2016 | RMPN: Payer Number De-assigned. |
Mar 22 2018 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Apr 13 2022 | M1553: Payment of Maintenance Fee, 12th Year, Large Entity. |
Date | Maintenance Schedule |
Oct 26 2013 | 4 years fee payment window open |
Apr 26 2014 | 6 months grace period start (w surcharge) |
Oct 26 2014 | patent expiry (for year 4) |
Oct 26 2016 | 2 years to revive unintentionally abandoned end. (for year 4) |
Oct 26 2017 | 8 years fee payment window open |
Apr 26 2018 | 6 months grace period start (w surcharge) |
Oct 26 2018 | patent expiry (for year 8) |
Oct 26 2020 | 2 years to revive unintentionally abandoned end. (for year 8) |
Oct 26 2021 | 12 years fee payment window open |
Apr 26 2022 | 6 months grace period start (w surcharge) |
Oct 26 2022 | patent expiry (for year 12) |
Oct 26 2024 | 2 years to revive unintentionally abandoned end. (for year 12) |