Aesthetic Degree Determination Method, Device, Electronic Device and Storage Medium
By segmenting and binarizing the image to be processed, combining the standard character image, the pixel distance between the character and the standard character is calculated, and the problems of low efficiency and low accuracy of character aesthetics in the prior art are solved, and efficient and accurate aesthetics are achieved.
Patent Information
- Application Number
- CN202311257243.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2043-09-27
AI Technical Summary
The existing method of judging character aesthetics is inefficient and has low accuracy, and usually requires subjective judgment or character disassembly and analysis.
By obtaining the image to be processed, each character image is obtained, binarization is performed, the standard character image is obtained, the pixel distance between the character and the standard character is calculated, and the aesthetics of each character is determined.
This method does not require disassembly of characters, significantly speeds up the efficiency of aesthetic determination and improves the accuracy of aesthetic determination.
Smart Images

Figure CN117727048B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular, to a method, apparatus, electronic device, and storage medium for determining aesthetics. Background Art
[0002] Currently, in some scenarios, it is necessary to evaluate the aesthetics of characters (for example, they can be handwritten Chinese characters, numbers, letters, etc.). For example, for users who are learning to write, evaluating the aesthetics of the characters they write can promote their improvement; another example is when performing optical character recognition (OCR) on an image, only the text information can be recognized, and the aesthetics of the text in the image cannot be obtained. However, the existing methods for evaluating the aesthetics of characters are either subjective human evaluations or analyses after disassembling the characters, which are not only inefficient but also result in low accuracy in determining aesthetics. Summary of the Invention
[0003] The embodiments of this application provide a method, apparatus, electronic device, and storage medium for determining aesthetics, which do not require disassembling the characters, accelerate the efficiency of determining aesthetics, and also improve the accuracy of determining aesthetics.
[0004] In a first aspect, the embodiments of this application provide a method for determining aesthetics, which includes:[[]]END]]
[0005] Obtain an image to be processed;
[0006] Based on the characters in the image to be processed, segment the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character;
[0007] Binarize each first character image to obtain one or more second character images;
[0008] For a third character image, obtain a standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images;
[0009] Based on the third character image and the standard character image, determine the pixel distance corresponding to the third character image, where the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image;
[0010] Based on the pixel distance corresponding to each second character image, determine the aesthetics of the characters in each first character image.
[0011] In a second aspect, an aesthetic degree determination device provided by an embodiment of the present application includes: an acquisition unit and a processing unit;
[0012] The acquisition unit is configured to acquire an image to be processed;
[0013] The processing unit is configured to segment the image to be processed based on the characters in the image to be processed, to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character;
[0014] The processing unit is further configured to binarize each first character image to obtain one or more second character images;
[0015] The processing unit is further configured to, for a third character image, acquire a standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images;
[0016] The processing unit is further configured to determine a pixel distance corresponding to the third character image based on the third character image and the standard character image, where the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image;
[0017] The processing unit is further configured to determine the aesthetic degree of the character in each first character image based on the pixel distance corresponding to each second character image.
[0018] In a third aspect, an electronic device provided by an embodiment of the present application includes: a processor and a memory. The processor is connected to the memory, and the memory is used to store a computer program. The processor is used to execute the computer program stored in the memory so that the electronic device executes the method as in the first aspect.
[0019] In a fourth aspect, a computer-readable storage medium provided by an embodiment of the present application stores a computer program, and the computer program enables a computer to execute the method as in the first aspect.
[0020] In a fifth aspect, a computer program product provided by an embodiment of the present application includes a non-transitory computer-readable storage medium storing a computer program, and the computer is operable to enable the computer to execute the method as in the first aspect.
[0021] Implementing the embodiments of the present application has the following beneficial effects:
[0022] By obtaining the image to be processed; then segmenting the image to be processed based on the characters in the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character; then binarizing each first character image to obtain one or more second character images; for the third character image, obtaining the standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images; fusing and determining the pixel distance corresponding to the third character image based on the third character image and the standard character image, where the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image; finally, determining the aesthetics of the characters in each first character image based on the pixel distance corresponding to each second character image, which improves the accuracy of aesthetics determination while accelerating the efficiency compared with manual judgment or judgment by disassembling characters. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0024] Figure 1 A schematic diagram of a scenario for determining aesthetics provided by an embodiment of the present application;
[0025] Figure 2 Another schematic diagram of a scenario for determining aesthetics provided by an embodiment of the present application;
[0026] Figure 3 A schematic flowchart of a method for determining aesthetics provided by an embodiment of the present application;
[0027] Figure 4 A schematic diagram of segmenting an image to be processed based on the characters in the image to be processed to obtain one or more first character images provided by an embodiment of the present application;
[0028] Figure 5 A schematic diagram of determining a sixth character image based on a third character image and a standard character image provided by an embodiment of the present application;
[0029] Figure 6 A block diagram of the functional units of an aesthetics determination device provided by an embodiment of the present application;
[0030] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0031] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0032] The terms "first", "second", "third", "fourth", etc. in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0033] Referring to
[0034] Referring to Figure 1 , Figure 1 is a schematic diagram of a scene for determining aesthetics provided by an embodiment of the present application.
[0035] This scene includes an aesthetics determination device. The aesthetics determination device can be a device such as a computer, a tablet computer, a smart phone, etc., which is not limited in the present application; a target software can be installed on the aesthetics determination device, and a virtual function button is set in the target software. The function implemented by the virtual function button corresponds to the aesthetics determination method of the present application. When the user touches the virtual function button, the aesthetics determination device can determine the aesthetics of the characters in the image according to the aesthetics determination method of the present application; it should be noted that the characters involved in the present application include handwritten Chinese characters, numbers, letters, symbols, etc. The present application mainly takes handwritten Chinese characters as an example for explanation.
[0036] Exemplarily, referring to Figure 1 , after the aesthetics determination device obtains the image to be processed, when the user touches Figure 1When the virtual function button (i.e., "OK") is clicked, the aesthetics determination device determines the aesthetics of the characters in the image to be processed (i.e., "Passion is talent") according to the aesthetics determination method provided by the present application, specifically:
[0037] Based on the characters in the image to be processed, the image to be processed is segmented to obtain one or more first character images, wherein the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes a character, that is, each character in "passion is talent" in the image to be processed, namely "heat", "love", "namely", "sky", and "gift", corresponds to a first character image respectively; each first character image is binarized to obtain one or more second character images; for the third character image, a standard character image corresponding to the third character image is obtained, wherein the third character image is any one of the one or more second character images. It should be noted that the present application will pre-construct a standard character image library, then the standard character image library can be obtained based on the characters in the third character image. The corresponding standard character image is obtained from the quasi-character image library; based on the third character image and the standard character image, the pixel distance corresponding to the third character image is determined, wherein the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image; based on the pixel distance corresponding to each second character image, the aesthetics of the characters in each first character image is determined, that is, the aesthetics of "热", "爱", "即", "天", and "赋" are determined, and then the aesthetics of these multiple characters are merged, or the maximum is taken, or the average is taken, etc., which is not limited to the present application, to obtain the aesthetics of the characters in the image to be processed, that is, the overall aesthetics of "激情就是人才" is obtained, assuming that the aesthetics is in the form of a level table item, as Figure 1 The overall aesthetic level of “Passion is Talent” in the image to be processed is shown as “Medium”.
[0038] In addition, the aesthetics determination method of the present application can also be applied in OCR text recognition scenarios, such as Figure 2 As shown, Figure 2 Another schematic diagram of a scene for determining aesthetics provided in an embodiment of the present application is as follows: Figure 2 As shown, when the user touches the virtual function button (i.e., "OK") on the terminal device, the aesthetics determination device performs OCR text recognition on the image to be processed and determines the aesthetics of the characters in the image to be processed (i.e., the handwritten "Passion is Talent") according to the aesthetics determination method of the present application, and then outputs the text obtained by OCR text recognition (i.e., "Passion is Talent") while also outputting the aesthetics level of "Passion is Talent" in the image to be processed as "Medium". It should be explained that Figure 2The example is illustrated by taking the aesthetic degree represented by levels as an example. The aesthetic degree shown as "medium" is only for the convenience of understanding and does not limit other representation forms of the aesthetic degree.
[0039] It can be seen that in the embodiment of the present application, by obtaining the image to be processed; then based on the characters in the image to be processed, segmenting the image to be processed to obtain one or more first character images, where each first character image includes one character; then binarizing each first character image to obtain one or more second character images; for the third character image, obtaining the standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images; fusing and determining the pixel distance corresponding to the third character image based on the third character image and the standard character image, where the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image; finally, based on the pixel distance corresponding to each second character image, determining the aesthetic degree of the character in each first character image. Compared with manual judgment or judgment by disassembling the characters, the efficiency is accelerated while the accuracy of aesthetic degree determination is improved.
[0040] Refer to Figure 3 , Figure 3 FIG. is a schematic flowchart of a method for determining aesthetic degree provided by an embodiment of the present application. This method is applied to the above aesthetic degree determination device and includes but is not limited to steps 301-306:
[0041] 301: Obtain the image to be processed.
[0042] In the embodiment of the present application, the image to be processed can be a frame image in a video or a single-frame image, and the image to be processed can be a single-frame image stored locally or a frame image in a video, or a single-frame image or a frame image in a video obtained from other devices. The present application does not make any limitations.
[0043] 302: Based on the characters in the image to be processed, segment the image to be processed to obtain one or more first character images.
[0044] In an embodiment of the present application, the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character; step 302 specifically includes but is not limited to the following steps: performing character detection on the image to be processed to obtain a character region; segmenting the image to be processed based on the pixel coordinates of the character region in the image to be processed to obtain a character region image. For example, inputting the image to be processed into a detection network for character detection to obtain a character region (i.e., obtaining the position information of the character region in the image to be processed, i.e., pixel coordinates), and then segmenting the image to be processed based on the character region to obtain a character region image; performing character recognition on the character region image to obtain the characters in the image to be processed; segmenting the image to be processed based on the characters in the image to be processed to obtain one or more first character images. Exemplarily, based on Figure 1 and Figure 3 the image to be processed shown, refer to Figure 4 , Figure 4 FIG. Figure 4 shown in Figure 4 is a schematic diagram of segmenting the image to be processed based on the characters in the image to be processed to obtain one or more first character images. As
[0045] 303: Binarize each first character image to obtain one or more second character images.
[0046] 304: For the third character image, obtain the standard character image corresponding to the third character image.
[0047] In an embodiment of the present application, the third character image is any one of one or more second character images; it should be noted that a standard character image library is pre-constructed, and each standard character image in the standard character image library can be a binarized image or not. If it is not a binarized image, the image obtained by binarizing it should be used when obtaining the standard character image corresponding to the third character image from the standard character image library.
[0048] 305: Based on the third character image and the standard character image, determine the pixel distance corresponding to the third character image.
[0049] In an embodiment of the present application, the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image. Among them, the method for calculating the pixel distance, such as Euclidean distance, City-Block Distance (D4), chessboard distance, etc., is not limited in the present application. Exemplarily, step 305 may specifically include:
[0050] First, based on the third character image and the standard character image, determine the variable parameters corresponding to the third character image. The variable parameters include the offset of pixels, the rotation angle, and the scaling factor (i.e., the magnification or reduction factor). Among them, the offset of pixels is obtained by the pixel offset of the character in the third character image and the standard character in the standard character image in the X-axis direction and the Y-axis direction in the image coordinate system. In addition, for example, the third character image and the standard character image can be analyzed by an image registration algorithm to determine the corresponding variable parameters. Among them, the image registration algorithm can adopt the Iterative Closest Point (ICP) algorithm, etc., which is not limited in the present application; then, based on the offset of pixels, offset the character in the third character image to obtain a fourth character image; then, rotate the fourth character image based on the rotation angle to obtain a fifth character image; scale the fifth character image based on the scaling factor to obtain a sixth character image. Exemplarily, refer to Figure 5 , Figure 5 is a schematic diagram for determining the sixth character image based on the third character image and the standard character image provided by the embodiment of the present application. As Figure 5 shown, by performing image registration on the third character image and the standard character image, the offset of pixels, the rotation angle, and the scaling factor are obtained. Then, based on the offset of pixels, the rotation angle, the scaling factor, and the third character image, the Figure 5 shown sixth character image is obtained. Specifically, based on the offset of pixels, the rotation angle, and the scaling factor, the character (i.e., "love") in the third character image is respectively offset, rotated, and scaled to obtain the sixth character image.
[0051] Finally, based on the sixth character image and the standard character image, determine the pixel distance corresponding to the third character image. Specifically: Obtain multiple first pixel points corresponding to the character in the sixth character image; Obtain multiple second pixel points corresponding to the character in the standard character image; Based on the multiple first pixel points and the multiple second pixel points, determine the pixel distance corresponding to the third character image. Specifically: For a third pixel point, determine the first pixel distance between the third pixel point and each second pixel point, obtaining multiple first pixel distances, where the third pixel point is any one of the multiple first pixel points. That is to say, in an image coordinate system, calculate the distance, i.e., the first pixel distance, between each first pixel point of the character in the sixth character image and each second pixel point of the character in the standard character image, obtaining multiple first pixel distances. It should be noted that the method for calculating the distance between pixel points can be used in this application and is not limited; Based on the multiple first pixel distances, determine the second pixel distance corresponding to the third pixel point. For example, the smallest first pixel distance among the multiple first pixel distances can be determined as the second pixel distance corresponding to the third pixel point; Based on the sum of the multiple second pixel distances corresponding to the multiple first pixel points, determine the pixel distance corresponding to the third character image. That is to say, since the second pixel distance corresponding to the third pixel point is determined above, and the third pixel point is any one of the multiple first pixel points, it can also be understood that the second pixel distance corresponding to any one of the first pixel points is determined. Furthermore, after the multiple second pixel distances corresponding to the multiple first pixel points are determined, it is determined as the pixel distance corresponding to the third character image.
[0052] 306: Based on the pixel distance corresponding to each second character image, determine the aesthetics of the characters in each first character image.
[0053] In the embodiments of the present application, since the pixel distance corresponding to the third character image has been determined in the above steps, and the third character image is any one of one or more second character images, it can also be understood that the pixel distance corresponding to any second character image has been determined. Furthermore, based on the pixel distance corresponding to each second character image among one or more second character images, the aesthetics of the characters in each second character image can be determined. Also, since one or more first character images and one or more second character images are in one-to-one correspondence, determining the aesthetics of the characters in each second character image is equivalent to determining the aesthetics of the characters in each first character image. Therefore, exemplarily, step 306 may specifically include: obtaining the length of the character in the standard character image, where the length of the character represents the number of pixel points of the character in the standard character image; based on the pixel distance corresponding to the third character image and the length of the character, determining the target pixel distance corresponding to the third character image. For example, the target pixel distance corresponding to the third character image is the ratio of the pixel distance corresponding to the third character image to the length of the character; based on the target pixel distance corresponding to each second character image, determining the aesthetics of the characters in each first character image. For example, based on the preset mapping relationship between the target pixel distance and the aesthetics (for example, the aesthetics can be represented by multiple levels, each level corresponding to a pixel distance interval, and then determining the aesthetics level corresponding to the interval where the pixel distance is located as the aesthetics of the character), obtaining the aesthetics of the characters in each second character image. And since one or more second character images and one or more first character images are in one-to-one correspondence, obtaining the aesthetics of the characters in each second character image is equivalent to obtaining the aesthetics of the characters in each first character image.
[0054] Of course, after determining the aesthetics of the characters in each first character image, the aesthetics of the characters in the image to be processed can also be determined based on the aesthetics of the characters in each first character image. For example, the aesthetics of the characters in each first character image can be weighted and fused to obtain the target aesthetics, and the target aesthetics can be determined as the overall aesthetics of the characters in the image to be processed.
[0055] It can be seen that in the embodiment of the present application, after segmenting the image to be processed based on the characters in the image to be processed, one or more first character images are obtained. Then, for each first character image, the corresponding standard character image is obtained. Then, based on the image registration algorithm, each first character image is registered to obtain the corresponding sixth character image. Furthermore, the accuracy of determining the aesthetics based on the registered first character image (i.e., the sixth character image) and the corresponding standard character image is higher. Then, based on the sum of the minimum distances between each pixel point corresponding to the characters in each registered first character image and each pixel point of the characters in the corresponding standard character image, the aesthetics corresponding to the characters in each first character image are determined, which not only ensures the accuracy of determining the aesthetics, but also does not require disassembling the characters, thus improving the efficiency.
[0056] Refer to Figure 6 , Figure 6 , which is a functional unit composition block diagram of a device for determining aesthetics provided by an embodiment of the present application. The device 600 for determining aesthetics includes: an acquisition unit 601 and a processing unit 602;
[0057] The acquisition unit 601 is configured to acquire an image to be processed;
[0058] The processing unit 602 is configured to segment the image to be processed based on the characters in the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character;
[0059] The processing unit 602 is further configured to binarize each first character image to obtain one or more second character images;
[0060] The processing unit 602 is further configured to, for a third character image, acquire the standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images;
[0061] The processing unit 602 is further configured to determine the pixel distance corresponding to the third character image based on the third character image and the standard character image, where the pixel distance corresponding to the third character image is the pixel distance between the characters in the third character image and the characters in the standard character image;
[0062] The processing unit 602 is further configured to determine the aesthetics of the characters in each first character image based on the pixel distance corresponding to each second character image.
[0063] In an embodiment of the present application, in terms of segmenting the image to be processed based on the characters in the image to be processed to obtain one or more first character images, the processing unit 602 is specifically configured to:
[0064] Perform character detection on the image to be processed to obtain character regions;
[0065] Segment the image to be processed based on the pixel coordinates of the character regions in the image to be processed to obtain character region images;
[0066] Perform character recognition on the character region images to obtain the characters in the image to be processed;
[0067] Segment the image to be processed based on the characters in the image to be processed to obtain one or more first character images;
[0068] In an embodiment of the present application, in terms of determining the pixel distance corresponding to the third character image based on the third character image and the standard character image, the processing unit 602 is specifically configured to:
[0069] Determine variable parameters corresponding to the third character image based on the third character image and the standard character image, where the variable parameters include the offset of pixels, the rotation angle, and the scaling factor;
[0070] Offset the characters in the third character image based on the offset of pixels to obtain a fourth character image;
[0071] Rotate the fourth character image based on the rotation angle to obtain a fifth character image;
[0072] Scale the fifth character image based on the scaling factor to obtain a sixth character image;
[0073] Determine the pixel distance corresponding to the third character image based on the sixth character image and the standard character image.
[0074] In an embodiment of the present application, in terms of determining the pixel distance corresponding to the third character image based on the sixth character image and the standard character image, the processing unit 602 is specifically configured to:
[0075] Obtain multiple first pixel points corresponding to the characters in the sixth character image;
[0076] Obtain multiple second pixel points corresponding to the characters in the standard character image;
[0077] Determine the pixel distance corresponding to the third character image based on the multiple first pixel points and the multiple second pixel points.
[0078] In an embodiment of the present application, in terms of determining the pixel distance corresponding to the third character image based on the multiple first pixel points and the multiple second pixel points, the processing unit 602 is specifically configured to:
[0079] For a third pixel point, determine a first pixel distance between the third pixel point and each second pixel point, obtaining a plurality of first pixel distances, where the third pixel point is any one of the plurality of first pixel points;
[0080] Based on the plurality of first pixel distances, determine a second pixel distance corresponding to the third pixel point;
[0081] Based on the sum of the plurality of second pixel distances corresponding to the plurality of first pixel points, determine a pixel distance corresponding to the third character image.
[0082] In an embodiment of the present application, in terms of determining the aesthetics of the characters in each first character image based on the pixel distance corresponding to each second character image, the processing unit 602 is specifically configured to:
[0083] Obtain the length of the character in the standard character image, where the length of the character represents the number of pixel points of the character in the standard character image;
[0084] Based on the pixel distance corresponding to the third character image and the length of the character, determine a target pixel distance corresponding to the third character image;
[0085] Based on the target pixel distance corresponding to each second character image, determine the aesthetics of the characters in each first character image.
[0086] In an embodiment of the present application, the processing unit 602 is specifically configured to:
[0087] Based on the aesthetics of the characters in each first character image, determine the aesthetics of the characters in the image to be processed.
[0088] Refer to Figure 7 , Figure 7 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 7 shown, the electronic device 700 includes a transceiver 701, a processor 702, and a memory 703. They are connected through a bus 704. The memory 703 is used to store computer programs and data, and can transmit the data stored in the memory 703 to the processor 702.
[0089] The processor 702 is used to read the computer program in the memory 703 and perform the following operations:
[0090] Control the transceiver 701 to obtain the image to be processed;
[0091] Based on the characters in the image to be processed, segment the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character;
[0092] Binarize each first character image to obtain one or more second character images;
[0093] For a third character image, obtain a standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images;
[0094] Based on the third character image and the standard character image, determine the pixel distance corresponding to the third character image, where the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image;
[0095] Based on the pixel distance corresponding to each second character image, determine the aesthetics of the characters in each first character image.
[0096] Specifically, the transceiver 701 described above may be Figure 6 the acquisition unit 601 of the aesthetics determination device 600 in the embodiment of [], and the processor 702 may be Figure 6 the processing unit 602 of the aesthetics determination device 600 in the embodiment of [].
[0097] In specific implementation, the transceiver 701, the processor 702, and the memory 703 described in the embodiments of the present invention may respectively execute all the implementation manners described in the aesthetics determination method provided by the embodiments of the present invention, which will not be elaborated here.
[0098] It should be understood that the electronic device in this application may include a smart phone (such as an Android phone, an iOS phone, a Windows Phone phone, etc.), a tablet computer, a palm computer, a notebook computer, a mobile Internet device MID (Mobile Internet Devices, abbreviated as: MID), or a wearable device, etc. The above electronic devices are only examples and not an exhaustive list, including but not limited to the above electronic devices. In practical applications, the above electronic devices may also include: intelligent vehicle terminals, computer devices, etc.
[0099] The embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement some or all of the steps of any one of the aesthetics determination methods described in the above method embodiments.
[0100] The embodiment of the present application also provides a computer program product, and the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps of any one of the aesthetics determination methods described in the above method embodiments.
[0101] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0102] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] In several embodiments provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.
[0104] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0105] In addition, in each embodiment of this application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software program modules.
[0106] When the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of this application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, RandomAccess Memory), mobile hard disks, magnetic disks, or optical discs.
[0107] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program. This program can be stored in a computer-readable memory, and the memory can include: flash drives, read-only memories (English: Read-Only Memory, abbreviated: ROM), random access memories (English: Random Access Memory, abbreviated: RAM), magnetic disks, or optical discs, etc.
[0108] The above has introduced the embodiments of this application in detail. Specific examples are used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A method for determining aesthetics, characterized in that, The method includes: Obtain the image to be processed; Based on the characters in the image to be processed, segment the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character; Binarize each first character image to obtain one or more second character images; For a third character image, obtain the standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images; Based on the third character image and the standard character image, determine the pixel distance corresponding to the third character image, specifically including: obtaining multiple first pixel points corresponding to the character in the sixth character image; obtaining multiple second pixel points corresponding to the character in the standard character image; based on the multiple first pixel points and the multiple second pixel points, determine the pixel distance corresponding to the third character image, where the sixth character image is obtained by registering the third character image and the standard character image, and the pixel distance corresponding to the third character image is the pixel distance between the character in the third character image and the character in the standard character image; Based on the pixel distance corresponding to each second character image, determine the aesthetics of the character in each first character image, specifically including: obtaining the length of the character in the standard character image, where the length of the character represents the number of pixel points of the character in the standard character image; based on the pixel distance corresponding to the third character image and the length of the character, determine the target pixel distance corresponding to the third character image; based on the target pixel distance corresponding to each second character image and the preset mapping relationship of aesthetics, determine the aesthetics of the character in each first character image.
2. The method according to claim 1, wherein The segmenting the image to be processed based on the characters in the image to be processed to obtain one or more first character images includes: Perform character detection on the image to be processed to obtain character regions; Based on the pixel coordinates of the character regions in the image to be processed, segment the image to be processed to obtain character region images; Perform character recognition on the character region images to obtain the characters in the image to be processed; Based on the characters in the image to be processed, segment the image to be processed to obtain the one or more first character images.
3. The method according to claim 1 or 2, characterized in that, The method further includes: Based on the third character image and the standard character image, determine the variable parameters corresponding to the third character image, where the variable parameters include the offset of pixels, the rotation angle, and the scaling factor; Offset the character in the third character image based on the offset of the pixels to obtain a fourth character image; Rotate the fourth character image based on the rotation angle to obtain a fifth character image; Scale the fifth character image based on the scaling factor to obtain the sixth character image.
4. The method according to claim 1 or 2, characterized in that, Determining a pixel distance corresponding to the third character image based on the multiple first pixel points and the multiple second pixel points includes: For a third pixel point, determining a first pixel distance between the third pixel point and each second pixel point to obtain a plurality of first pixel distances, where the third pixel point is any one of the multiple first pixel points; Based on the multiple first pixel distances, determining a second pixel distance corresponding to the third pixel point; Based on the sum of the multiple second pixel distances corresponding to the multiple first pixel points, determining a pixel distance corresponding to the third character image.
5. The method according to claim 1 or 2, characterized in that, The method further includes: Based on the aesthetics of the characters in each first character image, determining the aesthetics of the characters in the image to be processed.
6. An aesthetics determination device, characterized in that, The apparatus includes: an acquisition unit and a processing unit; The acquisition unit is configured to acquire an image to be processed; The processing unit is configured to segment the image to be processed based on the characters in the image to be processed to obtain one or more first character images, where the number of first character images is the same as the number of characters in the image to be processed, and each first character image includes one character; The processing unit is further configured to binarize each first character image to obtain one or more second character images; The processing unit is further configured to, for a third character image, acquire a standard character image corresponding to the third character image, where the third character image is any one of the one or more second character images; The processing unit is further configured to determine a pixel distance corresponding to the third character image based on the third character image and the standard character image, specifically including: acquiring a plurality of first pixel points corresponding to the characters in the sixth character image; acquiring a plurality of second pixel points corresponding to the characters in the standard character image; determining a pixel distance corresponding to the third character image based on the multiple first pixel points and the multiple second pixel points, the sixth character image is obtained by registering the third character image and the standard character image, and the pixel distance corresponding to the third character image is the pixel distance between the characters in the third character image and the characters in the standard character image; The processing unit is further configured to determine the aesthetics of the characters in each first character image based on the pixel distance corresponding to each second character image, specifically including: acquiring the length of the characters in the standard character image, where the length of the characters represents the number of pixel points of the characters in the standard character image; determining a target pixel distance corresponding to the third character image based on the pixel distance corresponding to the third character image and the length of the characters; determining the aesthetics of the characters in each first character image based on the target pixel distance corresponding to each second character image and a preset mapping relationship of aesthetics.
7. An electronic device, characterized in that, Including: A processor and a memory, the processor being connected to the memory, the memory being configured to store a computer program, and the processor being configured to execute the computer program stored in the memory so that the electronic device performs the method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1-5.
Citation Information
Patent Citations
Handwritten character image similarity determination model training method
CN116434250A
Off-line handwritten Chinese character scoring method and device and storage medium
CN116612478A