+

CN107481200B - Image processing method and device - Google Patents

Image processing method and device Download PDF

Info

Publication number
CN107481200B
CN107481200B CN201710644878.2A CN201710644878A CN107481200B CN 107481200 B CN107481200 B CN 107481200B CN 201710644878 A CN201710644878 A CN 201710644878A CN 107481200 B CN107481200 B CN 107481200B
Authority
CN
China
Prior art keywords
pixel
line segment
edge
image
original image
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710644878.2A
Other languages
Chinese (zh)
Other versions
CN107481200A (en
Inventor
刘皓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710644878.2A priority Critical patent/CN107481200B/en
Publication of CN107481200A publication Critical patent/CN107481200A/en
Application granted granted Critical
Publication of CN107481200B publication Critical patent/CN107481200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a kind of image processing method and devices.Wherein, this method includes:Obtain a plurality of line segment of target object, wherein a plurality of line segment is used to indicate the edge contour of target object;The original image of target object is obtained, and draws a plurality of line segment on the original image, obtains the first image;Edge treated is carried out to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment;Image procossing is carried out to the edge contour of original image according to the edge pixel of a plurality of line segment in the first image, obtains the second image of target object, wherein image procossing is used to carry out edge contour smooth.The present invention solves the big technical problem of image procossing amount of the relevant technologies.

Description

Image processing method and device
Technical field
The present invention relates to image processing fields, in particular to a kind of image processing method and device.
Background technology
Fig. 1 is the schematic diagram according to the image procossing of SSAA in the related technology a kind of.As shown in Figure 1, in super sampling In antialiasing (SuperSampling Anti-Aliasing, referred to as SSAA), 16 circles are for indicating inside a pixel 16 sampled points, top dash area 1 and dash area 2 are the pixels covered.This is at a kind of most intuitive antialiasing Reason method has rendered one big figure, has then reduced sampling (downsampl), has been equivalent to inside each pixel and done one Even profile samples.
Each sampled point is carried out one time, can obtain 1 white sampled point (1,1,1), 1 light blue sampled point (0.77,0.77,1) and 14 yellow sampled points (1,1,0).The value of this last pixel is being averaged for this 16 sampled points, That is, ((1,1,1)+(0.77,0.77,1)+14* (1,1,0))/16=(0.98,0.98,0.125).The case where hits is N Under, it is N, the N number of color of occupied space (color)+N number of depth (depth) that PS, which executes number, in each pixel.
SSAA needs to be carried out an image procossing (PS), and save colors (color) and depth in each sampled point (depth), time and space expense are all surprising.Multiple sampling antialiasing (MultiSampling Anti-Aliasing, Referred to as MSAA) appearance significantly improve this point.For MSAA in each pixel Exactly-once PS, output color write-in is all In the sampling sheet tested by depth template view (depth-stencil).Before Microsoft software Shader Model3, PS Input be centainly derived from the center of pixel, added center (centric) interpolation later, the input attribute of PS can be triangle The center for all sampled points that shape is covered.As shown in Fig. 2, Fig. 2 is the image procossing according to a kind of MSAA in the related technology Schematic diagram.Wherein, circle is for indicating color samples (color sample), and cross is for indicating depth-sampling (depth sample).Left figure in Fig. 2 is the schematic diagram without the image procossing using central difference, and the right figure in Fig. 2 is using center The schematic diagram of the image procossing of difference.As shown in Figure 1, if not having center interpolation, two sampled points in dash area 1 will all Obtain the color of ethereal blue, the color of final pixel be (2* (0,0,1)+14* (1,1,0))/16=(0.875,0.875, 0.125).It is exactly more accurate light blue ((1,1,1)+(0.77,0.77,1))/2=if having centric interpolation (0.885,0.885,1), final pixel color be (2* (0.885,0.885,1)+14* (1,1,0))/16=(0.98,0.98, 0.125).In each pixel PS execute number be each cover the pixel triangle it is primary, the N number of color+N of occupied space A depth.
Although MSAA solves the problems, such as calculating, but amount of storage is still very big, especially sample rate to 8 or more.It covers Lid sampling antialiasing (CoverageSampling Anti-Aliasing, abbreviation CSAA) has decoupled the buffering of color/depth Device (buffer) and the buffer for covering (coverage), can be adopted with the less spaces color/depth to store original height The getable quality of sample number.For example, situation as shown in Figure 1, is rendered with CSAA 16x, a pixel will be divided into a left side There are 4 coverage sampled points in upper, upper right, lower-left and 4 pieces of bottom right region, every piece of region, but share the same color and As a result depth is exactly (0.25* (0.885,0.885,1)+0.25* (0.885,0.885,1)+3.75* (1,1,0))/4= (0.98,0.98,0.125).In each pixel PS execute number be each cover the pixel triangle it is primary, occupied space M color+M depth, M are less than N.
Deferred lighting technology (Deferred Lighting), which partly solves Deferred frames, can not use hardware MSAA The problem of, but the cost of one side scene or no small is rendered again.
Edge antialiasing (Edge AA) is to do an edge according to the difference degree of neighbours depth and normal (normal) Detection, each pixel can obtain a weight, for indicating " as the degree at edge ", according to this weight, so that it may to need The color of neighbor pixel is brought interpolation, obtains the effect of AA by the buffer for doing anti-aliasing.As shown in Figure 3.Wherein, Fig. 3 is root According to a kind of schematic diagram of the treatment effect of edge antialiasing of the relevant technologies.
Fig. 4 is the schematic diagram according to the image procossing of MLAA of the relevant technologies a kind of.As shown in figure 4, form antialiasing (Morphological Antialiasing, referred to as MLAA) does not calculate isopleth (isoline), but divides door other edge Class is summarized as several specific shapes such as Z, U, L, and Z and U can be decomposed into L.
These methods of above-mentioned SSAA, MSAA, CSAA need hardware directly to support, but the overhead brought can not be underestimated. It is surprising to the impact that memory space is brought that one side, which is them,.Especially on non-desktop platform, memory is natively few, such as Fruit also needs to just less qualified to do it if AA.On the other hand, these methods are all the original sides (primitive) to considering for " edge " Boundary can all waste many calculation amounts no matter whether this edge really needs AA.And MLAA calculation amounts are huge, to hardware performance It is required that higher.
For the big problem of above-mentioned image procossing amount, currently no effective solution has been proposed.
Invention content
An embodiment of the present invention provides a kind of image processing method and devices, at least to solve the image procossing of the relevant technologies Measure big technical problem.
One side according to the ... of the embodiment of the present invention provides a kind of image processing method.This method includes:Obtain target The a plurality of line segment of object, wherein a plurality of line segment is used to indicate the edge contour of target object;Obtain the original graph of target object Picture, and a plurality of line segment is drawn on the original image, obtain the first image;Edge is carried out to a plurality of line segment on the first image Reason, obtains the edge pixel of a plurality of line segment;According to the edge pixel of a plurality of line segment in the first image to the edge of original image Profile carries out image procossing, obtains the second image of target object, wherein image procossing is used to carry out edge contour smooth.
Another aspect according to the ... of the embodiment of the present invention additionally provides a kind of image processing apparatus.The device includes:First obtains Unit is taken, a plurality of line segment for obtaining target object, wherein a plurality of line segment is used to indicate the edge contour of target object;The Two acquiring units, the original image for obtaining target object, and a plurality of line segment is drawn on the original image, obtain the first figure Picture;First processing units obtain the edge picture of a plurality of line segment for carrying out edge treated to a plurality of line segment on the first image Element;Second processing unit, for the edge pixel according to a plurality of line segment in the first image to the edge contour of original image into Row image procossing obtains the second image of target object, wherein image procossing is used to carry out edge contour smooth.
In embodiments of the present invention, pass through a plurality of line segment of acquisition target object, wherein a plurality of line segment is for indicating target The edge contour of object;The original image of target object is obtained, and draws a plurality of line segment on the original image, obtains the first figure Picture;Edge treated is carried out to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment;According in the first image The edge pixel of a plurality of line segment carries out image procossing to the edge contour of original image, obtains the second image of target object, In, image procossing is used to carry out edge contour smooth, has achieved the purpose that handle image, due to this method be based on The processes pixel at edge, independent of hardware itself, and the treating capacity of the opposite pixel processing method based on entire picture wants low Very much, reach the technique effect for reducing image procossing amount to realize, and then the image procossing amount for solving the relevant technologies is big The technical issues of.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and is constituted part of this application, this hair Bright illustrative embodiments and their description are not constituted improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is the schematic diagram according to the image procossing of SSAA in the related technology a kind of;
Fig. 2 is the schematic diagram according to the image procossing of MSAA in the related technology a kind of;
Fig. 3 is the schematic diagram according to a kind for the treatment of effect of edge antialiasing of the relevant technologies;
Fig. 4 is the schematic diagram according to the image procossing of MLAA of the relevant technologies a kind of;
Fig. 5 is a kind of schematic diagram of the hardware environment of image processing method according to the ... of the embodiment of the present invention;
Fig. 6 is a kind of flow chart of image processing method according to the ... of the embodiment of the present invention;
Fig. 7 is a kind of edge pixel according to a plurality of line segment in the first image according to the ... of the embodiment of the present invention to original graph The edge contour of picture carries out the flow chart of the method for antialiasing processing;
Fig. 8 is a kind of area ratio for obtaining edge pixel and accounting for original image according to the ... of the embodiment of the present invention, obtains edge The flow chart of the method for the coverage rate of pixel;
Fig. 9 is a kind of flow chart of the method for directional information obtaining every line segment according to the ... of the embodiment of the present invention;
Figure 10 is a kind of flow chart of the method for a plurality of line segment obtaining target object according to the ... of the embodiment of the present invention;
Figure 11 is the method that a kind of a plurality of line segment on the first image according to the ... of the embodiment of the present invention carries out edge treated Flow chart;
Figure 12 is a kind of schematic diagram that object model is split into a plurality of line segment according to the ... of the embodiment of the present invention;
Figure 13 be it is according to the ... of the embodiment of the present invention it is a kind of draw object before picture and draw object after picture Schematic diagram;
Figure 14 is a kind of schematic diagram of the pixel of the edge extremity of segment of object according to the ... of the embodiment of the present invention;
Figure 15 is the schematic diagram of a kind of pixel and surrounding pixel according to the ... of the embodiment of the present invention;
Figure 16 is a kind of schematic diagram of object pixel according to the ... of the embodiment of the present invention;
Figure 17 is a kind of edge pixel according to the ... of the embodiment of the present invention showing by the area coverage ratio that original image includes It is intended to;
Figure 18 be it is according to the ... of the embodiment of the present invention it is a kind of according to coverage rate mixed edge pixel and edge pixel in target figure The schematic diagram of the pixel of on piece;
Figure 19 is a kind of schematic diagram of image processing apparatus according to the ... of the embodiment of the present invention;And
Figure 20 is a kind of structure diagram of terminal according to the ... of the embodiment of the present invention.
Specific implementation mode
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The every other embodiment that member is obtained without making creative work should all belong to the model that the present invention protects It encloses.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, " Two " etc. be for distinguishing similar object, without being used to describe specific sequence or precedence.It should be appreciated that using in this way Data can be interchanged in the appropriate case, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover It includes to be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment to cover non-exclusive Those of clearly list step or unit, but may include not listing clearly or for these processes, method, product Or the other steps or unit that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, a kind of embodiment of image processing method is provided.
Optionally, in the present embodiment, above-mentioned image processing method can be applied to as shown in Figure 5 by server 502 In the hardware environment constituted with terminal 504.Fig. 5 is a kind of hardware environment of image processing method according to the ... of the embodiment of the present invention Schematic diagram.As shown in figure 5, server 502 is attached by network and terminal 504, above-mentioned network includes but not limited to:Extensively Domain net, Metropolitan Area Network (MAN) or LAN, terminal 504 are not limited to PC, mobile phone, tablet computer etc..At the image of the embodiment of the present invention Reason method can be executed by server 502, can also be executed, be can also be by server 502 and terminal by terminal 504 504 common execution.Wherein, the image processing method that terminal 504 executes the embodiment of the present invention can also be by mounted thereto Client executes.
Fig. 6 is a kind of flow chart of image processing method according to the ... of the embodiment of the present invention.As shown in fig. 6, this method can be with Include the following steps:
Step S602 obtains a plurality of line segment of target object.
In the technical solution that the application above-mentioned steps S602 is provided, a plurality of line segment of target object is obtained, wherein a plurality of Line segment is used to indicate the edge contour of target object.
The image processing method of the embodiment can be the antialiasing method of the edge detection based on wire frame, can be used for pair The image of target object carries out rendering processing.Wherein, target object can be the object in reality scene.Obtain target object A plurality of line segment, a plurality of line segment are used to indicate the edge contour of target object, constitute the wire frame of target object, can be with two The list of line segments that vertex is one group, wherein the location information with group vertex is stored on every line segment.Optionally, with a plurality of line segment The edge contour of target object is formed according to latter linked form before certain sequence.
The target object of the embodiment, which has object model, the object model, to be carried out according to the edge contour of target object What modeling obtained.Deconsolidation process is carried out to the object model of target object, obtains the list of line segments for being one group with two vertex.
Step S604 obtains the original image of target object, and draws a plurality of line segment on the original image, obtains the first figure Picture.
In the technical solution that the application above-mentioned steps S604 is provided, the original image of target object is obtained, and original A plurality of line segment is drawn on image, obtains the first image.
After a plurality of line segment for obtaining target object, the original image of target object is obtained, it can be normal on picture Draw target object, obtain original image, and by before drawing target object picture and to draw after object include original graph The picture of picture is cached.
In the original image for getting target object, drawn on the original image in a manner of drawing line segment above-mentioned a plurality of Line segment can draw above-mentioned a plurality of line segment on the original image according to the location information of a plurality of line segment, and then obtain the first image.
Step S606 carries out edge treated to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment.
In the technical solution that the application above-mentioned steps S606 is provided, edge is carried out to a plurality of line segment on the first image Reason, obtains the edge pixel of a plurality of line segment.
The original image of target object is being obtained, and is drawing a plurality of line segment on the original image, after obtaining the first image, Edge treated can be carried out to the first image in pixel coloring device, for example, judging by the filter of pixel coloring device a plurality of Whether the pixel on line segment is edge pixel.Optionally, the pixel on every line segment is obtained, to the week of the pixel on every line segment The pixel for enclosing predetermined number is sampled, for example, 8 pixels around the pixel on every line segment are sampled, if through There is any one pixel in the pixel that over-sampling obtains not and is the pixel in the original image of target object, it is determined that every above-mentioned Pixel on line segment is the edge pixel of a plurality of line segment, that is, the pixel of edge line segment.
Step S608 carries out figure according to the edge pixel of a plurality of line segment in the first image to the edge contour of original image As processing, the second image of target object is obtained.
In the technical solution that the application above-mentioned steps S608 is provided, according to the edge picture of a plurality of line segment in the first image Element carries out image procossing to the edge contour of original image, obtains the second image of target object, wherein image procossing for pair Edge contour carries out smooth.
In 3-D view, the edge of the original image of the target object always more or less sawtooth having a generally triangular shape, And image procossing refers to just being carried out smoothly to the edge contour of original image.Edge is being carried out to a plurality of line segment on the first image Processing, after obtaining the edge pixel of a plurality of line segment, according to the edge pixel of a plurality of line segment in the first image to original image Edge contour carry out image procossing, obtain the second image of target object.
It optionally, can be in vertex shader VS with two vertex of every line segment when drawing above-mentioned a plurality of line segment Positional information calculation goes out the direction of every line segment, and the direction of every line segment and vertex position information are passed to pixel coloring device PS It send.Pixel coloring device PS in the edge pixel on handling every line segment, according to the position of the edge pixel on every line segment and The vertex position information of line segment, every line segment every line segment of direction calculating on edge pixel and line segment fore-and-aft distance and water Flat distance, and then the side of every line segment is obtained according to the fore-and-aft distance and horizontal distance of edge pixel and line segment on every line segment The area coverage ratio that edge pixel includes by original image, that is, according to the longitudinal direction of edge pixel and line segment on every line segment The coverage rate of edge pixel must be calculated in distance and horizontal distance.
The number of respective pixel that can be with overlay edge pixel and edge pixel on picture according to the coverage rate of edge pixel According to the edge line segment pixels after being handled, wherein picture for drawing target object, that is, obtain original image it Preceding picture.It is original according to the edge line segment pixels setting after processing after the edge line segment pixels after being handled The edge pixel of image, retains the data of the pixel in original image in addition to edge line segment pixels, and then obtains target object The second image, to reach optimization aim object original image jagged edges, obtain the purpose of the second exquisite image.
S602 to step S608 through the above steps, by obtaining a plurality of line segment of target object, a plurality of line segment is used for table Show the edge contour of target object;The original image for obtaining target object, and draws a plurality of line segment on the original image, obtains the One image;Edge treated is carried out to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment;According to the first image In the edge pixel of a plurality of line segment image procossing is carried out to the edge contour of original image, obtain the second figure of target object Picture, wherein image procossing is used to carry out smoothly, having achieved the purpose that handle image, due to this method to edge contour For the processes pixel based on edge, independent of hardware itself, and the processing of the opposite pixel processing method based on entire picture Amount wants much lower, reaches the technique effect for reducing image procossing amount to realize, and then solve at the images of the relevant technologies Reason measures big technical problem.
Optionally, image is carried out to the edge contour of original image according to the edge pixel of a plurality of line segment in the first image Processing, the second image for obtaining target object include:According to the edge pixel of a plurality of line segment in the first image to original image Edge contour carry out antialiasing processing, obtain the second image of target object.And antialiasing processing refers to just to original image Edge contour carry out smooth, that is, carrying out softening processing, the edge contour of original image is made to seem smoother, it is closer Target object, to improve target object image image quality, be allowed to soft.Side is being carried out to a plurality of line segment on the first image Edge processing, after obtaining the edge pixel of a plurality of line segment, according to the edge pixel of a plurality of line segment in the first image to original graph The edge contour of picture carries out antialiasing processing, obtains the second image of target object.
As an alternative embodiment, step S604, the original image for obtaining target object include:In Target Photo Upper drafting target object, obtains original image;Step S608, according to the edge pixel of a plurality of line segment in the first image to original The edge contour of image carries out antialiasing processing, and the second image for obtaining target object includes:It obtains edge pixel and accounts for original graph The area ratio of picture obtains the coverage rate of edge pixel;According to coverage rate to edge pixel and edge pixel on Target Photo Corresponding first pixel is overlapped, and obtains object pixel;On Target Photo, original image is repainted according to object pixel Edge contour, obtain the second image.
Fig. 7 is a kind of edge pixel according to a plurality of line segment in the first image according to the ... of the embodiment of the present invention to original graph The edge contour of picture carries out the flow chart of the method for antialiasing processing.As shown in fig. 7, this approach includes the following steps:
Step S701 obtains the area ratio that edge pixel accounts for original image, obtains the coverage rate of edge pixel.
In the technical solution that the application above-mentioned steps S701 is provided, the area ratio that edge pixel accounts for original image is obtained Example, obtains the coverage rate of edge pixel.
The embodiment is normally drawn target object on Target Photo, is obtained when obtaining the original image of target object Original image, the Target Photo are the picture before drawing target object, can be the background picture of original image.
The original image of target object is being obtained, and is drawing a plurality of line segment on the original image, after obtaining the first image, It obtains edge pixel and accounts for the area ratio of original image, the coverage rate of the area ratio namely edge pixel on the original image, Can by between the edge pixel and corresponding line segment of a plurality of line segment lateral distance and fore-and-aft distance to determine that edge pixel accounts for original The area ratio of image determines.
Step S702, according to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo carries out Superposition, obtains object pixel.
In the technical solution that the application above-mentioned steps S702 is provided, exist to edge pixel and edge pixel according to coverage rate Corresponding first pixel is overlapped on Target Photo, obtains object pixel.
The pixel in pixel and original image on Target Photo can influence the effect for the second pixel that final process obtains. The area ratio of original image is accounted in acquisition edge pixel, after obtaining the coverage rate of edge pixel, to the edge of every line segment Pixel and edge pixel corresponding first pixel on Target Photo are overlapped, to consider the pixel pair on Target Photo The influence of the edge pixel of every line segment.The embodiment is according to the coverage rate of edge pixel obtained above to edge pixel and side Edge pixel corresponding first pixel on Target Photo is overlapped, and object pixel is obtained, that is, according to edge obtained above The coverage rate of pixel to the data of edge pixel and the data of edge pixel, fold by corresponding first pixel on Target Photo Add, obtains the corresponding data of object pixel.
Step S703 repaints the edge contour of original image according to object pixel, obtains second on Target Photo Image.
In the technical solution that the application above-mentioned steps S703 is provided, on Target Photo, painted again according to object pixel The edge contour of original image processed obtains the second image.
According to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo is overlapped, obtain To after object pixel, on Target Photo, the corresponding pixel of edge contour of original image is reset by object pixel, To repaint the edge contour of original image according to object pixel, the second image is obtained, which can be opposite side edge Profile carries out the final image that antialiasing is handled.
The embodiment accounts for the area ratio of original image by obtaining edge pixel, obtains the coverage rate of edge pixel;It presses According to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo is overlapped, and obtains object pixel; On Target Photo, the edge contour of original image is repainted according to object pixel, obtains the second image, is realized according to The edge pixel of a plurality of line segment in one image carries out image procossing to the edge contour of original image, obtains the of target object The purpose of two images, the special antialiasing function for improving the precision of image procossing, and not depending on hardware itself, and then reduce Image procossing amount.
As an alternative embodiment, step S703, the edge wheel of original image is repainted according to object pixel Exterior feature, obtaining the second image includes:In original image, it sets the pixel value of corresponding second pixel of edge contour to target picture The pixel value of element;The pixel value for retaining the third pixel in original image in addition to the second pixel, obtains the second image.
In the original image of target object, the corresponding pixel of edge contour of target object is the second pixel, original graph Except the pixel before the second pixel is third pixel as in.In the edge contour for repainting original image according to object pixel, When obtaining the second image, the pixel value of the second pixel can be set to the pixel value of above-mentioned object pixel, retain third pixel Pixel value, to obtain the second image.Since the image processing method of the embodiment is the edge pixel based on original image It is handled, relative to the method handled based on whole image pixel, which can reduce image procossing amount.
As an alternative embodiment, step S702, according to coverage rate to edge pixel and edge pixel in target Corresponding first pixel is overlapped on picture, is obtained object pixel and is included:Determine first of edge pixel in object pixel The second weight of weight and the first pixel in object pixel, wherein the first weight and the second weight are allocated by coverage rate; Edge pixel and the first pixel are overlapped according to the first weight and the second weight, obtain object pixel, wherein including by mesh The pixel value of mark pixel is set as:The product of the pixel value of edge pixel and the first weight, the pixel value of the first pixel and the second power The sum of the product of weight.
According to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo is overlapped, obtain When to object pixel, according to first weight of the coverage rate allocations of edge pixel in object pixel and the first pixel in object pixel In the second weight determine that the first weight is A weights, then the second weight is for example, when coverage rate is more than default coverage rate (1-A).After determining the first weight and the second weight, according to the first weight and the second weight to edge pixel and the first pixel It is overlapped, obtains object pixel.Optionally, edge pixel and the first pixel are carried out according to the first weight and the second weight When superposition, the pixel value of object pixel can be set to:A*Wa+b*Wb, wherein a is used to indicate the pixel value of edge pixel, Wa is for indicating first weight of the edge pixel in object pixel, and b is for indicating pixel of first pixel in object pixel Value, above-mentioned pixel value belong to the pixel data of pixel, and Wb is for indicating second weight of first pixel in object pixel.
It should be noted that it is above-mentioned according to coverage rate to edge pixel and edge pixel corresponding first on Target Photo Pixel is overlapped, and the method for obtaining object pixel is only the preferred embodiment of the embodiment of the present invention, does not limit the present invention According to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo is overlapped only aforesaid way, It is any to may be implemented that corresponding first pixel on Target Photo is overlapped to edge pixel and edge pixel according to coverage rate, The method for obtaining object pixel, and achieve the effect that reduce image procossing amount method all within protection scope of the present invention, The explanation no longer illustrated one by one herein.
As an alternative embodiment, step S701, obtains the area ratio that edge pixel accounts for original image, obtains The coverage rate of edge pixel includes:Obtain the location information of the directional information and edge pixel of every line segment;According to every line segment Vertex position information, the geometrical relationship between the directional information and the location information of edge pixel of every line segment obtain edge picture Plain lateral distance and fore-and-aft distance between every line segment;Obtain the predeterminable area determined by lateral distance and fore-and-aft distance Area accounts for the ratio of the area of original image, obtains the coverage rate of edge pixel.
Fig. 8 is a kind of area ratio for obtaining edge pixel and accounting for original image according to the ... of the embodiment of the present invention, obtains edge The flow chart of the method for the coverage rate of pixel.As shown in figure 8, this approach includes the following steps:
Step S801 obtains the location information of the directional information and edge pixel of every line segment.
In the technical solution that the application above-mentioned steps S801 is provided, the directional information and edge pixel of every line segment are obtained Location information.
The embodiment can obtain the coverage rate of edge pixel in the coverage rate for obtaining edge pixel by tinter, Wherein, tinter includes vertex shader VS and pixel coloring device PS.The area ratio of original image is accounted in acquisition edge pixel, When obtaining the coverage rate of edge pixel, according in vertex shader VS with the position on two vertex of every line segment of target object Confidence, which ceases, calculates the directional information of every line segment, by the position of the directional information of every line segment and the edge pixel of every line segment Information is transmitted to tinter PS.
Step S802, according to the position of the vertex position information of every line segment, the directional information and edge pixel of every line segment Geometrical relationship between confidence breath obtains lateral distance and fore-and-aft distance between edge pixel and every line segment.
In the technical solution that the application above-mentioned steps S802 is provided, according to the vertex position information of every line segment, every Geometrical relationship between the directional information of line segment and the location information of edge pixel obtains between edge pixel and every line segment Lateral distance and fore-and-aft distance.
After the directional information of every line segment of acquisition and the location information of edge pixel, pixel coloring device PS can be passed through The edge pixel of every line segment is handled, it can be according to the vertex position information of every line segment, the directional information of every line segment and side Geometrical relationship between the location information of edge pixel is calculated between the edge pixel of every line segment and corresponding every line segment Lateral distance and fore-and-aft distance.
Step S803, the area for obtaining the predeterminable area determined by lateral distance and fore-and-aft distance account for the area of original image Ratio, obtain the coverage rate of edge pixel.
In the technical solution that the application above-mentioned steps S803 is provided, acquisition is determined pre- by lateral distance and fore-and-aft distance If the area in region accounts for the ratio of the area of original image, the coverage rate of edge pixel is obtained.
After getting lateral distance and the fore-and-aft distance between edge pixel and every line segment, according to edge pixel with Lateral distance and fore-and-aft distance between corresponding every line segment determine the area of predeterminable area, for example, determine by lateral distance, The area for the closing triangle that fore-and-aft distance and every line segment determine accounts for the ratio of the area of original image, that is, edge pixel The area coverage ratio for including by original image, to obtain the coverage rate of edge pixel.
The location information that the embodiment passes through the directional information and edge pixel of every line segment of acquisition;According to every line segment Geometrical relationship between vertex position information, the directional information and the location information of edge pixel of every line segment obtains edge pixel Lateral distance between every line segment and fore-and-aft distance;Obtain the face of the predeterminable area determined by lateral distance and fore-and-aft distance Product accounts for the ratio of the area of original image, obtains the coverage rate of edge pixel, has reached acquisition edge pixel and has accounted for original image Area ratio, obtains the coverage rate of edge pixel, so according to coverage rate to edge pixel and edge pixel on Target Photo Corresponding first pixel is overlapped, and obtains object pixel;On Target Photo, original image is repainted according to object pixel Edge contour, obtain the second image, achieved the effect that reduce image procossing amount.
As an alternative embodiment, step S801, the directional information for obtaining every line segment include:Obtain every line The vertex of the first vertex position information and the second vertex position information of section, every line segment includes the first vertex and the second vertex, Vertex position information includes the first vertex position information and the second vertex position information;Obtain the first vertex position by every line segment The directional information for every line segment that confidence ceases and the second vertex position information is calculated.
Fig. 9 is a kind of flow chart of the method for directional information obtaining every line segment according to the ... of the embodiment of the present invention.Such as Fig. 9 Shown, this approach includes the following steps:
Step S901 obtains the first vertex position information and the second vertex position information of every line segment.
In the technical solution that the application above-mentioned steps S901 is provided, obtain every line segment the first vertex position information and Second vertex position information, wherein the first vertex position information is used to indicate the position on the first vertex of every line segment, the second top Dot position information is used to indicate the position on the second vertex of every line segment, and the vertex of every line segment includes the first vertex and the second top Point, vertex position information include the first vertex position information and the second vertex position information.
The vertex of every line segment of the edge contour for indicating target object includes two vertex, which is one Group.When obtaining the directional information of every line segment, the first vertex position information and the second vertex position letter of every line segment are obtained Breath, first vertex position information are used to indicate the position on the first vertex of every line segment, and the second vertex position information is for referring to Show the position on the second vertex of every line segment, the vertex of every line segment includes the first vertex and the second vertex, vertex position information Including the first vertex position information and the second vertex position information.
Step S902 is obtained and is calculated by the first vertex position information and the second vertex position information of every line segment The directional information of every line segment.
In the technical solution that the application above-mentioned steps S902 is provided, the first vertex position information by every line segment is obtained The directional information for every line segment being calculated with the second vertex position information.
After the first vertex position information and the second vertex position information for obtaining every line segment, it can by vertex The side of line segment where color device calculates the first vertex and the second vertex with the first vertex position information and the second vertex position information To information, and then by pixel coloring device PS according to the vertex position information of every line segment, the directional information of every line segment and side Geometrical relationship between the location information of edge pixel is calculated between the edge pixel of every line segment and corresponding every line segment Lateral distance and fore-and-aft distance, the area of the predeterminable area determined by lateral distance and fore-and-aft distance account for the area of original image Ratio, obtain the coverage rate of edge pixel.
The first vertex position information and the second vertex position information that the embodiment passes through every line segment of acquisition, wherein the One vertex position information is used to indicate the position on the first vertex of every line segment, and the second vertex position information is used to indicate every line The vertex of the position on the second vertex of section, every line segment includes the first vertex and the second vertex, and vertex position information includes first Vertex position information and the second vertex position information;Obtain the first vertex position information and the second vertex position by every line segment The directional information for every line segment that information is calculated realizes the purpose for the directional information for obtaining every line segment.
As an alternative embodiment, step S602, a plurality of line segment for obtaining target object include:Obtain target pair The object module of elephant;The edge contour that object module indicates is processed into a plurality of line segment.
Figure 10 is a kind of flow chart of the method for a plurality of line segment obtaining target object according to the ... of the embodiment of the present invention.Such as figure Shown in 10, this approach includes the following steps:
Step S1001 obtains the object module of target object.
In the technical solution that the application above-mentioned steps S1001 is provided, the object module of target object is obtained, wherein mesh Mark model is used to indicate the edge contour of target object.
Target object is with the object module pre-established, the object module namely before being rendered to original image Object model, have certain shape, the edge contour for indicating target object.
The edge contour that object module indicates is processed into a plurality of line segment by step S1002.
In the technical solution that the application above-mentioned steps S1002 is provided, the edge contour that object module indicates is processed into A plurality of line segment.
After the object module for obtaining target object, deconsolidation process is carried out to object module, is split into two vertex For one group of list of line segments, a plurality of line segment includes list of line segments.
The object module that the embodiment passes through acquisition target object, wherein object module is used to indicate the side of target object Edge profile;The edge contour that object module indicates is processed into a plurality of line segment, has reached a plurality of line segment for obtaining target object Purpose.
As an alternative embodiment, in step S1002, the edge contour that object module indicates is processed into a plurality of After line segment, the vertex position information of every line segment is stored, wherein the vertex position information of every line segment is used to indicate every line The position on the vertex of section;Step S604, drawing a plurality of line segment on the original image includes:It includes every to draw on the original image Every line segment of the vertex position information of line segment.
After the edge contour for indicating object module is processed into a plurality of line segment, to the vertex position information of every line segment It is stored, that is, the location information with group vertex is stored on each vertex on every line segment, for example, line segment 1 includes top The location information of point P1 and vertex P2, vertex P1 are A information, and the location information of vertex P2 is B location information, then is deposited on the P1 of vertex Location A information and B location information are stored up, location A information and B location information, the vertex position letter of every line segment are stored on the P2 of vertex Breath is used to indicate the position on the vertex of every line segment.By being drawn on the original image according to the vertex position information of every line segment Every line segment draws a plurality of line segment to obtain the purpose of the first image on the original image to realize.
As an alternative embodiment, step S606, carries out edge treated to a plurality of line segment on the first image, obtains Edge pixel to a plurality of line segment includes:Obtain the 4th pixel in a plurality of line segment on the first image;Acquisition and the 4th pixel 5th pixel of adjacent predetermined number;There are at least one pixel it is not original image in the 5th pixel of predetermined number In the case of pixel, determine that the 4th pixel is the edge pixel of a plurality of line segment.
Figure 11 is the method that a kind of a plurality of line segment on the first image according to the ... of the embodiment of the present invention carries out edge treated Flow chart.As shown in figure 11, this approach includes the following steps:
Step S1101 obtains the 4th pixel in a plurality of line segment on the first image.
In the technical solution that the application above-mentioned steps S1101 is provided, the in a plurality of line segment on the first image is obtained Four pixels.
Edge treated is being carried out to a plurality of line segment on the first image, when obtaining the edge pixel of a plurality of line segment, is obtaining the 4th pixel of a plurality of line segment on one image, the 4th pixel be it is to be determined whether be edge pixel pixel.
Step S1102 acquires the 5th pixel of the predetermined number adjacent with the 4th pixel.
In the technical solution that the application above-mentioned steps S1102 is provided, the predetermined number adjacent with the 4th pixel is acquired 5th pixel.
After the 4th pixel in a plurality of line segment on obtaining the first image, default adjacent with the 4th pixel is acquired The 5th several pixels does not limit predetermined number herein for example, being sampled to 8 the 5th pixels around the 4th pixel.
Step S1103, there are the pixels that at least one pixel is not original image in the 5th pixel of predetermined number In the case of, determine that the 4th pixel is the edge pixel of a plurality of line segment.
In the technical solution that the application above-mentioned steps S1103 is provided, exist at least in the 5th pixel of predetermined number In the case that one pixel is not the pixel of original image, determine that the 4th pixel is the edge pixel of a plurality of line segment.
After the 5th pixel for acquiring the predetermined number adjacent with the 4th pixel, in the 5th pixel for judging predetermined number It is not the pixel of original image with the presence or absence of at least one pixel, if it is judged that existing at least in the 5th pixel of predetermined number One pixel is not the pixel of original image, that is, it is not the pixel of original image to have any one the 5th pixel, it is determined that the Four pixels are the edge pixel of a plurality of line segment.
The embodiment is by obtaining the 4th pixel in a plurality of line segment on the first image;Acquisition is adjacent with the 4th pixel 5th pixel of predetermined number;There are the pixels that at least one pixel is not original image in the 5th pixel of predetermined number In the case of, it determines that the 4th pixel is the edge pixel of a plurality of line segment, realizes and edge is carried out to a plurality of line segment on the first image Processing, obtains the purpose of the edge pixel of a plurality of line segment, and then according to the edge pixel of a plurality of line segment in the first image to original The edge contour of beginning image carries out image procossing, obtains the second image of target object, wherein image procossing is used for edge wheel Exterior feature carries out smoothly, having achieved the effect that reduce image procossing amount.
As an alternative embodiment, the second image is handled to obtain by image processing method based on tinter.
The image processing method of the embodiment can be the tinter processing method based on edge pixel, use coverage rate meter It calculates, the special antialiasing function of hardware itself is not depended on, while obtaining higher precision, relative to based on entire picture Pixel processing method has achieved the effect that reduce image procossing amount.
Embodiment 2
Technical scheme of the present invention is illustrated with reference to preferred embodiment.
This embodiment offers a kind of antialiasing methods of the edge detection based on wire frame.Target object is object, in advance Object data is handled, which has object model, the edge shape for indicating object.Before rendering in advance to object mould Type is split, and splits into the list of line segments for being one group with two vertex, and stored together on each vertex of every line segment The location information on group vertex.
Figure 12 is a kind of schematic diagram that object model is split into a plurality of line segment according to the ... of the embodiment of the present invention.Such as Figure 12 institutes Show, the object model of the embodiment is triangle ABC, carries out deconsolidation process to triangle ABC, obtains line segment Line1, line segment Line2, line segment line3.Every line segment includes two vertex, the line segment Line1 as shown in the bottom right figure in Figure 12, the line segment Line1 includes vertex P1 and vertex P2, wherein the location information of vertex P1 is A, and the location information of vertex P2 is P2.Vertex P1 The vertex position information A and C of line segment Line1 are stored with vertex P2, that is, it is expressed as P1 (A, C), P2 (A, C).
Figure 13 be it is according to the ... of the embodiment of the present invention it is a kind of draw object before picture and draw object after picture Schematic diagram.As shown in figure 13, after object model is split into a plurality of line segment, picture is cached.When caching picture, It is normal to draw object, the original image of object is obtained, the picture before drafting and the image cache after drafting object are got off. Wherein, the left figure in Figure 13 is the Target Photo O before drawing object, and right figure is the picture M drawn after object, by target figure Piece O and picture M are cached.
Figure 14 is a kind of schematic diagram of the pixel of the edge extremity of segment of object according to the ... of the embodiment of the present invention.Such as Figure 14 institutes Show, after obtaining picture M, the edge line segment of object is drawn on picture M, determines the pixel of the edge line segment, it can be in picture Judge whether the pixel on edge line segment is edge pixel using filter in plain tinter PS.On the picture M of the embodiment The edge pixel of edge line segment is the region represented by dash area shown in Figure 14.
Figure 15 is the schematic diagram of a kind of pixel and surrounding pixel according to the ... of the embodiment of the present invention.As shown in figure 15, in picture M In, by pixel filter determine in original image it is to be determined whether be edge pixel pixel to be determined it is (as shown in figure 15 Intermediate black is round), 8 pixels around pixel to be determined are sampled, if there is any one pixel is not that object is painted The pixel of system, then pixel to be determined is edge pixel, in order to remove the black line segment of the middle sections Figure 16.Wherein, scheme 16 be a kind of schematic diagram of object pixel according to the ... of the embodiment of the present invention, and the black line segment of middle section is not edge pixel.
Figure 17 is a kind of edge pixel according to the ... of the embodiment of the present invention showing by the area coverage ratio that original image includes It is intended to.As shown in figure 17, during the original image to object carries out antialiasing processing, vertex shader VS can be passed through The directional information that every line segment is calculated according to the two of every line segment vertex position informations, by the directional information of every line segment and Vertex position information is transferred to pixel coloring device PS.Pixel coloring device PS is when handling the edge pixel of every line segment, according to every The directional information of the location information of the edge pixel of line segment, the vertex position information of every line segment and every line segment calculates edge The lateral distance x and fore-and-aft distance y of pixel and line segment, and then edge pixel is obtained by object according to lateral distance x and fore-and-aft distance y The area coverage ratio that body includes, that is, obtaining the coverage rate of edge pixel.
Figure 18 be it is according to the ... of the embodiment of the present invention it is a kind of according to coverage rate mixed edge pixel and edge pixel in target figure The schematic diagram of the pixel of on piece.Left figure as shown in figure 18, wherein orange dash area is for indicating edge line segment pixels;Such as Middle graph shown in Figure 18, wherein Intermediate grey part is according to coverage rate mixed edge pixel and edge pixel in target figure The obtained object pixel of pixel on piece O;Right figure as shown in figure 18, wherein by the edge contour of the original image of picture M Corresponding pixel value is set as the corresponding pixel value of above-mentioned object pixel, and black portions remove edge for indicating in original image Pixel except the corresponding pixel of profile, and then obtain the final image after original image processing.
The image processing method of the embodiment is the antialiasing method that edge pixel is handled based on tinter, due to being based on Color device handles edge pixel, using the pixel of coverage rate mixed edge pixel and edge pixel on Target Photo, does not depend on hard The special antialiasing function of part itself, for the pixel processing method based on entire picture, image procossing amount want it is low very It is more, the crenellated phenomena of object edge is optimized, obtains more exquisite image, and then improve image processing efficiency.
It should be noted that for each method embodiment above-mentioned, for simple description, therefore it is all expressed as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the described action sequence because According to the present invention, certain steps can be performed in other orders or simultaneously.Secondly, those skilled in the art should also know It knows, embodiment described in this description belongs to preferred embodiment, and involved action and module are not necessarily of the invention It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but it is very much In the case of the former be more preferably embodiment.Based on this understanding, technical scheme of the present invention is substantially in other words to existing The part that technology contributes can be expressed in the form of software products, which is stored in a storage In medium (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal equipment (can be mobile phone, calculate Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 3
According to embodiments of the present invention, a kind of image processing apparatus for implementing above-mentioned image processing method is additionally provided. Figure 19 is a kind of schematic diagram of image processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 19, which may include:The One acquiring unit 10, second acquisition unit 20, first processing units 30 and second processing unit 40.
First acquisition unit 10, a plurality of line segment for obtaining target object, wherein a plurality of line segment is for indicating target pair The edge contour of elephant.
Second acquisition unit 20, the original image for obtaining target object, and a plurality of line segment is drawn on the original image, Obtain the first image.
First processing units 30 obtain a plurality of line segment for carrying out edge treated to a plurality of line segment on the first image Edge pixel.
Second processing unit 40, for the edge pixel according to a plurality of line segment in the first image to the edge of original image Profile carries out image procossing, obtains the second image of target object, wherein image procossing is used to carry out edge contour smooth.
Optionally, second processing unit 40 is used for the edge pixel according to a plurality of line segment in the first image to original image Edge contour carry out antialiasing processing, obtain the second image of target object.And antialiasing processing refers to just to original image Edge contour carry out it is smooth.
Optionally, second acquisition unit 20 includes:First drafting module, for drawing target object on Target Photo, Obtain original image;Second processing unit 40 includes:First acquisition module accounts for the area of original image for obtaining edge pixel Ratio obtains the coverage rate of edge pixel;Laminating module is used for according to coverage rate to edge pixel and edge pixel in target figure Corresponding first pixel of on piece is overlapped, and obtains object pixel;Second drafting module is used in Target Photo, according to mesh Mark pixel repaints the edge contour of original image, obtains the second image.
Optionally, the second drafting module includes:Submodule is set, is used in original image, edge contour is corresponding The pixel value of second pixel is set as the pixel value of object pixel;Retain submodule, the second picture is removed in original image for retaining The pixel value of third pixel except element, obtains the second image.
Optionally, first acquisition unit 10 includes:Second acquisition module, the object module for obtaining target object, In, object module is used to indicate the edge contour of target object;Processing module, at the edge contour that indicates object module Manage into a plurality of line segment.
Optionally, which further includes:Storage unit, it is a plurality of for being processed into the edge contour for indicating object module After line segment, the vertex position information of every line segment is stored, wherein the vertex position information of every line segment is used to indicate every line The position on the vertex of section;Second acquisition unit 20 includes:Third drafting module includes every line for drawing on the original image Every line segment of the vertex position information of section.
It should be noted that the first acquisition unit 10 in the embodiment can be used for executing in the embodiment of the present application 1 Step S602, the second acquisition unit 20 in the embodiment can be used for executing the step S604 in the embodiment of the present application 1, the reality It applies the first processing units 30 in example to can be used for executing the step S606 in the embodiment of the present application 1, second in the embodiment Processing unit 40 can be used for executing the step S608 in the embodiment of the present application 1.
The embodiment obtains a plurality of line segment of target object by first acquisition unit 10, wherein a plurality of line segment is used for table The edge contour for showing target object obtains the original image of target object by second acquisition unit 20, and on the original image A plurality of line segment is drawn, the first image is obtained, edge is carried out to a plurality of line segment on the first image by first processing units 30 Reason, obtains the edge pixel of a plurality of line segment, by second processing unit 40 according to the edge picture of a plurality of line segment in the first image Element carries out image procossing to the edge contour of original image, obtains the second image of target object, wherein image procossing for pair Edge contour carries out smoothly, having achieved the purpose that handle image, since this method is the processes pixel based on edge, no Dependent on hardware itself, and the treating capacity of the opposite pixel processing method based on entire picture wants much lower, is reached to realize To the technique effect for reducing image procossing amount, and then the technical problem that the image procossing amount that solves the relevant technologies is big.
Herein it should be noted that example and application scenarios phase that said units and module and corresponding step are realized Together, but it is not limited to the above embodiments disclosure of that.It should be noted that above-mentioned module can be transported as a part of of device Row can also pass through hardware realization, wherein hardware environment packet in hardware environment as shown in Figure 5 by software realization Include network environment.
Embodiment 4
According to embodiments of the present invention, a kind of server or terminal for implementing above-mentioned image processing method is additionally provided.
Figure 20 is a kind of structure diagram of terminal according to the ... of the embodiment of the present invention.As shown in figure 20, which may include: One or more (one is only shown in figure) processors 201, memory 203 and transmitting device 205 are (in such as above-described embodiment Sending device), as shown in figure 20, which can also include input-output equipment 207.
Wherein, memory 203 can be used for storing software program and module, such as the image processing method in the embodiment of the present invention Method and the corresponding program instruction/module of device, processor 201 by operation be stored in software program in memory 203 and Module realizes above-mentioned image processing method to perform various functions application and data processing.Memory 203 can wrap Include high speed random access memory, can also include nonvolatile memory, as one or more magnetic storage device, flash memory or Other non-volatile solid state memories of person.In some instances, memory 203 can further comprise remote relative to processor 201 The memory of journey setting, these remote memories can pass through network connection to terminal.The example of above-mentioned network includes but unlimited In internet, intranet, LAN, mobile radio communication and combinations thereof.
Above-mentioned transmitting device 205 is used to receive via network or transmission data, can be also used for processor with Data transmission between memory.Above-mentioned network specific example may include cable network and wireless network.In an example, Transmitting device 205 includes a network adapter (Network Interface Controller, NIC), can pass through cable It is connected with other network equipments with router so as to be communicated with internet or LAN.In an example, transmission dress It is radio frequency (Radio Frequency, RF) module to set 205, is used to wirelessly be communicated with internet.
Wherein, specifically, memory 203 is for storing application program.
Processor 201 can call the application program that memory 203 stores by transmitting device 205, to execute following steps Suddenly:
Obtain a plurality of line segment of target object, wherein a plurality of line segment is used to indicate the edge contour of target object;
The original image of target object is obtained, and draws a plurality of line segment on the original image, obtains the first image;
Edge treated is carried out to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment;
Image procossing is carried out to the edge contour of original image according to the edge pixel of a plurality of line segment in the first image, is obtained To the second image of target object, wherein image procossing is used to carry out edge contour smooth.
Processor 201 is additionally operable to execute following step:According to the edge pixel of a plurality of line segment in the first image to original The edge contour of image carries out antialiasing processing, obtains the second image of target object.And antialiasing processing refers to just to original The edge contour of image carries out smooth.
Processor 201 is additionally operable to execute following step:Target object is drawn on Target Photo, obtains original image;It obtains It takes edge pixel to account for the area ratio of original image, obtains the coverage rate of edge pixel;According to coverage rate to edge pixel and side Edge pixel corresponding first pixel on Target Photo is overlapped, and obtains object pixel;On Target Photo, according to target picture Element repaints the edge contour of original image, obtains the second image.
Processor 201 is additionally operable to execute following step:In original image, by the picture of corresponding second pixel of edge contour Plain value is set as the pixel value of object pixel;The pixel value for retaining the third pixel in original image in addition to the second pixel, obtains To the second image.
Processor 201 is additionally operable to execute following step:Determine first weight and first of the edge pixel in object pixel Second weight of the pixel in object pixel, wherein the first weight and the second weight are allocated by coverage rate;According to the first power Weight and the second weight are overlapped edge pixel and the first pixel, obtain object pixel, wherein include by the picture of object pixel Plain value is set as:The product of the product of the pixel value of edge pixel and the first weight, the pixel value of the first pixel and the second weight and.
Processor 201 is additionally operable to execute following step:Obtain the position letter of the directional information and edge pixel of every line segment Breath;According to several between the vertex position information of every line segment, the directional information and the location information of edge pixel of every line segment What lateral distance and fore-and-aft distance between Relation acquisition edge pixel and every line segment;It obtains by lateral distance and fore-and-aft distance The area of determining predeterminable area accounts for the ratio of the area of original image, obtains the coverage rate of edge pixel.
Processor 201 is additionally operable to execute following step:Obtain the first vertex position information and the second vertex of every line segment Location information, wherein the first vertex position information is used to indicate the position on the first vertex of every line segment, the second vertex position letter Breath is used to indicate the position on the second vertex of every line segment, and the vertex of every line segment includes the first vertex and the second vertex, vertex Location information includes the first vertex position information and the second vertex position information;It obtains and is believed by the first vertex position of every line segment The directional information for every line segment that breath and the second vertex position information are calculated.
Processor 201 is additionally operable to execute following step:Obtain the object module of target object, wherein object module is used for Indicate the edge contour of target object;The edge contour that object module indicates is processed into a plurality of line segment.
Processor 201 is additionally operable to execute following step:It is processed into a plurality of line segment in the edge contour for indicating object module Later, the vertex position information of every line segment is stored, wherein the vertex position information of every line segment is used to indicate every line segment The position on vertex;Every line segment of the vertex position information for including every line segment is drawn on the original image.
Processor 201 is additionally operable to execute following step:Obtain the 4th pixel in a plurality of line segment on the first image;Acquisition 5th pixel of the predetermined number adjacent with the 4th pixel;There are at least one pixels in the 5th pixel of predetermined number is not In the case of the pixel of original image, determine that the 4th pixel is the edge pixel of a plurality of line segment.
Using the embodiment of the present invention, a kind of scheme of image processing method is provided.By obtaining a plurality of of target object Line segment, wherein a plurality of line segment is used to indicate the edge contour of target object;The original image of target object is obtained, and original A plurality of line segment is drawn on image, obtains the first image;Edge treated is carried out to a plurality of line segment on the first image, obtains a plurality of line The edge pixel of section;The edge contour of original image is carried out at image according to the edge pixel of a plurality of line segment in the first image Reason, obtains the second image of target object, wherein image procossing be used to carry out edge contour it is smooth, reached to image into The purpose of row processing, since this method is the processes pixel based on edge, independent of hardware itself, and it is opposite based on entire figure The treating capacity of the pixel processing method of piece wants much lower, reaches the technique effect for reducing image procossing amount to realize, in turn Solves the big technical problem of the image procossing amount of the relevant technologies.
Optionally, the specific example in the present embodiment can refer to the example described in above-described embodiment, the present embodiment Details are not described herein.
It will appreciated by the skilled person that structure shown in Figure 20 is only to illustrate, terminal can be smart mobile phone (such as Android phone, iOS mobile phones), tablet computer, palm PC and mobile internet device (Mobile Internet Devices, MID), the terminal devices such as PAD.Figure 20 it does not cause to limit to the structure of above-mentioned electronic device.For example, terminal is also It may include more either less components (such as network interface, display device) than shown in Figure 20 or have and Figure 20 institutes Show different configurations.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can To be completed come command terminal device-dependent hardware by program, which can be stored in a computer readable storage medium In, storage medium may include:Flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), disk or CD etc..
Embodiment 5
The embodiments of the present invention also provide a kind of storage mediums.Optionally, in the present embodiment, above-mentioned storage medium can For executing the program code of image processing method.
Optionally, in the present embodiment, above-mentioned storage medium can be located at multiple in network shown in above-described embodiment On at least one of network equipment network equipment.
Optionally, in the present embodiment, storage medium is arranged to store the program code for executing following steps:
Obtain a plurality of line segment of target object, wherein a plurality of line segment is used to indicate the edge contour of target object;
The original image of target object is obtained, and draws a plurality of line segment on the original image, obtains the first image;
Edge treated is carried out to a plurality of line segment on the first image, obtains the edge pixel of a plurality of line segment;
Image procossing is carried out to the edge contour of original image according to the edge pixel of a plurality of line segment in the first image, is obtained To the second image of target object, wherein image procossing is used to carry out edge contour smooth.
Optionally, storage medium is also configured to store the program code for executing following steps:According to the first image In the edge pixel of a plurality of line segment antialiasing processing is carried out to the edge contour of original image, obtain the second figure of target object Picture.And antialiasing processing refers to just being carried out smoothly to the edge contour of original image.
Optionally, storage medium is also configured to store the program code for executing following steps:On Target Photo Target object is drawn, original image is obtained;The area ratio that edge pixel accounts for original image is obtained, the covering of edge pixel is obtained Rate;According to coverage rate, to edge pixel and edge pixel, corresponding first pixel on Target Photo is overlapped, and obtains target Pixel;On Target Photo, the edge contour of original image is repainted according to object pixel, obtains the second image.
Optionally, storage medium is also configured to store the program code for executing following steps:In original image, Set the pixel value of corresponding second pixel of edge contour to the pixel value of object pixel;Retain and removes the second picture in original image The pixel value of third pixel except element, obtains the second image.
Optionally, storage medium is also configured to store the program code for executing following steps:Determine edge pixel The second weight of the first weight and the first pixel in object pixel in object pixel, wherein the first weight and the second power Weight is allocated by coverage rate;Edge pixel and the first pixel are overlapped according to the first weight and the second weight, obtain mesh Mark pixel, wherein include setting the pixel value of object pixel to:The product of the pixel value of edge pixel and the first weight, first The product of the pixel value of pixel and the second weight and.
Optionally, storage medium is also configured to store the program code for executing following steps:Obtain every line segment Directional information and edge pixel location information;According to the vertex position information of every line segment, the directional information of every line segment Geometrical relationship between the location information of edge pixel obtains lateral distance and longitudinal direction between edge pixel and every line segment Distance;The area for the predeterminable area that acquisition is determined by lateral distance and fore-and-aft distance accounts for the ratio of the area of original image, obtains The coverage rate of edge pixel.
Optionally, storage medium is also configured to store the program code for executing following steps:Obtain every line segment The first vertex position information and the second vertex position information, wherein the first vertex position information is used to indicate every line segment The position on the first vertex, the second vertex position information are used to indicate the position on the second vertex of every line segment, the top of every line segment Point includes the first vertex and the second vertex, and vertex position information includes the first vertex position information and the second vertex position information; Believe in the direction for obtaining every line segment being calculated by the first vertex position information and the second vertex position information of every line segment Breath.
Optionally, storage medium is also configured to store the program code for executing following steps:Obtain target object Object module, wherein object module is used to indicate the edge contour of target object;At the edge contour that object module is indicated Manage into a plurality of line segment.
Optionally, storage medium is also configured to store the program code for executing following steps:By object module The edge contour of expression is processed into after a plurality of line segment, stores the vertex position information of every line segment, wherein the top of every line segment Dot position information is used to indicate the position on the vertex of every line segment;Drafting includes the vertex position of every line segment on the original image Every line segment of information.
Optionally, storage medium is also configured to store the program code for executing following steps:Obtain the first image On a plurality of line segment in the 4th pixel;Acquire the 5th pixel of the predetermined number adjacent with the 4th pixel;In predetermined number In 5th pixel there are the pixel that at least one pixel is not original image in the case of, determine that the 4th pixel is a plurality of line segment Edge pixel.
Optionally, the specific example in the present embodiment can refer to the example described in above-described embodiment, the present embodiment Details are not described herein.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to:USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disc or The various media that can store program code such as CD.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
If the integrated unit in above-described embodiment is realized in the form of SFU software functional unit and as independent product Sale in use, can be stored in the storage medium that above computer can be read.Based on this understanding, skill of the invention Substantially all or part of the part that contributes to existing technology or the technical solution can be with soft in other words for art scheme The form of part product embodies, which is stored in a storage medium, including some instructions are used so that one Platform or multiple stage computers equipment (can be personal computer, server or network equipment etc.) execute each embodiment institute of the present invention State all or part of step of method.
In the above embodiment of the present invention, all emphasizes particularly on different fields to the description of each embodiment, do not have in some embodiment The part of detailed description may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed client, it can be by others side Formula is realized.Wherein, the apparatus embodiments described above are merely exemplary, for example, the unit division, only one Kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component can combine or It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it Between coupling, direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, unit or module It connects, can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme 's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated list The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (13)

1. a kind of image processing method, which is characterized in that including:
Obtain a plurality of line segment of target object, wherein a plurality of line segment is used to indicate the edge contour of the target object;
The original image of the target object is obtained, and draws a plurality of line segment on the original image, obtains the first figure Picture;
Edge treated is carried out to a plurality of line segment in described first image, obtains the edge pixel of a plurality of line segment;
Figure is carried out to the edge contour of the original image according to the edge pixel of a plurality of line segment in described first image As processing, the second image of the target object is obtained, wherein described image processing is for the edge wheel to the original image Exterior feature carries out smooth;
Wherein, edge wheel of the edge pixel according to a plurality of line segment in described first image to the original image Exterior feature carries out image procossing, and second image for obtaining the target object includes:According to described more in described first image The edge pixel of line segment carries out antialiasing processing to the edge contour of the original image, obtains the described of the target object Second image;
Wherein, according to the edge pixel of a plurality of line segment in described first image to the edge contour of the original image into The processing of row antialiasing, second image for obtaining the target object include:It obtains the edge pixel and accounts for the original graph The area ratio of picture obtains the coverage rate of the edge pixel;According to the coverage rate to the edge pixel and the edge Pixel corresponding first pixel on Target Photo is overlapped, and obtains object pixel;On the Target Photo, according to described Object pixel repaints the edge contour of the original image, obtains second image;
Wherein, the area ratio that the edge pixel accounts for the original image is obtained, the coverage rate packet of the edge pixel is obtained It includes:Obtain the location information of the directional information and the edge pixel of every line segment;According to the vertex position of every line segment Geometrical relationship between information, the directional information and the location information of the edge pixel of every line segment obtains the edge Lateral distance between pixel and every line segment and fore-and-aft distance;It obtains true by the lateral distance and the fore-and-aft distance The area of fixed predeterminable area accounts for the ratio of the area of the original image, obtains the coverage rate of the edge pixel.
2. according to the method described in claim 1, it is characterized in that,
The original image for obtaining the target object includes:The target object is drawn on the Target Photo, is obtained described Original image.
3. according to the method described in claim 1, it is characterized in that, repainting the original image according to the object pixel Edge contour, obtaining second image includes:
In the original image, it sets the pixel value of corresponding second pixel of the edge contour to the object pixel Pixel value;
The pixel value for retaining the third pixel in the original image in addition to second pixel obtains second image.
4. according to the method described in claim 1, it is characterized in that, according to the coverage rate to the edge pixel and the side Edge pixel corresponding first pixel on Target Photo is overlapped, and obtaining the object pixel includes:
Determine first weight and first pixel of the edge pixel in the object pixel in the object pixel The second weight, wherein first weight and second weight are allocated by the coverage rate;
The edge pixel and first pixel are overlapped according to first weight and second weight, obtain institute State object pixel, wherein include setting the pixel value of the object pixel to:The pixel value of the edge pixel and described the The product of one weight, the product of pixel value and second weight of first pixel and.
5. according to the method described in claim 1, it is characterized in that, the directional information for obtaining every line segment includes:
Obtain the first vertex position information and the second vertex position information of every line segment, wherein the first vertex position Confidence breath is used to indicate the position on the first vertex of every line segment, and second vertex position information is used to indicate described every The position on the second vertex of line segment, the vertex of every line segment include first vertex and second vertex, described Vertex position information includes first vertex position information and second vertex position information;
Acquisition is calculated every described by the first vertex position information and the second vertex position information of every line segment The directional information of line segment.
6. according to the method described in claim 1, it is characterized in that, a plurality of line segment for obtaining the target object includes:
Obtain the object module of the target object, wherein the object module is used to indicate the edge wheel of the target object It is wide;
The edge contour that the object module indicates is processed into a plurality of line segment.
7. according to the method described in claim 6, it is characterized in that,
After the edge contour for indicating the object module is processed into a plurality of line segment, the method further includes: Store the vertex position information of every line segment, wherein the vertex position information of every line segment is used to indicate the every line The position on the vertex of section;
The a plurality of line segment is drawn on the original image includes:It includes every line segment to be drawn on the original image Vertex position information every line segment.
8. method as claimed in any of claims 1 to 7, which is characterized in that described in described first image A plurality of line segment carries out edge treated, and the edge pixel for obtaining a plurality of line segment includes:
Obtain the 4th pixel in a plurality of line segment in described first image;
Acquire the 5th pixel of the predetermined number adjacent with the 4th pixel;
There are in the case of the pixel that at least one pixel is not the original image in the 5th pixel of the predetermined number, Determine that the 4th pixel is the edge pixel of a plurality of line segment.
9. method as claimed in any of claims 1 to 7, which is characterized in that second image is by described image Processing method handles to obtain based on tinter.
10. a kind of image processing apparatus, which is characterized in that including:
First acquisition unit, a plurality of line segment for obtaining target object, wherein a plurality of line segment is for indicating the target The edge contour of object;
Second acquisition unit, the original image for obtaining the target object, and draw on the original image described more Line segment, obtains the first image;
First processing units obtain described a plurality of for carrying out edge treated to a plurality of line segment in described first image The edge pixel of line segment;
Second processing unit, for the edge pixel according to a plurality of line segment in described first image to the original image Edge contour carry out image procossing, obtain the second image of the target object, wherein described image processing for described The edge contour of original image carries out smooth;
Wherein, the second processing unit includes:First acquisition module accounts for the original image for obtaining the edge pixel Area ratio, obtain the coverage rate of the edge pixel;Laminating module is used for according to the coverage rate to the edge pixel Corresponding first pixel is overlapped on Target Photo with the edge pixel, obtains object pixel;Second drafting module is used In on the Target Photo, the edge contour of the original image is repainted according to the object pixel, obtains described Two images;
First acquisition module is additionally operable to obtain the location information of the directional information and the edge pixel of every line segment;It presses According to the vertex position information of every line segment, the directional information of every line segment and the edge pixel location information it Between geometrical relationship obtain lateral distance and fore-and-aft distance between the edge pixel and every line segment;It obtains by described The area for the predeterminable area that lateral distance and the fore-and-aft distance determine accounts for the ratio of the area of the original image, obtains described The coverage rate of edge pixel.
11. device according to claim 10, which is characterized in that
Second acquisition unit includes:First drafting module obtains institute for drawing the target object on the Target Photo State original image.
12. according to the devices described in claim 11, which is characterized in that the second drafting module includes:
Submodule is set, in the original image, the pixel value of corresponding second pixel of the edge contour to be arranged For the pixel value of the object pixel;
Retain submodule, the pixel value for retaining the third pixel in the original image in addition to second pixel obtains To second image.
13. device according to claim 10, which is characterized in that first acquisition unit includes:
Second acquisition module, the object module for obtaining the target object, wherein the object module is for indicating described The edge contour of target object;
Processing module, the edge contour for indicating the object module are processed into a plurality of line segment.
CN201710644878.2A 2017-07-31 2017-07-31 Image processing method and device Active CN107481200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710644878.2A CN107481200B (en) 2017-07-31 2017-07-31 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710644878.2A CN107481200B (en) 2017-07-31 2017-07-31 Image processing method and device

Publications (2)

Publication Number Publication Date
CN107481200A CN107481200A (en) 2017-12-15
CN107481200B true CN107481200B (en) 2018-09-18

Family

ID=60598094

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710644878.2A Active CN107481200B (en) 2017-07-31 2017-07-31 Image processing method and device

Country Status (1)

Country Link
CN (1) CN107481200B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119516036A (en) 2018-04-12 2025-02-25 辉达公司 Add greater realism to computer-generated images by smoothing jagged edges
US20190318455A1 (en) * 2018-04-12 2019-10-17 Nvidia Corporation Adding greater realism to a computer-generated image by smoothing jagged edges within the image in an efficient manner
CN110148147B (en) * 2018-11-07 2024-02-09 腾讯大地通途(北京)科技有限公司 Image detection method, image detection device, storage medium and electronic device
WO2022047701A1 (en) * 2020-09-03 2022-03-10 深圳市大疆创新科技有限公司 Image processing method and apparatus
CN115131223A (en) * 2021-03-29 2022-09-30 深圳开立生物医疗科技股份有限公司 Image edge smoothing method and device and related equipment
CN113837955B (en) * 2021-08-17 2024-08-02 每平每屋(上海)科技有限公司 Image antialiasing processing method and electronic equipment
CN116594582B (en) * 2022-06-22 2024-03-22 格兰菲智能科技(北京)有限公司 Image display method, apparatus, computer device and storage medium

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005100176A (en) * 2003-09-25 2005-04-14 Sony Corp Image processor and its method
CN100463003C (en) * 2006-03-16 2009-02-18 腾讯科技(深圳)有限公司 Method and apparatus for implementing wash painting style
US8605086B2 (en) * 2008-07-03 2013-12-10 Nvidia Corporation Hybrid multisample/supersample antialiasing
CN101458825B (en) * 2009-01-04 2011-07-20 腾讯科技(深圳)有限公司 Collision detection method implementing 3D animation model in display card, display card and system therefor
CN102289786B (en) * 2011-09-01 2013-08-21 青岛海信信芯科技有限公司 Edge anti-aliasing method and device for image scaling
US9171386B2 (en) * 2011-10-11 2015-10-27 Microsoft Technology Licensing, Llc Caching coverage values for rendering text using anti-aliasing techniques
CN104715454B (en) * 2013-12-14 2017-10-24 中国航空工业集团公司第六三一研究所 A kind of antialiasing figure stacking method
CN105574817A (en) * 2014-10-17 2016-05-11 华为技术有限公司 Image anti-aliasing method and apparatus
CN104658030B (en) * 2015-02-05 2018-08-10 福建天晴数码有限公司 The method and apparatus of secondary image mixing
CN106600544A (en) * 2016-11-10 2017-04-26 北京暴风魔镜科技有限公司 Anti-aliasing method and anti-aliasing system based on texture mapping

Also Published As

Publication number Publication date
CN107481200A (en) 2017-12-15

Similar Documents

Publication Publication Date Title
CN107481200B (en) Image processing method and device
CN110211218B (en) Picture rendering method and device, storage medium and electronic device
CN103503032B (en) Veining in graphic hardware
CN111080780B (en) Edge processing method and device for virtual character model
CN106055295B (en) Image processing method, picture method for drafting and device
CN107045729B (en) A kind of image rendering method and device
CN107610131A (en) A kind of image cropping method and image cropping device
CN109544658B (en) Map rendering method and device, storage medium and electronic device
CN107358649A (en) The treating method and apparatus of terrain file
CN107154063A (en) The shape method to set up and device in image shows region
CN105549817B (en) The generation method of font packet, the methods of exhibiting of device and figure, device
CN108932745B (en) Image drawing method and device, terminal equipment and computer readable storage medium
CN109344352A (en) Page loading method, device and electronic equipment
CN110223372A (en) Method, apparatus, equipment and the storage medium of model rendering
CN104658030A (en) Secondary image mixing method and apparatus
US20160110914A1 (en) Graphic processing unit, a graphic processing system including the same, and an anti-aliasing method using the same
CN109448123A (en) The control method and device of model, storage medium, electronic equipment
CN109448077A (en) A kind of method, apparatus, equipment and storage medium that multi-layer image merges
CN110866965A (en) Mapping drawing method and device for three-dimensional model
CN105787874B (en) Method and device for mosaic processing of screenshot
CN107123077A (en) The rendering intent and device of object
CN101908216A (en) Method and device for realizing vector fonts
CN108230430A (en) The processing method and processing device of cloud layer shade figure
CN109859258A (en) Interface processing method and device, electronic equipment
WO2016040717A2 (en) Text realization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载