WO2021036903A1 - 一种绘图方法及电子设备 - Google Patents

一种绘图方法及电子设备 Download PDF

Info

Publication number
WO2021036903A1
WO2021036903A1 PCT/CN2020/110287 CN2020110287W WO2021036903A1 WO 2021036903 A1 WO2021036903 A1 WO 2021036903A1 CN 2020110287 W CN2020110287 W CN 2020110287W WO 2021036903 A1 WO2021036903 A1 WO 2021036903A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
drawn
hand
geometric
electronic device
Prior art date
Application number
PCT/CN2020/110287
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 华为技术有限公司
Publication of WO2021036903A1 publication Critical patent/WO2021036903A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/80Creating or modifying a manually drawn or painted image using a manual input device, e.g. mouse, light pen, direction keys on keyboard

Definitions

  • the embodiments of the present application relate to the field of terminal technology, and in particular, to a drawing method and electronic equipment.
  • the applications of electronic devices have become more and more extensive, and the interaction between users and electronic devices has also increased.
  • the user can take a screenshot of the news of interest and enter the drawing (editing) mode, graffiti and annotate the news part of interest, or select one of the preset geometric shapes provided in the drawing mode Regular geometric figures (such as rectangles), drag to the news section of interest, mark the news section of interest, and then share or save the marked news screen shots.
  • the embodiments of the present application provide a drawing method and electronic equipment to simplify the drawing process, facilitate the user's operation, and meet the user's demand for refined operation.
  • an embodiment of the present application provides a drawing method, which can be executed by an electronic device.
  • the method includes: displaying a first interface, the first interface including a first image; collecting hand-drawn graphics drawn on the first image; when the drawing mode of the hand-drawn graphics is regular drawing, in the first interface A regular geometric figure corresponding to the hand-drawn figure is generated on an image; a second interface is displayed, the second interface includes a second image, and the second image is to generate the regular geometric figure on the first image
  • the latter image wherein the position of the regular geometric figure on the second image is the same as or similar to the position of the hand-drawn figure on the first image, and the regular geometric figure is on the second image
  • the size of is the same as or similar to the size of the hand-drawn graphic on the first image.
  • the user does not need to manually select the regular geometric figure to be drawn and drag it to the corresponding position. It only needs to draw the geometric figure directly at the position where the regular geometric figure needs to be drawn, that is, According to the irregular geometric figures drawn by the user, regular geometric figures can be generated, which avoids the user’s difficulty in accurately dragging regular geometric figures on large-screen electronic devices. At the same time, it simplifies the drawing process, facilitates user operations, and satisfies It meets the needs of users for refined operation.
  • the electronic device before the electronic device collects the hand-drawn graphics drawn on the first image, it may also activate in response to the first operation when the first operation on the first interface is detected.
  • the drawing function the first operation is used to instruct to start the drawing function.
  • the user can start the drawing function through the first operation, which is convenient for the user to operate.
  • generating a regular geometric figure corresponding to the hand-drawn figure on the first image includes: inputting multiple pixel positions and multiple pixel values in the hand-drawn figure into geometric figure detection Model to obtain the type of geometric figure corresponding to the hand-drawn figure;
  • the geometric figure detection model may be a model that can calculate the type of the corresponding geometric figure according to a matrix formed by the pixel values of multiple pixels in the hand-drawn figure Arithmetic function; according to the type of geometric figure corresponding to the hand-drawn figure, and the position and size of the hand-drawn figure on the first image, a regular geometric figure is generated on the first image.
  • the electronic device may also receive an adjustment operation for the regular geometric figure, where the adjustment operation is used to adjust the parameters of the regular geometric figure, and the parameters include size, At least one of the thickness of the line and the line type; in response to the adjustment operation, the parameter of the regular geometric figure displayed in the second image included in the second interface is adjusted.
  • the user can adjust one or more parameters of the generated regular geometric figure through different adjustment operations, that is, after the regular geometric figure is generated, the electronic device can respond to the user's adjustment operation to adjust the size of the generated regular figure , Line thickness, line type, etc. to adjust one or more of them to meet the user's drawing needs.
  • the electronic device may also display a third interface, the third interface includes a third image, and the third image Is the image after adding the hand-drawn graphics to the first image.
  • the third interface includes a third image
  • the third image Is the image after adding the hand-drawn graphics to the first image.
  • the electronic device may also turn off the drawing function in response to the second operation when detecting a second operation on the second interface or the third interface, and the second operation Used to indicate to close the drawing function.
  • the drawing function is turned off, so as to avoid misoperation of the figure drawn by the user and ensure the accuracy of the drawing.
  • an embodiment of the present application also provides an electronic device, the electronic device including: a memory, a processor, and a display screen; wherein the processor is connected to the memory and the display screen; and one or more computers Program, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to execute the above-mentioned
  • the electronic device including: a memory, a processor, and a display screen; wherein the processor is connected to the memory and the display screen; and one or more computers Program, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to execute the above-mentioned
  • the method described in one aspect or any one of the possible designs of the first aspect are examples of the electronic device.
  • the embodiments of the present application also provide an electronic device, which includes functional modules that can execute the first aspect or any of the possible designs of the electronic device behavior in the first aspect; these functional modules can pass Hardware implementation can also be implemented by hardware executing corresponding software.
  • an embodiment of the present application also provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the first aspect or any one of the first aspects. Possible design methods described in.
  • the embodiments of the present application also provide a program product, which when the program product runs on an electronic device, causes the electronic device to execute the above-mentioned first aspect or any one of the possible designs in the first aspect. The method described.
  • FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the application
  • FIG. 2 is a schematic diagram of the hardware structure of a mobile phone provided by an embodiment of the application.
  • FIG. 3 is a schematic structural diagram of a geometric figure detection model provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of a graphical user interface of a mobile phone provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of an irregular drawing and a regular drawing provided by an embodiment of the application.
  • FIG. 6 is one of the schematic diagrams of a rule drawing provided by an embodiment of this application.
  • FIG. 7 is the second schematic diagram of a rule drawing provided by an embodiment of this application.
  • FIG. 8 is the third schematic diagram of a rule drawing provided by an embodiment of this application.
  • FIG. 9 is the fourth schematic diagram of a rule drawing provided by an embodiment of this application.
  • FIG. 10 is a schematic diagram of a drawing process provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of a sliding adjustment angle recognition provided by an embodiment of the application.
  • FIG. 12 is a schematic structural diagram of an electronic device provided by an embodiment of this application.
  • Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application.
  • a user uses a mobile phone to take a screenshot or browse pictures/photos, he can draw geometric figures on the screenshots or browsed pictures/photos.
  • the geometric figures irregular
  • the irregular geometric figure drawn by the user on the screenshot image or browsed picture/photo The position generates regular geometric figures and replaces the irregular geometric figures drawn by the user.
  • the user does not need to manually select the regular geometric figure to be drawn and drag it to the corresponding position, and only needs to select the position to draw the regular geometric figure on the touch screen of the mobile phone.
  • the mobile phone can generate regular geometric figures in the corresponding position according to the irregular geometric figures drawn by the user, avoiding the problem that users are difficult to accurately drag regular geometric figures on large-screen mobile phones and simplifying the drawing process. , It is convenient for users to operate, and also meets the needs of users for refined operation.
  • references described in this specification to "one embodiment” or “some embodiments”, etc. mean that one or more embodiments of the present application include a specific feature, structure, or characteristic described in conjunction with the embodiment. Therefore, the sentences “in one embodiment”, “in some embodiments”, “in some other embodiments”, “in some other embodiments”, etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless it is specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variations all mean “including but not limited to”, unless otherwise specifically emphasized.
  • the electronic device may be a portable terminal (for example, a device with a camera) with functions of image shooting, transmission, storage, etc., such as a mobile phone, a tablet computer, a digital camera, a wearable device (such as a smart watch) Wait.
  • portable terminals include, but are not limited to, carrying Or portable terminals with other operating systems.
  • the aforementioned portable terminal may also be other portable terminals, as long as it has functions such as image shooting, transmission, and storage.
  • electronic devices can support multiple applications. For example, one or more of the following applications: camera applications, instant messaging applications, etc. Among them, there can be multiple instant messaging applications, such as WeChat, Tencent chat software (QQ), WhatsApp Messenger, Line, Kakao Talk, DingTalk, etc. Users can send text, voice, pictures, video files, and various other files to other contacts through instant messaging applications; or users can implement voice and video calls with other contacts through instant messaging applications.
  • the application designed below may be an application that the electronic device comes with when it leaves the factory, an application that the electronic device downloads and installs from the network side, or an application that the electronic device receives from other electronic devices, which is not limited in the embodiment of the application.
  • FIG. 2 shows a schematic structural diagram of the mobile phone 100.
  • the mobile phone 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142, Antenna 1, antenna 2, mobile communication module 151, wireless communication module 152, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, A display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal.
  • AP application processor
  • GPU graphics processing unit
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the mobile phone 100.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may run the software code/module of the drawing algorithm and execute the corresponding drawing process. The specific process will be described later.
  • the display screen 194 is used to display the display interface of the application in the mobile phone 100, such as the viewfinder interface of the camera, the chat interface of WeChat, etc., and can also display images, videos, etc. in the gallery, or third-party image post-processing software (for example, Mei Figure Xiuxiu, vsco, MIX, etc.) display interface and so on.
  • the display screen 194 includes a display panel.
  • the display panel can adopt liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • the mobile phone 100 may include one or N display screens 194, and N is a positive integer greater than one.
  • the camera 193 is used to capture still images, moving images, or videos.
  • the number of cameras 193 in the mobile phone 100 may be at least two. Take two as an example, one of which is a front camera and the other is a rear camera; taking three as an example, one of which is a front camera and the other two are a rear camera.
  • the camera 193 may be a wide-angle camera, a telephoto camera, and so on.
  • the camera 193 may include photosensitive elements such as a lens group and an image sensor, where the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by objects to be photographed (such as the user's face, landscape, etc.), and The collected light signal is transmitted to the image sensor.
  • the image sensor generates an image of the object to be photographed according to the light signal.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the mobile phone 100 by running instructions stored in the internal memory 121.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, at least one application program (such as a camera, a gallery, a WeChat, etc.) required by a function, etc.
  • the data storage area can store data (such as images, videos, etc.) created during the use of the mobile phone 100.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the internal memory 121 may store the software code/module of the drawing algorithm, and the processor 110 runs the software code/module of the drawing algorithm to execute the corresponding drawing process. The specific process will be described later.
  • the sensor module 180 may include a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and so on.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the mobile phone 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
  • the temperature sensor 180J is used to detect temperature.
  • the mobile phone 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the mobile phone 100, which is different from the position of the display screen 194.
  • the mobile phone 100 includes a touch screen composed of a touch sensor 180K and a display screen 194 as an example for description.
  • the mobile phone 100 can receive key 190 input, and generate key signal input related to user settings and function control of the mobile phone 100.
  • the mobile phone 100 can use the motor 191 to generate a vibration notification (such as an incoming call vibration notification).
  • the indicator 192 in the mobile phone 100 can be an indicator light, which can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 in the mobile phone 100 is used to connect to the SIM card.
  • the SIM card can be connected to and separated from the mobile phone 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195.
  • the mobile phone 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the mobile phone.
  • the mobile phone may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • a geometric figure detection model is stored in the mobile phone 100 (for example, a geometric figure detection model is stored in the internal memory 121 of the mobile phone 100).
  • the mobile phone 100 can run the drawing algorithm and execute the drawing process,
  • the stored geometric figure detection model is called to detect the hand-drawn figure drawn by the user on the mobile phone 100, and the type of the geometric figure corresponding to the hand-drawn figure is determined.
  • the hand-drawn graphic refers to a graphic formed by a trajectory (line) drawn by the user on the mobile phone 100
  • the graphic formed by the trajectory drawn by the user on the mobile phone 100 can correspond to a certain type of geometrical figure, or it can be
  • the non-(irregular) trajectory that does not correspond to any type of geometric figure is not limited in the embodiment of the present application.
  • the hand-drawn graphics drawn by the user is a hand-drawn graphics corresponding to a rectangle.
  • the geometric figure detection model may be a model based on a neural network architecture, such as forward neural network, convolutional neural network (convolutional neural networks, CNN), recurrent neural network (recurrent neural network, RNN), deep neural network, etc.
  • a neural network architecture such as forward neural network, convolutional neural network (convolutional neural networks, CNN), recurrent neural network (recurrent neural network, RNN), deep neural network, etc.
  • the geometric pattern detection model is a model based on a deep neural network as an example for description.
  • the work of each layer in the deep neural network can be expressed in mathematical expressions
  • the output of each layer Input for the next layer From the physical level, the work of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column space) through five operations on the input space (the set of input vectors), These five operations include: 1. Dimension Up/Down; 2. Enlarge/Reduce; 3. Rotate; 4. Translation; 5. "Bend".
  • the operations of 1, 2, and 3 are determined by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a().
  • W is a weight vector, and each value in the vector represents the weight value of a neuron in the layer of neural network.
  • the weight vector W determines the space transformation from the input space to the output space described above, that is, the weight vector W of each layer controls how the space is transformed.
  • the purpose of training a deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the weight vector W of multiple layers). Therefore, the training process of the neural network is essentially the way of learning to control the spatial transformation, and more specifically the learning of the weight matrix.
  • the weight vector of the network (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it The prediction is lower and keep adjusting until the neural network can predict the target value you really want. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value".
  • This is the loss function or objective function, which is used to measure the difference between the predicted value and the target value. Important equation. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, then the training of the deep neural network becomes a process of reducing this loss as much as possible.
  • the training device can compare the depth of the user's hand-drawn graphics according to a large number of various types of geometric figures (such as rectangles, circles, arrows, wavy lines, five-pointed stars, triangles, diamonds, etc.) stored in the training set.
  • the neural network is trained to obtain a geometric figure detection model.
  • the hand-drawn graphics in the training set are the input of the deep neural network
  • the type label matrix (vector) corresponding to the hand-drawn graphics is the expected output of the deep neural network for the hand-drawn graphics , which is the really desired target value mentioned above, it needs to be understood that each type of geometric figure corresponds to a unique type label matrix.
  • the weight vector (W) of each layer of the deep neural network is adjusted.
  • the weight vector (W) of each layer of the deep neural network is adjusted until the output of the deep neural network
  • the actual type matrix of is consistent with the type label matrix corresponding to the input hand-drawn graphics.
  • the hand-drawn graphics (the matrix formed by the pixel values of each pixel of the hand-drawn graphics) can be used as the input of the geometric figure detection model, and each layer of the model can be detected according to the geometric figure.
  • the input hand-drawn figure is continuously operated to obtain the output type matrix of the geometric figure detection model, and the type of the geometric figure corresponding to the type matrix is the type of the hand-drawn figure.
  • the geometric figure detection model may be an arithmetic function that can calculate the type of the corresponding geometric figure according to the matrix formed by the pixel values of multiple pixels in the hand-drawn figure.
  • the aforementioned training device can be a mobile phone 100, or a personal computer (PC), laptop, server, etc., and the geometric pattern detection model can be trained by the training device and stored in the mobile phone 100. , Such as stored in the internal memory 121 of the mobile phone 100.
  • the drawing method provided in this application can be used in applications such as system gallery, system screenshots, etc., can also be used in applications such as system cameras, third-party image post-application applications, and can also be used in instant messaging applications such as WeChat, QQ and other applications.
  • applications such as system gallery, system screenshots, etc.
  • applications such as system cameras, third-party image post-application applications, and can also be used in instant messaging applications such as WeChat, QQ and other applications.
  • instant messaging applications such as WeChat, QQ and other applications.
  • Scenario 1 System gallery.
  • FIG. 4 shows a graphical user interface GUI of the mobile phone 100, and the GUI may be referred to as the desktop 401 (or the main interface 401) of the mobile phone 100.
  • the mobile phone 100 detects an operation (for example, a click operation) on the icon 402 of the gallery application on the desktop 401, it can start the gallery application and display another GUI as shown in (B) in FIG. 4, which can become an image Select interface 403.
  • the image selection interface 403 may include thumbnails of one or more images.
  • the mobile phone 100 detects an operation (for example, a click operation) on the thumbnail 404, it opens the image corresponding to the thumbnail 404, and displays another GUI as shown in (C) in FIG. 4, which may be called an image preview Interface 405.
  • the image preview interface 405 includes an image 406 corresponding to the thumbnail 404.
  • the user can control the mobile phone 100 to enter the drawing mode by long-pressing the image 406 (for example, pressing for more than 1 second) through a set start (wake-up) operation.
  • the image preview interface 405 may also include one or more controls, and the one or more controls may be used to control the mobile phone 100 to enter the drawing mode. In addition to starting operations set by the user, It is also possible to control the mobile phone 100 to enter the drawing mode through the one or more controls.
  • the user can draw any track on the image displayed on the mobile phone 100 (in this example, the image 406 corresponding to the thumbnail 404), and the mobile phone 100 directly displays the displayed image 406 according to the track drawn by the user Corresponding trajectories or display regular geometric figures generated from hand-drawn graphics composed of drawn trajectories.
  • the mobile phone 100 in order to facilitate the identification of whether the user draws a direct trajectory or needs to generate a regular geometric figure based on a hand-drawn figure formed by the drawn trajectory, the mobile phone 100 has regular drawing and non (irregular) drawing in the drawing mode.
  • Two drawing methods among which, if the user draws any trajectory directly, it means that it is performing irregular drawing, and the corresponding trajectory is directly displayed on the displayed image, that is, the user’s hand-drawn graphics are directly displayed; if the user is in a place (one point) on the touch screen ) Keep pressing for a long time and draw another place, it means that you are drawing a rule.
  • a ruled geometric figure is generated and displayed on the displayed image.
  • FIG. 5(A) after entering the drawing mode, without a long press, the user directly draws the trajectory on the image to perform irregular drawing, and the mobile phone 100 directly displays it on the displayed image The trajectory drawn by the user.
  • Figure 5(B) when there is a long press, the user draws a trajectory on the image and performs regular drawing (for example, one finger of the user keeps long pressing on one place on the touch screen, and the other finger is on the
  • the mobile phone 100 inputs the trajectory drawn by the user (that is, the hand-drawn figure) into the geometric figure detection model to obtain the geometry corresponding to the hand-drawn figure drawn by the user and output by the geometric figure detection model.
  • the type of the figure in this example, a straight line
  • a regular geometric figure is generated and displayed on the image.
  • the mobile phone 100 can be based on the position and size of the smallest enclosing rectangle of the hand-drawn figure drawn by the user. , In the smallest bounding rectangle, a largest regular geometric figure is generated according to the type of the geometric figure.
  • the mobile phone 100 uses the connection between the midpoints of the two shorter opposite sides (width) in the minimum circumscribed rectangle as the generated regular straight line;
  • the largest circle (inscribed circle) and the largest five-pointed star can be determined in the corresponding smallest circumscribed rectangle, which is a generated regular figure.
  • the user can adjust the thickness and size of the generated regular geometric figure line by sliding.
  • the line thickness of the generated regular straight line can be adjusted by sliding up and down. For example, the regular straight line generated by sliding upward becomes thinner, and the regular straight line generated by sliding downward becomes thicker.
  • the mobile phone 100 when the mobile phone 100 detects an operation on the "drawing mode exit" control 501, it exits the drawing mode, saves and displays that contains generated Of regular geometric figures.
  • the user can also exit the drawing mode by double-clicking, which is not limited in the embodiment of the present application.
  • Scenario 2 A screenshot of the system or any application.
  • the user can control the mobile phone 100 to enter (evoke) the drawing mode by long pressing the screenshot image (for example, pressing for more than 1s), similar to the above scenario 1, the mobile phone 100 is in the drawing mode
  • regular drawing and irregular drawing are two drawing methods, regular drawing and irregular drawing, and users can perform regular drawing. After generating regular geometric figures on the screenshot image, slide to adjust the size of the generated regular geometric figures, the thickness of the lines, etc., below Describe with specific examples.
  • Example 1 Referring to Figure 6(A), in the screenshot state, after the user controls the mobile phone 100 to enter the drawing mode by long pressing (such as long pressing a certain position of the touch screen), the user keeps one finger long pressing, and the other One hand points out the "wave line” drawn.
  • the mobile phone 100 detects that the user is drawing in the long-press state. When drawing a rule, the mobile phone 100 will draw the "wave line” after the user draws the "wave line”. Input into the geometric figure detection model, and obtain the output of the geometric figure detection model, and the type of the geometric figure corresponding to the “wave line” drawn by the user is a wavy line.
  • the mobile phone 100 determines that the type of geometric figure corresponding to the "wave line" drawn by the user is a wavy line, it generates it on the screenshot image according to the position and size of the "wave line” drawn by the user Regular wavy lines and display.
  • the user can also adjust the waveform of the generated regular wavy lines by sliding left and right, and adjust the thickness of the lines by sliding up and down.
  • Example 2 As shown in Figure 7(A), after the mobile phone 100 is controlled to enter the drawing mode in the screenshot state, the user keeps pressing one finger and the other hand points out the drawn “arrow", and the mobile phone 100 detects that the user is Drawing in the long-press state, in the rule drawing, after the user draws the "arrow", the mobile phone 100 inputs the "arrow” drawn by the user into the geometry detection model to obtain the user-drawn "arrow” output by the geometry detection model.
  • the type of geometric figure corresponding to "arrow” is arrow. Referring to FIG.
  • the mobile phone 100 determines that the type of geometric figure corresponding to the "arrow" drawn by the user is an arrow, it generates regular arrows on the screenshot image according to the position and size of the "arrow” drawn by the user. display.
  • the regular arrow is generated and displayed on the screenshot image, the user can also adjust the thickness of the line of the generated regular arrow by sliding up and down.
  • the mobile phone 100 can also input the “five-pointed star” drawn by the user into the geometrical figure detection model after the user has drawn the “five-pointed star” .
  • the type of geometric figure corresponding to the “five-pointed star” drawn by the user and outputted by the geometric figure detection model is a five-pointed star.
  • a regular five-pointed star is generated and displayed on the screenshot image.
  • the user can also adjust the thickness of the generated regular five-pointed star by sliding up and down.
  • the mobile phone 100 can also input the “rectangle” drawn by the user into the geometric figure detection model after the user draws the “rectangle” to obtain the geometric figure
  • the type of geometric figure corresponding to the "rectangle” drawn by the user and outputted by the detection model is a rectangle.
  • a regular rectangle is generated and displayed on the screenshot image.
  • the user can also adjust the thickness of the lines of the generated regular rectangle by sliding up and down.
  • the user can also click on the area where the generated regular graphics such as five-pointed stars, rectangles, and circles are located on the mobile phone 100, and the mobile phone 100 displays the generated five-pointed stars, rectangles, and circles.
  • the user can adjust the size of the generated five-pointed star, rectangle, circle and other regular graphics by dragging the adjustment frame in the area where the regular graphics are located.
  • FIG. 10 shows a schematic flowchart of a drawing method provided by an embodiment of the present application. This method can be applied to the mobile phone 100 shown in FIG. 2 or similar electronic devices. The following embodiments take the method applied to the mobile phone 100 as an example. As shown in Figure 10, the process of the method includes:
  • the mobile phone 1001 displays the first image.
  • the first image may be the image 406 displayed by the mobile phone 100.
  • the first image may also be a screenshot image; in other embodiments, the first image may also be any image opened or captured by the mobile phone 100 through chat software or the like.
  • the mobile phone 100 starts the drawing function.
  • the mobile phone 100 after the mobile phone 100 detects the start operation of the drawing function, in response to the start operation (see the foregoing description), the mobile phone 100 starts the drawing function and enters the drawing mode.
  • the mobile phone 100 collects the hand-drawn graphics, and determines whether the drawing method of drawing the hand-drawn graphics is regular drawing, if it is, proceed to 1004, if not, proceed to 1008.
  • the mobile phone 100 collects a sliding track of a center point of a finger or a stylus on the touch screen of the mobile phone 100, and the mobile phone 100 generates a hand-drawn graphic according to the sliding track.
  • the touch screen has a pressure-sensitive function
  • the pressure value when the center point of a finger or stylus slides on the touch screen of the mobile phone 100 can also be recorded at the same time, and the thickness of the line corresponding to the sliding track is determined according to the pressure value; if the touch screen Without pressure sensing function, the sliding track can adopt the default value.
  • the mobile phone 100 generating hand-drawn graphics according to the sliding track can be implemented by calling an application programming interface (API) of an existing drawing application.
  • API application programming interface
  • the mobile phone 100 after the mobile phone 100 enters the drawing mode, it will start to monitor whether the touch screen has a long press. If the mobile phone 100 does not monitor the long press event, it is determined that the user is not (no) Rule drawing; if the long press on the touch screen is monitored for a time exceeding the set threshold (such as 1s), it is determined that the long press event is monitored. At this time, the mobile phone 100 can display a long press global flag (cur long pressed), and the long press can be It is a text logo, or other logos, which indicate that the mobile phone 100 detects a long-press event and enters the rule drawing mode, prompting the user to perform rule drawing.
  • the set threshold such as 1s
  • the mobile phone 100 After entering the regular drawing mode, the mobile phone 100 generates regular geometric figures according to the hand-drawn figures drawn by the user.
  • the mobile phone 100 displays curly long pressed, which indicates that the mobile phone 100 detects the long press event and enters the regular drawing mode.
  • the user can still hold the long press while drawing, and draw (for example, the user’s finger has been Keep pressing a certain position on the touch screen and use the other finger to draw); it is also possible to draw without holding a long press.
  • the mobile phone 100 can generate regular geometric figures according to the hand-drawn figures drawn by the user.
  • the user can configure a long-press event monitoring area according to the screen shape and/or size of the mobile phone 100, and the mobile phone 100 only monitors the long-press event in the configured monitoring area.
  • the mobile phone 100 recognizes the type of the geometric figure corresponding to the hand-drawn figure.
  • the mobile phone 100 After the mobile phone 100 collects the hand-drawn graphics and determines that it is a regular drawing, it inputs the hand-drawn graphics into the geometric figure detection model to obtain the type of geometric figure corresponding to the hand-drawn figure output by the geometric figure detection model, and realize the geometric figure corresponding to the hand-drawn figure Type identification.
  • the geometry detection model For the training process of the geometry detection model, please refer to the previous description.
  • the mobile phone 1005 The mobile phone 100 generates a regular geometric figure on the first image according to the position and size of the hand-drawn figure and the determined type of the geometric figure.
  • the mobile phone 100 displays an image containing regular geometric figures.
  • the position of the regular geometric figure in the image is the same or similar to the position of the hand-drawn figure in the image
  • the size of the regular geometric figure in the image is the same or similar to the size of the hand-drawn figure in the image.
  • the mobile phone 100 can generate a largest regular geometric figure according to the type of the geometric figure in the smallest circumscribed rectangle according to the position and size of the minimum circumscribed rectangle of the hand-drawn figure drawn by the user. For example, according to the position and size of the minimum circumscribed rectangle of a hand-drawn graphic (such as a straight line), the mobile phone 100 uses the connection between the midpoints of the two shorter opposite sides (width) in the minimum circumscribed rectangle as the generated regular straight line; For star-level geometric figures, the largest circle (inscribed circle) and the largest five-pointed star can be determined in the corresponding smallest circumscribed rectangle, which is a generated regular figure.
  • a hand-drawn graphic such as a straight line
  • the mobile phone 100 receives an adjustment instruction for the regular geometric figure, and adjusts the regular geometric figure.
  • the rule geometric graph generated by the mobile phone 100 by default is in the selected state, and an adjustment box (edit box) that can adjust the rule graph is displayed, and the user can adjust it by dragging
  • the box adjusts the size of the generated regular graphics, and can also perform preset operations, such as sliding up and down, sliding left and right, etc., to adjust the line thickness and line type (such as the waveform of a wavy line) of the regular geometric graphics.
  • a regular figure is generated and displayed
  • the adjustment box of the regular geometric figure is displayed.
  • adjustment rules corresponding to the regular geometric figures are set for each kind of regular geometric figures, wherein the adjustment rules between different regular geometric figures may be completely different, partly the same and partly different, or completely different.
  • the thickness of the line can be adjusted by sliding with an angle.
  • the recognition of up and down sliding, left and right sliding and angled sliding can be realized according to the coordinates of the starting point of the sliding (x 1 , y 1 ) and the coordinates of the end point (x 2 , y 2 ).
  • the set first threshold interval such as [-10°, 10°]
  • arctan[y 2 -y 1 )/( x 2 -x 1 )] is located in the second threshold interval, such as [-10°, 10°] is determined to be left and right sliding
  • arctan[(x 2 -x 1 )/(y 2 -y 1 )] Is not located in the set first threshold interval and arctan[y 2 -y 1 )/(x 2 -x 1 )] is not located in the set second threshold interval, it is determined as a sliding with an angle
  • ⁇ ) is located between [-10°, 10°]
  • ⁇ ) is located between [80°, 100°]
  • it is determined to slide up and down otherwise it is determined to slide with an angle
  • optional it is also possible to only determine that ⁇ ) is between [35°, 55°] as an angular sliding.
  • the length of the movement from the starting point to the ending point of the sliding can be used as a reference value for regular geometric adjustment.
  • the thickness of the line increases by 1pt for each increase in the length of the movement from the starting point to the ending point by 1cm.
  • the mobile phone 100 displays an image containing hand-drawn graphics.
  • the image containing the hand-drawn figure or the regular geometric figure is saved.
  • the method provided in the embodiments of the present application is introduced from the perspective of the terminal device (mobile phone 100) as the execution subject.
  • the terminal device may include a hardware structure and/or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a certain function of the above-mentioned functions is executed by a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraint conditions of the technical solution.
  • the electronic device may include: one or more processors 1202, a memory 1203, and one or more computer programs 1204; Or multiple communication buses 1205 are connected.
  • the electronic device may also include external hardware such as a display screen, a microphone, and a speaker.
  • the one or more computer programs 1204 are stored in the above-mentioned memory 1203 and configured to be executed by the one or more processors 1202, and the one or more computer programs 1204 include instructions, and the above-mentioned instructions can be used for execution. All or part of the steps described in the embodiment shown in the foregoing FIGS. 3 to 10.
  • the processor 1202 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), and may be one or more integrated circuits for controlling program execution, and may be Baseband chip, etc.
  • the number of the memory 1203 may be one or more, and the memory 1203 may be a read-only memory (ROM), a random access memory (RAM), a disk memory, or the like.
  • the electronic device shown in FIG. 12 may be a mobile phone, an ipad, a notebook computer, a smart TV, a wearable device (such as a smart watch, a smart helmet, or a smart bracelet, etc.).
  • a mobile phone its structure can be seen in FIG. 2, for example, the memory 1203 is the internal memory 121.
  • the term “when” or “after” can be interpreted as meaning “if" or “after” or “in response to determining" or “in response to detecting ".
  • the phrase “when determining" or “if detected (statement or event)” can be interpreted as meaning “if determined" or “in response to determining" or “when detected (Condition or event stated)” or “in response to detection of (condition or event stated)”.
  • relationship terms such as first and second are used to distinguish one entity from another entity, and any actual relationship and order between these entities are not limited.
  • the method provided in the embodiments of the present application is introduced from the perspective of the terminal device as the execution subject.
  • the terminal device may include a hardware structure and/or a software module, and realize the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a certain function of the above-mentioned functions is executed by a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraint conditions of the technical solution.
  • the computer may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it can be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium, (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state hard disk).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种绘图方法及电子设备,涉及终端技术领域,用以简化绘图过程,方便用户的操作,满足用户精细化操作的需求。该方法为:显示第一界面,所述第一界面中包括第一图像;采集在所述第一图像上绘制的手绘图形;当所述手绘图形的绘图方式为规则绘图时,在所述第一图像上生成与所述手绘图形对应的规则几何图形;显示第二界面,所述第二界面中包括第二图像,所述第二图像是在所述第一图像上生成所述规则几何图形后的图像,其中,所述规则几何图形在所述第二图像上的位置与所述手绘图形在所述第一图像上的位置相同或相近,所述规则几何图形在所述第二图像上的大小与所述手绘图形在所述第一图像上的大小相同或相近。

Description

一种绘图方法及电子设备
相关申请的交叉引用
本申请要求在2019年08月29日提交中国专利局、申请号为201910809935.7、申请名称为“一种绘图方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及终端技术领域,尤其涉及一种绘图方法及电子设备。
背景技术
随着电子设备中各种功能不断完善,电子设备的应用也越来越广泛,用户与电子设备间的交互也越来越多。例如:用户可以在浏览新闻时,将感兴趣的新闻进行截屏,并进入绘图(编辑)模式,对感兴趣的新闻部分进行涂鸦标注,或在绘图模式下提供的预设规则几何图形中选择一个规则几何图形(如矩形),拖动至感兴趣的新闻部分,对感兴趣的新闻部分进行标注,进而可以分享或保存带有标注的新闻截屏。
然而,随着柔性屏、折叠屏等技术的飞速发展,可随身携带的屏幕呈越来越大的趋势。用户对便携大屏的电子设备的操作要求,将比小屏的电子设备更高,也更精细。适用于小屏的操作方式难以适用于大屏的电子设备,因此如何在大屏的电子设备上进行精细化的操作成为一个需要解决的问题。
发明内容
本申请实施例提供一种绘图方法及电子设备,用以简化绘图过程,方便用户的操作,满足用户精细化操作的需求。
第一方面,本申请实施例提供一种绘图方法,该方法可以由电子设备执行。该方法包括:显示第一界面,所述第一界面中包括第一图像;采集在所述第一图像上绘制的手绘图形;当所述手绘图形的绘图方式为规则绘图时,在所述第一图像上生成与所述手绘图形对应的规则几何图形;显示第二界面,所述第二界面中包括第二图像,所述第二图像是在所述第一图像上生成所述规则几何图形后的图像,其中,所述规则几何图形在所述第二图像上的位置与所述手绘图形在所述第一图像上的位置相同或相近,所述规则几何图形在所述第二图像上的大小与所述手绘图形在所述第一图像上的大小相同或相近。
在本申请实施例中,在绘图的过程中,无需用户手动选择需要绘制的规则几何图形,并拖动至相应位置,只需要在需要绘制规则几何图形的位置,直接进行几何图形的绘制,即可根据用户绘制的不规则几何图形,生成规则几何图形,避免了用户在大屏电子设备,难以实现对规则几何图形精准拖动的问题,同时简化了绘图过程,方便了用户的操作,也满足了用户精细化操作的需求。
在一种可能的设计中,电子设备采集在所述第一图像上绘制的手绘图形之前,还可以在检测到针对所述第一界面的第一操作时,响应于所述第一操作,启动绘图功能,所述第 一操作用于指示启动绘图功能。上述设计中,用户可以通过第一操作,启动绘图功能,方便用户操作。
在一种可能的设计中,在所述第一图像上生成与所述手绘图形对应的规则几何图形,包括:将所述手绘图形中的多个像素位置和多个像素值输入到几何图形检测模型,得到所述手绘图形对应的几何图形的类型;比如,所述几何图形检测模型可以为能够根据所述手绘图形中的多个像素的像素值构成的矩阵进行运算得到对应几何图形的类型的运算函数;根据所述手绘图形对应的几何图形的类型,及所述手绘图形在所述第一图像上的位置和大小,在所述第一图像上生成规则几何图形。上述设计中,有助于生成与用户绘制的手绘图形相符的规则几何图形,提升绘图效率和用户体验。
在一种可能的设计中,电子设备显示第二界面之后,还可以接收针对所述规则几何图形的调整操作,所述调整操作用于调整所述规则几何图形的参数,所述参数包括大小、线条的粗细、线型中的至少一种;响应于所述调整操作,调整所述第二界面中包括的第二图像中显示的规则几何图形的参数。上述设计中,用户可以通过不同的调整操作,调整生成的规则几何图形的一种或多种参数,即在生成规则几何图形后,电子设备可以响应用户的调整操作,对生成的规则图形的大小、线条的粗细、线型等中的一种或多种进行调整,满足用户的绘图需求。
在一种可能的设计中,当所述手绘图形的绘图方式为非(不)规则绘图时,电子设备还可以显示第三界面,所述第三界面中包括第三图像,所述第三图像是在所述第一图像上添加所述手绘图形后的图像。上述设计中,有助于满足用户对于不规则绘图的需求,直接显示在第一图像上绘制的手绘图形,提升用户体验。
在一种可能的设计中,电子设备还可以在检测到针对所述第二界面或所述第三界面的第二操作时,响应于所述第二操作,关闭绘图功能,所述第二操作用于指示关闭绘图功能。上述设计中,电子设备检测到针对所述第二界面或所述第三界面的第二操作时,关闭绘图功能,避免对用户绘制完成的图形的误操作,保证了绘图的准确。
第二方面,本申请实施例还提供一种电子设备,所述电子设备包括:存储器、处理器和显示屏;其中,所述处理器与所述存储器和显示屏连接;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述电子设备执行时,使得所述电子设备执行上述第一方面或者第一方面的任一种可能的设计中所述的方法。
第三方面,本申请实施例还提供一种电子设备,该电子设备中包括能够执行上述第一方面或者第一方面的任一种可能的设计中电子设备行为的功能模块;这些功能模块可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第四方面,本申请实施例还提供一种计算机存储介质,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行上述第一方面或者第一方面的任一种可能的设计中所述的方法。
第五方面,本申请实施例还提供一种程序产品,当所述程序产品在电子设备上运行时,使得所述电子设备执行上述第一方面或者第一方面的任一种可能的设计中所述的方法。
附图说明
图1为本申请实施例提供的一种应用场景的示意图;
图2为本申请实施例提供的一种手机的硬件结构的示意图;
图3为本申请实施例提供的一种几何图形检测模型结构示意图;
图4为本申请实施例提供的一种手机的图形用户界面的示意图;
图5为本申请实施例提供的一种无规则绘图和有规则绘图示意图;
图6为本申请实施例提供的一种规则绘图示意图之一;
图7为本申请实施例提供的一种规则绘图示意图之二;
图8为本申请实施例提供的一种规则绘图示意图之三;
图9为本申请实施例提供的一种规则绘图示意图之四;
图10为本申请实施例提供的一种绘图过程示意图;
图11为本申请实施例提供的一种滑动调节角度识别示意图;
图12为本申请实施例提供的一种电子设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
图1为本申请实施例提供的一种应用场景的示意图,如图1所示,用户在使用手机截屏或者浏览图片/照片时,可以在截屏图像或者浏览的图片/照片上绘制几何图形,手机采集到用户在截屏图像或者浏览的图片/照片上绘制的几何图形(不规则)后,基于用户绘制的不规则几何图形,在截屏图像或者浏览的图片/照片上用户绘制的不规则几何图形的位置生成规则几何图形,对用户绘制的不规则几何图形进行替换。
由此可见,在本申请实施例中,在绘图的过程中,无需用户手动选择需要绘制的规则几何图形,并拖动至相应位置,只需要在手机的触摸屏上选择绘制规则几何图形的位置,直接进行几何图形的绘制,手机即可根据用户绘制的不规则几何图形,在相应位置生成规则几何图形,避免了用户在大屏手机难以实现对规则几何图形精准拖动的问题,同时简化绘图过程,方便用户的操作,也满足用户精细化操作的需求。
以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请实施例中,“一个或多个”是指一个、两个或两个以上;“和/或”,描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。另外,本申请实施例涉及的多个,是指大于或等于两个。需要说明的是,在本申请实施例的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们 的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
以下介绍电子设备、用于这样的电子设备的图形用户界面(graphical user interface,GUI)、和用于使用这样的电子设备的实施例。在本申请一些实施例中,电子设备可以是具有图像拍摄、传输、存储等功能的便携式终端(比如,具有摄像头的设备),诸如手机、平板电脑、数码相机、可穿戴设备(如智能手表)等。便携式终端的示例性实施例包括但不限于搭载
Figure PCTCN2020110287-appb-000001
或者其它操作系统的便携式终端。上述便携式终端也可以是其它便携式终端,只要具有图像拍摄、传输、存储等功能即可。
通常情况下,电子设备可以支持多种应用。比如以下应用中的一个或多个:相机应用、即时消息收发应用等。其中,即时消息收发应用可以有多种,比如微信、腾讯聊天软件(QQ)、WhatsApp Messenger、连我(Line)、Kakao Talk、钉钉等。用户通过即时消息收发应用,可以将文字、语音、图片、视频文件以及其他各种文件等信息发送给其他联系人;或者用户可以通过即时消息收发应用与其他联系人实现语音、视频通话等。下文中设计的应用可以是电子设备出厂时自带的应用,也可以是电子设备从网络侧下载并安装的应用,或者是电子设备接收其它电子设备发送的应用,本申请实施例不作限定。
以电子设备是手机为例,图2示出了手机100的结构示意图。如图2所示,手机100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块151,无线通信模块152,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。
其中,处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是手机100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。在本申请实施例中,处理器110可以运行绘图算法的软件代码/模块,执行相应的绘图流程,具体的流程将在后文介绍。
显示屏194用于显示手机100中的应用的显示界面,比如相机的取景界面,微信的聊天界面等等,还可以显示图库中的图像,视频等,或者,第三方图像后期软件(比如,美图秀秀、vsco、MIX等)的显示界面等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施 例中,手机100可以包括1个或N个显示屏194,N为大于1的正整数。
摄像头193用于捕获静态图像、动态图像或视频。在本申请实施例中,手机100中摄像头193的数量可以是至少两个。以两个为例,其一个是前置摄像头,另一个是后置摄像头;以三个为例,其中一个是前置摄像头,另外两个是后置摄像头。需要说明的是,摄像头193可以是广角摄像头、长焦摄像头等等。通常,摄像头193可以包括感光元件比如镜头组和图像传感器,其中,镜头组包括多个透镜(凸透镜或凹透镜),用于采集待拍摄物体(比如用户人脸、风景等)反射的光信号,并将采集的光信号传递给图像传感器。图像传感器根据所述光信号生成待拍摄物体的图像。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行手机100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如相机,图库、微信等)等。存储数据区可存储手机100使用过程中所创建的数据(比如图像,视频等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。在一些实施例中,内部存储器121中可以存储绘图算法的软件代码/模块,处理器110运行所述绘图算法的软件代码/模块,执行相应的绘图流程,具体的流程将在后文介绍。
传感器模块180可以包括指纹传感器180H,温度传感器180J,触摸传感器180K等。
指纹传感器180H用于采集指纹。手机100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,手机100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于手机100的表面,与显示屏194所处的位置不同。本申请下述实施例中,以手机100包括由触摸传感器180K与显示屏194组成的触摸屏为例进行说明。
另外,手机100可以接收按键190输入,产生与手机100的用户设置以及功能控制有关的键信号输入。手机100可以利用马达191产生振动提示(比如来电振动提示)。手机100中的指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。手机100中的SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和手机100的接触和分离。
手机100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
可以理解的是,本申请实施例示意的结构并不构成对手机的具体限定。在本申请另一些实施例中,手机可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
另外,在本申请实施例中,在手机100中存储有几何图形检测模型(如在手机100的内部存储器121中存储有几何图形检测模型),手机100可以在运行绘图算法,执行绘图流程时,调用存储的几何图形检测模型,对用户在手机100上绘制的手绘图形进行检测,确定手绘图形对应的几何图形的类型。需要说明的是,所述手绘图形是指用户在手机100上绘制的轨迹(线条)形成的图形,用户在手机100上绘制的轨迹形成的图形可以对应于某种类型的几何图形,也可以是不与任意一种类型的几何图形对应的非(不)规则轨迹,在本申请实施例中不做限定。示例的,如图1所示,用户绘制的手绘图形为对应矩形的手绘图形。
可选的,在本申请实施例中,几何图形检测模型可以为基于神经网络架构的模型,如前向神经网络、卷积神经网络(convolutional neural networks,CNN)、循环神经网络(recurrent neural network,RNN)、深度神经网络等。
示例的,参照图3所示,以几何图形检测模型为基于深度神经网络的模型为例进行说明。其中,深度神经网络中的每一层的工作可以用数学表达式
Figure PCTCN2020110287-appb-000002
来描述,每一层的输出
Figure PCTCN2020110287-appb-000003
为下一层的输入
Figure PCTCN2020110287-appb-000004
从物理层面深度神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure PCTCN2020110287-appb-000005
完成,4的操作由+b完成,5的操作则由a()来实现。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该权重向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重向量W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由多层的权重向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。
因此,在本申请实施例中,训练设备可以根据训练集中保存的大量各种类型的几何图形(如矩形、圆形、箭头、波浪线、五角星、三角形、菱形等)的用户手绘图形对深度神经网络进行训练,得到几何图形检测模型。其中,训练集中的手绘图形(实际为手绘图形各个像素点的像素值构成的矩阵)为深度神经网络的输入,手绘图形对应的类型标签矩阵(向量)为深度神经网络对于该手绘图形的期望输出,也就是上文中所述的真正想要的目标值,需要理解的是,每种几何图形的类型对应唯一的类型标签矩阵。通过将训练集中手绘图形不断的输入深度神经网络,深度神经网络每一层
Figure PCTCN2020110287-appb-000006
对输入的手绘图形不断运算,得到深度神经网络输出的实际类型矩阵,也就是上文中所述的预测值,根据深度神经网络输出的实际类型矩阵与该手绘图形对应的类型标签矩阵的误差,对深度神经网络每一层的权重向量(W)进行调整,通过将训练集中手绘图形不断的输入到深度神经 网络,对深度神经网络每一层的权重向量(W)进行调整,直至深度神经网络输出的实际类型矩阵与输入的手绘图形对应的类型标签矩阵相符,完成对深度神经网络的训练,即得到几何图形检测模型。
当对手绘图形的类型进行识别时,即可将手绘图形(手绘图形各个像素点的像素值构成的矩阵)作为几何图形检测模型的输入,根据几何图形检测模型每层
Figure PCTCN2020110287-appb-000007
对输入的手绘图形不断进行运算,得到几何图形检测模型的输出的类型矩阵,与该类型矩阵对应的几何图形的类型,即为手绘图形的类型。综上,也就是说所述几何图形检测模型可以为能够根据手绘图形中的多个像素的像素值构成的矩阵进行运算得到对应几何图形的类型的运算函数。
另外,需要理解的,上述训练设备可以为手机100,也可以为个人电脑(personal computer,PC)、笔记本电脑、服务器等设备,几何图形检测模型可以由训练设备训练完成后,存储至手机100中,如存储至手机100的内部存储器121中。
为了便于理解,本申请以下实施例将以具有图2所示结构的手机为例,结合附图对本申请实施例提供的绘图方法进行具体阐述。
在一些实施例中,本申请提供的绘图方法可以应用于系统图库、系统截屏等应用中,也可以应用在系统相机、第三方图像后期应用等应用中,还可以应用在即时通信应用比如微信、QQ等应用中。以下实施例将以不同的场景为例进行介绍。
场景1:系统图库。
图4中的(A)示出了手机100的一种图形用户界面GUI,该GUI可以称为手机100的桌面401(或主界面401)。当手机100检测到针对桌面401上的图库应用的图标402的操作(比如,点击操作)后,可以启动图库应用,显示如图4中的(B)所示另一GUI,该GUI可以成为图像选择界面403。该图像选择界面403上可以包括一个或多个图像的缩略图。手机100检测到针对缩略图404的操作(比如,点击操作)后,打开该缩略图404对应的图像,显示如图4中的(C)所示的另一GUI,该GUI可以称为图像预览界面405。该图像预览界面405中包括缩略图404对应的图像406。在图像预览界面中用户可以通过设定的启动(唤醒)操作,如在长按图像406(例如:按压大于1s)控制手机100进入绘图模式。在一些可能的实施例中,在图像预览界面405中,也可以包含一个或多个控件,所述一个或多个控件可以用于控制手机100进入绘图模式,用户除了通过设定的启动操作外,也可以通过所述一个或多个控件,控制手机100进入绘图模式。当手机100进入绘图模式后,用户可以在手机100显示的图像(本示例为与缩略图404对应的图像406)上绘制任意轨迹,手机100根据用户绘制的轨迹,直接在显示的图像406上显示相应的轨迹或者显示根据绘制的轨迹构成的手绘图形生成的规则几何图形。
在一些实施例中,为了便于对用户是绘制直接的轨迹,还是需要根据绘制的轨迹形成的手绘图形生成规则几何图形进行识别,手机100在绘图模式下,有规则绘图和非(不)规则绘图两种绘图方式,其中,如果用户直接绘制任意轨迹,则说明是在进行非规则绘图,直接在显示的图像上显示相应的轨迹,即直接显示用户的手绘图形;如果在触摸屏的一处(一点)保持长按,另一处进行绘制,则说明是在进行规则绘图,根据用户绘制的手绘图形生成规则几何图形在显示的图像上显示。
示例的:如图中的5(A)所示,在进入绘图模式后,在无长按的情况下,用户在图像上直接绘制轨迹,进行非规则绘图,手机100直接在显示的图像上显示用户绘制的轨迹。如图5中的(B)所示,在有长按的情况下,用户在图像上绘制轨迹,进行规则绘图(如 用户的一只手指在触摸屏的一处保持长按,另一只手指在触摸屏上进行绘制),手机100在用户绘制完轨迹之后,手机100将用户绘制的轨迹(即手绘图形)输入到几何图形检测模型中,得到几何图形检测模型输出的用户绘制的手绘图形对应的几何图形的类型(在本示例中为直线),并根据用户绘制的手绘图形的位置和大小,及确定的几何图形的类型,在图像上生成规则几何图并显示。
在一种可能的实施中,根据用户绘制的手绘图形的位置和大小,及确定的几何图形的类型,生成规则几何图形时,手机100可以根据用户绘制的手绘图形的最小外接矩形的位置和大小,在该最小外接矩形中,根据几何图形的类型生成一个最大的规则几何图形。如根据手绘图形(如直线)的最小外接矩形的位置和大小,手机100将该最小外接矩形中两个较短对边(宽)的中点的连线作为生成的规则直线;对于圆、五角星等几何图形,可以在相应的最小外接矩形内确定最大圆(内接圆)、最大五角星等,为生成的规则图形。
在一种可能的实施中,手机100在生成规则几何图形后,用户可以通过滑动调整生成的规则几何图形线条的粗细、大小等。示例的,参照图5中的(C)所示,可以通过上下滑动调整生成的规则直线的线条粗细,如向上滑动生成的规则直线线条变细,向下滑动生成的规则直线线条变粗。
在一些实施例中,如图5中的(B)或图5中的(C)所示,手机100检测到针对“绘图模式退出”控件501的操作时,退出绘图模式,保存并显示包含生成的规则几何图形的图像。可选的,在绘图模式下,用户也可以通过双击的方式退出绘图模式,本申请实施例中对此不进行限定。
场景2:系统或任一应用的截屏。
在截屏状态下(如显示任一截屏图像时),用户可以通过长按截屏图像(例如:按压大于1s),控制手机100进入(唤起)绘图模式,与上述场景1相似,手机100在绘图模式下有规则绘图和非规则绘图两种绘图方式,并可以在用户进行规则绘图,在截屏图像上生成规则几何图形后,通过滑动对生成的规则几何图形的大小、线条的粗细等进行调整,下面结合具体示例进行说明。
示例1:参照图6中的(A)所示,在截屏状态下,用户通过长按(如长按触摸屏的某一位置)控制手机100进入绘图模式后,用户一只手指保持长按,另一只手指出绘制出“波浪线”,手机100检测到用户是在长按状态下进行绘图,在进行规则绘图,手机100在用户绘制完“波浪线”之后,将用户绘制的“波浪线”输入到几何图形检测模型中,得到几何图形检测模型输出的用户绘制的“波浪线”对应的几何图形的类型为波浪线。参照图6中的(B)所示,手机100确定用户绘制的“波浪线”对应的几何图形的类型为波浪线后,根据用户绘制的“波浪线”的位置和大小,在截屏图像上生成规则波浪线并显示。另外,在截屏图像上生成规则波浪线并显示后,用户还可以通过左右滑动调整生成的规则波浪线的波形,通过上下滑动调整线条的粗细。
示例2:参见图7中的(A)所示,在截屏状态控制手机100进入绘图模式后,用户一只手指保持长按,另一只手指出绘制出“箭头”,手机100检测到用户是在长按状态下进行绘图,在进行规则绘图,手机100在用户绘制完“箭头”之后,将用户绘制的“箭头”输入到几何图形检测模型中,得到几何图形检测模型输出的用户绘制的“箭头”对应的几何图形的类型为箭头。参照图7中的(B)所示,手机100确定用户绘制的“箭头”对应的几何图形的类型为箭头后,根据用户绘制的“箭头”的位置和大小,在截屏图像上生成 规则箭头并显示。另外,在截屏图像上生成规则箭头并显示后,用户还可以通过上下滑动调整生成的规则箭头的线条的粗细。
另外,参照图8中的(A)和图8中的(B)所示,手机100也可以在用户绘制完“五角星”之后,将用户绘制的“五角星”输入到几何图形检测模型中,得到几何图形检测模型输出的用户绘制的“五角星”对应的几何图形的类型为五角星。并根据用户绘制的“五角星”的位置和大小,在截屏图像上生成规则五角星并显示。另外,在截屏图像上生成规则五角星并显示后,用户还可以通过上下滑动调整生成的规则五角星的线条的粗细。
参照图9中的(A)和图9中的(B)所示,手机100也可以在用户绘制完“矩形”之后,将用户绘制的“矩形”输入到几何图形检测模型中,得到几何图形检测模型输出的用户绘制的“矩形”对应的几何图形的类型为矩形。并根据用户绘制的“矩形”的位置和大小,在截屏图像上生成规则矩形并显示。另外,在截屏图像上生成规则矩形并显示后,用户还可以通过上下滑动调整生成的规则矩形的线条的粗细。
可选的,对于生成的五角星、矩形、圆等规则图形,用户还可以在手机100上点击生成的五角星、矩形、圆等规则图形所在区域,手机100显示生成的五角星、矩形、圆等规则图形所在区域的调整框,用户可以通过拖动调整框调整生成的五角星、矩形、圆等规则图形的大小。
以下实施例介绍通过手机100进行绘图的可能的实现方式。图10示出了本申请一实施例提供的绘图方法的流程示意图。该方法可以适用于图2所示的手机100或类似的电子设备。以下实施例以该方法应用于手机100为例。如图10所示,该方法的流程包括:
1001:手机100显示第一图像。
在一些实施例中,与图4中的(C)为例,第一图像可以是手机100显示的图像406。在另一些实施例中,第一图像也可以是截屏图像;在另一些实施例中,第一图像还可以是手机100通过聊天软件等打开或者截取的任一图像。
1002:手机100启动绘图功能。
在一些实施例中,手机100检测到绘图功能启动操作后,响应于该启动操作(可参见前文描述),启动绘图功能,进入绘图模式。
1003:手机100采集手绘图形,并判断绘制手绘图形的绘图方式是否为规则绘图,如果是进行1004,如果否,进行1008。
举例来说,在绘图模式下,手机100采集手指或者触控笔等的中心点在手机100的触摸屏上滑动轨迹,手机100根据滑动轨迹生成手绘图形。可选的,如果触摸屏有压感功能,也可以同时记录手指或者触控笔等的中心点在手机100的触摸屏上滑动时的压力值,根据压力值确定滑动轨迹对应的线条的粗细;如果触摸屏不具备压感功能,则滑动轨迹可以采用默认值。其中,手机100根据滑动轨迹生成手绘图形可以在调用现有的画图应用的应用程序编程接口(application programming interface,API)等实现。
在一种可能的实施中,对于绘图方式的判断,手机100在进入绘图模式后,会开启对触摸屏有无长按的监听,如果手机100没有监听到长按事件,确定用户进行非(不)规则绘图;如监听到对触摸屏的长按的时间超过设定阈值(如1s),确定监听到长按事件,此时手机100可以显示一个长按全局标志(cur long pressed),cur long pressed可以是文字标志,也可以是其它标志,标识手机100检测到长按事件,进入到了规则绘图方式,提示用户可以进行规则绘图。在进入规则绘图方式后,手机100会根据用户绘制的手绘图形生成 规则几何图形。可选的,手机100显示出cur long pressed,标识手机100检测到长按事件,进入到了规则绘图方式后,用户在进行绘图时可以仍保持长按,并进行绘图(如用户的某一手指一直保持对触摸屏某一位置的按压,使用另一指进行绘图);也可以不保持长按,进行绘图,手机100均可根据用户绘制的手绘图形生成规则几何图形。
可选的,用户可以根据手机100的屏幕形状和/或尺寸,配置长按事件监听区域,手机100仅对配置的监听区域进行长按的监听。
1004:手机100识别所述手绘图形对应的几何图形的类型。
手机100采集到手绘图形,并判断是进行规则绘图后,将手绘图形输入到几何图形检测模型中,得到几何图形检测模型输出的手绘图形对应的几何图形的类型,实现对手绘图形对应的几何图形的类型的识别。关于几何图形检测模型训练的过程可参见前文描述。
1005:手机100根据所述手绘图形的位置和大小,及确定的几何图形的类型,在所述第一图像上生成规则几何图形。
1006:手机100显示包含规则几何图形的图像。
其中,规则几何图形在图像中的位置和手绘图形在图像中的位置相同或相近,规则几何图形在图像中的大小和手绘图形在图像中的大小相同或相近。
在一种可能的实施中,手机100可以根据用户绘制的手绘图形的最小外接矩形的位置和大小,在该最小外接矩形中,根据几何图形的类型生成一个最大的规则几何图形。如根据手绘图形(如直线)的最小外接矩形的位置和大小,手机100将该最小外接矩形中两个较短对边(宽)的中点的连线作为生成的规则直线;对于圆、五角星等几何图形,可以在相应的最小外接矩形内确定最大圆(内接圆)、最大五角星等,为生成的规则图形。
1007:手机100接收对规则几何图形的调整指令,调整规则几何图形。
在一种可能的实施中,生成规则图形并显示后,手机100默认生成的规则几何图形处于被选中状态,并显示可对规则图形进行调整的调整框(编辑框),用户可以通过拖动调整框调整生成的规则图形的大小,也可以执行预设的操作,如上下滑动,左右滑动等,调整规则几何图形的线条的粗细、线型(如波浪线的波形)等参数。
在另一种可能的实施中,生成规则图形并显示后,还可以通过长按规则几何图形的区域(如与规则几何图形对应的手绘图形的最小外接矩形区域),选中生成的规则几何图形,手机在100在用户选中生成的规则几何图形后,显示出规则几何图形的调整框。
可选的,对于每种规则几何图形均设置有对应该规则几何图形的调整规则,其中不同规则几何图形之间的调整规则可以完全不同、也可以部分相同部分不同,也可以完全不同。
示例的,对于直线、波浪线、箭头、五角星、矩形、圆等规则图形均可设置通过上下滑动调整线条的粗细,对于波浪线还可以设置通过左右滑动调整波形的大小。可选的,也可以通过带角度的滑动调整线条的粗细等。
其中,对于上下滑动、左右滑动及带角度的滑动的识别可以根据滑动的起点的坐标(x 1,y 1)和终点的坐标(x 2,y 2)实现,示例的,如果arctan[(x 2-x 1)/(y 2-y 1)]位于设定的第一阈值区间,如[-10°,10°]之间确定为上下滑动,如果arctan[y 2-y 1)/(x 2-x 1)]位于设定的第二阈值区间,如[-10°,10°]之间确定为左右滑动,如果arctan[(x 2-x 1)/(y 2-y 1)]不位于设定的第一阈值区间且arctan[y 2-y 1)/(x 2-x 1)]不位于设定的第二阈值区间,确定为带角度的滑动。
可选的,参照图11所示,也可以根据angle(弧度)=Math.atan2((p2.y-p1.y),(p2.x-p1.x))和Θ=angle*(180/Math.PI),确定滑动的起点和终点构成的直线与X轴顺时针的夹角(Θ), 并根据滑动的起点和终点构成的直线与X轴顺时针的夹角,进行上下滑动、左右滑动及带角度的滑动的识别,其中Math.atan2为弧度计算函数,P1表示滑动的起点,P2表示滑动的终端,p1.x、p2.x分别表示p1、p2的横坐标(对应X轴),p1.y、p2.y分别表示p1、p2的纵坐标(对应Y轴)。示例的,如果Θ)位于[-10°,10°]之间确定为左右滑动,如果Θ)位于[80°,100°]之间确定为上下滑动,否则确定为带角度滑动,可选的,也可以仅将Θ)位于[35°,55°]之间确定为带角度滑动。
对于滑动调节可以根据滑动的起点到终点移动的长度,作为规则几何图形调节的参考值,如对于上下滑动,起点到终点移动的长度每增加1cm,线条的粗细增加1pt。
1008:手机100显示包含手绘图形的图像。
可选的,在手机100退出绘图模式后,对包含手绘图形或规则几何图形的图像进行保存。
上述本申请提供的实施例中,从终端设备(手机100)作为执行主体的角度对本申请实施例提供的方法进行了介绍。为了实现上述本申请实施例提供的方法中的各功能,终端设备可以包括硬件结构和/或软件模块,以硬件结构、软件模块、或硬件结构加软件模块的形式来实现上述各功能。上述各功能中的某个功能以硬件结构、软件模块、还是硬件结构加软件模块的方式来执行,取决于技术方案的特定应用和设计约束条件。
下面结合附图介绍本申请实施例提供的装置,以实现本申请上述方法实施例。
如图12所示,本申请另外一些实施例公开了一种电子设备,该电子设备可以包括:一个或多个处理器1202,存储器1203,一个或多个计算机程序1204;上述各器件可以通过一个或多个通信总线1205连接,此外该电子设备还可以包括显示屏、麦克风和扬声器等外在硬件。其中,所述一个或多个计算机程序1204被存储在上述存储器1203中并被配置为被该一个或多个处理器1202执行,该一个或多个计算机程序1204包括指令,上述指令可以用于执行前述的图3~图10所示的实施例中记载的全部或部分步骤。
其中,处理器1202可以是中央处理器(central processing unit,CPU),或特定应用集成电路(application-specific integrated circuit,ASIC),可以是一个或多个用于控制程序执行的集成电路,可以是基带芯片,等等。存储器1203的数量可以是一个或多个,存储器1203可以是只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)或磁盘存储器,等等。
图12所示的电子设备可以是手机、ipad、笔记本电脑、智能电视、穿戴式设备(例如智能手表、智能头盔或智能手环等)等。当图12所示的电子设备是手机时,其结构可以参见图2所示,比如,存储器1203是内部存储器121。
以上实施例中所用,根据上下文,术语“当…时”或“当…后”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。另外,在上述实施例中,使用诸如第一、第二之类的关系术语来区份一个实体和另一个实体,而并不限制这些实体之间的任何实际的关系和顺序。
上述本申请提供的实施例中,从终端设备作为执行主体的角度对本申请实施例提供的方法进行了介绍。为了实现上述本申请实施例提供的方法中的各功能,终端设备可以包括 硬件结构和/或软件模块,以硬件结构、软件模块、或硬件结构加软件模块的形式来实现上述各功能。上述各功能中的某个功能以硬件结构、软件模块、还是硬件结构加软件模块的方式来执行,取决于技术方案的特定应用和设计约束条件。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。
为了解释的目的,前面的描述是通过参考具体实施例来进行描述的。然而,上面的示例性的讨论并非意图是详尽的,也并非意图要将本申请限制到所公开的精确形式。根据以上教导内容,很多修改形式和变型形式都是可能的。选择和描述实施例是为了充分阐明本申请的原理及其实际应用,以由此使得本领域的其他技术人员能够充分利用具有适合于所构想的特定用途的各种修改的本申请以及各种实施例。
需要指出的是,本专利申请文件的一部分包含受著作权保护的内容。除了对专利局的专利文件或记录的专利文档内容制作副本以外,著作权人保留著作权。

Claims (14)

  1. 一种绘图方法,应用于电子设备,其特征在于,包括:
    显示第一界面,所述第一界面中包括第一图像;
    采集在所述第一图像上绘制的手绘图形;
    当所述手绘图形的绘图方式为规则绘图时,在所述第一图像上生成与所述手绘图形对应的规则几何图形;
    显示第二界面,所述第二界面中包括第二图像,所述第二图像是在所述第一图像上生成所述规则几何图形后的图像,其中,所述规则几何图形在所述第二图像上的位置与所述手绘图形在所述第一图像上的位置相同或相近,所述规则几何图形在所述第二图像上的大小与所述手绘图形在所述第一图像上的大小相同或相近。
  2. 如权利要求1所述的方法,其特征在于,采集在所述第一图像上绘制的手绘图形之前,所述方法还包括:
    检测到针对所述第一界面的第一操作时,响应于所述第一操作,启动绘图功能,所述第一操作用于指示启动绘图功能。
  3. 如权利要求1所述的方法,其特征在于,在所述第一图像上生成与所述手绘图形对应的规则几何图形,包括:
    将所述手绘图形中的多个像素位置和多个像素值输入到几何图形检测模型,得到所述手绘图形对应的几何图形的类型;所述几何图形检测模型为能够根据所述手绘图形中的多个像素的像素值构成的矩阵进行运算得到对应几何图形的类型的运算函数;
    根据所述手绘图形对应的几何图形的类型,及所述手绘图形在所述第一图像上的位置和大小,在所述第一图像上生成规则几何图形。
  4. 如权利要求1或3所述的方法,其特征在于,显示第二界面之后,所述方法还包括:
    接收针对所述规则几何图形的调整操作,所述调整操作用于调整所述规则几何图形的参数,所述参数包括大小、线条的粗细、线型中的至少一种;
    响应于所述调整操作,调整所述第二界面中包括的第二图像中显示的规则几何图形的参数。
  5. 如权利要求1所述的方法,其特征在于,当所述手绘图形的绘图方式为非规则绘图时,所述方法还包括:
    显示第三界面,所述第三界面中包括第三图像,所述第三图像是在所述第一图像上添加所述手绘图形后的图像。
  6. 如权利要求1或5所述的方法,其特征在于,所述方法还包括:
    检测到针对所述第二界面或所述第三界面的第二操作时,响应于所述第二操作,关闭绘图功能,所述第二操作用于指示关闭绘图功能。
  7. 一种电子设备,其特征在于,所述电子设备包括:
    存储器、处理器和显示屏;其中,所述处理器与所述存储器和显示屏连接;
    以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:
    显示第一界面,所述第一界面中包括第一图像;
    采集在所述第一图像上绘制的手绘图形;
    当所述手绘图形的绘图方式为规则绘图时,在所述第一图像上生成与所述手绘图形对应的规则几何图形;
    显示第二界面,所述第二界面中包括第二图像,所述第二图像是在所述第一图像上生成所述规则几何图形后的图像,其中,所述规则几何图形在所述第二图像上的位置与所述手绘图形在所述第一图像上的位置相同或相近,所述规则几何图形在所述第二图像上的大小与所述手绘图形在所述第一图像上的大小相同或相近。
  8. 如权利要求7所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备还执行以下步骤:
    检测到针对所述第一界面的第一操作时,响应于所述第一操作,启动绘图功能,所述第一操作用于指示启动绘图功能。
  9. 如权利要求7所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备具体执行以下步骤:
    将所述手绘图形中的多个像素位置和多个像素值输入到几何图形检测模型,得到所述手绘图形对应的几何图形的类型;所述几何图形检测模型为能够根据所述手绘图形中的多个像素的像素值构成的矩阵进行运算得到对应几何图形的类型的运算函数;
    根据所述手绘图形对应的几何图形的类型,及所述手绘图形在所述第一图像上的位置和大小,在所述第一图像上生成规则几何图形。
  10. 如权利要求7或9所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备还执行以下步骤:
    接收针对所述规则几何图形的调整操作,所述调整操作用于调整所述规则几何图形的参数,所述参数包括大小、线条的粗细、线型中的至少一种;
    响应于所述调整操作,调整所述第二界面中包括的第二图像中显示的规则几何图形的参数。
  11. 如权利要求7所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备还执行以下步骤:
    当所述手绘图形的绘图方式为非规则绘图时,显示第三界面,所述第三界面中包括第三图像,所述第三图像是在所述第一图像上添加所述手绘图形后的图像。
  12. 如权利要求7或11所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备还执行以下步骤:
    检测到针对所述第二界面或所述第三界面的第二操作时,响应于所述第二操作,关闭绘图功能,所述第二操作用于指示关闭绘图功能。
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1-6任一所述的方法。
  14. 一种程序产品,其特征在于,包括指令,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1-6任一项所述的方法。
PCT/CN2020/110287 2019-08-29 2020-08-20 一种绘图方法及电子设备 WO2021036903A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910809935.7A CN110851062A (zh) 2019-08-29 2019-08-29 一种绘图方法及电子设备
CN201910809935.7 2019-08-29

Publications (1)

Publication Number Publication Date
WO2021036903A1 true WO2021036903A1 (zh) 2021-03-04

Family

ID=69595535

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110287 WO2021036903A1 (zh) 2019-08-29 2020-08-20 一种绘图方法及电子设备

Country Status (2)

Country Link
CN (1) CN110851062A (zh)
WO (1) WO2021036903A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851062A (zh) * 2019-08-29 2020-02-28 华为技术有限公司 一种绘图方法及电子设备
CN111552429B (zh) * 2020-04-29 2021-07-23 杭州海康威视数字技术股份有限公司 一种图形选中方法、装置及电子设备
CN111625179B (zh) * 2020-06-02 2021-11-16 京东方科技集团股份有限公司 图形绘制方法、电子设备及计算机存储介质
CN112102435B (zh) * 2020-09-24 2023-08-01 安徽文香科技股份有限公司 一种几何图形绘制的方法、装置、设备及存储介质
CN116324689A (zh) 2020-10-30 2023-06-23 海信视像科技股份有限公司 显示设备、几何图形识别方法及多图层叠加显示方法
CN113010067A (zh) * 2020-12-25 2021-06-22 北京小米移动软件有限公司 图形处理方法及装置、电子设备、存储介质
CN115713452A (zh) * 2021-08-23 2023-02-24 华为技术有限公司 图元共享方法、电子设备、芯片及计算机可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094365A (zh) * 2015-07-17 2015-11-25 百度在线网络技术(北京)有限公司 一种绘制式输入方法、装置及输入法系统
CN105260743A (zh) * 2015-09-29 2016-01-20 小米科技有限责任公司 图形分类方法和装置
CN105719328A (zh) * 2016-01-19 2016-06-29 华中师范大学 一种手绘几何图形规范化方法及系统
US20180348990A1 (en) * 2017-06-02 2018-12-06 Apple Inc. Providing a graphical canvas for handwritten input
CN109324749A (zh) * 2018-09-10 2019-02-12 Oppo(重庆)智能科技有限公司 绘图方法、装置、存储介质及电子设备
CN110851062A (zh) * 2019-08-29 2020-02-28 华为技术有限公司 一种绘图方法及电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH061482B2 (ja) * 1987-09-03 1994-01-05 シャープ株式会社 図形入力方式
CN101393648B (zh) * 2008-10-07 2011-06-29 广东威创视讯科技股份有限公司 手绘几何图形的识别方法
CN102034254B (zh) * 2010-09-29 2012-07-04 广东威创视讯科技股份有限公司 一种识别几何图形的方法
CN103324396A (zh) * 2012-12-17 2013-09-25 上海海知信息技术有限公司 在笔迹图像上进行编辑的方法
CN103606303B (zh) * 2013-05-09 2016-02-03 陕西思智通教育科技有限公司 一种用于网络教学的呈现方法及设备
CN104714666B (zh) * 2013-12-12 2017-09-05 鸿合科技有限公司 一种智能笔及其笔划识别处理方法
CN104572967B (zh) * 2014-12-30 2018-01-19 北京奇虎科技有限公司 一种在页面绘制图形的方法和装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094365A (zh) * 2015-07-17 2015-11-25 百度在线网络技术(北京)有限公司 一种绘制式输入方法、装置及输入法系统
CN105260743A (zh) * 2015-09-29 2016-01-20 小米科技有限责任公司 图形分类方法和装置
CN105719328A (zh) * 2016-01-19 2016-06-29 华中师范大学 一种手绘几何图形规范化方法及系统
US20180348990A1 (en) * 2017-06-02 2018-12-06 Apple Inc. Providing a graphical canvas for handwritten input
CN109324749A (zh) * 2018-09-10 2019-02-12 Oppo(重庆)智能科技有限公司 绘图方法、装置、存储介质及电子设备
CN110851062A (zh) * 2019-08-29 2020-02-28 华为技术有限公司 一种绘图方法及电子设备

Also Published As

Publication number Publication date
CN110851062A (zh) 2020-02-28

Similar Documents

Publication Publication Date Title
WO2021036903A1 (zh) 一种绘图方法及电子设备
WO2020239019A1 (zh) 一种分享内容的方法及电子设备
WO2021083052A1 (zh) 对象分享方法及电子设备
WO2021104365A1 (zh) 对象分享方法及电子设备
KR101588294B1 (ko) 사용자 인터렉션을 제공하는 사용자 단말 장치 및 그 방법
WO2021104195A1 (zh) 图像显示方法及电子设备
WO2021082711A1 (zh) 图像显示方法及电子设备
EP3585037A1 (en) Image capturing method and terminal
EP3890303A1 (en) Photographing method and terminal
EP3547218B1 (en) File processing device and method, and graphical user interface
WO2020156466A1 (zh) 拍摄方法及终端设备
WO2020258929A1 (zh) 文件夹界面切换方法及终端设备
CN110663016B (zh) 显示图形用户界面的方法和移动终端
WO2021104227A1 (zh) 拍照方法及电子设备
WO2019184947A1 (zh) 图像查看方法及移动终端
WO2021121253A1 (zh) 图像处理方法及电子设备
WO2021073579A1 (zh) 长截图的方法及终端设备
WO2021037073A1 (zh) 控制方法及终端设备
WO2021031717A1 (zh) 截屏方法及终端设备
US20220272275A1 (en) Photographing method and electronic device
WO2021104159A1 (zh) 显示控制方法及电子设备
WO2021104266A1 (zh) 对象显示方法及电子设备
WO2022266907A1 (zh) 处理方法、终端设备及存储介质
CN111050109B (zh) 电子设备控制方法及电子设备
CN112911147A (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: 20858249

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20858249

Country of ref document: EP

Kind code of ref document: A1