Image Processing Method, Apparatus, Electronic Device, and Storage Medium

By automatically identifying and adjusting the text font size in the picture, the problem of low efficiency in image text size adjustment in the prior art is solved, and efficient image size adjustment and visual experience optimization are achieved.

CN114418855BActive Publication Date: 2025-07-25LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210080847.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2025-07-25
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

When users need to adjust the size of the text in the picture when typing documents, the existing technology requires multiple drag and drop operations, resulting in low layout efficiency.

Method used

By responding to user input operations, the initial text font size in the pending picture is automatically recognized, and the scaling process is performed according to the target font size, and the image size is adjusted to match the text size.

Benefits of technology

It improves the layout efficiency, reduces users' cumbersome adjustment operations, and ensures the consistency of the visual experience of text display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114418855B_ABST
    Figure CN114418855B_ABST
Patent Text Reader

Abstract

The image processing method provided by this application can respond to the user's input operation, obtain the image to be processed, and respectively determine the initial font size and the target font size of the text in the image to be processed; furthermore, perform a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed. Based on the present invention, the image size can be adjusted corresponding to the font size of the text in the image, thereby improving the typesetting efficiency and avoiding cumbersome operations for the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software technology, and more specifically, to an image processing method, apparatus, electronic device, and storage medium. Background Art

[0002] When users perform document layout, they often need to insert images, and the text in the inserted images often has a different proportion from other text in the document. At present, users can only adjust the size of the image by dragging and dropping it alone to adjust the size of the text in it. This requires users to drag and drop multiple times, resulting in extremely low layout efficiency. Summary of the Invention

[0003] In view of this, to solve the above problems, this application provides an image processing method, apparatus, electronic device, and storage medium. The technical solutions are as follows:

[0004] This application provides an image processing method on the one hand. The method includes:

[0005] In response to a first input operation, obtain an image to be processed, and determine the initial font size of the text in the image to be processed;

[0006] In response to a second input operation, determine the target font size of the text in the image to be processed;

[0007] Based on the initial font size and the target font size of the text in the image to be processed, perform a scaling process on the image to be processed.

[0008] Preferably, the determining the initial font size of the text in the image to be processed includes:

[0009] Determine multiple text regions in the image to be processed and the font size of the text in each text region;

[0010] Use the font size of the text in the target text region as the initial font size of the text in the image to be processed, where the target text region is the text region that meets the corresponding conditions among the multiple text regions.

[0011] Preferably, the determining method of the target text region includes:

[0012] Use the text region with the largest region height among the multiple text regions as the target text region; and / or

[0013] Determine the visual focus region, and use the text region located in the visual focus region among the multiple text regions as the target text region; and / or

[0014] Add a first region box matching each text region to the image to be processed; in response to a third input operation, determine the specified first region box, and use the text region corresponding to the specified first region box as the target text region.

[0015] Preferably, after determining the initial font size of the text in the image to be processed, the method further includes:

[0016] Add a second region box matching the target text region to the image to be processed;

[0017] The determining the target font size of the text in the image to be processed in response to a second input operation includes:

[0018] In response to a trigger operation on the second region box, output the font size of the text in the target text region;

[0019] In response to a drag operation on the second region box, perform a scaling process on the second region box. At the same time, adjust the font size of the text in the target text region based on the scaling degree of the second region box, and use the adjusted font size of the text in the target text region as the target font size of the text in the image to be processed.

[0020] Preferably, the performing a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed includes:

[0021] In response to a drag operation on the second region box, perform a scaling operation on the image to be processed based on the initial font size of the text in the image to be processed and the adjusted font size of the text in the target text region.

[0022] Preferably, the image to be processed includes a first image as the original image and at least one second image as the target image;

[0023] After determining the initial font size of the text in the image to be processed, the method further includes:

[0024] Add a third region box matching its target text region to the first image, and add a fourth region box matching its target text region to each second image;

[0025] The determining the target font size of the text in the image to be processed in response to a second input operation includes:

[0026] In response to a format selection operation on the third region box, use the initial font size corresponding to the first image as the target font size of the text in each second image;

[0027] Performing a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture, includes:

[0028] In response to a format replacement operation for the fourth region box corresponding to the target second picture, performing a scaling process on the target second picture based on the initial font size and the target font size corresponding to the target second picture, where the target second picture is one or more of the at least one second picture.

[0029] Preferably, the to-be-processed picture includes a plurality of third pictures;

[0030] After determining the initial font size of the text in the to-be-processed picture, the method further includes:

[0031] Adding a fifth region box matching the target text region to each third picture;

[0032] The determining the target font size of the text in the to-be-processed picture in response to a second input operation includes:

[0033] In response to a region selection operation for the fifth region boxes corresponding to the plurality of third pictures, determining the target font size of the text in each third picture based on the initial font size corresponding to each third picture, and the target font sizes corresponding to any two third pictures are the same;

[0034] The performing a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture, includes:

[0035] Performing a scaling process on each third picture based on the initial font size and the target font size corresponding to each third picture.

[0036] On the other hand, the present application provides a picture processing device, the device includes:

[0037] A font size determination module, configured to obtain a to-be-processed picture in response to a first input operation, determine the initial font size of the text in the to-be-processed picture; and determine the target font size of the text in the to-be-processed picture in response to a second input operation;

[0038] A picture scaling module, configured to perform a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture.

[0039] On yet another aspect, the present application provides an electronic device, the electronic device includes:

[0040] A memory, configured to store an application program and data generated by the running of the application program;

[0041] A processor for executing the application to implement the following functions: in response to a first input operation, obtain a picture to be processed and determine the initial font size of the text in the picture to be processed; in response to a second input operation, determine the target font size of the text in the picture to be processed; and perform a scaling process on the picture to be processed based on the initial font size and the target font size of the text in the picture to be processed.

[0042] In another aspect, the present application provides a storage medium storing computer program code, and when the computer program code is executed, the above-mentioned picture processing method is implemented.

[0043] Compared with the prior art, the beneficial effects achieved by the present application are as follows:

[0044] Through the above technical solutions, the picture processing method provided by the present application can respond to the user's input operation, obtain the picture to be processed, and respectively determine the initial font size and the target font size of the text in the picture to be processed; furthermore, perform a scaling process on the picture to be processed based on the initial font size and the target font size of the text in the picture to be processed. Based on the present invention, the picture size can be adjusted corresponding to the font size of the text in the picture, thereby improving the typesetting efficiency and avoiding cumbersome operations for the user. Description of the Drawings

[0045] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0046] Figure 1 It is a hardware structure block diagram of the electronic device provided by the embodiment of the present application;

[0047] Figure 2 It is a method flow chart of the picture processing method provided by the embodiment of the present application;

[0048] Figure 3 It is a scene schematic diagram provided by the embodiment of the present application;

[0049] Figure 4 It is another scene schematic diagram provided by the embodiment of the present application;

[0050] Figure 5 It is a method flow chart of another picture processing method provided by the embodiment of the present application;

[0051] Figure 6 It is another scene schematic diagram provided by the embodiment of the present application;

[0052] Figure 7Another scenario schematic diagram provided by an embodiment of the present application;

[0053] Figure 8 A method flowchart of another image processing method provided by an embodiment of the present application;

[0054] Figure 9 Another scenario schematic diagram provided by an embodiment of the present application;

[0055] Figure 10 A method flowchart of another image processing method provided by an embodiment of the present application;

[0056] Figure 11 Another scenario schematic diagram provided by an embodiment of the present application;

[0057] Figure 12 A method flowchart of another image processing method provided by an embodiment of the present application;

[0058] Figure 13 Another scenario schematic diagram provided by an embodiment of the present application;

[0059] Figure 14 A structural schematic diagram of an image processing apparatus provided by an embodiment of the present application. Detailed implementation manners

[0060] 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 only a 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 of the present application without creative efforts shall fall within the protection scope of the present application.

[0061] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners.

[0062] The present application provides an image processing method, which can be applied to an electronic device. Refer to Figure 1 The hardware structure block diagram of the electronic device shown. The hardware structure of the electronic device may include: a processor 11, a communication interface 12, a memory 13, and a communication bus 14;

[0063] In the embodiments of the present application, the number of the processor 11, the communication interface 12, the memory 13, and the communication bus 14 is at least one, and the processor 11, the communication interface 12, and the memory 13 complete mutual communication through the communication bus 14.

[0064] The processor 11 may be a central processing unit (CPU), a graphics processing unit (GPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application, etc.

[0065] The memory 13 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0066] Among them, the memory 13 stores the application program and the data generated by the running of the application program, and the processor 11 executes the application program to implement the functions:

[0067] In response to a first input operation, obtain a picture to be processed, and determine the initial font size of the text in the picture to be processed; in response to a second input operation, determine the target font size of the text in the picture to be processed; based on the initial font size and the target font size of the text in the picture to be processed, perform a scaling process on the picture to be processed.

[0068] It should be noted that for the refinement and extension of the functions implemented by the processor executing the application program, reference may be made to the following description.

[0069] The embodiments of the present application provide a picture processing method. Refer to Figure 2 the method flow chart shown. The method includes the following steps:

[0070] S101, in response to a first input operation, obtain a picture to be processed, and determine the initial font size of the text in the picture to be processed.

[0071] In the embodiments of the present application, in picture editing scenarios such as PPT or WPS, for pictures containing text, users have the need to adjust their sizes during typesetting to ensure that the text in the pictures meets expectations and improve the visual experience of the text display in the pictures. For this, an operation for triggering picture processing input by the user, that is, the first input operation, can be used to obtain the picture to be processed, and then a picture recognition algorithm can be called to determine the initial font size of the text in the picture to be processed. The first input operation can be an operation of types such as gesture, voice, and touch. Taking the touch type operation as an example, it can specifically be operations such as uploading, selecting, clicking, and swiping. The present invention does not make any limitations in this regard.

[0072] For ease of understanding, refer to Figure 3The schematic diagram of the shown scenario. In the picture editing interface, the user has uploaded n pictures with different sizes. By detecting the user's input operations on the picture editing interface, the picture to be processed can be obtained from the n pictures. For example, assume that the first input operation is a continuous click operation more than three times. Continue to refer to Figure 3 , it is detected that the user performs a continuous click operation on picture n, and the number of continuous clicks exceeds three times, then picture n can be determined as the picture to be processed.

[0073] It should be noted that in the above example, using the click touch operation as the first input operation is only for illustration. It can be understood that for other input methods not listed in the embodiments of the present application, they are also within the protection scope of the present application.

[0074] In addition, in the embodiments of the present application, the font size of the text represents the size of the text, and the size of the text is related to the font type of the text on the one hand and the type of the text on the other hand. For example, for two texts with the same typeface of regular script - text 1 and text 2, where the font type of text 1 is No. 4 and the font type of text 2 is No. 5, then compared with text 2, text 1 is larger in size, that is, text 1 has a larger font size. Another example, for two texts with the same font type of No. 4 - text 3 and text 4, where the typeface of text 3 is regular script and the typeface of text 4 is Song typeface, then compared with text 3, text 4 is larger in size, that is, text 4 has a larger font size.

[0075] Therefore, in the embodiments of the present application, the initial font size of the text in the picture to be processed, that is, the font size of the text in the picture to be processed at the initial moment, when determining the initial font size of the text in the picture to be processed based on the picture recognition algorithm, consider the font type of the text in the picture to be processed on the one hand and the type of the text in the picture to be processed on the other hand. Therefore, before processing the picture to be processed in the present application, a detection model for recognizing the font size of the text in the picture is trained based on the picture recognition algorithm, so as to determine the initial font size of the text in the picture to be processed through this detection model. When training the detection model, it can be implemented in the existing machine learning method. The training samples of the detection model are a large number of pictures containing text, and the font types and types of the text in the pictures used as training samples are diverse. The training process will not be elaborated here.

[0076] Of course, in some application scenarios, the font size of the text in the picture to be processed can only consider the font type of the text or the type of the text. In this case, the detection model can determine the font size of the text in the picture to be processed only based on the font type of the text or the type of the text. Correspondingly, the training samples of the detection model also change accordingly. It is only necessary that the font types / types of the text in the pictures used as training samples are diverse.

[0077] S102, in response to the second input operation, determine the target font size of the text in the picture to be processed.

[0078] In the embodiments of the present application, in response to an operation input by the user for indicating the target font size, that is, the second input operation, the target font size of the text in the to-be-processed picture is determined. The target font size is the font size expected by the user for the to-be-processed picture. The second input operation can be an operation of types such as gesture, voice, touch, etc. Taking the voice type of operation as an example, it can specifically input a voice such as "Please adjust the text to the ** font size", and then determine the target font size through technologies such as voice recognition and semantic parsing.

[0079] For ease of understanding, continue to take the Figure 3 illustrated scenario as an example for description. After monitoring that the user performs continuous click operations on picture n and the number of continuous clicks exceeds three times, determining that picture n is the to-be-processed picture and obtaining the initial font size of the text in picture n as font size a, the voice collection device (such as a microphone) of the local device is further started to collect the voice input by the user. After processing the voice "Please adjust the text to font size b" input by the user, the target font size of the text in picture n is determined as font size b. At this time, a prompt box for displaying the target font size can be added, and the schematic diagram of the scenario is as Figure 4 shown.

[0080] It should be noted that taking the voice type of operation as the second input operation in the above example is only for illustration. It can be understood that other input methods not listed in the embodiments of the present application are also within the protection scope of the present application.

[0081] S103, based on the initial font size and the target font size of the text in the to-be-processed picture, perform a scaling process on the to-be-processed picture.

[0082] In the embodiments of the present application, after obtaining the initial font size and the target font size of the text in the to-be-processed picture, the scaling ratio of the to-be-processed picture can be determined based on the initial font size and the target font size, and then a scaling operation is performed on the to-be-processed picture according to the scaling ratio, and the scaled picture is displayed to the user, which can make the font size of the text in the picture reach the user's expectation and ensure the display visual experience of the text in the picture.

[0083] For the scaling ratio of the to-be-processed picture, in some scenarios, the ratio of the target font size to the initial font size of the text can be used as the scaling ratio. In some scenarios, other influencing factors, such as adjustment coefficients, etc., can also be added, which will not be elaborated here. It should be noted that in the embodiments of the present application, the scaling of the to-be-processed picture is based on the size when the to-be-processed picture is obtained.

[0084] The picture processing method provided by the embodiments of the present application can correspondingly adjust the picture size according to the font size of the text in the picture, thereby improving the typesetting efficiency and avoiding the cumbersome operations of the user.

[0085] As an implementation of determining the initial font size of the text in the picture to be processed, an embodiment of the present application provides another picture processing method, including the following steps. The method flow chart is as Figure 5 shown:

[0086] S201, in response to the first input operation, obtain the picture to be processed, and determine multiple text regions in the picture to be processed, as well as the font size of the text in each text region.

[0087] In the embodiment of the present application, after obtaining the picture to be processed and before calling the picture recognition algorithm to determine the initial font size of the text in the picture to be processed, it is first necessary to detect the text regions in the picture to be processed. In most scenarios, there are multiple text regions in the picture to be processed, and the sizes of the texts in each text region are the same; then, recognize the font size of the text in each text region.

[0088] Of course, in some scenarios, if there is only one text region in the picture to be processed, after recognizing the font size of the text in this text region, this text region can be directly used as the target text region, and the font size of the text in this text region can be used as the initial font size of the text in the picture to be processed.

[0089] S202, use the font size of the text in the target text region as the initial font size of the text in the picture to be processed, where the target text region is the text region that meets the corresponding conditions among the multiple text regions.

[0090] In the embodiment of the present application, in most scenarios, since there are multiple text regions in the picture to be processed and the font sizes of the texts in each text region are also different, in this case, filtering conditions can be considered to filter out the text regions that meet the conditions from the multiple text regions as the target text regions, and then use the font size of the text in the target text region as the initial font size of the text in the picture to be processed.

[0091] For ease of understanding, continue to take the Figure 3 scenario shown as an example for illustration. After determining that picture n is the picture to be processed, call the picture recognition algorithm to determine that picture n contains multiple text regions and the font sizes of the texts in each text region are also different. Refer to the Figure 6 scenario schematic diagram shown. Picture n contains three text regions - text region 1, text region 2, and text region 3. The font size of the text in text region 1 is font size c, the font size of the text in text region 2 is font size d, and the font size of the text in text region 3 is font size e. At this time, the average value of font size c, font size d, and font size e can be calculated to obtain the average font size of the text in the picture to be processed, and then the text region whose font size is closest to this average font size is used as the target text region, which can make the font size of the target text region represent the average font size of the text in the picture to be processed to the greatest extent.

[0092] In the specific implementation process, one or more of the following methods can be used to determine the target text area:

[0093] Taking the text area with the largest area height among multiple text areas as the target text area; and / or

[0094] Determining the visual focus area and taking the text area within the visual focus area among multiple text areas as the target text area; and / or

[0095] Adding a first area box matching each text area to the picture to be processed; in response to the third input operation, determining the specified first area box, and taking the text area corresponding to the specified first area box as the target text area.

[0096] In the embodiments of the present application, in most scenarios, there are multiple text areas in the picture to be processed. To ensure that the selected target text area better meets the user's needs:

[0097] On the one hand, the text area with the largest area height can be selected as the target text area. This is because the largest area height means the largest font size of the text therein. From the user's editing habit, the larger the font size, the greater the user's attention. Therefore, the text in the target text area is the content that the user pays the most attention to. Continue to refer to Figure 6 , by comparing the area heights of text areas 1, 2, and 3, it can be determined that the area height of text area 1 is the largest, that is, the font size of the text in text area 1 is the largest. Therefore, text area 1 can be used as the target text area, and font size c can be used as the initial font size of the text in the picture to be processed.

[0098] On the other hand, the user's visual focus area can be located, and then the text area within the visual focus area can be used as the target text area, which can select the content that the user pays the most attention to from the user's visual perspective. Specifically, the camera of the local device can be started to track the focus direction of the user's eyes, and the visual focus area of the user in the display interface of the local device can be located based on this focus direction. Continue to refer to Figure 6 , assuming that by locating the user's visual focus area, it is determined that text area 2 is within the visual focus area, then text area 2 can be used as the target text area, and font size d can be used as the initial font size of the text in the picture to be processed.

[0099] Of course, in some scenarios, there may be multiple text areas within the visual focus area. Continue to refer to Figure 6, assuming that both text region 1 and text region 2 are located in the visual focus region, other screening conditions can be further considered. For example, the text region with the largest region height can be used as the target text region. Thus, text region 1 can be used as the target text region, and font size c can be used as the initial font size of the text in the image to be processed.

[0100] On the other hand, the target text region is selected by the user through human-computer interaction, accurately identifying the content that the user is concerned about on the basis of enhancing the user's sense of participation. Specifically, a region box, i.e., the first region box, matching each text region is added to the image to be processed. The first region box matches the font size of the text in the corresponding text region. Furthermore, in response to the operation input by the user for specifying the text region, i.e., the third input operation, the first region box specified by the user is determined, and the text region corresponding to the specified first region box is further used as the target text region. The third input operation can be operations of types such as gestures, voices, touches, etc. Taking the touch type of operation as an example, it can specifically be operations such as selection, click, swipe, etc. The embodiments of the present invention do not make limitations in this regard.

[0101] Continuing with Figure 6 the scenario shown as an example for illustration. Assuming that the third input operation is a single click operation, referring to Figure 7 the schematic diagram of the scenario shown, first region boxes matching the font sizes of the text in text regions 1, 2, and 3 in image n are added respectively. It is monitored that the user performs a single click operation on the first region box corresponding to text region 3, then text region 3 can be used as the target text region, and font size e can be used as the initial font size of the text in the image to be processed.

[0102] S203, in response to the second input operation, determine the target font size of the text in the image to be processed.

[0103] S204, based on the initial font size and the target font size of the text in the image to be processed, perform a scaling process on the image to be processed.

[0104] Another image processing method provided by the embodiments of the present application includes the following steps, and the method flow chart is as Figure 8 shown:

[0105] S301, in response to the first input operation, obtain the image to be processed, and determine multiple text regions in the image to be processed, as well as the font size of the text in each text region.

[0106] S302, use the font size of the text in the target text region as the initial font size of the text in the image to be processed, where the target text region is the text region that meets the corresponding conditions among the multiple text regions.

[0107] S303, add a second region box matching the target text region to the image to be processed.

[0108] In an embodiment of the present application, after determining a target text region from multiple text regions in a to-be-processed picture, a region box matching the target text region, i.e., a second region box, is further added to the to-be-processed picture, and the second region box matches the font size of the text in the target text region.

[0109] See Figure 9 the scene schematic diagram shown. The picture is as Figure 9 (a) shown; as Figure 9 (b) shown, the user selects the picture, and in response to the selection operation input by the user, the picture is used as the to-be-processed picture, and an image recognition algorithm is called to determine the initial font size of the text in the to-be-processed picture. During this process, the region where "Puppeteer" is located in the to-be-processed picture is used as the target text region, and thus a region box matching the font size of "Puppeteer" is added to the region where "Puppeteer" is located.

[0110] S304, in response to a trigger operation on the second region box, output the font size of the text in the target text region.

[0111] In an embodiment of the present application, after adding a matching second region box to the target text region, the trigger operation input by the user for the second region box can be further monitored. For example, moving the mouse into the second region box, or single-clicking the second region box. In response to the trigger operation on the second region box, output the font size of the text in the target text region.

[0112] For ease of understanding, continue to refer to Figure 9 the scene shown. As Figure 9 (c) shown, the user moves the mouse into the region box added to "Puppeteer" in the to-be-processed picture. In response to the trigger operation input by the user, a hint box for displaying its font size is added to "Puppeteer" in the to-be-processed picture to display and output the font size of "Puppeteer" in the to-be-processed picture.

[0113] S305, in response to a drag operation on the second region box, perform a scaling process on the second region box. At the same time, adjust the font size of the text in the target text region based on the scaling degree of the second region box, and use the adjusted font size of the text in the target text region as the target font size of the text in the to-be-processed picture.

[0114] In the embodiments of the present application, after the font size of the text in the target text area is output, it is possible to further monitor the dragging operation input by the user for the second area box. Specifically, the user can drag any corner point of the second area box. If the user drags the corner point closer to the center of the second area box, the second area box is shrunk; conversely, if the user drags the corner point away from the center of the second area box, the second area box is enlarged. Of course, the degree of shrinkage / enlargement of the second area box can be determined according to the actual position of the dragged corner point.

[0115] While scaling the second area box, it is also possible to adjust the font size of the text in the target text area according to the degree of shrinkage / enlargement of the second area box, and then use the shrunk / enlarged font size as the target font size of the text in the image to be processed.

[0116] For ease of understanding, continue to refer to Figure 9 the scenario shown. For the area box added to "Puppeteer" in the image to be processed, the user drags one of the corner points away from the center of the area box. In response to the dragging operation input by the user, the magnification degree of the area box is determined according to the actual position of the dragged corner point, and then the area box is enlarged according to the magnification degree. At the same time, the font size of "Puppeteer" in the image to be processed is enlarged according to the magnification degree. Of course, the font size displayed and output in the prompt box is also enlarged accordingly.

[0117] Since the user is more concerned about the adjustment of the text than the size of the image to be processed, in some embodiments, in response to the dragging operation input by the user for the second area box, only the font size of the text in the image to be processed is shrunk / enlarged (constantly updating the target font size of the text), and the size of the image to be processed is not adjusted. Only when it is detected that the user stops inputting the dragging operation, such as detecting that the user's mouse leaves the second area box, or detecting that the user's finger leaves the display screen, is the degree of shrinkage / enlargement of the image to be processed determined according to the initial font size and the current target font size of the text in the image to be processed, and the image to be processed is shrunk / enlarged according to the degree of shrinkage / enlargement.

[0118] For ease of understanding, continue to refer to Figure 9 the scenario shown. As Figure 9 (d) shows, the font size of "Puppeteer" in the image to be processed is enlarged from 12 to 16 at the beginning. During this process, the size of the image to be processed does not change. Once it is detected that the user stops inputting the dragging operation, assuming that the font size of "Puppeteer" in the image to be processed is 16 at this time, the magnification degree of the image to be processed can be determined as 16 / 12, and the image to be processed is further enlarged according to the magnification degree, as Figure 9 (e) shows, and the display of the prompt box ends.

[0119] S306. Perform a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed.

[0120] In some embodiments, during the process of the user dragging the second region box, the image to be processed can also be scaled along with the font size of the text therein. Specifically:

[0121] In response to the dragging operation on the second region box, perform a scaling operation on the image to be processed based on the initial font size of the text in the image to be processed and the adjusted font size of the text in the target text region.

[0122] In the embodiments of the present application, in response to the dragging operation input by the user on the second region box, not only the font size of the text in the image to be processed is reduced / enlarged (constantly updating the target font size of the text), but also the reduction / enlargement degree of the image to be processed can be determined based on the initial font size and the current target font size of the text in the image to be processed, and the image to be processed is scaled / enlarged with this reduction / enlargement degree.

[0123] For easy understanding, continue to refer to Figure 9 the scenario shown. As Figure 9 shown in (f), the font size of "Puppeteer" in the image to be processed is enlarged from 12 at the beginning to 16. During this process, the size of the image to be processed is also enlarged with an enlargement degree of 16 / 12. Once it is detected that the user stops inputting the dragging operation, the image to be processed at this time is output. As Figure 9 shown in (g), at this time, the display of the end prompt box and the second region box in the image to be processed ends.

[0124] The embodiments of the present application provide another image processing method, including the following steps. The method flow chart is as Figure 10 shown:

[0125] S401. In response to the first input operation, obtain the image to be processed, determine multiple text regions in the image to be processed, and the font size of the text in each text region. The image to be processed includes a first image as the original image and at least one second image as the target image.

[0126] In image editing scenarios such as PPT or WPS, multiple images are often typeset together. Adjusting the size of each image one by one is difficult to ensure the consistency of the font display in all images. Often, the text in some images is not clear, while the text in some images is displayed too large.

[0127] To quickly perform batch scaling on a large number of images, in the embodiments of the present application, for the obtained images to be processed, one of the images can be used as the original image (i.e., the first image), and the other images in the images to be processed except the first image can be used as the target images (i.e., the second images). In this way, the font size of the text in the target images can be adjusted based on the font size of the text in the original image, and at the same time, the size of the target images can be adjusted.

[0128] S402, Use the font size of the text in the target text area as the initial font size of the text in the image to be processed, where the target text area is the text area that meets the corresponding conditions among multiple text areas.

[0129] S403, Add a third area box that matches the target text area in the first image, and add a fourth area box that matches the target text area in each second image.

[0130] In the embodiments of the present application, for the first image, after determining the target text area from multiple text areas in the first image, a region box that matches the target text area, that is, the third area box, can be further added to the first image, and the third area box matches the font size of the text in the target text area of the first image.

[0131] For each second image, after determining the target text area from multiple text areas in the second image, a region box that matches the target text area, that is, the fourth area box, can be further added to the second image, and the fourth area box matches the font size of the text in the target text area of the second image.

[0132] See Figure 11 the schematic diagram of the scenario shown. The two images are respectively as Figure 11 (a) and 11(b); the user first selects the image shown in Figure 11 (a), in response to the selection operation input by the user for the first time, use the image shown in Figure 11 (a) as the first image. Further, the user then selects the image shown in Figure 11 (b), in response to the selection operation input by the user for the second time, use the image shown in Figure 11 (b) as the second image.

[0133] For the determined first image and second image, call the image recognition algorithm to respectively determine the initial font size of the text in the first image and the second image. In this process, use the area where "Puppeteer" is located in the first image as the target text area of the first image, and thus add a region box (i.e., the third area box) that matches the font size of "Puppeteer" to the area where "Puppeteer" is located, as Figure 11(c); similarly, the area where "Playwright" is located in the second picture is used as the target text area of the first picture, and thus an area box (i.e., the fourth area box) matching the font size of "Playwright" is added to the area where "Playwright" is located, as shown in Figure 11 (d).

[0134] S404, in response to the format selection operation for the third area box, use the initial font size corresponding to the first picture as the target font size of the text in each second picture.

[0135] In the embodiments of the present application, after adding a matching third area box to the target text area of the first picture and a matching fourth area box to the target text area of each second picture, it is possible to further monitor the format selection operation input by the user for the third area box. For example, after single-clicking the third area box and then clicking the format brush, in response to the format selection operation for the third area box, use the initial font size of the text in the first picture as the target font size of the text in each second picture.

[0136] For ease of understanding, continue to refer to the Figure 11 scenario shown. As shown in Figure 11 (e), the user single-clicks the area box added to "Puppeteer" in the first picture and then clicks the format brush. At this time, in response to the format selection operation input by the user for the area box added to "Puppeteer", use the font size of "Puppeteer" in the first picture as the target font size of "Playwright" in the second picture.

[0137] S405, in response to the format replacement operation for the fourth area box corresponding to the target second picture, perform a scaling process on the target second picture based on the initial font size and the target font size corresponding to the target second picture, where the target second picture is one or more of at least one second picture.

[0138] In the embodiments of the present application, after determining the target font size of the text in each second picture, it is possible to further monitor the format replacement operation input by the user for each fourth area box. Specifically, the user can input a format replacement operation for one or more second pictures specified by the user, and the one or more second pictures specified are the target second pictures. For the target second picture, determine the scaling degree of the target second picture based on the initial font size and the target font size of the text in the second picture, and perform a scaling process on the target second picture with this scaling degree.

[0139] For ease of understanding, continue to refer to the Figure 11 scenario shown. As shown in Figure 11As shown in (f), the user selects to perform format replacement on the second picture, and applies the format brush to the area box added by "Playwright" in the second picture. In response to the format replacement operation input by the user for the area box added by "Playwright", since the font size of "Puppeteer" in the first picture is smaller than the font size of "Playwright" in the second picture, the reduction degree of the second picture can be determined according to the font size of "Puppeteer" in the first picture and the font size of "Playwright" in the second picture, and the second picture is reduced by this reduction degree, as Figure 11 shown in (g). Finally, the display of the third area box in the first picture and the fourth area box in the second picture is ended, as Figure 11 shown in (h) and (i).

[0140] Another picture processing method provided by an embodiment of the present application includes the following steps. The method flow chart is as Figure 12 shown:

[0141] S501, in response to a first input operation, obtain a picture to be processed, determine multiple text areas in the picture to be processed, and the font size of the text in each text area. The picture to be processed includes multiple third pictures.

[0142] For quickly performing batch scaling on a large number of pictures, in an embodiment of the present application, for the obtained picture to be processed, each picture therein belongs to a target picture, that is, the text in each third picture in the picture to be processed needs to have its font size adjusted. Of course, the size of each third picture also needs to be adjusted.

[0143] S502, use the font size of the text in the target text area as the initial font size of the text in the picture to be processed. The target text area is a text area that meets corresponding conditions among the multiple text areas.

[0144] S503, add a fifth area box that matches its target text area to each third picture.

[0145] In an embodiment of the present application, for each third picture, after determining the target text area from the multiple text areas in the third picture, a region box that matches its target text area, that is, a fifth area box, can be further added to the third picture. The fifth area box matches the font size of the text in the target text area of the third picture.

[0146] Referring to Figure 13 the scene schematic diagram shown, the two pictures are respectively as Figure 13 (a) and Figure 13 (b) shown. The user can simultaneously select Figure 13 (a) and Figure 13 (b) shown in the two pictures, and willFigure 13 (a) and Figure 13 The two pictures shown in (b) are respectively used as the third picture.

[0147] For Figure 13 (a) and Figure 13 For each of the two third pictures shown in (b), call the picture recognition algorithm to respectively determine the initial font size of the text in each third picture. In this process, take the area where "Puppeteer" is located in the third picture shown in Figure 13 (a) as its target text area, and thus add a region box (i.e., the fifth region box) that matches the font size of "Puppeteer" to the area where "Puppeteer" is located, as shown in Figure 13 (c); similarly, Figure 13 Take the area where "Playwright" is located in the third picture shown in (b) as its target text area, and thus add a region box (i.e., the fifth region box) that matches the font size of "Playwright" to the area where "Playwright" is located, as shown in Figure 13 (d).

[0148] S504, in response to the region selection operation for the fifth region boxes corresponding to multiple third pictures, based on the initial font size corresponding to each third picture, determine the target font size of the text in each third picture, and the target font sizes corresponding to any two third pictures are the same.

[0149] In the embodiments of the present application, after adding a matching fifth region box to the target text area of each third picture, it is possible to further monitor the region selection operation input by the user for the fifth region boxes of all third pictures. For example, all the fifth region boxes of all third pictures are selected. In response to the region selection operation of the user for the fifth region boxes of all third pictures, determine the target font size of the text in each third picture according to the initial font size of the text in all third pictures. For example, there are 3 third pictures, namely the third picture 1, the third picture 2, and the third picture 3. Then, the initial font size of the text in the third picture 1, the initial font size of the text in the third picture 2, and the initial font size of the text in the third picture 3 can be processed, such as mean processing, to determine the target font size of the text in the third picture 1, the third picture 2, and the third picture 3, and the target font sizes of the third picture 1, the third picture 2, and the third picture 3 are the same.

[0150] For easy understanding, continue to refer to the scenario shown in Figure 13 As shown in Figure 13 (e) and Figure 13 (f), the user selects all the region boxes added to "Puppeteer" in the third picture shown in Figure 13 (c), and the region box added to Figure 13The bounding box added to "Playwright" in the third picture shown in (d), in response to the user's area selection operation on the bounding box added to "Puppeteer" and the bounding box added to "Playwright", according to Figure 13 the font size of "Puppeteer" in the third picture shown in (c) and Figure 13 the font size of "Playwright" in the third picture shown in (d) to determine the target font size of the two. Since the font size of "Puppeteer" is smaller than that of "Playwright", the target font size is greater than the font size of "Puppeteer" and smaller than the font size of "Playwright".

[0151] S505. Based on the initial font size and the target font size corresponding to each third picture, perform a scaling process on each third picture.

[0152] In the embodiments of the present application, continue to refer to the Figure 13 scene shown. After determining the target font size of the third picture shown in Figure 13 (c) and the third picture shown in Figure 13 (d), since the target font size is greater than the font size of "Puppeteer", the magnification degree of the third picture shown in Figure 13 (c) can be determined according to the target font size and the font size of "Puppeteer", and the third picture shown in Figure 13 (c) is magnified by this magnification degree, as shown in Figure 13 (g); similarly, since the target font size is smaller than the font size of "Playwright", the reduction degree of the third picture shown in Figure 13 (d) can be determined according to the target font size and the font size of "Playwright", and the third picture shown in Figure 13 (d) is reduced by this reduction degree, as shown in Figure 13 (h).

[0153] Corresponding to the above picture processing method, the present application also discloses a picture processing device, as shown in Figure 14 . The picture processing device includes:

[0154] A font size determination module 10, configured to obtain a picture to be processed in response to a first input operation, and determine the initial font size of the text in the picture to be processed; and determine the target font size of the text in the picture to be processed in response to a second input operation;

[0155] A picture scaling module 20, configured to perform a scaling process on the picture to be processed based on the initial font size and the target font size of the text in the picture to be processed.

[0156] In another embodiment of the image processing device disclosed in the present application, the font size determination module 10 determines the initial font size of the text in the image to be processed, including:

[0157] Determine multiple text regions in the image to be processed and the font size of the text in each text region; use the font size of the text in the target text region as the initial font size of the text in the image to be processed, where the target text region is the text region that meets the corresponding conditions among the multiple text regions.

[0158] In another embodiment of the image processing device disclosed in the present application, the manner in which the font size determination module 10 determines the target text region includes:

[0159] Use the text region with the largest region height among the multiple text regions as the target text region; and / or

[0160] Determine the visual focus region and use the text region located within the visual focus region among the multiple text regions as the target text region; and / or

[0161] Add a first region box matching each text region to the image to be processed; in response to a third input operation, determine the designated first region box and use the text region corresponding to the designated first region box as the target text region.

[0162] In another embodiment of the image processing device disclosed in the present application, after the font size determination module 10 determines the initial font size of the text in the image to be processed, it is further configured to:

[0163] Add a second region box matching the target text region to the image to be processed;

[0164] The font size determination module 10 determines the target font size of the text in the image to be processed in response to a second input operation, including:

[0165] In response to a trigger operation on the second region box, output the font size of the text in the target text region; in response to a drag operation on the second region box, perform a scaling process on the second region box. Meanwhile, adjust the font size of the text in the target text region based on the scaling degree of the second region box, and use the adjusted font size of the text in the target text region as the target font size of the text in the image to be processed.

[0166] In another embodiment of the image processing device disclosed in the present application, the image scaling module 20 performs a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed, including:

[0167] In response to a drag operation on the second region box, perform a scaling operation on the image to be processed based on the initial font size of the text in the image to be processed and the adjusted font size of the text in the target text region.

[0168] In an embodiment of another image processing device disclosed in the present application, the image to be processed includes a first image as the original image and at least one second image as the target image;

[0169] After the font size determination module 10 determines the initial font size of the text in the image to be processed, it is further configured to:

[0170] Add a third region box matching the target text region in the first image, and add a fourth region box matching the target text region in each second image;

[0171] The font size determination module 10 determines the target font size of the text in the image to be processed in response to a second input operation, including:

[0172] In response to a format selection operation on the third region box, use the initial font size corresponding to the first image as the target font size of the text in each second image;

[0173] The image scaling module 20 performs a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed, including:

[0174] In response to a format replacement operation on the fourth region box corresponding to the target second image, perform a scaling process on the target second image based on the initial font size and the target font size corresponding to the target second image, where the target second image is one or more of the at least one second image.

[0175] In an embodiment of another image processing device disclosed in the present application, the image to be processed includes a plurality of third images;

[0176] After the font size determination module 10 determines the initial font size of the text in the image to be processed, the method further includes:

[0177] Add a fifth region box matching the target text region in each third image;

[0178] The font size determination module 10 determines the target font size of the text in the image to be processed in response to a second input operation, including:

[0179] In response to a region selection operation on the fifth region boxes corresponding to the plurality of third images, determine the target font size of the text in each third image based on the initial font size corresponding to each third image, and the target font sizes corresponding to any two third images are the same;

[0180] The image scaling module 20 performs a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed, including:

[0181] Perform scaling processing on each third picture based on the initial font size and the target font size corresponding to each third picture.

[0182] For the detailed functions of each module in the embodiments of the present application, reference may be made to the corresponding disclosed parts of the above-mentioned picture processing method embodiments, which will not be elaborated herein.

[0183] Corresponding to the above-mentioned picture processing method, the present application also discloses a storage medium storing computer program code, and when the computer program code is executed, the picture processing method is implemented.

[0184] The above has introduced in detail a picture processing method, device, electronic device and storage medium provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

[0185] It should be noted that the embodiments in this specification are all described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0186] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements inherent to the process, method, article or device, but also other elements inherent to these process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0187] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for image processing, the method comprising: Obtaining an image to be processed in response to a first input operation, and determining an initial font size of the text in the image to be processed; Determining a target font size of the text in the image to be processed in response to a second input operation; Performing a scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed; When the image to be processed includes multiple images, performing the scaling process on the image to be processed includes performing a batch scaling process on the multiple images; Wherein, when the image to be processed includes a first image as the original image and at least one second image as the target image, using the initial font size corresponding to the first image as the target font size of the text in each second image; Performing the batch scaling process includes: performing a scaling process on a target second image based on the initial font size and the target font size corresponding to the target second image, and the target second image is one or more of the at least one second image.

2. The method according to claim 1, wherein determining the initial font size of the text in the image to be processed includes: Determining a plurality of text regions in the image to be processed, and the font size of the text in each text region; Using the font size of the text in the target text region as the initial font size of the text in the image to be processed, and the target text region is a text region that meets the corresponding conditions among the plurality of text regions.

3. The method according to claim 2, wherein the determining manner of the target text region includes: Using the text region with the largest region height among the plurality of text regions as the target text region; And / or Determining a visual focus region, and using the text region located in the visual focus region among the plurality of text regions as the target text region; And / or Adding a first region box matching each text region to the image to be processed; In response to a third input operation, determining the designated first region box, and using the text region corresponding to the designated first region box as the target text region.

4. The method according to claim 2, after determining the initial font size of the text in the image to be processed, the method further includes: Adding a second region box matching the target text region to the image to be processed; The determining the target font size of the text in the image to be processed in response to a second input operation includes: Outputting the font size of the text in the target text region in response to a trigger operation on the second region box; In response to a drag operation on the second region box, performing a scaling process on the second region box, and at the same time, adjusting the font size of the text in the target text region based on the scaling degree of the second region box, and using the adjusted font size of the text in the target text region as the target font size of the text in the image to be processed.

5. The method according to claim 4, wherein performing the scaling process on the image to be processed based on the initial font size and the target font size of the text in the image to be processed includes: In response to a drag operation on the second region box, perform a scaling operation on the to-be-processed picture based on the initial font size of the text in the to-be-processed picture and the adjusted font size of the text in the target text region.

6. The method according to claim 2, wherein the to-be-processed picture includes a first picture as the original picture and at least one second picture as the target picture; After determining the initial font size of the text in the to-be-processed picture, the method further includes: Adding a third region box matching its target text region to the first picture, and adding a fourth region box matching its target text region to each second picture; The determining the target font size of the text in the to-be-processed picture in response to a second input operation includes: In response to a format selection operation on the third region box, using the initial font size corresponding to the first picture as the target font size of the text in each second picture; The performing a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture includes: In response to a format replacement operation on the fourth region box corresponding to the target second picture, perform a scaling process on the target second picture based on the initial font size and the target font size corresponding to the target second picture, where the target second picture is one or more of the at least one second picture.

7. The method according to claim 2, wherein the to-be-processed picture includes a plurality of third pictures; After determining the initial font size of the text in the to-be-processed picture, the method further includes: Adding a fifth region box matching its target text region to each third picture; The determining the target font size of the text in the to-be-processed picture in response to a second input operation includes: In response to a region selection operation on the fifth region boxes corresponding to the plurality of third pictures, determining the target font size of the text in each third picture based on the initial font size corresponding to each third picture, and the target font sizes corresponding to any two third pictures are the same; The performing a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture includes: Performing a scaling process on each third picture based on the initial font size and the target font size corresponding to each third picture.

8. An image processing device, the device includes: A font size determination module, configured to obtain a to-be-processed picture in response to a first input operation, and determine the initial font size of the text in the to-be-processed picture; In response to a second input operation, determine the target font size of the text in the to-be-processed picture; An image scaling module, configured to perform a scaling process on the to-be-processed picture based on the initial font size and the target font size of the text in the to-be-processed picture; When the to-be-processed picture includes multiple pictures, performing a scaling process on the to-be-processed picture includes performing a batch scaling process on the multiple pictures; Wherein, when the to-be-processed picture includes a first picture as the original picture and at least one second picture as the target picture, using the initial font size corresponding to the first picture as the target font size of the text in each second picture; Performing batch scaling processing includes: performing scaling processing on a target second picture based on the initial font size and the target font size corresponding to the target second picture, where the target second picture is one or more of at least one second picture.

9. An electronic device, the electronic device includes: a memory for storing an application program and data generated by running the application program; a processor for executing the application program to implement functions: in response to a first input operation, obtaining a picture to be processed and determining the initial font size of the text in the picture to be processed; in response to a second input operation, determining the target font size of the text in the picture to be processed; performing scaling processing on the picture to be processed based on the initial font size and the target font size of the text in the picture to be processed; when the picture to be processed includes multiple pictures, performing scaling processing on the picture to be processed includes performing batch scaling processing on the multiple pictures; wherein, when the picture to be processed includes a first picture as the original picture and at least one second picture as the target picture, using the initial font size corresponding to the first picture as the target font size of the text in each second picture; performing batch scaling processing includes: performing scaling processing on a target second picture based on the initial font size and the target font size corresponding to the target second picture, where the target second picture is one or more of at least one second picture.

10. A storage medium, the storage medium stores computer program code, and when the computer program code is executed, it implements the picture processing method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Scaling an image having text

    US20140267438A1

  • Grouping batch-based picture detection method and apparatus, and storage medium

    WO2021051580A1