WO2023005139A1 - 线条绘制方法、装置、电子设备及计算机可读存储介质 - Google Patents

线条绘制方法、装置、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2023005139A1
WO2023005139A1 PCT/CN2021/142560 CN2021142560W WO2023005139A1 WO 2023005139 A1 WO2023005139 A1 WO 2023005139A1 CN 2021142560 W CN2021142560 W CN 2021142560W WO 2023005139 A1 WO2023005139 A1 WO 2023005139A1
Authority
WO
WIPO (PCT)
Prior art keywords
transformation
abscissa
amount
ordinate
transformation amount
Prior art date
Application number
PCT/CN2021/142560
Other languages
English (en)
French (fr)
Inventor
朱理森
孙红伟
张培祺
Original Assignee
新线科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 新线科技有限公司 filed Critical 新线科技有限公司
Priority to EP21951711.7A priority Critical patent/EP4365847A1/en
Publication of WO2023005139A1 publication Critical patent/WO2023005139A1/zh

Links

Images

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras

Definitions

  • the embodiments of the present application relate to the field of computer technology, and in particular to a line drawing method, device, electronic equipment, and computer-readable storage medium.
  • Free-hand remote control is a technology that can remotely control electronic devices within a certain range without the need for control devices such as remote controls, or traditional input and output devices such as mice and keyboards. With the development of computer technology, more and more electronic devices support the function of remote control with bare hands.
  • a line can be drawn on the screen according to the hand.
  • Embodiments of the present application provide a line drawing method, device, electronic device, and computer-readable storage medium, capable of drawing stable lines.
  • the embodiment of the present application provides a line drawing method, including:
  • the first frame image includes the user's hand
  • the pre-configured transformation amount coefficient and the transformation amount threshold draw the corresponding line.
  • the transformation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • the transformation amount threshold on the abscissa is the second preset value
  • the transformation amount threshold on the ordinate is the third preset value
  • the initial The end of the line is the starting point, draw a straight line with the target length
  • the initial line is the line drawn according to the image before the first image in the image sequence
  • the target length corresponds to the abscissa transformation amount or the ordinate transformation amount.
  • drawing a line of target length includes:
  • the abscissa transformation amount is greater than or equal to the product of the abscissa transformation amount coefficient and the ordinate transformation amount, and the ordinate transformation amount is less than the threshold value of the ordinate transformation amount, start from the end of the initial line and draw the first line along the horizontal direction.
  • a line segment of the target length, the first target length corresponds to the transformation amount of the abscissa.
  • drawing a line of target length includes:
  • the second target length corresponds to the ordinate transformation amount.
  • the transformation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • the transformation amount coefficient on the abscissa is the fourth preset value
  • the transformation amount coefficient on the ordinate is the fifth preset value
  • the transformation amount threshold on the abscissa is the sixth preset value
  • the transformation amount threshold on the ordinate is the seventh preset value Down
  • the abscissa transformation amount is greater than or equal to the product of the abscissa transformation amount coefficient and the ordinate transformation amount, and the abscissa transformation amount is less than the abscissa transformation amount threshold, and the ordinate transformation amount is greater than or equal to the ordinate transformation amount coefficient and the abscissa transformation
  • the product of the amount, and the ordinate transformation amount is less than the ordinate transformation amount threshold, then the end of the initial line is used as the starting point, and the first position coordinate is the end point, and the curve is drawn.
  • the initial line is drawn according to the image before the first image in the image sequence the lines.
  • the preset correlation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • the transformation amount coefficient on the abscissa is less than the second set threshold
  • the transformation amount coefficient on the ordinate is less than the third set threshold
  • the transformation amount threshold on the abscissa is less than the fourth set threshold
  • the transformation amount threshold on the ordinate is less than the fifth set threshold
  • a straight line or curve is drawn starting from the end of the initial line, which is the line drawn according to the image preceding the first image in the image sequence.
  • the method further includes: when both the transformation amount of the abscissa and the transformation amount of the ordinate are less than the first set threshold, accumulating the transformation amount of the abscissa and the pre-configured initial amount of the abscissa to obtain the abscissa The cumulant, and the cumulative ordinate transformation amount and the pre-configured initial ordinate amount to obtain the ordinate cumulant;
  • the sixth set threshold draw a straight line of the target length with the end of the initial line as the starting point.
  • the initial line is based on the image sequence before the first image.
  • the line drawn by the image, the target length corresponds to the accumulated amount of the abscissa or the accumulated amount of the ordinate.
  • drawing a line of target length includes:
  • the end of the initial line is used as a starting point to draw a line segment of the third target length along the horizontal direction, and the third target length corresponds to the abscissa cumulative amount;
  • a line segment of the fourth target length is drawn vertically with the end of the initial line as the starting point, and the fourth target length corresponds to the accumulated amount of the ordinate.
  • the embodiment of the present application provides a line drawing device, including:
  • An image acquisition module configured to acquire the first frame image in the image sequence, where the first frame image includes the user's hand;
  • a position coordinate determination module configured to determine the first position coordinates of the hand in the first frame image according to the feature information of the hand
  • the difference transformation module is used to transform the difference between the first position coordinate and the second position coordinate to obtain the abscissa transformation amount and the ordinate transformation amount corresponding to the difference value on the screen of the electronic device, and the second position coordinate is the hand
  • the second frame image is the image before the first frame image in the image sequence;
  • a line drawing module used to connect the lines of the first position coordinates and the second position coordinates under the condition that at least one of the abscissa transformation amount and the ordinate transformation amount is not less than the first set threshold value, according to the abscissa transformation amount and the ordinate transformation amount Corresponding relationship between the coordinate transformation amount, the pre-configured transformation amount coefficient and the transformation amount threshold value, and draw the corresponding line.
  • the embodiment of the present application provides an electronic device, including:
  • an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored.
  • the computer program instructions are executed by a processor, the method described in the first aspect is implemented.
  • Fig. 1 is a schematic diagram of lines drawn based on related technologies
  • FIG. 2 is a flow chart of a line drawing method provided in an embodiment of the present application.
  • Fig. 3 is a flow chart of another line drawing method provided by the embodiment of the present application.
  • Fig. 4 is a flow chart of another line drawing method provided by the embodiment of the present application.
  • Fig. 5 is a flow chart of another line drawing method provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of lines drawn based on the line drawing method provided in the embodiment of the present application.
  • FIG. 7 is a structural diagram of a line drawing device provided in an embodiment of the present application.
  • FIG. 8 is a structural diagram of an electronic device provided by an embodiment of the present application.
  • the drawn lines are unstable due to the inertia of the hand or the user's habitual actions.
  • the moving track of the hand is an arc, which causes the drawn line to be not a straight line; when drawing a curve, the line is not smooth due to hand shaking.
  • the embodiment of the present application provides a line drawing method, which can draw stable lines.
  • the line drawing method provided in the embodiment of the present application may be executed by a line drawing device, or a module in the line drawing device for executing the line drawing method.
  • the line drawing device can exist independently, or can be integrated in an electronic device, such as a notebook, a desktop computer, an interactive electronic whiteboard and other smart devices with data processing functions.
  • the line drawing method performed by an electronic device is taken as an example to describe the line drawing method provided in the embodiment of the present application in detail.
  • FIG. 2 is a flow chart of a line drawing method provided by an embodiment of the present application.
  • the line drawing method may include the following steps:
  • the image sequence may be a sequence formed by arranging multiple images in a certain order, for example, the images may be arranged according to the acquisition time of the images to obtain an image sequence.
  • the images contained in the image sequence can be obtained from a webpage or a local image database, or can be collected by a device with an image collection function.
  • the device with an image collection function can be a camera integrated in an electronic device, or It may be a device independent of the electronic device, for example, it may be a mobile phone, a video camera, and the like.
  • the device with the image collection function can communicate with the electronic device to send the collected image to the electronic device to provide a basis for the subsequent electronic device to draw lines.
  • the images included in the image sequence can also be obtained by intercepting a video, which can be captured by a device capable of image collection, or obtained from a video database of an electronic device.
  • each image includes a user's hand, and the hands included in each image in the same image sequence belong to the same user.
  • each image may also include other parts of the user or other objects other than the user, which are not specifically limited here.
  • the first frame image is an image in the image sequence, for example, an image may be selected from the image sequence as the first frame image as required.
  • the feature information of the hand may be information that uniquely identifies the hand, such as key points of the hand, and the key points of the hand may include joint points, fingertips, heels of palms, and palms.
  • the first position coordinate is the position coordinate of the hand in the first frame image.
  • one of the key points of the hand can be selected, and the position coordinate of the key point is used as the hand in the first frame image. location coordinates.
  • the position coordinates of the palm can be used as the position coordinates of the hand in the first frame image, which is simple and convenient.
  • multiple key points of the hand may also be selected, and the position coordinates of the hand in the first frame image are determined based on the position coordinates of the multiple key points.
  • the position coordinates of multiple key points can be averaged to obtain an average point, and the position coordinates of the average point can be used as the position coordinates of the hand in the first frame image.
  • Using the position coordinates of multiple key points to determine the position coordinates of the hand can improve the accuracy of the hand position coordinates.
  • the position coordinates of the average point can be used as the position coordinates of the hand in the first frame image, thereby improving the accuracy of the hand.
  • the accuracy of the location coordinates of the head can be used as the position coordinates of the hand in the first frame image, thereby improving the accuracy of the hand.
  • the position coordinates of each point of the hand can be determined by a positioning model, and the positioning model can be a deep neural network model.
  • an image containing the user's hand can be input into a deep neural network model, and the deep neural network model can output the position of each pixel of the hand in the image as the position coordinates of each point of the hand.
  • the position coordinates of each point can be smoothed by filtering technology, and the abrupt points or sharp points can be removed, so that when determining the first position of the hand When position coordinates are used, the accuracy of the first position coordinates can be improved, thereby improving the accuracy of subsequent lines.
  • the second position coordinates are the position coordinates of the hand in the second frame of image, and the determination process of the second position coordinates is the same as that of the first position coordinates, which is described briefly and will not be repeated here.
  • the second frame image may be the previous frame image of the first frame image, for example, the image sequence includes images numbered 1-10, the smaller the number, the earlier the corresponding acquisition time, assuming the first frame image As the image numbered 5, the second frame of image may be the image numbered 4. In this way, lines can be drawn in real time according to the changes of the hand in adjacent images, ensuring the accuracy of the lines.
  • the coordinates of the first position and the second The difference of the position coordinates is transformed, and transformed into the screen of the electronic device.
  • the transformation here can be an enlargement transformation or a reduction transformation, which is specifically related to the size of the first frame image and the screen.
  • the difference between the first position coordinate and the second position coordinate can be transformed by a transformation factor, and the transformation factor can be determined according to the mapping relationship between the image size and the screen size, for example, the transformation factor in the embodiment of the present application can be It is determined according to the mapping relationship between the size of the first frame image and the size of the screen of the electronic device.
  • the difference here can include abscissa difference and ordinate difference.
  • the transformation factor can include abscissa transformation factor and ordinate transformation factor, and the abscissa transformation factor and ordinate transformation factor can be The same may also be different.
  • the abscissa transformation amount is the transformation amount obtained by transforming the abscissa difference value based on the abscissa transformation factor; the ordinate transformation amount is the transformation amount obtained by transforming the ordinate difference value based on the ordinate transformation factor.
  • the abscissa transformation amount and the ordinate transformation amount may be constants without signs.
  • the first set threshold may be, for example, 1, that is, when at least one of the abscissa transformation amount and the ordinate transformation amount is greater than or equal to 1, according to the abscissa transformation amount and the ordinate transformation amount, pre-configured The correlation between the transformation coefficient and the transformation threshold, and draw the corresponding line.
  • Transformation coefficients and transformation thresholds can be used to represent the types of lines that are allowed to be drawn in different application scenarios. Different application scenarios can set different transformation coefficients and transformation thresholds. Therefore, when drawing lines in this application scenario, only Obtaining the lines corresponding to the application scene avoids the situation that the actual drawn lines do not match the requirements due to hand inertia and other reasons, and meets the actual needs of users.
  • the transformation coefficient and the transformation threshold are determined, it means that the type of line that is allowed to be drawn in the current application scene is known. At this time, the relationship between the transformation quantity of the abscissa and the ordinate and the transformation coefficient and the threshold of the transformation can be further determined. , to draw specific lines.
  • the current application scene when the current application scene only allows drawing straight lines, it can further determine whether to draw a horizontal line or a vertical line according to the relationship between the transformation amount of the abscissa and the ordinate, and the transformation coefficient and the threshold of the transformation amount, so as to meet the needs of the user. Actual demand.
  • the method may further include:
  • the images containing the user's hands are arranged in chronological order to obtain an image sequence.
  • the image can be identified through a feature recognition algorithm to determine whether it contains the user's hand.
  • the image can be input into a pre-built neural network model, and the pre-built neural network model outputs a result, which is used to represent the image. Whether to include the user's hands.
  • the obtained images can be Perform preprocessing to improve image quality.
  • preprocessing such as filtering, noise reduction, scaling, and enhancement may be performed on the acquired image.
  • the first set threshold value as 1 as an example, when at least one of the abscissa transformation amount and the ordinate transformation amount is not less than 1, by configuring the transformation amount coefficient and the transformation amount threshold, one of straight lines and curves can be drawn or more.
  • the transformation coefficient may include abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold may include abscissa transformation threshold and ordinate transformation threshold
  • the abscissa transformation amount is denoted as Dx
  • the ordinate transformation amount is denoted as Dy
  • the abscissa transformation coefficient is denoted as Cx
  • the ordinate transformation coefficient is denoted as Cy
  • the abscissa transformation threshold value is denoted as Tx
  • the ordinate transformation value is denoted as Tx.
  • the coordinate transformation amount threshold is denoted as Ty.
  • Tx is a second preset value
  • Ty is a third preset value
  • the first preset value may be 1
  • the second preset value and the third preset value may be constants with larger values, such as constants greater than 100, and the second preset value and the third preset value may be The same may also be different.
  • the line drawing method provided by the embodiment of the present application may further include the following steps:
  • the target length is related to the type of straight line, for example, when drawing a horizontal straight line, the target length corresponds to Dx; when drawing a vertical straight line, the target length corresponds to Dy.
  • the correspondence here may be that the target length is the same as Dx or Dy, or that the target length is a multiple of Dx or Dy.
  • Dx is greater than or equal to the product of Cx and Dy, and Dy is less than Tx, starting from the end of the initial line, a line segment of the first target length is drawn horizontally, and the first target length is equal to Dx correspond.
  • Dy when Dy is greater than or equal to the product of Cy and Dx, and Dx is less than Tx, a line segment of the second target length is drawn vertically from the end of the initial line, and the second target length is the same as Corresponding to the transformation amount of the ordinate.
  • the user may be prompted to adjust Dx or Dy to meet the above conditions for drawing a horizontal line or a vertical line.
  • a prompt message "If you need to draw a horizontal line, please increase Dx; if you need to draw a vertical line, please increase Dy" may be displayed to the user, and the content of the prompt message is related to the sizes of Dx and Dy.
  • a curve can be drawn under the condition that Cx is a fourth preset value, Cy is a fifth preset value, Tx is a sixth preset value, and Ty is a seventh preset value.
  • the fourth preset value and the fifth preset value can be 0, for example, the sixth preset value and the seventh preset value are constants with larger values, such as constants greater than 100, the sixth preset value and the seventh preset value
  • the preset values may be the same or different, and the sixth preset value and the seventh preset value may also be the same as or different from the second preset value and the third preset value in the above embodiment.
  • the line drawing method provided by the embodiment of the present application may include the following steps:
  • Cx, Cy, Tx, and Ty can satisfy the following conditions:
  • Cx is less than the second set threshold
  • Cy is less than the third set threshold
  • Tx is less than the fourth set threshold
  • Ty is less than the fifth set threshold
  • the size of the second set threshold, the third set threshold, the fourth set threshold and the fifth set threshold can be set according to actual needs, the second set threshold and the third set threshold can be the same or different, the fourth The set threshold and the fifth set threshold may be the same or different.
  • the second set threshold and the third set threshold may be constants less than 0.2
  • the fourth set threshold and the fifth set threshold may be constants less than 5.
  • Dy is greater than or equal to Ty
  • Dx is greater than or equal to Tx
  • Dx is greater than or equal to Cx and Dy
  • Cx and Dy draw a curve connecting the coordinates of the first position and the second position
  • Dx is less than Tx
  • Dx is less than the product of Cx and Dy
  • Dy in the case of Dy ⁇ Ty, if Dy is greater than or equal to the product of Cy and Dx, and Dx is greater than Tx, draw a curve connecting the first position coordinates and the second position coordinates of the hand; if Dy is greater than or Equal to the product of Cy and Dx, and Dx is less than Tx, and Dx is greater than or equal to the product of Cx and Dy, draw a curve connecting the first position coordinates and the second position coordinates; if Dy is greater than or equal to the product of Cy and Dx, and Dx is less than Tx, and Dx is less than the product of Cx and Dy, draw a vertical line segment starting from the end of the initial line, and the length of the vertical line segment corresponds to Dy; if Dy is less than the product of Cy and Dx, and Dx is greater than Tx, take the initial The end of the line is the starting point, draw a horizontal line segment, and the length of the horizontal line segment corresponds to Dx; if Dy is less than Cy and Dx, and D
  • the transformation coefficient and the transformation threshold can be set as above, and the transformation quantity on the abscissa and the ordinate, and the transformation coefficient and the transformation threshold satisfy the above relationship , draw the corresponding lines to meet the needs of drawing multiple types of lines in the same scene.
  • the line drawing method provided in the embodiment of the present application may include the following steps:
  • S510-S530 is the same as the process of S210-S230 in FIG. 2 , for details, refer to the description of S210-S230 , which is not repeated here for brevity.
  • the initial amount of the abscissa and the initial amount of the ordinate are pre-configured constants, which are used to assist in drawing the line when both Dx and Dy are small.
  • the initial quantity on the abscissa can be recorded as Ax
  • the initial quantity on the ordinate can be recorded as Ay.
  • the initial values of Ax and Ay can be 0.
  • the transformation amount can be accumulated, and then a line can be drawn according to the accumulation amount. This avoids inaccurate lines due to small variations in the hand position.
  • Dx and Ax can be accumulated respectively to obtain the cumulative amount on the abscissa; and Dy and Ay can be added to obtain the cumulative amount on the vertical axis.
  • the sixth set threshold may be 1, for example.
  • a straight line may be drawn starting from the end of the initial line.
  • the type of straight line is related to the relationship between the cumulative amount of abscissa and the cumulative amount of ordinate. For example, if the cumulative amount of abscissa is greater than the cumulative amount of ordinate, the straight line is a horizontal straight line; if the cumulative amount of abscissa is less than or equal to the cumulative amount of ordinate In the case of , the line is a vertical line.
  • S550 may include the following steps:
  • the end of the initial line is used as a starting point to draw a line segment of the third target length along the horizontal direction, and the third target length corresponds to the abscissa cumulative amount;
  • the cumulative amount of the abscissa is less than or equal to the cumulative amount of the ordinate, starting from the end of the initial line, draw a line segment of a fourth target length along the vertical direction, and the fourth target length corresponds to the cumulative amount of the ordinate.
  • the accumulative amount of the abscissa is greater than the accumulative amount of the ordinate, which means that the total moving distance of the hand in the horizontal direction is greater than the total moving distance in the vertical direction. At this time, the movement of the hand in the vertical direction can be ignored, and the horizontal direction line.
  • the accumulative amount of the abscissa is smaller than the accumulative amount of the ordinate, indicating that the total moving distance of the hand in the vertical direction is greater than the total moving distance in the horizontal direction. At this time, the horizontal movement of the hand can be ignored to obtain a vertical line.
  • Ax and Ay need to be initialized, that is, Ax and Ay should be cleared to prevent them from affecting the size of the accumulation of abscissa and ordinate, and thus affecting the drawing of lines.
  • both the cumulative amount on the abscissa and the cumulative amount on the ordinate are less than 1, you can continue to accumulate the transformation amount on the abscissa and the transformation amount on the ordinate between the second frame image and the previous frame image, assuming that the second frame image and the previous frame image
  • the abscissa transformation amount and the ordinate transformation amount of one frame of image are both less than 1, that is, both the abscissa transformation amount and the ordinate change amount accumulated again are less than 1.
  • the line drawn based on the line drawing method provided in the embodiment of the present application can refer to FIG. 6, and comparing FIG. 6 with FIG. 1, it can be seen that The lines drawn based on the line drawing method provided by the embodiment of the present application can meet the user's requirements for drawing horizontal and vertical lines, and avoid the situation that the lines are unstable due to unstable hands.
  • the embodiment of the present application also provides a line drawing device.
  • the line drawing device provided in the embodiment of the present application will be described in detail below with reference to FIG. 7 .
  • the line drawing device may include:
  • An image acquisition module 71 configured to acquire a first frame of image in the image sequence, where the first frame of image includes the user's hand;
  • the position coordinate determination module 72 is used for determining the first position coordinates of the hand in the first frame image according to the feature information of the hand;
  • the difference transformation module 73 is used to transform the difference between the first position coordinate and the second position coordinate to obtain the corresponding abscissa transformation amount and ordinate transformation amount of the difference on the screen of the electronic device, and the second position coordinate is The position coordinates of the second frame image, the second frame image is the image before the first frame image in the image sequence;
  • the line drawing module 74 is configured to, when at least one of the transformation amount of the abscissa and the transformation amount of the ordinate is not less than the first set threshold value, according to the transformation amount of the abscissa and the transformation amount of the ordinate, the pre-configured transformation coefficient and the transformation The relationship between the volume thresholds and draw the corresponding lines.
  • the transformation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • Line drawing module 74 comprising:
  • the straight line drawing unit is used for when the product of the transformation amount coefficient on the abscissa and the transformation amount coefficient on the ordinate is a first preset value, the transformation amount threshold on the abscissa is a second preset value, and the transformation amount threshold on the ordinate is a third preset value In the case of , draw a straight line of the target length starting from the end of the initial line.
  • the initial line is a line drawn according to the image preceding the first image in the image sequence, and the target length corresponds to the abscissa transformation amount or the ordinate transformation amount.
  • the line drawing unit is specifically used for:
  • the abscissa transformation amount is greater than or equal to the product of the abscissa transformation amount coefficient and the ordinate transformation amount, and the ordinate transformation amount is less than the threshold value of the ordinate transformation amount, start from the end of the initial line and draw the first line along the horizontal direction.
  • a line segment of the target length, the first target length corresponds to the transformation amount of the abscissa.
  • the line drawing unit is specifically used for:
  • the second target length corresponds to the ordinate transformation amount.
  • the transformation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • Line drawing module 74 comprising:
  • the curve drawing unit is used for when the transformation amount coefficient on the abscissa is the fourth preset value, the transformation amount coefficient on the ordinate is the fifth preset value, the transformation amount threshold on the abscissa is the sixth preset value, and the transformation amount threshold on the ordinate is the sixth preset value. In the case of seven preset values,
  • the abscissa transformation amount is greater than or equal to the product of the abscissa transformation amount coefficient and the ordinate transformation amount, and the abscissa transformation amount is less than the abscissa transformation amount threshold, and the ordinate transformation amount is greater than or equal to the ordinate transformation amount coefficient and the abscissa transformation
  • the product of the amount, and the ordinate transformation amount is less than the ordinate transformation amount threshold, then the end of the initial line is used as the starting point, and the first position coordinate is the end point, and the curve is drawn.
  • the initial line is drawn according to the image before the first image in the image sequence the lines.
  • the preset correlation coefficient includes abscissa transformation coefficient and ordinate transformation coefficient
  • the transformation threshold includes abscissa transformation threshold and ordinate transformation threshold
  • Line drawing module 74 comprising:
  • the multi-line drawing unit is used for when the transformation amount coefficient on the abscissa is less than the second set threshold, the transformation amount coefficient on the ordinate is less than the third set threshold, the transformation amount threshold on the abscissa is less than the fourth set threshold, and the transformation amount threshold on the ordinate If it is less than the fifth set threshold, a straight line or curve is drawn with the end of the initial line as the starting point, and the initial line is a line drawn according to the image before the first image in the image sequence.
  • the device also includes:
  • the accumulation module is used to accumulate the abscissa transformation amount and the pre-configured abscissa initial amount to obtain the abscissa cumulative amount and accumulate the ordinate amount when both the abscissa transformation amount and the ordinate transformation amount are less than the first set threshold The transformation amount and the pre-configured initial amount of the ordinate are obtained to obtain the cumulative amount of the ordinate;
  • the straight line drawing unit is also used to draw a straight line of the target length with the end of the initial line as the starting point when at least one of the cumulative amount of the abscissa and the cumulative amount of the ordinate is greater than the sixth set threshold, and the initial line is based on the image sequence
  • the line drawn by the image before the first image in , the target length corresponds to the cumulative amount of the abscissa or the cumulative amount of the ordinate.
  • the line drawing unit is specifically used for:
  • the end of the initial line is used as a starting point to draw a line segment of the third target length along the horizontal direction, and the third target length corresponds to the abscissa cumulative amount;
  • a line segment of the fourth target length is drawn vertically with the end of the initial line as the starting point, and the fourth target length corresponds to the accumulated amount of the ordinate.
  • the pre-configured transformation amount coefficient and the transformation amount threshold draw the corresponding line. That is, when drawing a line in the embodiment of the present application, not only the position change of the hand in different frame images is considered, but also the relationship between the position change and the transformation coefficient and the transformation threshold are considered, so that when drawing a line, only It can draw the lines corresponding to the association relationship, but not the lines irrelevant to the association relationship, thus avoiding the inconsistency between the actually drawn line and the line type due to reasons such as inertia, and ensuring the stability of the line.
  • Each module and unit in the device shown in FIG. 7 has the function of realizing each step in FIG. 2-FIG. 5 and can achieve corresponding technical effects. For the sake of concise description, details are not repeated here.
  • an embodiment of the present application further provides an electronic device, and the electronic device provided in the embodiment of the present application will be described in detail below with reference to FIG. 8 .
  • the electronic device may include a camera module 81 , a display screen 82 , a processor 83 and a memory 84 .
  • the camera module 81 is used to collect images.
  • the camera module 81 is integrated in an electronic device as an example.
  • the display screen 82 can be a device with a display function, for example, in the embodiment of the present application, it can be used to display drawn lines, and of course it can also display other content.
  • the display screen 82 can be integrated in the electronic device, or can be independent from the main body of the electronic device. In the case that the display screen 82 is independent of the main body of the electronic device, if the electronic device needs to display information through the display screen 82, a communication connection can be established with the display screen 82.
  • the display screen 82 may also have a touch function, for example, it may also be a touch screen integrating a display function and a touch function.
  • Memory 84 is used to store computer program instructions.
  • the processor 83 may include a central processing unit (Central Processing Unit, CPU), or a specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • Memory 84 may include mass storage for data or instructions.
  • memory 84 may include a hard disk drive (Hard Disk Drive, HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (Universal Serial Bus, USB) drive or two or more Combinations of multiple of the above.
  • memory 84 may include removable or non-removable (or fixed) media, or memory 84 may be a non-volatile solid-state memory.
  • the memory 84 may be a read only memory (Read Only Memory, ROM).
  • the ROM can be mask programmed ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or flash memory or both.
  • PROM programmable ROM
  • EPROM erasable PROM
  • EEPROM electrically erasable PROM
  • EAROM electrically rewritable ROM
  • the processor 83 reads and executes the computer program instructions stored in the memory 84 to realize the method in the embodiment shown in FIG. 2-FIG. 5, and to achieve the corresponding technology achieved by the embodiment shown in FIG. 2-FIG. The effect is described for brevity and will not be repeated here.
  • the electronic device may also include a communication interface 85 and a bus 86 .
  • a camera module 81 a display screen 82 , a processor 83 , a memory 84 , and a communication interface 85 are connected through a bus 86 to complete mutual communication.
  • the communication interface 85 is mainly used to implement communication between various modules, devices and/or devices in the embodiments of the present application.
  • Bus 86 includes hardware, software, or both, and couples the various components of the electronic device to each other.
  • the bus 86 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus, a Front Side Bus (FSB), Hyper Transport (HT) interconnect, Industry Standard Architecture (ISA) bus, InfiniBand interconnect, Low Pin Count (LPC) bus, memory bus, Micro Channel Architecture (MCA) bus, peripheral components Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association Local (VLB) bus, or other suitable bus or two or more of these The combination.
  • Bus 86 may comprise one or more buses, where appropriate. Although the embodiments of this application describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect.
  • the electronic device may execute the line drawing method in the embodiment of the present application based on the first frame image in the acquired image sequence, thereby realizing the line drawing method described in conjunction with FIGS. 2-5 and the line drawing device described in FIG. 7 .
  • the embodiments of the present application may provide a computer storage medium for implementation.
  • Computer program instructions are stored on the computer storage medium; when the computer program instructions are executed by a processor, any line drawing method in the above-mentioned embodiments is implemented.
  • Examples of computer storage media include non-transitory computer storage media such as electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, and the like.
  • the functional blocks shown in the structural block diagrams described above may be implemented as hardware, software, firmware, or a combination thereof.
  • hardware When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), appropriate firmware, a plug-in, a function card, and the like.
  • ASIC Application Specific Integrated Circuit
  • the elements of the present application are the programs or code segments employed to perform the required tasks.
  • Programs or code segments can be stored in machine-readable media, or transmitted over transmission media or communication links by data signals carried in carrier waves.
  • "Machine-readable medium" may include any medium that can store or transmit information.
  • machine-readable media examples include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, etc. wait.
  • Code segments may be downloaded via a computer network such as the Internet, an Intranet, or the like.
  • processors may be, but are not limited to, general purpose processors, special purpose processors, application specific processors, or field programmable logic circuits. It can also be understood that each block in the block diagrams and/or flowcharts and combinations of blocks in the block diagrams and/or flowcharts can also be realized by dedicated hardware for performing specified functions or actions, or can be implemented by dedicated hardware and Combination of computer instructions to achieve.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)
  • Image Analysis (AREA)

Abstract

本申请实施例公开了一种线条绘制方法、装置、设备及存储介质,在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。

Description

线条绘制方法、装置、电子设备及计算机可读存储介质
相关申请的交叉引用
本申请要求享有于2021年7月30日提交的中国专利申请202110874236.8的优先权,该申请的全部内容通过引用并入本文中。
技术领域
本申请实施例涉及计算机技术领域,尤其涉及线条绘制方法、装置、电子设备及计算机可读存储介质。
背景技术
徒手遥控是一种无需遥控器等控制设备,或鼠标键盘等传统输入输出设备,即可在一定范围内遥控电子设备的技术。随着计算机技术的发展,越来越多的电子设备支持徒手遥控功能。
目前比较常见的是通过手部控制电子设备屏幕上光标的移动,例如可以根据手部在屏幕上绘制线条。
在根据手部绘制线条时,传统方式是基于当前帧图像中手部的运动轨迹绘制线条,但由于惯性等原因,手部通常不稳定,从而导致绘制的线条不稳定。
发明内容
本申请实施例提供一种线条绘制方法、装置、电子设备及计算机可读存储介质,可以绘制稳定的线条。
第一方面,本申请实施例提供了一种线条绘制方法,包括:
获取图像序列中的第一帧图像,第一帧图像包括用户的手部;
根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,第二位置坐标为手部在第 二帧图像的位置坐标,第二帧图像为图像序列中位于第一帧图像之前的图像;
在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
在一些实施例中,变换量系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
在横坐标变换量系数和纵坐标变换量系数的乘积为第一预设数值,横坐标变换量阈值为第二预设数值,纵坐标变换量阈值为第三预设数值的情况下,以初始线条的末端为起点,绘制目标长度的直线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条,目标长度与横坐标变换量或纵坐标变换量对应。
在一些实施例中,以初始线条的末端为起点,绘制目标长度的直线,包括:
在横坐标变换量大于或等于横坐标变换量系数与纵坐标变换量的乘积,且纵坐标变换量小于纵坐标变换量阈值的情况下,以初始线条的末端为起点,沿水平方向绘制第一目标长度的线段,第一目标长度与横坐标变换量对应。
在一些实施例中,以初始线条的末端为起点,绘制目标长度的直线,包括:
在纵坐标变换量大于或等于纵坐标变换量系数与横坐标变换量的乘积,且横坐标变换量小于横坐标变换量阈值的情况下,以初始线条的末端为起点,沿竖直方向绘制第二目标长度的线段,第二目标长度与纵坐标变换量对应。
在一些实施例中,变换量系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
在横坐标变换量系数为第四预设数值、纵坐标变换量系数为第五预设 数值、横坐标变换量阈值为第六预设数值以及纵坐标变换量阈值为第七预设数值的情况下,
若横坐标变换量大于或等于横坐标变换量系数与纵坐标变换量的乘积,且横坐标变换量小于横坐标变换量阈值,且纵坐标变换量大于或等于纵坐标变换量系数与横坐标变换量的乘积,且纵坐标变换量小于纵坐标变换量阈值,则以初始线条的末端为起点,第一位置坐标为终点,绘制曲线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条。
在一些实施例中,预设相关系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
在横坐标变换量系数小于第二设定阈值,纵坐标变换量系数小于第三设定阈值,横坐标变换量阈值小于第四设定阈值,以及纵坐标变换量阈值小于第五设定阈值的情况下,以初始线条的末端为起点,绘制直线或曲线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条。
在一些实施例中,所述方法还包括:在横坐标变换量和纵坐标变换量均小于第一设定阈值的情况下,累加横坐标变换量和预先配置的横坐标初始量,得到横坐标累积量,以及累加纵坐标变换量和预先配置的纵坐标初始量,得到纵坐标累积量;
在横坐标累加量和纵坐标累加量至少有一个大于第六设定阈值的情况下,以初始线条的末端为起点,绘制目标长度的直线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条,目标长度与横坐标累加量或纵坐标累加量对应。
在一些实施例中,以初始线条的末端为起点,绘制目标长度的直线,包括:
在横坐标累加量大于纵坐标累加量的情况下,以初始线条的末端为起点,沿水平方向绘制第三目标长度的线段,第三目标长度与横坐标累加量对应;
在横坐标累加量小于或等于纵坐标累加量的情况下,以初始线条的末端为起点,沿竖直方向绘制第四目标长度的线段,第四目标长度与纵坐标累加量对应。
第二方面,本申请实施例提供了一种线条绘制装置,包括:
图像获取模块,用于获取图像序列中的第一帧图像,第一帧图像包括用户的手部;
位置坐标确定模块,用于根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
差值变换模块,用于对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,第二位置坐标为手部在第二帧图像的位置坐标,第二帧图像为图像序列中位于第一帧图像之前的图像;
线条绘制模块,用于在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,连接第一位置坐标和第二位置坐标的线条,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
第三方面,本申请实施例提供了一种电子设备,包括:
摄像模组,用于采集图像;
显示屏,用于显示线条;
处理器;
存储器,用于存储计算机程序指令;
当计算机程序指令被处理器执行时,实现如第一方面所述的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,当计算机程序指令被处理器执行时,实现如第一方面所述的方法。
本申请实施例提供的线条绘制方法、装置、电子设备及计算机可读存储介质,在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。即本申请实施例在绘制线条时,不仅考虑了手部在不同帧图像中的位置变化,还考虑了位置变化与变换量系数和变换量阈值之间的关联关系,从而在绘制线条时,只能绘制与关联关系对应的线条,而不会绘制与关联关系无关的线条,因而可以避免因惯性等原因而导致实际绘制的线条与线条类型不一致的情况,保证了线条的稳定。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例中所需要使用的附图作简单地介绍,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为基于相关技术绘制的线条的示意图;
图2为本申请实施例提供的一种线条绘制方法的流程图;
图3为本申请实施例提供的另一种线条绘制方法的流程图;
图4为本申请实施例提供的另一种线条绘制方法的流程图;
图5为本申请实施例提供的另一种线条绘制方法的流程图;
图6为基于本申请实施例提供的线条绘制方法绘制的线条的示意图;
图7为本申请实施例提供的一种线条绘制装置的结构图;
图8为本申请实施例提供的一种电子设备的结构图。
具体实施方式
下面将详细描述本申请的各个方面的特征和示例性实施例,为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细描述。应理解,此处所描述的具体实施例仅被配置为解释本申请,并不被配置为限定本申请。对于本领域技术人员来说,本申请可以在不需要这些具体细节中的一些细节的情况下实施。下面对实施例的描述仅仅是为了通过示出本申请的示例来提供对本申请更好的理解。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以根据手部的运动轨迹绘制线条为例,在某些场景中,用户可能需要 绘制特定的线条,例如需要绘制直线,或者曲线。
传统方式在基于手部的运动轨迹绘制线条时,因手部惯性或用户的习惯性动作,导致绘制的线条不稳定。例如在绘制直线时,手的移动轨迹为弧线,导致绘制的线条不是直线;在绘制曲线时,因手部抖动导致线条不平滑。
示例性的,参考图1,以绘制水平直线和竖直直线为例,由于惯性,手部在移动过程中不稳定,导致实际绘制的线条并非直线,从而无法满足用户的需求。
为此,本申请实施例提供了一种线条绘制方法,可以绘制稳定的线条。本申请实施例提供的线条绘制方法,执行主体可以是线条绘制装置,或者该线条绘制装置中用于执行线条绘制方法的模块。该线条绘制装置可以独立存在,也可以集成在电子设备中,该电子设备例如可以是笔记本、台式机、交互电子白板等具备数据处理功能的智能设备。
本申请实施例以电子设备执行线条绘制方法为例,详细说明本申请实施例提供的线条绘制方法。
图2为本申请实施例提供的一种线条绘制方法的流程图。
如图2所示,该线条绘制方法可以包括如下步骤:
S210、获取图像序列中的第一帧图像,其中,第一帧图像包括用户的手部;
S220、根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
S230、对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,其中,第二位置坐标为手部在第二帧图像的位置坐标,第二帧图像为所述图像序列中位于第一帧图像之前的图像;
S240、在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
由此,在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。即本申请实施例在绘制线条时,不仅考虑了手部在不同帧图像中的位置变化,还考虑了位置变化与变换量系数和变换量阈值之间的关联关系,从而在绘制线条时,只能绘 制与关联关系对应的线条,而不会绘制与关联关系无关的线条,因而可以避免因惯性等原因而导致实际绘制的线条与线条类型不一致的情况,保证了线条的稳定。
下面对上述步骤进行详细说明,具体如下所示:
在S210中,图像序列可以是将多个图像按照一定的顺序排列形成的序列,例如可以按照图像的采集时间排列各图像,得到图像序列。
在一个实施例中,图像序列包含的图像可以从网页或本地图像数据库中获取,也可以通过具备图像采集功能的设备采集,该具备图像采集功能的设备可以是集成在电子设备中的摄像头,也可以是独立于电子设备的设备,例如可以是手机、摄像机等。
在具备图像采集功能的设备独立于电子设备的情况下,该具备图像采集功能的设备可以和电子设备进行通信,以将采集的图像发送给电子设备,为后续电子设备绘制线条提供依据。
在一个实施例中,图像序列包含的图像也可以通过截取视频得到,该视频可以由具备图像采集功能的设备拍摄得到,也可以从电子设备的视频数据库中获取。
本申请实施例的图像序列中,各图像均包含用户的手部,同一个图像序列中各图像包含的手部属于同一用户。
各图像中除了包括用户的手部,还可以包括用户的其他部位或除用户以外的其他对象,此处不做具体限定。
第一帧图像为图像序列中的图像,例如可以根据需要从图像序列中选择一个图像作为第一帧图像。
在S220中,手部的特征信息可以是唯一标识手部的信息,例如可以是手部的关键点,手部的关键点可以包括关节点、指尖、掌根、掌心等。
第一位置坐标为手部在第一帧图像中的位置坐标,在一个实施例中,可以从手部的关键点中选取一个,将该关键点的位置坐标作为该手部在第一帧图像的位置坐标。
例如可以将掌心的位置坐标作为该手部在第一帧图像的位置坐标,简单方便。
在一个实施例中,也可以从手部的关键点中选取多个,基于多个关键点的位置坐标,确定手部在第一帧图像的位置坐标。
例如可以对多个关键点的位置坐标取平均,得到平均点,将该平均点 的位置坐标作为该手部在第一帧图像的位置坐标。
利用多个关键点的位置坐标确定手部的位置坐标,可以提高手部位置坐标的准确性。
在一个实施例中,还可以比较第一帧图像与图像序列中的其他图像,确定手部中位置坐标变化较小的点,根据位置坐标变化较小的点,确定手部在第一帧图像的位置坐标。
例如在位置变化较小的点有多个的情况下,可以对其取平均,得到平均点,将该平均点的位置坐标作为该手部在第一帧图像的位置坐标,由此可以提高手部位置坐标的准确性。
在一个实施例中,手部各点的位置坐标可以通过定位模型确定,定位模型可以是深度神经网络模型。
例如可以将包含用户手部的图像输入深度神经网络模型,由深度神经网络模型输出手部各像素点在图像中的位置,作为手部各点的位置坐标。
当然还可以通过其他方式确定手部各点的位置坐标,本申请实施例不做具体限定。
在一个实施例中,在得到手部各点的位置坐标后,可以通过滤波技术对各点的位置坐标进行平滑处理,将其中的突变点或尖点等去掉,使得在确定手部的第一位置坐标时,可以提高第一位置坐标的准确性,进而提高后续线条的准确性。
在S230中,第二位置坐标为手部在第二帧图像的位置坐标,第二位置坐标的确定过程与第一位置坐标的确定过程相同,为简洁描述,此处不再赘述。
在一个实施例中,第二帧图像可以是第一帧图像的前一帧图像,例如图像序列包含编号为1-10的图像,编号越小,对应的采集时间越早,假定第一帧图像为编号为5的图像,第二帧图像可以是编号为4的图像。由此可以根据手在相邻图像中的变化实时绘制线条,保证线条的准确性。
考虑到现实中图像的尺寸与电子设备屏幕的尺寸可能存在一定的差距,为了更好的在屏幕中展现绘制的线条,方便用户观看,在一个实施例中,可以对第一位置坐标和第二位置坐标的差值进行变换,将其变换至电子设备的屏幕中。
这里的变换可以是放大变换,也可以是缩小变换,具体与第一帧图像和屏幕的尺寸有关。
在一个实施例中,可以通过变换因子对第一位置坐标和第二位置坐标的差值进行变换,变换因子可以根据图像尺寸和屏幕尺寸的映射关系确定,例如本申请实施例中的变换因子可以根据第一帧图像的尺寸与电子设备屏幕的尺寸之间的映射关系确定。
以二维坐标为例,这里的差值可以包括横坐标差值和纵坐标差值,相应的,变换因子可以包括横坐标变换因子和纵坐标变换因子,横坐标变换因子和纵坐标变换因子可以相同也可以不同。
横坐标变换量,也即基于横坐标变换因子对横坐标差值进行变换得到的变换量;纵坐标变换量,也即基于纵坐标变换因子对纵坐标差值进行变换得到的变换量。横坐标变换量和纵坐标变换量可以是不包含符号的常数。
在S240中,第一设定阈值例如可以是1,也即在横坐标变换量和纵坐标变换量至少有一个大于或等于1的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
变换量系数和变换量阈值可以用于表示不同应用场景下允许绘制的线条类型,不同的应用场景可以设置不同的变换量系数和变换量阈值,由此在该应用场景下绘制线条时,只能得到与该应用场景对应的线条,避免了因手部惯性等原因,导致实际绘制的线条与需求不匹配的情况,满足了用户的实际需求。
在变换量系数和变换量阈值确定的情况下,表示当前应用场景允许绘制的线条类型已知,此时可以进一步根据横坐标变换量和纵坐标变换量,与变换量系数和变换量阈值的关系,绘制具体的线条。
例如在当前应用场景仅允许绘制直线的情况下,可以进一步根据横坐标变换量和纵坐标变换量,与变换量系数和变换量阈值的关系,确定绘制水平直线还是竖直直线,以满足用户的实际需求。
以通过具备图像采集功能的设备采集图像为例,应当理解,该设备在采集图像时,采集到的图像中不一定包含用户的手部。基于此,在一个实施例中,在S210之前,该方法还可以包括:
获取具备图像采集功能的设备采集的图像;
对图像进行处理,确定包含用户手部的图像;
将包含用户手部的图像按照时间顺序排列,得到图像序列。
在一个实施例中,可以通过特征识别算法,对图像进行识别,确定其 是否包含用户的手部。
在一个实施例中,也可以通过深度学习的方式确定图像是否包含用户的手部,例如可以将图像输入预先构建的神经网络模型,由预先构建的神经网络模型输出结果,该结果用于表示图像是否包含用户的手部。
考虑到实际采集的图像可能存在干扰、不清晰等问题,为了提高手部位置坐标的准确性,在一个实施例中,在获取具备图像采集功能的设备采集的图像之后,可以对获取到的图像进行预处理,提高图像质量。
例如可以对获取到的图像进行滤波、降噪、缩放、增强等预处理。
以第一设定阈值为1为例,在横坐标变换量和纵坐标变换量至少有一个不小于1的情况下,通过配置变换量系数和变换量阈值,可以绘制直线和曲线中的一种或多种。
这里的变换量系数可以包括横坐标变换量系数和纵坐标变换量系数,变换量阈值可以包括横坐标变换量阈值和纵坐标变换量阈值。
为便于描述,下面将横坐标变换量记为Dx,纵坐标变换量记为Dy,横坐标变换量系数记为Cx,纵坐标变换量系数记为Cy,横坐标变换量阈值记为Tx,纵坐标变换量阈值记为Ty。
在一个实施例中,在Cx和Cy的乘积为第一预设数值,Tx为第二预设数值,Ty为第三预设数值的情况下,可以绘制直线。
其中,第一预设数值可以是1,第二预设数值和第三预设数值可以是数值较大的常数,例如可以为大于100的常数,第二预设数值和第三预设数值可以相同也可以不同。
基于此,在一个实施例中,如图3所示,本申请实施例提供的线条绘制方法还可以包括如下步骤:
S310、获取图像序列中的第一帧图像;
S320、根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
S330、对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量;
S340、以初始线条的末端为起点,绘制目标长度的直线,其中,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条,目标长度与Dx或Dy对应。
其中,S310-S330的过程与图2中S210-S230的过程相同,具体可以参见S210-S230的描述,为简洁描述,此处不再赘述。
下面对图3中的其他步骤进行详细说明,具体如下所示:
在S340中,初始线条的末端,也即屏幕中的光标当前所在的位置,也就是说屏幕中的光标跟随线条移动。
目标长度与直线的类型有关,例如在绘制水平直线时,该目标长度与Dx对应;在绘制竖直直线时,该目标长度与Dy对应。
这里的对应可以是目标长度与Dx或Dy相同,也可以是目标长度为Dx或Dy的倍数。
在一个实施例中,在Dx大于或等于Cx与Dy的乘积,且Dy小于Tx的情况下,以初始线条的末端为起点,沿水平方向绘制第一目标长度的线段,第一目标长度与Dx对应。
在Dx大于或等于Cx与Dy的乘积,且Dy小于Tx的情况下,认为手部在水平方向的移动大于在竖直方向的移动,在仅允许绘制直线的情况下,此时可以忽略手部在竖直方向的移动,得到水平方向的线段,满足了用户绘制水平直线的需求。
在一个实施例中,在Dy大于或等于Cy与Dx的乘积,且Dx小于Tx的情况下,以初始线条的末端为起点,沿竖直方向绘制第二目标长度的线段,第二目标长度与纵坐标变换量对应。
在Dy大于或等于Cy与Dx的乘积,且Dx小于Tx的情况下,认为手部在竖直方向的移动大于在水平方向的移动,在仅允许绘制直线的情况下,此时可以忽略手部在水平方向的移动,得到竖直方向的线段,满足了用户绘制竖直直线的需求。
在一个实施例中,在Dx和Dy不满足上述条件的情况下,可以提示用户调整Dx或Dy,使其满足上述绘制水平直线或竖直直线的条件。
例如可以向用户显示“如果需要绘制水平直线,请增大Dx;如果需要绘制竖直直线,请增大Dy”的提示信息,提示信息的内容与Dx和Dy的大小有关。
由此,可以根据横坐标变换量和纵坐标变换量与变换量系数和变换量阈值的关系,绘制真正的水平直线或竖直直线,满足用户的需求,避免了因手部惯性导致线条出现弯折或弧度的情况,提高了线条的稳定性。
在一个实施例中,在Cx为第四预设数值、Cy为第五预设数值、Tx为第六预设数值以及Ty为第七预设数值的情况下,可以绘制曲线。
第四预设数值和第五预设数值例如可以是0,第六预设数值和第七预 设数值为数值较大的常数,例如可以是大于100的常数,第六预设数值和第七预设数值可以相同也可以不同,第六预设数值和第七预设数值与上述实施例中的第二预设数值和第三预设数值也可以相同,也可以不同。
基于此,在一个实施例中,如图4所示,本申请实施例提供的线条绘制方法可以包括如下步骤:
S410、获取图像序列中的第一帧图像;
S420、根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
S430、对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量;
S440、若Dx大于或等于Cx与Dy的乘积,且Dx小于Tx,且Dy大于或等于Cy与Dx的乘积,且Dy小于Ty,则以初始线条的末端为起点,第一位置坐标为终点,绘制曲线。
其中,S410-S430的过程与图2中S210-S230的过程相同,具体可以参见S210-S230的描述,为简洁描述,此处不再赘述。
下面对图4中的其他步骤进行详细说明,具体如下所示:
在S440中,在Dx大于或等于Cx与Dy的乘积,且Dx小于Tx,且Dy大于或等于Cy与Dx的乘积,且Dy小于Ty的情况下,表示手部在水平方向和竖直方向均有较大的移动,此时可以以手部在第一帧图像中的第一位置坐标为终点,连接初始线条的末端和第一位置坐标,得到斜线,对该斜线进行平滑处理即可得到平滑的曲线,满足用户绘制平滑曲线的需求。
在一个实施例中,在某些场景下可能需要兼顾直线和曲线,即既可以绘制直线,也可以绘制曲线,此时Cx、Cy、Tx和Ty可以满足如下条件:
Cx小于第二设定阈值、Cy小于第三设定阈值、Tx小于第四设定阈值以及Ty小于第五设定阈值。
也即在Cx小于第二设定阈值、Cy小于第三设定阈值、Tx小于第四设定阈值以及Ty小于第五设定阈值的情况下,可以绘制直线或曲线。
第二设定阈值、第三设定阈值、第四设定阈值和第五设定阈值的大小可以根据实际需要设置,第二设定阈值和第三设定阈值可以相同也可以不同,第四设定阈值和第五设定阈值可以相同也可以不同。
示例性的,第二设定阈值和第三设定阈值可以为小于0.2的常数,第四设定阈值和第五设定阈值可以为小于5的常数。
在一个实施例中,在Dy大于或等于Ty的情况下,如果Dx大于或等于Tx,绘制连接第一位置坐标和第二位置坐标的曲线;如果Dx小于Tx,且Dx大于或等于Cx与Dy的乘积,绘制连接第一位置坐标和第二位置坐标的曲线;如果Dx小于Tx,且Dx小于Cx与Dy的乘积,以初始线条的末端为起点,绘制竖直线段,竖直线段的长度与Dy对应。
在一个实施例中,在Dy<Ty的情况下,如果Dy大于或等于Cy与Dx的乘积,且Dx大于Tx,绘制连接手的第一位置坐标和第二位置坐标的曲线;如果Dy大于或等于Cy与Dx的乘积,且Dx小于Tx,且Dx大于或等于Cx与Dy的乘积,绘制连接第一位置坐标和第二位置坐标的曲线;如果Dy大于或等于Cy与Dx的乘积,且Dx小于Tx,且Dx小于Cx与Dy的乘积,以初始线条的末端为起点,绘制竖直线段,竖直线段的长度与Dy对应;如果Dy小于Cy与Dx的乘积,且Dx大于Tx,以初始线条的末端为起点,绘制水平线段,水平线段的长度与Dx对应;如果Dy小于Cy与Dx,且Dx小于Tx,且Dx大于或等于Cx与Dy的乘积,以初始线条的末端为起点,绘制水平线段,水平线段的长度与Dx对应。
由此,在同时需要绘制直线和曲线的场景中,可以对变换量系数和变换量阈值进行如上设置,并在横坐标变换量和纵坐标变换量,与变换量系数和变换量阈值满足上述关系时,绘制对应的线条,满足在同一场景中绘制多类型线条的需求。
在一个实施例中,在横坐标变换量和纵坐标变换量均小于第一设定阈值的情况下,如图5所示,本申请实施例提供的线条绘制方法可以包括如下步骤:
S510、获取图像序列中的第一帧图像;
S520、根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
S530、对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量;
S540、累加横坐标变换量和预先配置的横坐标初始量,得到横坐标累积量,以及累加纵坐标变换量和预先配置的纵坐标初始量,得到纵坐标累积量;
S550、在横坐标累加量和纵坐标累加量至少有一个大于第六设定阈值,的情况下,以初始线条的末端为起点,绘制目标长度的直线,其中,目标长度与横坐标累加量或纵坐标累加量对应。
S510-S530的过程与图2中S210-S230的过程相同,具体可以参见S210-S230的描述,为简洁描述,此处不再赘述。
下面对图5中的其他步骤进行详细说明,具体如下所示:
在S540中,横坐标初始量和纵坐标初始量为预先配置的常数,用于在Dx和Dy均较小的情况下,辅助绘制线条。为便于描述,可以将横坐标初始量记为Ax,纵坐标初始量记为Ay。Ax和Ay的初始值可以为0。
以第一设定阈值为1为例,在Dx小于1,且Dy小于1的情况下,可以累积变换量,然后根据累积量绘制线条。由此可以避免因手部位置变化较小而导致线条不准确的情况。
示例性的,可以分别将Dx和Ax累加,得到横坐标累积量;将Dy和Ay累加,得到纵坐标累积量。
在S550中,第六设定阈值例如可以是1。在一个实施例中,在横坐标累加量和纵坐标累加量至少有一个大于1的情况下,可以以初始线条的末端为起点,绘制直线。
直线的类型与横坐标累积量和纵坐标累积量的关系有关,例如在横坐标累积量大于纵坐标累积量的情况下,该直线为水平直线;在横坐标累积量小于或等于纵坐标累积量的情况下,该直线为竖直直线。
基于此,在一个实施例中,S550可以包括如下步骤:
在横坐标累加量大于纵坐标累加量的情况下,以初始线条的末端为起点,沿水平方向绘制第三目标长度的线段,第三目标长度与横坐标累加量对应;
在横坐标累加量小于或等于纵坐标累加量的情况下,以初始线条的末端为起点,沿竖直方向绘制第四目标长度的线段,第四目标长度与所述纵坐标累加量对应。
其中,横坐标累加量大于纵坐标累加量,表示手部在水平方向总的移动距离大于其在竖直方向总的移动距离,此时可以忽略手部在竖直方向的移动,得到水平方向的线条。
横坐标累加量小于纵坐标累加量,表示手部在竖直方向总的移动距离大于其在水平方向总的移动距离,此时可以忽略手部在水平方向的移动,得到竖直方向的线条。
由此,在Dx和Dy均小于1的情况下,可以通过累积的方式绘制线条,保证了线条的准确性。
需要说明的是,该过程执行结束后,需要初始化Ax和Ay,也即将Ax和Ay清零,防止其影响横坐标累积量和纵坐标累积量的大小,进而影响线条的绘制。
在一个实施例中,如果横坐标累积量和纵坐标累积量均小于1,可以继续累加第二帧图像和前一帧图像的横坐标变换量和纵坐标变换量,假定第二帧图像和前一帧图像的横坐标变换量和纵坐标变换量均小于1,也即再次累加的横坐标变换量和纵坐标变化量均小于1。
在一个实施例中,以用户绘制水平方向的直线和竖直方向的直线为例,基于本申请实施例提供的线条绘制方法绘制的线条可以参考图6,对比图6与图1,可以看出,基于本申请实施例提供的线条绘制方法绘制的线条可以满足用户绘制水平直线和竖直直线的需求,避免了因手部不稳定而导致线条不稳定的情况。
基于相同的发明构思,本申请实施例还提供了一种线条绘制装置,下面结合图7对本申请实施例提供的线条绘制装置进行详细说明。
如图7所示,该线条绘制装置可以包括:
图像获取模块71,用于获取图像序列中的第一帧图像,第一帧图像包括用户的手部;
位置坐标确定模块72,用于根据手部的特征信息,确定手部在第一帧图像的第一位置坐标;
差值变换模块73,用于对第一位置坐标和第二位置坐标的差值进行变换,得到差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,第二位置坐标为手部在第二帧图像的位置坐标,第二帧图像为图像序列中位于第一帧图像之前的图像;
线条绘制模块74,用于在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
在一个实施例中,变换量系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
线条绘制模块74,包括:
直线绘制单元,用于在横坐标变换量系数和纵坐标变换量系数的乘积为第一预设数值,横坐标变换量阈值为第二预设数值,纵坐标变换量阈值为第三预设数值的情况下,以初始线条的末端为起点,绘制目标长度的直 线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条,目标长度与横坐标变换量或纵坐标变换量对应。
在一个实施例中,直线绘制单元,具体用于:
在横坐标变换量大于或等于横坐标变换量系数与纵坐标变换量的乘积,且纵坐标变换量小于纵坐标变换量阈值的情况下,以初始线条的末端为起点,沿水平方向绘制第一目标长度的线段,第一目标长度与横坐标变换量对应。
在一个实施例中,直线绘制单元,具体用于:
在纵坐标变换量大于或等于纵坐标变换量系数与横坐标变换量的乘积,且横坐标变换量小于横坐标变换量阈值的情况下,以初始线条的末端为起点,沿竖直方向绘制第二目标长度的线段,第二目标长度与纵坐标变换量对应。
在一个实施例中,变换量系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
线条绘制模块74,包括:
曲线绘制单元,用于在横坐标变换量系数为第四预设数值、纵坐标变换量系数为第五预设数值、横坐标变换量阈值为第六预设数值以及纵坐标变换量阈值为第七预设数值的情况下,
若横坐标变换量大于或等于横坐标变换量系数与纵坐标变换量的乘积,且横坐标变换量小于横坐标变换量阈值,且纵坐标变换量大于或等于纵坐标变换量系数与横坐标变换量的乘积,且纵坐标变换量小于纵坐标变换量阈值,则以初始线条的末端为起点,第一位置坐标为终点,绘制曲线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条。
在一个实施例中,预设相关系数包括横坐标变换量系数和纵坐标变换量系数,变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
线条绘制模块74,包括:
多线条绘制单元,用于在横坐标变换量系数小于第二设定阈值,纵坐标变换量系数小于第三设定阈值,横坐标变换量阈值小于第四设定阈值,以及纵坐标变换量阈值小于第五设定阈值的情况下,以初始线条的末端为起点,绘制直线或曲线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条。
在一个实施例中,该装置还包括:
累积模块,用于在横坐标变换量和纵坐标变换量均小于第一设定阈值的情况下,累加横坐标变换量和预先配置的横坐标初始量,得到横坐标累积量,以及累加纵坐标变换量和预先配置的纵坐标初始量,得到纵坐标累积量;
直线绘制单元,还用于在横坐标累加量和纵坐标累加量至少有一个大于第六设定阈值的情况下,以初始线条的末端为起点,绘制目标长度的直线,初始线条为根据图像序列中位于第一图像之前的图像绘制的线条,目标长度与横坐标累加量或纵坐标累加量对应。
在一个实施例中,直线绘制单元,具体用于:
在横坐标累加量大于纵坐标累加量的情况下,以初始线条的末端为起点,沿水平方向绘制第三目标长度的线段,第三目标长度与横坐标累加量对应;
在横坐标累加量小于或等于纵坐标累加量的情况下,以初始线条的末端为起点,沿竖直方向绘制第四目标长度的线段,第四目标长度与纵坐标累加量对应。
在横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。即本申请实施例在绘制线条时,不仅考虑了手部在不同帧图像中的位置变化,还考虑了位置变化与变换量系数和变换量阈值之间的关联关系,从而在绘制线条时,只能绘制与关联关系对应的线条,而不会绘制与关联关系无关的线条,因而可以避免因惯性等原因而导致实际绘制的线条与线条类型不一致的情况,保证了线条的稳定。
图7所示装置中的各个模块和单元具有实现图2-图5中各个步骤的功能并能达到相应的技术效果,为简洁描述,此处不再赘述。
基于相同的发明构思,本申请实施例还提供了一种电子设备,下面结合图8对本申请实施例提供的电子设备进行详细说明。
如图8所示,该电子设备可以包括摄像模组81、显示屏82、处理器83以及存储器84。
摄像模组81用于采集图像,本申请实施例以摄像模组81集成在电子设备中为例。
显示屏82可以是具备显示功能的装置,例如在本申请实施例可以用于 显示绘制的线条,当然还可以显示其他内容。
显示屏82可以集成在电子设备中,也可以独立于电子设备的主体。在显示屏82独立于电子设备的主体的情况下,如果电子设备需要通过显示屏82显示信息,可以与显示屏82建立通信连接。
显示屏82除了可以具备显示功能,还可以具备触控功能,例如也可以是集显示功能和触控功能于一体的触控屏。
存储器84用于存储计算机程序指令。
处理器83可以包括中央处理器(Central Processing Unit,CPU),或者特定集成电路(Application Specific Integrated Circuit,ASIC),或者可以被配置成实施本申请实施例的一个或多个集成电路。
存储器84可以包括用于数据或指令的大容量存储器。举例来说而非限制,存储器84可包括硬盘驱动器(Hard Disk Drive,HDD)、软盘驱动器、闪存、光盘、磁光盘、磁带或通用串行总线(Universal Serial Bus,USB)驱动器或者两个或更多个以上这些的组合。在一个实例中,存储器84可以包括可移除或不可移除(或固定)的介质,或者存储器84是非易失性固态存储器。在一个实例中,存储器84可以是只读存储器(Read Only Memory,ROM)。在一个实例中,该ROM可以是掩模编程的ROM、可编程ROM(PROM)、可擦除PROM(EPROM)、电可擦除PROM(EEPROM)、电可改写ROM(EAROM)或闪存或者两个或更多个以上这些的组合。
处理器83通过读取并执行存储器84中存储的计算机程序指令,以实现图2-图5所示实施例中的方法,并达到图2-图5所示实施例执行其方法达到的相应技术效果,为简洁描述,在此不再赘述。
在一个示例中,该电子设备还可包括通信接口85和总线86。其中,如图8所示,摄像模组81、显示屏82、处理器83、存储器84、通信接口85通过总线86连接并完成相互间的通信。
通信接口85,主要用于实现本申请实施例中各模块、装置和/或设备之间的通信。
总线86包括硬件、软件或两者,将电子设备的各部件彼此耦接在一起。举例来说而非限制,总线86可包括加速图形端(Accelerated Graphics Port,AGP)或其他图形总线、增强工业标准架构(Extended Industry Standard Architecture,EISA)总线、前端总线(Front Side Bus,FSB)、超传输(Hyper Transport,HT)互连、工业标准架构(Industry Standard  Architecture,ISA)总线、无限带宽互连、低引脚数(LPC)总线、存储器总线、微信道架构(MCA)总线、外围组件互连(PCI)总线、PCI-Express(PCI-X)总线、串行高级技术附件(SATA)总线、视频电子标准协会局部(VLB)总线或其他合适的总线或者两个或更多个以上这些的组合。在合适的情况下,总线86可包括一个或多个总线。尽管本申请实施例描述和示出了特定的总线,但本申请考虑任何合适的总线或互连。
该电子设备可以基于获取的图像序列中的第一帧图像执行本申请实施例中的线条绘制方法,从而实现结合图2-图5描述的线条绘制方法以及图7描述的线条绘制装置。
另外,结合上述实施例中的线条绘制方法,本申请实施例可提供一种计算机存储介质来实现。该计算机存储介质上存储有计算机程序指令;该计算机程序指令被处理器执行时实现上述实施例中的任意一种线条绘制方法。计算机存储介质的示例包括非暂态计算机存储介质,如电子电路、半导体存储器设备、ROM、闪存、可擦除ROM(EROM)、软盘、CD-ROM、光盘、硬盘等。
需要明确的是,本申请并不局限于上文所描述并在图中示出的特定配置和处理。为了简明起见,这里省略了对已知方法的详细描述。在上述实施例中,描述和示出了若干具体步骤作为示例。但是,本申请的方法过程并不限于所描述和示出的具体步骤,本领域的技术人员可以在领会本申请的精神后,作出各种改变、修改和添加,或者改变步骤之间的顺序。
以上所述的结构框图中所示的功能块可以实现为硬件、软件、固件或者它们的组合。当以硬件方式实现时,其可以例如是电子电路、专用集成电路(Application Specific Integrated Circuit,ASIC)、适当的固件、插件、功能卡等等。当以软件方式实现时,本申请的元素是被用于执行所需任务的程序或者代码段。程序或者代码段可以存储在机器可读介质中,或者通过载波中携带的数据信号在传输介质或者通信链路上传送。“机器可读介质”可以包括能够存储或传输信息的任何介质。机器可读介质的例子包括电子电路、半导体存储器设备、ROM、闪存、可擦除ROM(EROM)、软盘、CD-ROM、光盘、硬盘、光纤介质、射频(Radio Frequency,RF)链路,等等。代码段可以经由诸如因特网、内联网等的计算机网络被下载。
还需要说明的是,本申请中提及的示例性实施例,基于一系列的步骤或者装置描述一些方法或系统。但是,本申请不局限于上述步骤的顺序, 也就是说,可以按照实施例中提及的顺序执行步骤,也可以不同于实施例中的顺序,或者若干步骤同时执行。
上面参考根据本申请实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本申请实施例的各方面。应当理解,流程图和/或框图中的每个方框以及流程图和/或框图中各方框的组合可以由计算机程序指令实现。这些计算机程序指令可被提供给通用计算机、专用计算机、或其它可编程数据处理装置的处理器,以产生一种机器,使得经由计算机或其它可编程数据处理装置的处理器执行的这些指令使能对流程图和/或框图的一个或多个方框中指定的功能/动作的实现。这种处理器可以是但不限于是通用处理器、专用处理器、特殊应用处理器或者现场可编程逻辑电路。还可理解,框图和/或流程图中的每个方框以及框图和/或流程图中的方框的组合,也可以由执行指定的功能或动作的专用硬件来实现,或可由专用硬件和计算机指令的组合来实现。
以上所述,仅为本申请的具体实施方式,所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、模块和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。应理解,本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。

Claims (11)

  1. 一种线条绘制方法,包括:
    获取图像序列中的第一帧图像,所述第一帧图像包括用户的手部;
    根据所述手部的特征信息,确定所述手部在所述第一帧图像的第一位置坐标;
    对所述第一位置坐标和第二位置坐标的差值进行变换,得到所述差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,所述第二位置坐标为所述手部在第二帧图像的位置坐标,所述第二帧图像为所述图像序列中位于所述第一帧图像之前的图像;
    在所述横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据所述横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
  2. 根据权利要求1所述的方法,其中,所述变换量系数包括横坐标变换量系数和纵坐标变换量系数,所述变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
    所述根据所述横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
    在所述横坐标变换量系数和纵坐标变换量系数的乘积为第一预设数值,所述横坐标变换量阈值为第二预设数值,所述纵坐标变换量阈值为第三预设数值的情况下,以初始线条的末端为起点,绘制目标长度的直线,所述初始线条为根据所述图像序列中位于所述第一图像之前的图像绘制的线条,所述目标长度与所述横坐标变换量或纵坐标变换量对应。
  3. 根据权利要求2所述的方法,其中,所述以初始线条的末端为起点,绘制目标长度的直线,包括:
    在所述横坐标变换量大于或等于所述横坐标变换量系数与所述纵坐标变换量的乘积,且所述纵坐标变换量小于所述纵坐标变换量阈值的情况下,以所述初始线条的末端为起点,沿水平方向绘制第一目标长度的线段,所述第一目标长度与所述横坐标变换量对应。
  4. 根据权利要求2所述的方法,其中,所述以初始线条的末端为起点,绘制目标长度的直线,包括:
    在所述纵坐标变换量大于或等于所述纵坐标变换量系数与所述横坐标变换量的乘积,且所述横坐标变换量小于所述横坐标变换量阈值的情况下, 以所述初始线条的末端为起点,沿竖直方向绘制第二目标长度的线段,所述第二目标长度与所述纵坐标变换量对应。
  5. 根据权利要求1所述的方法,其中,所述变换量系数包括横坐标变换量系数和纵坐标变换量系数,所述变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
    所述根据所述横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
    在所述横坐标变换量系数为第四预设数值、所述纵坐标变换量系数为第五预设数值、所述横坐标变换量阈值为第六预设数值以及所述纵坐标变换量阈值为第七预设数值的情况下,
    若所述横坐标变换量大于或等于所述横坐标变换量系数与所述纵坐标变换量的乘积,且所述横坐标变换量小于所述横坐标变换量阈值,且所述纵坐标变换量大于或等于所述纵坐标变换量系数与所述横坐标变换量的乘积,且所述纵坐标变换量小于所述纵坐标变换量阈值,则以初始线条的末端为起点,第一位置坐标为终点,绘制曲线,所述初始线条为根据所述图像序列中位于所述第一图像之前的图像绘制的线条。
  6. 根据权利要求1所述的方法,其中,所述预设相关系数包括横坐标变换量系数和纵坐标变换量系数,所述变换量阈值包括横坐标变换量阈值和纵坐标变换量阈值;
    所述根据所述横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条,包括:
    在所述横坐标变换量系数小于第二设定阈值,所述纵坐标变换量系数小于第三设定阈值,所述横坐标变换量阈值小于第四设定阈值,以及所述纵坐标变换量阈值小于第五设定阈值的情况下,以初始线条的末端为起点,绘制直线或曲线,所述初始线条为根据所述图像序列中位于所述第一图像之前的图像绘制的线条。
  7. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述横坐标变换量和纵坐标变换量均小于第一设定阈值的情况下,累加所述横坐标变换量和预先配置的横坐标初始量,得到横坐标累积量,以及累加所述纵坐标变换量和预先配置的纵坐标初始量,得到纵坐标累积量;
    在所述横坐标累加量和纵坐标累加量至少有一个大于第六设定阈值的 情况下,以初始线条的末端为起点,绘制目标长度的直线,所述初始线条为根据所述图像序列中位于所述第一图像之前的图像绘制的线条,所述目标长度与所述横坐标累加量或纵坐标累加量对应。
  8. 根据权利要求7所述的方法,其中,所述以初始线条的末端为起点,绘制目标长度的直线,包括:
    在所述横坐标累加量大于所述纵坐标累加量的情况下,以所述初始线条的末端为起点,沿水平方向绘制第三目标长度的线段,所述第三目标长度与所述横坐标累加量对应;
    在所述横坐标累加量小于或等于所述纵坐标累加量的情况下,以所述初始线条的末端为起点,沿竖直方向绘制第四目标长度的线段,所述第四目标长度与所述纵坐标累加量对应。
  9. 一种线条绘制装置,包括:
    图像获取模块,用于获取图像序列中的第一帧图像,所述第一帧图像包括用户的手部;
    位置坐标确定模块,用于根据所述手部的特征信息,确定所述手部在所述第一帧图像的第一位置坐标;
    差值变换模块,用于对所述第一位置坐标和第二位置坐标的差值进行变换,得到所述差值在电子设备屏幕上对应的横坐标变换量和纵坐标变换量,所述第二位置坐标为所述手部在第二帧图像的位置坐标,所述第二帧图像为所述图像序列中位于所述第一帧图像之前的图像;
    线条绘制模块,用于在所述横坐标变换量和纵坐标变换量至少有一个不小于第一设定阈值的情况下,根据所述横坐标变换量和纵坐标变换量、预先配置的变换量系数和变换量阈值之间的关联关系,绘制对应的线条。
  10. 一种电子设备,包括:
    摄像模组,用于采集图像;
    显示屏,用于显示线条;
    处理器;
    存储器,用于存储计算机程序指令,当所述计算机程序指令被所述处理器执行时,实现如权利要求1-8中任一项所述的方法。
  11. 一种计算机可读存储介质,其上存储有计算机程序指令,当所述计算机程序指令被处理器执行时,实现如权利要求1-8中任一项所述的方法。
PCT/CN2021/142560 2021-07-30 2021-12-29 线条绘制方法、装置、电子设备及计算机可读存储介质 WO2023005139A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP21951711.7A EP4365847A1 (en) 2021-07-30 2021-12-29 Line drawing method and apparatus, electronic device and computer-readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110874236.8 2021-07-30
CN202110874236.8A CN113610944A (zh) 2021-07-30 2021-07-30 一种线条绘制方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023005139A1 true WO2023005139A1 (zh) 2023-02-02

Family

ID=78338837

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/142560 WO2023005139A1 (zh) 2021-07-30 2021-12-29 线条绘制方法、装置、电子设备及计算机可读存储介质

Country Status (3)

Country Link
EP (1) EP4365847A1 (zh)
CN (1) CN113610944A (zh)
WO (1) WO2023005139A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113610944A (zh) * 2021-07-30 2021-11-05 新线科技有限公司 一种线条绘制方法、装置、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120050293A1 (en) * 2010-08-25 2012-03-01 Apple, Inc. Dynamically smoothing a curve
CN105468180A (zh) * 2014-08-29 2016-04-06 深圳市鸿合创新信息技术有限责任公司 一种电子白板轨迹平滑方法和装置
CN109582929A (zh) * 2018-12-13 2019-04-05 掌阅科技股份有限公司 基于电子书的标记线绘制方法及电子设备
CN112684895A (zh) * 2020-12-31 2021-04-20 安徽鸿程光电有限公司 标记方法、装置、设备及计算机存储介质
CN112884864A (zh) * 2021-01-21 2021-06-01 广州朗国电子科技有限公司 基于电子白板自动矫正矩形的绘图方法及其应用
CN113610944A (zh) * 2021-07-30 2021-11-05 新线科技有限公司 一种线条绘制方法、装置、设备及存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9305340B2 (en) * 2011-11-09 2016-04-05 Mitsubishi Electric Corporation Drawing device and drawing program
KR101404018B1 (ko) * 2013-02-01 2014-06-10 전자부품연구원 손동작 인식 장치 및 그 방법
JP6122322B2 (ja) * 2013-03-25 2017-04-26 株式会社メガチップス 画像処理装置、プログラムおよび集積回路
CN105320434A (zh) * 2014-06-16 2016-02-10 中兴通讯股份有限公司 基于安卓系统的曲线绘制处理方法、装置及终端
CN108446032B (zh) * 2017-12-28 2022-03-08 安徽慧视金瞳科技有限公司 一种投影交互系统中的鼠标手势实现方法
CN110750160B (zh) * 2019-10-24 2023-08-18 京东方科技集团股份有限公司 基于手势的绘画屏绘画方法、装置、绘画屏和存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120050293A1 (en) * 2010-08-25 2012-03-01 Apple, Inc. Dynamically smoothing a curve
CN105468180A (zh) * 2014-08-29 2016-04-06 深圳市鸿合创新信息技术有限责任公司 一种电子白板轨迹平滑方法和装置
CN109582929A (zh) * 2018-12-13 2019-04-05 掌阅科技股份有限公司 基于电子书的标记线绘制方法及电子设备
CN112684895A (zh) * 2020-12-31 2021-04-20 安徽鸿程光电有限公司 标记方法、装置、设备及计算机存储介质
CN112884864A (zh) * 2021-01-21 2021-06-01 广州朗国电子科技有限公司 基于电子白板自动矫正矩形的绘图方法及其应用
CN113610944A (zh) * 2021-07-30 2021-11-05 新线科技有限公司 一种线条绘制方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN113610944A (zh) 2021-11-05
EP4365847A1 (en) 2024-05-08

Similar Documents

Publication Publication Date Title
US10043308B2 (en) Image processing method and apparatus for three-dimensional reconstruction
CN106845335B (zh) 用于虚拟现实设备的手势识别方法、装置及虚拟现实设备
EP2846308A2 (en) Pointing direction detecting device and its method, program and computer readable-medium
WO2022166243A1 (zh) 捏合手势检测识别方法、装置及系统
CN106774850B (zh) 一种移动终端及其交互控制方法
US10678342B2 (en) Method of virtual user interface interaction based on gesture recognition and related device
CN109583391B (zh) 关键点检测方法、装置、设备及可读介质
CN110287891B (zh) 基于人体关键点的手势控制方法、装置及电子设备
WO2020220809A1 (zh) 目标对象的动作识别方法、装置和电子设备
US9218060B2 (en) Virtual mouse driving apparatus and virtual mouse simulation method
WO2013075466A1 (zh) 一种基于图像传感模块的字符输入方法、装置及终端
WO2023005139A1 (zh) 线条绘制方法、装置、电子设备及计算机可读存储介质
CN106569716B (zh) 单手操控方法及操控系统
CN111931756A (zh) 用于生成电子签名的方法、计算设备和计算机存储介质
CN106598422B (zh) 混合操控方法及操控系统和电子设备
CN114879846A (zh) 触发位置的确定方法、装置、设备及介质
JP2016099643A (ja) 画像処理装置、画像処理方法および画像処理プログラム
CN108255352B (zh) 一种投影交互系统中多点触摸实现方法及系统
CN111986229A (zh) 视频目标检测方法、装置及计算机系统
CN111601129B (zh) 控制方法、装置、终端及存储介质
CN110765926B (zh) 图画书识别方法、装置、电子设备和存储介质
JP6011154B2 (ja) 画像処理装置、画像処理方法
WO2023020268A1 (zh) 一种手势识别方法、装置、设备及介质
KR101909326B1 (ko) 얼굴 모션 변화에 따른 삼각 매쉬 모델을 활용하는 사용자 인터페이스 제어 방법 및 시스템
CN111913574B (zh) 用于控制设备的方法、装置、电子设备和计算机可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21951711

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2021951711

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2021951711

Country of ref document: EP

Effective date: 20240130

NENP Non-entry into the national phase

Ref country code: DE