CN105654531B - Method and device for drawing image contour - Google Patents

Method and device for drawing image contour Download PDF

Info

Publication number
CN105654531B
CN105654531B CN201511021247.2A CN201511021247A CN105654531B CN 105654531 B CN105654531 B CN 105654531B CN 201511021247 A CN201511021247 A CN 201511021247A CN 105654531 B CN105654531 B CN 105654531B
Authority
CN
China
Prior art keywords
pixel
profile
image
drafting
starting point
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
CN201511021247.2A
Other languages
Chinese (zh)
Other versions
CN105654531A (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.)
Beijing Jupiter Technology Co ltd
Original Assignee
Beijing Kingsoft Internet Security Software 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 Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201511021247.2A priority Critical patent/CN105654531B/en
Publication of CN105654531A publication Critical patent/CN105654531A/en
Application granted granted Critical
Publication of CN105654531B publication Critical patent/CN105654531B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Landscapes

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

Abstract

The embodiment of the invention provides a method and a device for drawing an image contour. The specific implementation mode of the method comprises the following steps: when an image contour drawing instruction is detected, determining coordinates of pixel points in the image contour by adopting an edge detection algorithm; determining a starting point of contour drawing and a drawing direction corresponding to the starting point according to coordinates of pixel points in the image contour, a position input by a current user and a direction of drawing operation of the current user, and determining a set number of pixel points in the drawing direction; and when the last pixel point in the set number of pixel points is the termination point of the image contour, determining the target image contour according to the pixel points in the stored target image contour and the pixel points between the starting point and the termination point, otherwise, taking the set number of pixel points as the pixel points in the target image contour, storing the pixel points, and taking the last pixel point as the starting point to execute the determination process of the drawing direction. By applying the embodiment, the outline of the image can be drawn more accurately.

Description

A kind of method for drafting and device of image outline
Technical field
The present invention relates to technical field of image processing, in particular to the method for drafting and device of a kind of image outline.
Background technique
Image cropping is a basic function of graph and image processing application program (App), currently on the market many products It can accomplish this point.For example, user wants some self-timer head portrait on current image to cut down, it is necessary to first by mesh Logo image i.e. determine by the self-timer head portrait, then reapplies cutting implement and is cut out.Shape is generally utilized in the prior art Masking-out determines target image, is then cut out again, and shape masking-out includes the various shapes such as round, oval, star-like.Utilize shape The image that this mode of shape masking-out is cut out is the shape of shape masking-out.But in practical applications, the profile of target image is big Majority be it is irregular, when target image may be personage's head portrait, intersect connected multiple irregular images etc., such as a few individuals The group photo image of object, tree for having a large amount of leaves etc. so irregular image when, will be unable to accurately using shape masking-out Determine target image, poor user experience.
In the prior art, the profile of the free Freehandhand-drawing draw target image of graph and image processing App can also be utilized, The profile of target image is drawn using mouse, or is drawn on mobile phone or tablet computer screen using finger, is recycled Cutting implement is cut out.In this mode, although what user can be drawn with arbitrarily drawn image outline, free Freehandhand-drawing Target image profile is inaccurate, current image roughly can only be cut into the shape that user wants, user experience is poor.
Summary of the invention
The method for drafting and device for being designed to provide a kind of image outline of the embodiment of the present invention, can be more accurately Drawing image profile.
In order to achieve the above object, the invention discloses a kind of method for drafting of image outline, it is applied to that there is display screen Electronic equipment, which comprises
A. true using edge detection algorithm in the picture of profile to be drawn when detecting that image outline draws instruction Determine the coordinate of pixel in image outline;
B. the position inputted according to the coordinate of pixel in described image profile and active user, determines in image outline The starting point that profile is drawn;
C. the direction that operation is drawn according to active user, determines that is drawn in the corresponding image outline of the starting point draws Direction processed, and setting quantity pixel is determined in image outline according to the drafting direction;
D. judge whether the last one corresponding pixel of the drafting direction is described in the setting quantity pixel The terminating point of image outline, if it is, being risen according in the pixel and described image profile in the target image profile of preservation The pixel in image outline between initial point and terminating point, determines target image profile, otherwise, by the setting quantity picture Vegetarian refreshments executes step C as starting point as the pixel in target image profile and preservation, by the last one described pixel.
Preferably, the position inputted according to the coordinate of pixel in described image profile and active user, in image The starting point of determining profile drafting includes: in profile
According to the position that active user inputs, the coordinate of the position is obtained;
According to the coordinate of pixel in the coordinate of the position and described image profile, the position and described image are determined The distance between each pixel in profile;
By the pixel in the corresponding image outline of minimum range, it is determined as the starting point of profile drafting.
Preferably, the pixel by the corresponding image outline of minimum range, is determined as the starting point of profile drafting Include:
Judge whether the minimum range is less than default first distance threshold value, if so, by the corresponding image of minimum range Pixel in profile is determined as the starting point of profile drafting.
Preferably, the method also includes:
When the minimum range is not less than default first distance threshold value, prompt information is exported.
Preferably, it is described according to active user draw operation direction, determine in the corresponding image outline of the starting point into The drafting direction that row is drawn, comprising:
The direction that operation is drawn according to active user determines that active user draws the corresponding angle in direction of operation;
According to the corresponding each angular range in each drafting direction saved for the starting point, where determining the angle Angular range is drawn what the corresponding drafting direction of the angular range was determined as drawing in the corresponding image outline of the starting point Direction processed.
Preferably, the last one corresponding pixel of the drafting direction is in the judgement setting quantity pixel The no terminating point for described image profile, comprising:
Determine the coordinate of the last one corresponding pixel of drafting direction in the setting quantity pixel;
Judge the coordinate of the last one pixel is with the distance between the coordinate of starting point that the profile is drawn It is no to be less than default second distance threshold value;
If so, determining that the last one described pixel is terminating point, otherwise, it determines the last one pixel non-end Stop.
Preferably, the position inputted according to the coordinate of pixel in described image profile and active user, in image Before determining the starting point that profile is drawn in profile, the method also includes:
According to the coordinate of pixel in determining image outline, the contour wide two-value of picture with profile to be drawn is generated The black and white picture of change, the image outline of the picture comprising the profile to be drawn in the black and white picture of the binaryzation.
Preferably, described using the setting quantity pixel as the pixel in target image profile and preservation, packet It includes:
Judge the setting quantity pixel whether is preserved in target image profile, if it is not, then by the setting Quantity pixel is as the pixel in target image profile and preservation.
Preferably, the method also includes:
If being saved the setting quantity pixel in target image profile, the setting number of preservation is deleted Measure a pixel.
Preferably, the edge detection algorithm includes triumphant Buddhist nun Canny edge detection algorithm.
In order to achieve the above object, the invention also discloses a kind of drawing apparatus of image outline, it is applied to that there is display The electronic equipment of screen, described device include:
Image outline detection module, for when detect image outline draw instruction when, in the picture of profile to be drawn, The coordinate of pixel in image outline is determined using edge detection algorithm;
Starting point determining module, for the position according to the coordinate of pixel in described image profile and active user's input It sets, the starting point that profile is drawn is determined in image outline;
Direction determining mould is drawn, for drawing the direction of operation according to active user, determines the corresponding figure of the starting point As the drafting direction drawn in profile, and setting quantity pixel is determined in image outline according to the drafting direction Point;
Terminating point judgment module, for judge in the setting quantity pixel drafting direction it is corresponding the last one Pixel whether be described image profile terminating point;
Target image profile determining module, if corresponding most for the drafting direction in the setting quantity pixel The latter pixel is the terminating point of described image profile, then according to pixel in the target image profile of preservation and described The pixel in image outline in image outline between starting point and ending point, determines target image profile;
Pixel preserving module, if for the drafting direction in the setting quantity pixel it is corresponding the last one Pixel is not the terminating point of described image profile, then using the setting quantity pixel as the picture in target image profile Vegetarian refreshments simultaneously saves, and by the last one described pixel as starting point, direction determining mould is drawn in triggering.
Preferably, the starting point determining module includes:
Coordinate obtains submodule, and the position for being inputted according to active user obtains the coordinate of the position;
Distance determines submodule, for the coordinate of pixel in the coordinate and described image profile according to the position, really The distance between each pixel in the fixed position and described image profile;
Starting point determines submodule, for being determined as the pixel in the corresponding image outline of minimum range profile and drawing The starting point of system.
Preferably, the starting point determines that submodule is specifically used for:
Judge whether the minimum range is less than default first distance threshold value, if so, by the corresponding image of minimum range Pixel in profile is determined as the starting point of profile drafting.
Preferably, described device further include:
Prompt information output module, for when the minimum range is not less than default first distance threshold value, output to be prompted Information.
Preferably, the drafting direction determining mould includes:
Angle determines submodule, for drawing the direction of operation according to active user, determines that active user draws operation The corresponding angle in direction;
It draws direction and determines submodule, for according to the corresponding each angle in each drafting direction saved for the starting point Range is spent, determines the angular range where the angle, it is corresponding that the corresponding drafting direction of the angular range is determined as the starting point Image outline in the drafting direction drawn.
Preferably, the terminating point judgment module includes:
Pixel coordinate determines submodule, and for determining, the drafting direction is corresponding most in the setting quantity pixel The coordinate of the latter pixel;
Coordinate distance judging submodule, what coordinate and the profile for judging the last one pixel were drawn rises Whether the distance between coordinate of initial point is less than default second distance threshold value;
Terminating point determines submodule, if for profile in the coordinate and described image profile of the last one pixel The distance between starting point coordinate of drafting is less than default second distance threshold value, it is determined that the last one described pixel is to terminate Point, otherwise, it determines the last one described pixel nonterminal point.
Preferably, before the starting point determining module, described device further include:
Binaryzation picture determining module, for the coordinate according to pixel in determining image outline, generate with wait draw The black and white picture of the contour wide binaryzation of the picture of profile includes the profile to be drawn in the black and white picture of the binaryzation Picture image outline.
Preferably, the pixel preserving module is specifically used for:
Judge the setting quantity pixel whether is preserved in target image profile, if it is not, then by the setting Quantity pixel is as the pixel in target image profile and preservation.
Preferably, described device further include:
Pixel removing module, if for being saved the setting quantity pixel in target image profile, Delete the setting quantity pixel saved.
As seen from the above technical solution, the embodiment of the present invention first uses edge detection algorithm to determine pixel in image outline The coordinate of point, the direction of position and drafting operation further according to user's input, determines target image profile from image outline Pixel coordinate, therefore can more accurately drawing image profile, improve user experience.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described.It should be evident that the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of the method for drafting of image outline provided in an embodiment of the present invention;
Fig. 2 is reference picture provided in an embodiment of the present invention;
Fig. 3 is the image outline picture of reference picture provided in an embodiment of the present invention;
Fig. 4 is the flow diagram of the method for drafting of another image outline provided in an embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram of the drawing apparatus of image outline provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Whole description.Obviously, described embodiment is only a part of the embodiments of the present invention, instead of all the embodiments.Base Embodiment in the present invention, those of ordinary skill in the art are obtained all without making creative work Other embodiments shall fall within the protection scope of the present invention.
It, being capable of more accurately drawing image wheel the embodiment of the invention provides a kind of method for drafting of image outline and device Exterior feature improves user experience.Method and device provided in this embodiment is applied in the electronic equipment with display screen, including desk-top The electronic equipments such as computer, laptop, tablet computer pad, mobile phone, the mode of the user's operation captured can be mouse The sliding action of movement and/or finger.
Below by specific embodiment, the present invention is described in detail.
Fig. 1 is a kind of flow diagram of the method for drafting of image outline provided in an embodiment of the present invention comprising as follows Step:
Step S101: when detecting that image outline draws instruction, in the picture of profile to be drawn, using edge detection Algorithm determines the coordinate of pixel in image outline.
It is understood that the edge of image refers to the significant part of image local area brightness change, the edge of image Composed shape is the profile of image.In one picture, the profile of image may be to intersect intricately, It is also likely to be mutually independent several profiles.
In practical applications, the coordinate of pixel in image outline can be determined using edge detection algorithm.Using edge Detection algorithm determines that the coordinate of image outline pixel belongs to the prior art, in embodiments of the present invention to the process without superfluous It states.
In order to effectively determine the coordinate of pixel in image outline, triumphant Buddhist nun can be used in embodiments of the present invention Canny edge detection algorithm.Canny edge detection is actually a kind of first order differential operator detection algorithm, it is in first differential On the basis of operator, also adds non-maximum value and inhibit and dual threshold two improvement.Can not only have using non-maxima suppression Effect ground inhibits multiple response edge, but also the positioning accuracy at edge can be improved;Using dual threshold, i.e. high threshold and Low threshold, The omission factor at edge can be effectively reduced.By adjusting corresponding parameter, Canny edge detection algorithm can identify different essences The image outline of thin degree.Due to determining that the pixel in image outline belongs to the prior art using Canny edge detection algorithm, Therefore details are not described herein again.
Step S102: the position inputted according to the coordinate of pixel in the image outline and active user, in image outline The starting point that middle determining profile is drawn.
In order to obtain the location information of active user's input, corresponding prompt information can be provided, prompts user in screen Position when middle input initial drawing, such as " please clicking in screen, to input initial position ", or provides input frame, prompts to use Family inputs the coordinate (x, y) of initial position, and used coordinate system can be to sit with the upper left corner of currently profile picture to be drawn Origin is marked, is horizontally to the right positive direction of the x-axis, is straight down positive direction of the y-axis, corresponding unit length is provided in reference axis, when It is so also possible using other coordinate systems.
It, can be using various ways image obtained in the step S101 after position of active user's input has been determined In profile determine profile draw starting point, for example, according to active user input position abscissa, by image outline with The pixel that the abscissa is identical, position apart from active user's input is nearest is determined as the starting point of profile drafting, or According to active user input position ordinate, by it is identical with the ordinate in image outline, apart from active user input The nearest pixel in position be determined as the starting point of profile drafting.
Step S103: the direction of operation is drawn according to active user, determines and carries out in the corresponding image outline of the starting point The drafting direction of drafting, and setting quantity pixel is determined in image outline according to the drafting direction.
After the starting point that profile is drawn has been determined, in order to determine target image profile, the present invention from image outline Need to obtain the direction that active user draws operation in embodiment during drafting.Operation is drawn in order to obtain active user Direction, can prompt user input draw operation direction.Specifically, user inputs the mode for drawing operation direction, can be with It is to pin right mouse button to be slided on the screen, is also possible to be slided on the screen with finger, therefore corresponding prompt information It can be " left mouse button please be pin to slide on the screen " or " please sliding on the screen ", input frame can also be provided, prompt to use Family inputs at least two coordinate points according to the coordinate shown on screen, and the direction for drawing operation is obtained using these coordinate points.
The drafting operation of user may be along any one direction, and the direction that user draws operation determines the image wheel The drafting direction drawn in exterior feature.In the image outline, there may be images in multiple directions corresponding with the starting point The pixel of profile.The direction that operation is drawn according to active user, determines and is drawn in the corresponding image outline of the starting point Drafting direction, can have different modes, for example, it may be determined that active user draw operation direction and with the starting point pair The angle between each direction for including in the image outline answered, the direction in the corresponding image outline of minimum angle is determined as Draw direction.
The setting quantity pixel can be 4~10 pixels, and certain other quantity pixel is also possible. The value of the setting quantity is different, and the speed and effect that corresponding profile is drawn also can be different.
Step S104: judge in the setting quantity pixel whether is the last one corresponding pixel of the drafting direction For the terminating point of described image profile.
In the present embodiment, which may include different embodiments.Such as, it can be determined that the last one pixel Point on abscissa direction or in ordinate direction at a distance from starting point whether less than one threshold value, when horizontal, ordinate direction One of direction on the distance between the last one pixel and starting point be less than given threshold when, so that it may determine should The last one pixel is terminating point.In order to avoid maloperation, which, which is generally less than, is set between quantity pixel Distance.
Step S105: if the last one corresponding pixel of the drafting direction is institute in the setting quantity pixel The terminating point of image outline is stated, then according to starting point in the pixel and described image profile in the target image profile of preservation The pixel in image outline between terminating point, determines target image profile.
Step S106: if the last one corresponding pixel of the drafting direction is not in the setting quantity pixel The terminating point of described image profile, then using the setting quantity pixel as the pixel in target image profile and guarantor It deposits, by the last one described pixel as starting point, executes step S103.
The direction that operation is drawn according to active user determines a drafting side corresponding with starting point in image outline To, and setting quantity pixel is determined in image outline according to the drafting direction.If in the setting quantity pixel The last one corresponding pixel of the drafting direction is not the terminating point of described image profile, then makees the last one pixel For starting point, then carry out the drafting of target image profile.Therefore such operation can regard a drafting period as each time, If the last one pixel corresponding with the drafting direction is not the terminating point of image outline in the drafting period, by this A little pixels are saved, and using the last one pixel as starting point, start next drafting period.Every determination one Draw the period, all in the drafting period with draw corresponding the last one pixel in direction whether be image outline terminating point Judged.
As shown in the above, the embodiment of the present invention first uses edge detection algorithm to determine pixel in image outline Coordinate, the direction of position and drafting operation further according to user's input, determines the picture of target image profile from image outline Vegetarian refreshments coordinate, therefore it is capable of the profile of more accurately drawing image, improve user experience.
In another embodiment of the present invention, the step S102 in embodiment of the method shown in FIG. 1, according to the image wheel The position of the coordinate of pixel and active user's input in exterior feature, it is described before determining the starting point that profile is drawn in image outline Method can also include:
According to the coordinate of pixel in determining image outline, the contour wide two-value of picture with profile to be drawn is generated The black and white picture of change, the image outline of the picture comprising the profile to be drawn in the black and white picture of the binaryzation.
Assuming that the picture of profile to be drawn is as shown in Fig. 2, target image is the region in the upper left corner in Fig. 2.It is examined using edge Method of determining and calculating determines the coordinate of pixel in the image outline in Fig. 2, and according to the Coordinate generation one of pixel in the image outline A black and white picture with the contour wide binaryzation of Fig. 2 includes the image outline in Fig. 2 in i.e. Fig. 3, Fig. 3.
Obtain include the binaryzation of image outline information black and white picture after, according to active user input position exist When determining the starting point that profile is drawn in image outline, it can determine that profile is drawn directly from the image outline of the binaryzation picture The starting point of system improves the efficiency of drawing process to simplify the process that image outline is drawn.
In another embodiment of the present invention, the step S102 in embodiment of the method shown in FIG. 1, according to the image wheel The position of the coordinate of pixel and active user's input in exterior feature determines the starting point that profile is drawn in image outline, can wrap Include following steps:
Step 1: the position inputted according to active user obtains the coordinate of the position;
Step 2: according to the coordinate of pixel in the coordinate of the position and described image profile, determining the position and institute State the distance between each pixel in image outline;
Step 3: by the pixel in the corresponding image outline of minimum range, being determined as the starting point of profile drafting.
It in the present embodiment, will be with the smallest described image of the coordinate distance by determining the coordinate of user's input position The coordinate of pixel is determined as the starting point of profile drafting in profile, and the drawing process of image outline can be made more acurrate.
Further, by the pixel in the corresponding image outline of minimum range, it is determined as profile in image outline and draws Starting point, may include: to judge whether the minimum range is less than default first distance threshold value, if it is, will most narrow spacing From the pixel in corresponding image outline, be determined as the starting point that profile in image outline is drawn, when the minimum range not When less than default first distance threshold value, prompt information is exported, the input position for prompting user current is in described image profile Pixel it is too far, it should adjust input position, make pixel of the input position in described image profile, can make in this way Drawing process is more acurrate.
In another embodiment of the present invention, the step S103 in embodiment of the method shown in FIG. 1, according to active user The direction for drawing operation, determines the drafting direction drawn in the corresponding image outline of the starting point, may include walking as follows It is rapid:
Step 1: drawing the direction of operation according to active user, determine that active user draws the corresponding angle in direction of operation Degree;
Step 2: according to the corresponding each angular range in each drafting direction saved for the starting point, determining the angle The corresponding drafting direction of the angular range is determined as drawing in the corresponding image outline of the starting point by the angular range at place The drafting direction of system.
It is assumed that current starting point is the A point in Fig. 3, coordinate system is established in Fig. 3.Image is determined in step s101 Two drafting directions, the respectively direction A1 and A2, the corresponding angle in the two directions are saved in profile when the coordinate of pixel Range is respectively 0~180 degree, -180~0 degree.Assuming that the direction that active user draws operation is U1, and determine the direction pair U1 The angle answered is -130 degree, it is thus determined that the angle is in -180~0 degree of angular range, the direction A2 is determined as and starting point The drafting direction drawn in the corresponding image outline of A.
In the present embodiment, determine that user draws the angular range where the angle in the direction of operation, by the angle model It encloses corresponding drafting direction and is determined as the drafting direction drawn in the corresponding image outline of the starting point, drafting can be simplified The determination process in direction reduces calculation amount.
In another embodiment of the present invention, the step S104 in embodiment of the method shown in FIG. 1, judges the setting In quantity pixel the last one corresponding pixel of the drafting direction whether be described image profile terminating point, can wrap Include following steps:
Step 1: determining the coordinate of the last one corresponding pixel of drafting direction in the setting quantity pixel;
Step 2: between the coordinate for judging the starting point that the coordinate of the last one pixel and the profile are drawn Whether distance is less than default second distance threshold value;
Step 3: if so, determining that the last one described pixel is terminating point, otherwise, it determines the last one described pixel Point nonterminal point.
In the present embodiment, the distance between the coordinate of the last one pixel and starting point coordinate are less than default second Distance threshold can more accurately determine terminating point when profile is drawn as the standard for determining terminating point.
After saving the setting quantity pixel as the pixel in target image profile, if detecting use The pixel of preservation can also be deleted, can specifically include step by the delete operation at family:
Judge the setting quantity pixel whether is preserved in target image profile, if it is not, then by the setting Quantity pixel is as the pixel in target image profile and preservation;If being saved described set in target image profile Fixed number amount pixel then deletes the setting quantity pixel of preservation.
In the present embodiment, if being saved the setting quantity pixel in target image profile, it may be said that bright Drafting operation belongs to a kind of delete operation.Specifically, user may wish to replace drawn profile, or due to user's Maloperation depicts the profile of mistake.If drafting operation belongs to delete operation, the setting number being saved is deleted Measure a pixel.As it can be seen that this delete operation that the embodiment provides can be improved user experience.
Fig. 4 is the flow diagram of the method for drafting of another image outline provided in an embodiment of the present invention comprising such as Lower step:
Step S401: when detecting that image outline draws instruction, in the picture of profile to be drawn, using edge detection Algorithm determines the coordinate of pixel in image outline.
Step S402: it according to the coordinate of pixel in determining image outline, generates contour with the picture of profile to be drawn The black and white picture of wide binaryzation, the image wheel of the picture comprising the profile to be drawn in the black and white picture of the binaryzation It is wide.
Step S403: the position inputted according to active user obtains the coordinate of the position;According to the coordinate of the position With the coordinate of pixel in described image profile, determine in the position and described image profile between each pixel away from From, and determine the minimum range in the distance.
Step S404: judging whether the minimum range is less than default first distance threshold value, if so, thening follow the steps Otherwise S405 executes S406.
Step S405: when the minimum range is not less than default first distance threshold value, prompt information is exported.
Step S406: when the minimum range is less than default first distance threshold value, by the corresponding image wheel of minimum range Pixel in exterior feature is determined as the starting point of profile drafting.
Step S407: the direction of operation is drawn according to active user, determines and carries out in the corresponding image outline of the starting point The drafting direction of drafting, and setting quantity pixel is determined in image outline according to the drafting direction.
Step S408: the seat of the last one corresponding pixel of drafting direction in the setting quantity pixel is determined Mark.
Step S409: between the coordinate for judging the starting point that the coordinate of the last one pixel and the profile are drawn Distance whether be less than default second distance threshold value, if so, then follow the steps S410, otherwise, execute step S412.
Step S410: when between the coordinate for the starting point that the coordinate of the last one pixel and the profile are drawn When distance is less than default second distance threshold value, determine that the last one described pixel is terminating point.
Step S411: according to starting point and end in the pixel and described image profile in the target image profile of preservation The pixel in image outline between stop, determines target image profile.
Step S412: when between the coordinate for the starting point that the coordinate of the last one pixel and the profile are drawn When distance is not less than default second distance threshold value, the last one described pixel nonterminal point is determined.
Step S413: judge the setting quantity pixel whether is preserved in target image profile, if it is, holding Otherwise row step S414 executes step S415.
Step S414: when having preserved the setting quantity pixel in target image profile, preservation is deleted The setting quantity pixel, and using first pixel corresponding with the drafting direction of preservation as starting point, it executes Step S407.
Step S415: when in target image profile without saving the setting quantity pixel, by the setting number Measure pixel and be used as the pixel in target image profile and preservation, and will described in the last one pixel as starting point, Execute step S407.
As shown in the above, the embodiment of the present invention first uses edge detection algorithm to determine pixel in image outline Coordinate, the direction of position and drafting operation further according to user's input, determines the picture of target image profile from image outline Vegetarian refreshments coordinate.When the input position range image profile of user farther out when, can also provide prompt information, prompt user's adjustment defeated Enter position, therefore being capable of more accurately drawing image profile.Meanwhile user can also delete drawn wheel in drawing process Pixel in exterior feature improves user experience.
Fig. 5 is a kind of structural schematic diagram of the drawing apparatus of image outline provided in an embodiment of the present invention, with side shown in Fig. 1 Method embodiment is corresponding, and described device includes:
Image outline detection module 501, for when detect image outline draw instruction when, in the picture of profile to be drawn In, the coordinate of pixel in image outline is determined using edge detection algorithm;
Starting point determining module 502, for what is inputted according to the coordinate of pixel in described image profile and active user Position determines the starting point that profile is drawn in image outline;
Direction determining mould 503 is drawn, for drawing the direction of operation according to active user, determines that the starting point is corresponding The drafting direction drawn in image outline, and setting quantity pixel is determined in image outline according to the drafting direction Point;
Terminating point judgment module 504, for judging that the drafting direction is corresponding last in the setting quantity pixel One pixel whether be described image profile terminating point;
Target image profile determining module 505, if corresponding for the drafting direction in the setting quantity pixel The last one pixel be described image profile terminating point, then according to the pixel in the target image profile of preservation, and The pixel in image outline in described image profile between starting point and ending point, determines target image profile;
Pixel preserving module 506, if corresponding last for the drafting direction in the setting quantity pixel One pixel is not the terminating point of described image profile, then using the setting quantity pixel as in target image profile Pixel and preservation, and regard the last one described pixel as starting point, triggering drafting direction determining mould 503.
Specifically, the edge detection algorithm that image outline detection module 501 uses may include triumphant Buddhist nun Canny edge detection Algorithm.
In another embodiment of the present invention, the starting point determining module 502 in Installation practice shown in fig. 5 is specific May include:
Coordinate obtains submodule (not shown), and the position for being inputted according to active user obtains the position Coordinate;
Distance determines submodule (not shown), for pixel in the coordinate and described image profile according to the position The coordinate of point determines the distance between each pixel in the position and described image profile;
Starting point determines submodule (not shown), for by the pixel in the corresponding image outline of minimum range, It is determined as the starting point of profile drafting.
Further, which, which determines submodule specifically, can be used for judging whether the minimum range is less than default One distance threshold, if so, the pixel in the corresponding image outline of minimum range is determined as the starting point of profile drafting.
In another embodiment of the present invention, device shown in fig. 5 can also include:
Prompt information output module (not shown), for being not less than default first distance threshold value when the minimum range When, export prompt information.
In another embodiment of the present invention, the drafting direction determining mould 503 in Installation practice shown in fig. 5 has Body may include:
Angle determines submodule (not shown), for drawing the direction of operation according to active user, determines current use Draw the corresponding angle in direction of operation in family;
It draws direction and determines submodule (not shown), for according to each drafting direction saved for the starting point Corresponding each angular range, determines the angular range where the angle, and the corresponding drafting direction of the angular range is determined as The drafting direction drawn in the corresponding image outline of the starting point.
In another embodiment of the present invention, the terminating point judgment module 504 in Installation practice shown in fig. 5 is specific May include:
Pixel coordinate determines submodule (not shown), for determining the drafting in the setting quantity pixel The coordinate of the last one corresponding pixel of direction;
Coordinate distance judging submodule (not shown), for judge the coordinate of the last one pixel with it is described Whether the distance between coordinate of starting point that profile is drawn is less than default second distance threshold value;
Terminating point determines submodule (not shown), if coordinate and the figure for the last one pixel As the distance between starting point coordinate that profile is drawn in profile is less than default second distance threshold value, it is determined that it is described the last one Pixel is terminating point, otherwise, it determines the last one described pixel nonterminal point.
In another embodiment of the present invention, the starting point determining module 502 in Installation practice shown in Fig. 5 it Before, described device can also include:
Binaryzation picture determining module (not shown), for the coordinate according to pixel in determining image outline, The black and white picture with the contour wide binaryzation of picture of profile to be drawn is generated, includes institute in the black and white picture of the binaryzation State the image outline of the picture of profile to be drawn.
In another embodiment of the present invention, the pixel preserving module 506 in Installation practice shown in fig. 5 is specific It can be used for:
Judge the setting quantity pixel whether is preserved in target image profile, if it is not, then by the setting Quantity pixel is as the pixel in target image profile and preservation.
In another embodiment of the present invention, device shown in fig. 5 can also include:
Pixel removing module (not shown), if for being saved the setting quantity in target image profile A pixel then deletes the setting quantity pixel of preservation.
Since above-mentioned apparatus embodiment is that the method for drafting embodiment based on image outline obtains, there is phase with this method Same technical effect, therefore details are not described herein for the technical effect of Installation practice.
For device embodiment, since it is substantially similar to the method embodiment, related so describing fairly simple Place illustrates referring to the part of embodiment of the method.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or any other variant be intended to it is non- It is exclusive to include, so that the process, method, article or equipment for including a series of elements not only includes those elements, It but also including other elements that are not explicitly listed, or further include solid by this process, method, article or equipment Some elements.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including There is also other identical elements in the process, method, article or equipment of the element.
It will appreciated by the skilled person that all or part of the steps in above embodiment is can to pass through journey What sequence instructed relevant hardware to complete, the program can store in computer-readable storage medium.It is designated herein Storage medium refers to ROM/RAM, magnetic disk, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent substitution, improvement and etc. done within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (9)

1. a kind of method for drafting of image outline, which is characterized in that applied to the electronic equipment with display screen, the method packet It includes:
A. it when detecting that image outline draws instruction, in the picture of profile to be drawn, is determined and is schemed using edge detection algorithm As the coordinate of pixel in profile;
B. the position inputted according to active user, obtains the coordinate of the position;According to the coordinate and described image of the position The coordinate of pixel in profile determines the distance between each pixel in the position and described image profile;By most narrow spacing From the pixel in corresponding image outline, it is determined as the starting point of profile drafting;
C. the direction that operation is drawn according to active user, determines the drafting side drawn in the corresponding image outline of the starting point To, and setting quantity pixel is determined in image outline according to the drafting direction;
D. judge whether the last one corresponding pixel of the drafting direction is described image in the setting quantity pixel The terminating point of profile, if it is, according to starting point in the pixel and described image profile in the target image profile of preservation The pixel in image outline between terminating point, determines target image profile, otherwise, by the setting quantity pixel As the pixel in target image profile and preservation, the last one described pixel is executed into step C as starting point.
2. the method according to claim 1, wherein the pixel by the corresponding image outline of minimum range Point, the starting point for being determined as profile drafting include:
Judge whether the minimum range is less than default first distance threshold value, if so, by the corresponding image outline of minimum range In pixel, be determined as profile drafting starting point.
3. according to the method described in claim 2, it is characterized in that, the method also includes:
When the minimum range is not less than default first distance threshold value, prompt information is exported.
4. the method according to claim 1, wherein the direction for drawing operation according to active user, determines The drafting direction drawn in the corresponding image outline of the starting point, comprising:
The direction that operation is drawn according to active user determines that active user draws the corresponding angle in direction of operation;
According to the corresponding each angular range in each drafting direction saved for the starting point, the angle where the angle is determined The corresponding drafting direction of the angular range is determined as the drafting side drawn in the corresponding image outline of the starting point by range To.
5. the method according to claim 1, wherein the drafting in the judgement setting quantity pixel The last one corresponding pixel of direction whether be described image profile terminating point, comprising:
Determine the coordinate of the last one corresponding pixel of drafting direction in the setting quantity pixel;
Judge whether the distance between coordinate of starting point that the coordinate of the last one pixel is drawn with the profile is small In default second distance threshold value;
If so, determining that the last one described pixel is terminating point, otherwise, it determines the last one described pixel nonterminal Point.
6. the method according to claim 1, wherein it is described according to the coordinate of pixel in described image profile and The position of active user's input, before the starting point that profile is drawn is determined in image outline, the method also includes:
According to the coordinate of pixel in determining image outline, generate and the contour wide binaryzation of picture of profile to be drawn Black and white picture, the image outline of the picture comprising the profile to be drawn in the black and white picture of the binaryzation.
7. the method according to claim 1, wherein described using the setting quantity pixel as target figure As the pixel in profile and preservation, comprising:
Judge the setting quantity pixel whether is preserved in target image profile, if it is not, then by the setting quantity A pixel is as the pixel in target image profile and preservation.
8. the method according to the description of claim 7 is characterized in that the method also includes:
If being saved the setting quantity pixel in target image profile, the setting quantity of preservation is deleted Pixel.
9. the method according to claim 1, wherein the edge detection algorithm includes the inspection of the edge triumphant Buddhist nun Canny Method of determining and calculating.
CN201511021247.2A 2015-12-30 2015-12-30 Method and device for drawing image contour Active CN105654531B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511021247.2A CN105654531B (en) 2015-12-30 2015-12-30 Method and device for drawing image contour

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511021247.2A CN105654531B (en) 2015-12-30 2015-12-30 Method and device for drawing image contour

Publications (2)

Publication Number Publication Date
CN105654531A CN105654531A (en) 2016-06-08
CN105654531B true CN105654531B (en) 2019-01-08

Family

ID=56490006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511021247.2A Active CN105654531B (en) 2015-12-30 2015-12-30 Method and device for drawing image contour

Country Status (1)

Country Link
CN (1) CN105654531B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885538B (en) * 2016-09-28 2020-12-22 北京京东尚科信息技术有限公司 Method and device for adding hot area links on picture
CN110197519A (en) * 2018-02-26 2019-09-03 苏州宝时得电动工具有限公司 Method for compensating signal, device and storage medium in map generating process
CN109785400B (en) * 2018-11-20 2023-08-04 广东智媒云图科技股份有限公司 Silhouette image manufacturing method and device, electronic equipment and storage medium
CN111611151B (en) * 2019-02-25 2023-05-16 阿里巴巴集团控股有限公司 Method and device for detecting overdrawing of user interface
CN111210485B (en) * 2020-01-06 2023-03-28 北京字节跳动网络技术有限公司 Image processing method and device, readable medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940081A (en) * 1995-01-27 1999-08-17 Sony Corporation Method and apparatus for forming a font and the font produced method and apparatus for drawing a blurred figure
CN103092524A (en) * 2013-01-31 2013-05-08 广东欧珀移动通信有限公司 Method for realizing screenshot through touch screen and mobile terminal
CN104574403A (en) * 2015-01-12 2015-04-29 飞天诚信科技股份有限公司 Intelligent cutting method
CN104932827A (en) * 2015-06-29 2015-09-23 北京金山安全软件有限公司 Picture clipping method and device and terminal
CN105046730A (en) * 2015-07-09 2015-11-11 北京盛世宣合信息科技有限公司 Writing trace demonstration method and apparatus applied to writing brush
CN105094599A (en) * 2015-06-29 2015-11-25 北京金山安全软件有限公司 Picture clipping method and device and terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940081A (en) * 1995-01-27 1999-08-17 Sony Corporation Method and apparatus for forming a font and the font produced method and apparatus for drawing a blurred figure
CN103092524A (en) * 2013-01-31 2013-05-08 广东欧珀移动通信有限公司 Method for realizing screenshot through touch screen and mobile terminal
CN104574403A (en) * 2015-01-12 2015-04-29 飞天诚信科技股份有限公司 Intelligent cutting method
CN104932827A (en) * 2015-06-29 2015-09-23 北京金山安全软件有限公司 Picture clipping method and device and terminal
CN105094599A (en) * 2015-06-29 2015-11-25 北京金山安全软件有限公司 Picture clipping method and device and terminal
CN105046730A (en) * 2015-07-09 2015-11-11 北京盛世宣合信息科技有限公司 Writing trace demonstration method and apparatus applied to writing brush

Also Published As

Publication number Publication date
CN105654531A (en) 2016-06-08

Similar Documents

Publication Publication Date Title
CN105654531B (en) Method and device for drawing image contour
US9367734B2 (en) Apparatus, control method, and storage medium for setting object detection region in an image
CN110853076A (en) Target tracking method, device, equipment and storage medium
CN107589963B (en) A kind of image processing method, mobile terminal and computer readable storage medium
US20150138382A1 (en) Image capturing method, apparatus, and electronic device
JP5484184B2 (en) Image processing apparatus, image processing method, and program
CN111543934A (en) Vision detection method and device, electronic product and storage medium
CN105303514A (en) Image processing method and apparatus
WO2014106445A1 (en) Method and apparatus for detecting backlight
WO2017206444A1 (en) Method and device for detecting imaging difference, and computer storage medium
WO2016029555A1 (en) Image interpolation method and device
CN113379723B (en) Irregular glue overflow port detection method, device, equipment and storage medium
EP3056980A1 (en) Method and apparatus for switching screen display mode of terminal device, and terminal device
CN106210522B (en) A kind of image processing method, device, mobile terminal and readable storage medium storing program for executing
EP3231175B1 (en) System and method for processing depth images which capture an interaction of an object relative to an interaction plane
CN112733703A (en) Vehicle parking state detection method and system
EP3043539A1 (en) Incoming call processing method and mobile terminal
CN110415285A (en) Image processing method, device and electronic equipment
CN111126300B (en) Human body image detection method and device, electronic equipment and readable storage medium
WO2018076172A1 (en) Image display method and terminal
CN111444555B (en) Temperature measurement information display method and device and terminal equipment
CN109658453B (en) Circle center determining method, device, equipment and storage medium
JP7106296B2 (en) Image processing device, image processing method and program
JP6991045B2 (en) Image processing device, control method of image processing device
CN112747734B (en) Method, system and device for adjusting direction of environment map

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: Room 115, area C, 1 / F, building 8, yard 1, yaojiayuan South Road, Chaoyang District, Beijing 100123

Patentee after: Beijing LEMI Technology Co.,Ltd.

Address before: 100085 Beijing City, Haidian District Road 33, two floor East Xiaoying

Patentee before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240122

Address after: 3870A, 3rd Floor, Building 4, Courtyard 49, Badachu Road, Shijingshan District, Beijing, 100144

Patentee after: Beijing Jupiter Technology Co.,Ltd.

Country or region after: China

Address before: 100123 room 115, area C, 1st floor, building 8, yard 1, yaojiayuan South Road, Chaoyang District, Beijing

Patentee before: Beijing LEMI Technology Co.,Ltd.

Country or region before: China