WO2022161199A1 - 图像编辑方法及设备 - Google Patents

图像编辑方法及设备 Download PDF

Info

Publication number
WO2022161199A1
WO2022161199A1 PCT/CN2022/072316 CN2022072316W WO2022161199A1 WO 2022161199 A1 WO2022161199 A1 WO 2022161199A1 CN 2022072316 W CN2022072316 W CN 2022072316W WO 2022161199 A1 WO2022161199 A1 WO 2022161199A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
editing
processed
edited
blocks
Prior art date
Application number
PCT/CN2022/072316
Other languages
English (en)
French (fr)
Inventor
张兴华
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Priority to US18/263,516 priority Critical patent/US20240104811A1/en
Publication of WO2022161199A1 publication Critical patent/WO2022161199A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting

Definitions

  • the embodiments of the present disclosure relate to the technical field of image processing, and in particular, to an image editing method and device.
  • Image editing includes brightness adjustment, contrast adjustment, adding stickers, and more.
  • the electronic device loads the image selected by the user into the memory, and displays editing tools, such as filters, cropping, adjustment, etc., while displaying the image on the interface.
  • editing tools such as filters, cropping, adjustment, etc.
  • the user edits the image using an editing tool.
  • the electronic device saves the edited image.
  • Embodiments of the present disclosure provide an image editing method and device to overcome the problem of system crash caused by insufficient memory or CPU when editing an image with a higher resolution.
  • an embodiment of the present disclosure provides an image editing method, including:
  • an editing instruction input by the user where the editing instruction is used to edit a preview image, the preview image is generated by processing the to-be-processed image according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the to-be-processed image the resolution of the image; edit the preview image in response to the editing instruction, display the edited preview image, and store the editing instruction; receive the storage instruction input by the user;
  • the blocks of the image to be processed are loaded into the memory, so as to edit the blocks according to the editing instructions, and use the edited blocks to generate a target image, wherein the blocks are obtained by dividing the to-be-processed image .
  • an electronic device including:
  • a receiving unit configured to receive an editing instruction input by a user, where the editing instruction is used to edit a preview image, the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is low at the resolution of the image to be processed;
  • a storage unit for storing the editing instruction
  • the receiving unit is further configured to receive a storage instruction input by a user
  • the processing unit is further configured to, in response to the storage instruction, load the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, and use the edited segment A target image is generated, wherein the block is obtained by dividing the to-be-processed image.
  • embodiments of the present disclosure provide an electronic device, including: at least one processor and a memory;
  • the memory stores computer-executable instructions
  • the at least one processor executes computer-implemented instructions stored in the memory to cause the at least one processor to perform the image editing method described in the first aspect and various possible designs of the first aspect above.
  • embodiments of the present disclosure provide a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, the first aspect and the first The image editing method described in terms of various possible designs.
  • an embodiment of the present disclosure provides a computer program product, where the computer program product includes: a computer program, where the computer program is stored in a readable storage medium, and at least one processor of an electronic device stores data from the readable storage medium.
  • the medium reads the computer program, the computer program being executed by the at least one processor to cause the electronic device to perform the image editing method as described in the first aspect and various possible designs of the first aspect above.
  • an embodiment of the present disclosure provides a computer program that, when executed by a processor, implements the image editing method described in the first aspect and various possible designs of the first aspect.
  • the image editing method, device, storage medium, computer product and computer program provided in this embodiment generate and display a preview image of the to-be-processed image when the electronic device detects that the user processes the high-resolution image to be processed.
  • the electronic device sequentially stores the editing instructions.
  • the electronic device loads the blocks corresponding to the editing instructions into the memory according to the stored editing instructions, edits the blocks according to the editing instructions, and generates the target image according to the edited blocks.
  • FIG. 1A is a schematic diagram of a running environment of an image editing method provided by an embodiment of the present disclosure
  • FIG. 1B is a schematic diagram of another operating environment of the image editing method provided by an embodiment of the present disclosure.
  • FIG. 2 is a flowchart of an image editing method provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of an image editing process provided by the present disclosure.
  • FIG. 4 is a schematic diagram of partial editing in an image editing method provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of partial editing in an image editing method provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of global editing in an image editing method provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of global editing in an image editing method provided by an embodiment of the present disclosure.
  • FIG. 8 is a structural block diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • Ultra-large images refer to images with a particularly large size or very high resolution, such as 4K and 8K images.
  • the memory and CPU performance of electronic devices are limited. If the super large image is fully loaded, it will bring a very large overhead to the memory, CPU, etc., and even cause the electronic device to crash due to insufficient memory.
  • the common method is to load in blocks, that is, only the part visible to the user is encoded and decoded, so as to avoid the image occupying too much memory.
  • This technology has been widely used in electronic maps. For example, when a user navigates using a navigation application (application, APP), the area on the interface of the navigation APP is an area centered on the user's positioning, rather than the entire map.
  • the image to be edited is a large image
  • the image is loaded into the memory, which is likely to cause excessive consumption or insufficient memory.
  • some intermediate data will be generated due to the need to execute image processing algorithms, and the algorithm and the intermediate data will further consume memory, which may easily lead to the collapse of the electronic equipment system.
  • embodiments of the present disclosure provide an image editing method and device, which store editing instructions for previewing images, and load and edit images to be processed in blocks according to the editing instructions, so as to overcome the need for memory or CPU when editing images with higher resolutions.
  • FIG. 1A is a schematic diagram of a running environment of an image editing method provided by an embodiment of the present disclosure.
  • the operating environment includes an electronic device 1 , such as an electronic device having a display screen.
  • An APP capable of image editing is installed on the electronic device 1 .
  • Users use the APP to edit images.
  • the user imports an image through an image import button on the APP, etc., so that a preview image of the image to be processed is displayed on the display screen of the electronic device.
  • the user inputs editing instructions through the display screen, such as selecting a sticker, etc. to edit the preview image.
  • the electronic device loads the to-be-processed image in blocks and edits the to-be-processed image according to the user's editing instruction for the preview image.
  • the image to be processed is, for example, an image captured by the electronic device 1; or, the image to be processed is an image stored locally by the electronic device 1 by means of copying or the like.
  • FIG. 1B is a schematic diagram of another operating environment of the image editing method provided by the embodiment of the present disclosure.
  • the operating environment includes an electronic device 1 and a server 2 , and a network connection is established between the electronic device 1 and the server 2 .
  • a network connection is established between the electronic device 1 and the server 2 .
  • a large number of images are stored on the server 2, and the electronic device 1 can download and edit the images from the server 1.
  • FIG. 1A refer to the description of FIG. 1A above, which will not be repeated here.
  • the APP on the electronic device 1 is an APP that comes with the system, an APP of a third party, etc., which is not limited by the embodiment of the present disclosure.
  • the electronic device 1 is a desktop electronic device or a mobile electronic device, a desktop electronic device such as a TV, a computer, etc., a mobile electronic device such as a mobile phone, a tablet computer, a notebook computer, a wearable electronic device, a smart home device, etc. .
  • a server is an independently set server or a server cluster composed of multiple servers, and the like.
  • FIG. 1A and FIG. 1B take the electronic device 1 as the main body to process the image.
  • the electronic device 1 stores the editing instructions in sequence, and sends the editing instructions to the server 2 that stores the image to be processed, and the server 2 sequentially loads the parts of the image to be processed according to the editing instructions. blocks, and perform image processing on the blocks.
  • FIG. 2 is a flowchart of an image editing method provided by an embodiment of the present disclosure.
  • the executive body of this embodiment is the electronic device in the above-mentioned FIG. 1A and FIG. 1B .
  • This embodiment includes:
  • the editing instruction is used to edit the preview image of the image to be processed.
  • the editing instruction is used to edit a preview image, the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed.
  • the image to be processed is a large image, such as a 4K or 8K high-definition image, and the resolution of the image is relatively high, which is higher than the resolution of the screen of the electronic device, so that the electronic device cannot be loaded, or the electronic device cannot be loaded or is consumed even if it is successfully loaded. more memory, etc.
  • the user clicks the to-be-processed image, and the electronic device generates a preview image for the to-be-processed image according to the screen resolution, loads the preview image into the memory, and displays the preview image on the display on the screen.
  • the resolution of the preview image is less than or equal to the resolution of the screen of the electronic device.
  • the resolution of the preview image is lower than that of the image to be processed, that is, the preview image is obtained by losing some pixels of the image to be processed. Due to the loss of some pixels, if the preview image is enlarged, etc., the preview image will be blurred when enlarged to a certain multiple. However, if the image to be processed is enlarged, when the magnification is the same, the image to be processed is likely not to be blurred. Whether or not it will blur depends on the relationship between screen pixels and image pixels.
  • the width of the image to be processed is 1080 pixels, and when the image to be processed is displayed on a mobile phone with a width of 720, when the magnification of the image to be processed is between 1.0 and 2.0, the image to be processed will not be blurred. When the magnification is more than 2 times, it is very likely to be blurred.
  • the preview image of the image to be processed is generated according to the screen resolution of the electronic device, therefore, the preview image will become blurred when enlarged.
  • the "blur" can be improved according to the partial loading method, that is, a new preview image is generated by loading the corresponding area from the to-be-processed image during the zoom-in operation.
  • editing the preview image refers to adjusting the preview image, such as adjusting the brightness, contrast, saturation, and the like of the preview image.
  • editing the preview image refers to adding filters, applying beauty, etc. to the preview image.
  • Edit the preview image in response to the editing instruction display the edited preview image, and store the editing instruction.
  • the electronic device edits the preview image according to the editing instruction and stores the editing instruction at the same time.
  • the object edited by this editing command is the preview image edited by the previous editing command. That is, each edit is an edit to the preview image based on the previous edit.
  • the editing effect is displayed on the display screen of the electronic device in real time for the user to view.
  • the to-be-processed image includes multiple blocks.
  • steps 103 and 104 after the user finishes editing the preview image, he clicks an editing instruction on the interface to trigger the electronic device to edit the image to be processed (ie, the original image) according to the stored editing instruction.
  • the blocks corresponding to the editing instructions are loaded into the memory, and the blocks are edited according to the editing instructions.
  • a target image is generated based on the edited patches. For example, if the user performs partial editing on the preview image, the block is a partial area of the image to be processed.
  • the electronic device divides the entire image to be processed into blocks, loads one or more blocks corresponding to the editing instruction each time, and edits these blocks. Afterwards, the electronic device generates the target image using the edited segments.
  • a preview image of the to-be-processed image is generated and displayed.
  • the electronic device sequentially stores the editing instructions.
  • the electronic device loads the blocks corresponding to the editing instructions into the memory according to the stored editing instructions, edits the blocks according to the editing instructions, and generates the target image according to the edited blocks.
  • the edited segment when the electronic device uses the edited segment to generate the target image after editing the segment, the edited segment is used to cover the corresponding position of the image to be processed, thereby obtaining the target image.
  • the electronic device duplicates the image to be processed to obtain a duplicate image, and uses the edited segment to cover the corresponding position of the duplicate image.
  • the user performs partial editing or global editing on the preview image.
  • the electronic device performs local editing and global editing on the image to be processed will be described in detail respectively.
  • the electronic device performs partial editing on the preview image.
  • Local editing refers to the partial area of the preview image, such as beautifying the face area, without editing other areas other than the face area.
  • FIG. 3 is a schematic diagram of an image editing process provided by the present disclosure.
  • the user clicks the icon of the image editing APP on the display screen of the electronic device to enter the image selection interface.
  • the image selection interface displays at least one thumbnail.
  • the user clicks a certain thumbnail (hereinafter referred to as a target thumbnail) among the at least one thumbnail to send a selection instruction to the electronic device.
  • the electronic device In response to the selection request, the electronic device generates a preview image according to the to-be-processed image corresponding to the target thumbnail, and displays the preview image. For example, if the image to be processed is a 4K image, the preview image is a 1K image.
  • the process of generating the preview image by the electronic device is insensitive to the user.
  • the electronic device can also inform the user through voice prompts, text prompts, etc.: the resolution of the image to be processed is relatively high, and whether the user agrees to generate a preview image.
  • whether the image to be processed is a large image is usually related to the performance of the electronic device. For example, for a low-end machine, an image with a resolution exceeding 1920 ⁇ 1080 is an oversized image; for a high-end model, an image with a resolution over 4096 ⁇ 2160 is an oversized image. Therefore, when the user selects the target thumbnail, the electronic device generates a preview image only when it is determined that the image to be processed is an oversized image.
  • the electronic device reads the image information of the to-be-processed image corresponding to the target thumbnail. Then, according to the image information, it is determined whether the size of the to-be-processed image is larger than a preset threshold. If the resolution of the image to be processed is greater than the preset threshold, a preview image is generated according to the resolution of the image to be processed and the resolution of the electronic device. For example, if the resolution of the display screen of the electronic device is 1920 ⁇ 1080 and the resolution of the image to be processed is 4096 ⁇ 2160, a preview image with a resolution of 1920 ⁇ 1080 is generated.
  • the image to be processed is directly loaded, and the image to be processed is edited. If the resolution of the image to be processed is greater than the preset threshold, a preview image is generated according to the image to be processed.
  • the preset threshold is determined according to at least one of the size of the central processing unit (CPU) of the electronic device, the size of a graphics processing unit (Graphics Processing Unit, GPU), the size of the screen resolution and the size of the memory.
  • the electronic device generates and edits a preview image for the image to be processed only when the image to be processed is a super large image, thereby saving image processing steps.
  • image editing tools are also displayed on the display screen of the electronic device.
  • image editing tools include beauty, makeup, face reshaping, face-lift fitness, facial features, and more.
  • the electronic device also displays tabs for other screenwriting tools, such as filters, editing, authoring, and more.
  • the user selects different tool labels, and the electronic device displays tools of the corresponding category.
  • the user selects a favorite editing tool to edit the image according to needs or preferences.
  • the electronic device generates editing instructions to edit the preview image according to the user's operation of the editing tool. During the editing process, each edit is to edit the preview image based on the previous edit.
  • the electronic device reshapes the face of the character in the preview image according to the user's operation, and displays the editing effect in real time.
  • the user selects three-dimensional facial features, and the electronic device adjusts the facial features of the face in the preview image after face reshaping, and displays the editing effect in real time.
  • FIG. 4 is a schematic diagram of partial editing in an image editing method provided by an embodiment of the present disclosure.
  • the electronic device extracts blocks from the to-be-processed image according to the partial area of the preview image. Then, the electronic device loads the segment into the memory, and edits the segment according to the editing instruction to obtain the edited segment. Finally, the target image is generated by using the edited blocks, so as to complete the editing of the image to be processed.
  • the electronic device When the user edits the preview image multiple times, that is, when there are at least two editing instructions, the electronic device sequentially edits the preview image according to the at least two editing instructions during the process of editing the preview image by the user, and displays the edited preview image.
  • the image is previewed, and the at least one editing instruction is sequentially stored according to the input sequence.
  • the electronic device loads the segment into the memory, obtains the editing instructions according to the storage order of the stored at least two editing instructions, and sequentially edits the segment to obtain the edited segment.
  • OOM Out Of Memory
  • the editing object of each editing command is the editing result of the previous editing command. That is to say, each edit is superimposed on the basis of the previous edit command.
  • the editing sequence for the preview image is: adjust the brightness first, then add the filter.
  • the editing order of the blocks should also be: adjust the brightness first, and then add the filter. If the editing sequence of the preview image is different from the editing sequence of the blocks, the superimposed effect of multiple editing of the block and the superimposed effect of multiple editing of the preview image will be inconsistent, and even deviation may occur.
  • the electronic device sequentially stores a plurality of editing instructions input by the user according to the input sequence. After that, when editing the to-be-processed image, the above-mentioned multiple editing instructions are sequentially executed on the blocks, so as to ensure that the editing process of the to-be-processed image is consistent with the editing process of the preview image and achieve an ideal editing effect.
  • the electronic device needs to divide the block into multiple sub-blocks, where the preset size is, for example, the maximum value of the single loading amount of the electronic device. After that, the electronic device sequentially loads the plurality of sub-blocks in the memory, and edits each sub-block of the plurality of sub-blocks according to the editing instruction to obtain a plurality of edited sub-blocks. After the sub-block, the edited sub-block is generated. Exemplary, please follow Figure 5.
  • FIG. 5 is a schematic diagram of partial editing in an image editing method provided by an embodiment of the present disclosure.
  • the electronic device extracts a sub-block from the image to be processed according to a local area of the preview image, if the sub-block is relatively large, the electronic device divides the sub-block into 20 sub-blocks. After that, load some sub-blocks each time, such as loading each sub-block of 20 sub-blocks in turn. For another example, the sub-blocks of the first row, the second row, the third row, the fourth row and the fifth row are loaded in order from top to bottom.
  • the sub-block is divided into sub-blocks and then the sub-blocks are loaded. Since the size of the sub-block is smaller than the size of the sub-block, the overhead of memory and the like can be reduced.
  • the electronic device can flexibly divide the image to be processed in different ways. For example, the electronic device divides the image to be processed according to the row, that is, the pixels of consecutive rows are regarded as a block; for another example, the electronic device divides the image to be processed according to the column, that is, the pixels of consecutive columns are regarded as a block; For example, the electronic device blocks the image to be processed in rows and columns simultaneously. For another example, the electronic device divides the image to be processed according to the region. For example, if the image to be processed includes mountains, water, and grass, the image to be processed is divided into three partitions, which are mountains, water, and grass in sequence.
  • Global editing refers to editing the entire preview image. For example, brightness adjustment is performed on the entire preview image, etc.
  • the process of selecting a target thumbnail and generating a preview image by the user may refer to the description of FIG. 3 above, which will not be repeated here.
  • the electronic device divides the image to be processed into blocks to obtain multiple blocks. Then, the electronic device loads some of the plurality of sub-blocks in the memory each time, and edits each of the partial sub-blocks according to the editing instruction, so as to obtain a plurality of edited sub-blocks. piece. Finally, the electronic device generates the target image according to the plurality of edited segments. For example, see FIG. 6 .
  • FIG. 6 is a schematic diagram of global editing in an image editing method provided by an embodiment of the present disclosure.
  • the electronic device recognizes that the stored editing instruction is to edit the entire preview image.
  • the electronic device divides the image to be processed into a plurality of sub-blocks.
  • each small square represents a sub-block.
  • the electronic device loads the sub-blocks in sequence. For example, one sub-block is loaded each time; for another example, one row or one column of sub-blocks is loaded each time, etc., the embodiment of the present disclosure is not limited.
  • the electronic device when the electronic device divides the image to be processed into blocks to obtain multiple blocks, first find the cache for loading the blocks from the memory, and then divide the image to be processed according to the size of the fixed cache, so as to divide the to-be-processed image into multiple blocks, wherein the fixed cache is used to load the multiple blocks.
  • the electronic device selects a portion of memory of an appropriate size from the memory as a fixed buffer in the image processing process. Each time it is loaded, a fixed number of chunks are loaded so that multiple chunks are processed in parallel.
  • the image processing speed can be increased by processing a plurality of blocks in parallel.
  • the electronic device when the electronic device divides the image to be processed into blocks according to the size of the fixed cache, so as to divide the image to be processed into multiple blocks, it first determines the blocks according to the size of the fixed cache. size of the block. Then, the electronic device performs grid division on the image to be processed according to the size of the block, so as to divide the image to be processed into multiple blocks, and two adjacent blocks in the multiple blocks are divided into grids. Blocks have overlapping parts.
  • the electronic device divides the block or to-be-processed image by grid division.
  • the electronic device determines which segmentation method to use according to the image processing algorithm. For example, when an electronic device performs an image algorithm on a certain area, it only needs the data in the area to be able to execute the image algorithm. At this time, the electronic device adopts a grid division strategy to perform grid division on the image to be processed.
  • the image processing algorithm is, for example, stickers, partial beauty, and the like.
  • an electronic device when an electronic device performs an image algorithm on a certain area, in addition to the data of the pixels in the area, it also needs to know the information of the surrounding pixels. At this time, the electronic device adopts a sliding window strategy. At this time, two adjacent blocks among the plurality of blocks have overlapping portions. For an example, see Figure 7.
  • FIG. 7 is a schematic diagram of global editing in an image editing method provided by an embodiment of the present disclosure.
  • the oblique line filling part belongs to the two sub-blocks at the same time.
  • the image processing algorithm is, for example, overall beauty, brightness adjustment, contrast adjustment, and the like.
  • the images to be processed are divided by grid division, so as to achieve the purpose of accurately dividing the images to be processed.
  • the editing of the preview image by the electronic device according to the editing instruction is roughly divided into two cases: editing of pixels and editing of positions.
  • editing of pixels For example, when adjusting the brightness, it is necessary to adjust the pixels and adjacent pixels, and no location mapping is required at this time.
  • position mapping needs to be performed on the first pixel in the preview image and the second pixel in the block.
  • the electronic device first responds to the storage instruction, loads the block of the image to be processed corresponding to the editing instruction into the memory, and determines the first pixel from the block according to the first pixel in the preview image. Two pixels, the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the scaling ratio, and the scaling ratio is generated according to the image to be processed. The zoom ratio of the preview image described above. Then, the electronic device edits the first pixel according to the editing instruction, edits the second pixel to obtain an edited segment, and uses the edited segment to generate a target image.
  • Position mapping refers to: the effect seen by the user is the editing effect of the preview image.
  • the position of each edited first pixel in the preview image is adjusted according to the zoom ratio, etc. , find the second pixel in the image to be processed, and then edit the second pixel according to the editing of the first pixel.
  • the scaling ratio refers to the scaling ratio when generating the preview image from the original to-be-processed image.
  • the position coordinates of the second pixel can be obtained by multiplying the coordinates of the first pixel by the scaling ratio.
  • the electronic device after the electronic device generates the target image, the electronic device also deletes the above-mentioned preview image and the stored editing instruction, thereby releasing the storage space of the electronic device.
  • FIG. 8 is a structural block diagram of an electronic device 100 provided by an embodiment of the present disclosure.
  • the device includes: a receiving unit 11 , a processing unit 12 , a display unit 13 and a storage unit 14 .
  • the receiving unit 11 is configured to receive an editing instruction input by a user, where the editing instruction is used to edit a preview image, and the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device.
  • the resolution is lower than the resolution of the image to be processed;
  • a processing unit 12 configured to edit the preview image in response to the editing instruction
  • the display unit 13 is used to display the edited preview image
  • the receiving unit 11 is further configured to receive a storage instruction input by a user
  • the processing unit 12 is further configured to, in response to the storage instruction, load the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, and use the edited segment.
  • a target image is generated from blocks, wherein the block is obtained by dividing the image to be processed.
  • the editing instruction is used to edit a partial area of the preview image
  • the processing unit 12 is used to extract the image to be processed according to the partial area of the preview image. For the corresponding segment, load the segment into the memory, edit the segment according to the editing instruction to obtain the edited segment, and use the edited segment to generate the target image.
  • the processing unit 12 is configured to divide the block into multiple sub-blocks when the size of the block exceeds a preset size; load the multiple sub-blocks in sequence in the memory block, each of the plurality of sub-blocks is edited according to the editing instruction to obtain a plurality of edited sub-blocks, and an edited sub-block is generated according to the plurality of edited sub-blocks.
  • the editing instruction is used to edit the entire area of the preview image
  • the processing unit 12 is configured to divide the to-be-processed image into blocks to obtain a plurality of blocks, each Loading some of the plurality of sub-blocks in the memory, and editing each of the partial sub-blocks according to the editing instruction to obtain a plurality of edited sub-blocks, according to the A plurality of edited segments are generated to generate the target image.
  • the processing unit 12 is configured to determine a fixed cache from the memory, the fixed cache is used to load the plurality of blocks, and according to the size of the fixed cache
  • the to-be-processed image is divided to divide the to-be-processed image into multiple blocks, wherein the fixed cache is used to load the multiple blocks.
  • the processing unit 12 divides the to-be-processed image according to the size of the fixed cache, so that when the to-be-processed image is divided into multiple
  • the size of the buffer is fixed, the size of the block is determined, and the image to be processed is divided into grids according to the size of the block, so as to divide the image to be processed into multiple blocks, the multiple blocks
  • the two adjacent blocks in the have overlapping parts.
  • the receiving unit 11 before receiving an editing instruction input by a user, the receiving unit 11 further receives a selection instruction input by the user, where the selection instruction is used to select a target thumbnail from at least one thumbnail,
  • the target thumbnail is a thumbnail of the image to be processed, and the at least one thumbnail is displayed on the display screen of the electronic device;
  • the processing unit 12 is further configured to generate a preview image of the image to be processed in response to the selection request.
  • the processing unit 12 is configured to read image information of the image to be processed, and determine whether the resolution of the image to be processed is greater than a preset threshold according to the image information, and the The preset threshold is determined according to at least one of the size of the central processing unit (CPU), the size of the graphics processing unit (GPU), the size of the screen resolution, and the size of the memory of the electronic device. If the resolution of the image to be processed is greater than the preset threshold, the preview image is generated according to the image to be processed.
  • the processing unit 12 when editing the preview image in response to the editing instructions, is configured to edit the preview image in sequence according to the at least two editing instructions ;
  • the display unit 13 is used for sequentially editing the preview image according to at least two editing instructions
  • the storage unit 14 is used to sequentially store the at least two editing instructions according to the input sequence
  • the processing unit 12 is further configured to load the sub-blocks into the memory, obtain the editing instructions according to the storage order of the stored at least two editing instructions, and sequentially edit the sub-blocks to obtain the edited sub-blocks.
  • the processing unit 12 in response to the storage instruction, loads the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, and
  • the target image is generated by using the edited segment, it is used to load the segment of the image to be processed corresponding to the edit instruction into the memory in response to the storage instruction, and according to the first pixel in the preview image, from the
  • the second pixel is determined in the block, and the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the zoom ratio, and the zoom ratio is determined according to the generating the zoom ratio of the preview image from the image to be processed, editing the first pixel according to the editing instruction, editing the second pixel to obtain the edited segment, and generating the edited segment using the edited segment. target image.
  • the processing unit 12 when the processing unit 12 uses the edited segment to generate the target image, the processing unit 12 is configured to use the edited segment to replace the segment at the corresponding position in the to-be-processed image to obtain the target image image.
  • the device provided in this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again in this embodiment.
  • FIG. 9 is a schematic structural diagram of an electronic device 900 according to an embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server.
  • the terminal device may include, but is not limited to, such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, referred to as PDA), tablet computers (Portable Android Device, referred to as PAD), portable multimedia players (Portable Media Player, PMP for short), in-vehicle terminals (such as in-vehicle navigation terminals), mobile terminals such as wearable electronic devices, and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
  • PDA Personal Digital Assistant
  • PAD Portable multimedia players
  • PMP Portable Media Player
  • in-vehicle terminals such as in-vehicle navigation terminals
  • mobile terminals such as wearable electronic devices
  • stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
  • the electronic device shown in FIG. 9 is only
  • the electronic device 900 may include a processing device (such as a central processing unit, a graphics processor, etc.) 901, which may be stored in a read only memory (Read Only Memory, ROM for short) 902 according to a program or from a storage device 908 loads a program into a random access memory (Random Access Memory, RAM for short) 903 to perform various appropriate actions and processes, so as to implement the method shown in the above flow chart of the present disclosure.
  • ROM Read Only Memory
  • RAM Random Access Memory
  • various programs and data necessary for the operation of the electronic device 900 are also stored.
  • the processing device 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904.
  • An input/output (I/O) interface 905 is also connected to bus 904 .
  • an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD for short) ), speaker, vibrator, etc. output device 907; storage device 908 including, eg, magnetic tape, hard disk, etc.; and communication device 909.
  • Communication means 909 may allow electronic device 900 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 9 shows an electronic device 900 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via the communication device 909, or from the storage device 908, or from the ROM 902.
  • the processing apparatus 901 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.
  • the aforementioned computer-readable medium carries one or more programs, and when the aforementioned one or more programs are executed by the electronic device, causes the electronic device to execute the methods shown in the foregoing embodiments.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or, can be connected to an external A computer (eg, connected via the Internet using an Internet service provider).
  • LAN Local Area Network
  • WAN Wide Area Network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner.
  • the name of the unit does not constitute a limitation of the unit itself under certain circumstances, for example, the first obtaining unit may also be described as "a unit that obtains at least two Internet Protocol addresses".
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (Application Specific) Standard Product, ASSP), System on a Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on a Chip
  • CPLD Complex Programmable Logic Device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • an image editing method comprising: receiving an editing instruction input by a user, the editing instruction being used to edit a preview image, the preview image being based on an electronic device
  • the screen resolution of the image to be processed is generated by processing the image to be processed, and the resolution of the preview image is lower than the resolution of the image to be processed; edit the preview image in response to the editing instruction, display the edited preview image, and store the editing instruction; receiving the storage instruction input by the user; responding to the storage instruction, loading the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, and use the editing
  • the target image is generated by the subsequent block, wherein the block is obtained by dividing the to-be-processed image.
  • the editing instruction is used to edit a local area of the preview image, and the block corresponding to the editing instruction is loaded into a memory, so as to edit the editing instruction according to the editing instruction splitting into blocks, and using the edited blocks to generate a target image, including: extracting the corresponding blocks from the to-be-processed image according to the local area of the preview image; loading the blocks into the memory, according to the Editing the segment by the editing instruction to obtain the edited segment; and generating the target image by using the edited segment.
  • the loading the segment into the memory and editing the segment according to the editing instruction to obtain the edited segment includes: when the segment is When the size exceeds the preset size, the sub-block is divided into multiple sub-blocks, the multiple sub-blocks are sequentially loaded in the memory, and each of the multiple sub-blocks is edited according to the editing instruction to A plurality of edited sub-blocks are obtained, and an edited sub-block is generated according to the plurality of edited sub-blocks.
  • the editing instruction is used to edit the entire area of the preview image, and the block corresponding to the editing instruction is loaded into a memory, so as to edit the editing instruction according to the editing instruction Partitioning, and using the edited partitions to generate a target image, including: partitioning the to-be-processed image to obtain multiple partitions; loading part of the multiple partitions in the memory each time , edit each of the partial blocks according to the editing instruction to obtain a plurality of edited blocks; and generate the target image according to the plurality of edited blocks.
  • dividing the image to be processed to obtain a plurality of blocks includes: determining a fixed cache from the memory, and dividing the fixed cache according to the size of the fixed cache.
  • the to-be-processed image is divided to divide the to-be-processed image into multiple blocks, wherein the fixed cache is used to load the multiple blocks.
  • dividing the to-be-processed image according to the size of the fixed buffer to divide the to-be-processed image into multiple blocks includes: according to the fixed buffer determine the size of the block; according to the size of the block, perform grid division on the to-be-processed image, so as to divide the to-be-processed image into multiple blocks, the Two adjacent blocks have overlapping parts.
  • the method before receiving an editing instruction input by a user, the method further includes: receiving a selection instruction input by the user, where the selection instruction is used to select a target thumbnail from at least one thumbnail,
  • the target thumbnail image is a thumbnail image of the image to be processed, and the at least one thumbnail image is displayed on the display screen of the electronic device; in response to the selection request, a preview image of the image to be processed is generated.
  • generating a preview image of the image to be processed in response to the selection request includes: reading image information of the image to be processed; Whether the resolution of the image to be processed is greater than a preset threshold, the preset threshold is based on at least one of the size of the central processing unit CPU of the electronic device, the size of the graphics processing unit GPU, the size of the screen resolution and the size of the memory. One is determined; if the resolution of the to-be-processed image is greater than the preset threshold, the preview image is generated according to the to-be-processed image.
  • the editing the preview image in response to the editing instructions, displaying the edited preview image, and storing the editing instructions includes: according to At least two editing instructions edit the preview image in sequence, display the edited preview image, and store the at least two editing instructions in sequence according to the input order; load the partitions into the memory, and perform the editing according to the editing instructions.
  • Editing the blocks to obtain the edited blocks includes: loading the blocks into a memory, obtaining the editing instructions according to the storage order of the stored at least two editing instructions, and sequentially editing the blocks to obtain Edited chunks.
  • generating the target image by using the edited segment includes: using the edited segment to replace the segment at the corresponding position in the image to be processed to obtain the target image.
  • an electronic device comprising:
  • a receiving unit configured to receive an editing instruction input by a user, where the editing instruction is used to edit a preview image, the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is low at the resolution of the image to be processed;
  • a storage unit for storing the editing instruction
  • the receiving unit is further configured to receive a storage instruction input by a user
  • the processing unit is further configured to, in response to the storage instruction, load the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, and use the edited segment A target image is generated, wherein the block is obtained by dividing the to-be-processed image.
  • the editing instruction is used to edit a partial area of the preview image
  • the processing unit is configured to extract from the image to be processed according to the partial area of the preview image
  • the corresponding segment is generated; the segment is loaded into the memory, and the segment is edited according to the editing instruction to obtain the edited segment; the edited segment is used to generate the target image.
  • the processing unit is configured to divide the block into multiple sub-blocks when the size of the block exceeds a preset size; and load the multiple sub-blocks in sequence in the memory.
  • each of the plurality of sub-blocks is edited according to the editing instruction to obtain a plurality of edited sub-blocks; and an edited sub-block is generated according to the plurality of edited sub-blocks.
  • the editing instruction is used to edit the entire area of the preview image
  • the processing unit is configured to divide the to-be-processed image into blocks to obtain multiple blocks; Each time a partial block of the plurality of blocks is loaded in the memory, and each block of the partial blocks is edited according to the editing instruction, so as to obtain a plurality of edited blocks; The plurality of edited segments are generated to generate the target image.
  • the processing unit is configured to determine a fixed buffer from the memory; and divide the to-be-processed image according to the size of the fixed buffer, so as to store the to-be-processed image.
  • the image is divided into multiple blocks, wherein the fixed cache is used to load the multiple blocks.
  • the processing unit divides the to-be-processed image according to the size of the fixed buffer, so that when the to-be-processed image is divided into a plurality of blocks, the The size of the fixed buffer is determined, and the size of the block is determined; according to the size of the block, grid division is performed on the image to be processed, so as to divide the image to be processed into multiple blocks, and the multiple blocks are divided into multiple blocks. Two adjacent partitions in a block have overlapping parts.
  • the receiving unit before receiving an editing instruction input by a user, the receiving unit further receives a selection instruction input by the user, where the selection instruction is used to select a target thumbnail from at least one thumbnail , the target thumbnail is the thumbnail of the image to be processed, and the at least one thumbnail is displayed on the display screen of the electronic device;
  • the processing unit is further configured to generate a preview image of the image to be processed in response to the selection request.
  • the processing unit is configured to read image information of the image to be processed; according to the image information, determine whether the resolution of the image to be processed is greater than a preset threshold,
  • the preset threshold is determined according to at least one of the size of the central processing unit (CPU), the size of the graphics processing unit (GPU), the size of the screen resolution, and the size of the memory of the electronic device; If the rate is greater than the preset threshold, the preview image is generated according to the to-be-processed image.
  • the processing unit when editing the preview image in response to the editing instructions, the processing unit is configured to edit the preview sequentially according to the at least two editing instructions image;
  • the display unit for displaying the edited preview image
  • the storage unit is used to sequentially store the at least two editing instructions according to the input sequence
  • the processing unit is further configured to load the sub-blocks into the memory, obtain the editing instructions according to the storage order of the stored at least two editing instructions, and edit the sub-blocks in sequence to obtain the edited sub-blocks.
  • the processing unit in response to the storage instruction, loads the segment of the image to be processed corresponding to the editing instruction into the memory, so as to edit the segment according to the editing instruction, And when the target image is generated by the edited segment, it is used for responding to the storage instruction, loading the segment of the image to be processed corresponding to the editing instruction into the memory, and according to the first pixel in the preview image, from the The second pixel is determined in the block, and the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the zoom ratio, and the zoom ratio is determined according to The to-be-processed image generates a zoom ratio of the preview image, edits the first pixel according to the editing instruction, edits the second pixel to obtain an edited segment, and uses the edited segment Generate the target image.
  • the processing unit when the processing unit generates the target image by using the edited segment, the processing unit is configured to use the edited segment to replace the segment at the corresponding position in the image to be processed, to obtain the target image.
  • an electronic device comprising: at least one processor and a memory;
  • the memory stores computer-executable instructions
  • the at least one processor executes computer-implemented instructions stored in the memory to cause the at least one processor to perform the image editing method as described above.
  • a computer-readable storage medium where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, Implement the image editing method described above.
  • a computer program product comprising computer-executable instructions that, when executed by a processor, implement the image editing method as described above.
  • a computer program that, when executed by a processor, implements the image editing method as described above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

提供了一种图像编辑方法及设备,当电子设备检测到用户对分辨率较高的待处理图像进行处理时,生成并显示该待处理图像的预览图像。用户对预览图像编辑的过程中,电子设备依次存储编辑指令。当用户保存编辑后的预览图像时,电子设备根据存储的编辑指令,将编辑指令对应的分块加载到内存中,并根据编辑指令对分块进行编辑,根据编辑后的分块生成目标图像。采用该种方案,对分辨率较高的待处理图像进行编辑时,无需将整个待处理图像一次性的加载到内存中,而是仅加载编辑指令对应的分块,使得加载到内存中的数据比较少,从而克服编辑分辨率较高的图像时内存或CPU不够用导致的系统崩溃的问题。

Description

图像编辑方法及设备
相关申请交叉引用
本申请要求于2021年1月29日提交中国专利局、申请号为202110129764.0、发明名称为“图像编辑方法及设备”的中国专利申请的优先权,其全部内容通过引用并入本文。
技术领域
本公开实施例涉及图像处理技术领域,尤其涉及一种图像编辑方法及设备。
背景技术
随着技术的飞速发展,越来越多的用户利用电子设备对图像进行编辑,以使得图像达到理想的显示效果。图像编辑包括亮度调整、对比调整、添加贴纸等。
常见的图像编辑过程中,电子设备将用户选中的图像加载到内存,在界面上显示图像的同时显示编辑工具,如滤镜、裁剪、调整等。用户利用编辑工具对图像进行编辑。编辑完成后,电子设备保存编辑好的图像。
然而,当待编辑的图像比较大时,如4K分辨率或8K分辨率的图像,由于电子设备的内存和中央处理器(central processing unit,CPU)等性能有限,完全加载图像会给内存和CPU带来非常大的开销,甚至发生内存不够系统崩溃的现象。因此,如何编辑分辨率较高的图像,即如何编辑大图像或超大图像视为业界急待解决的问题。
发明内容
本公开实施例提供一种图像编辑方法及设备,以克服编辑分辨率较高的图像时内存或CPU不够用导致的系统崩溃的问题。
第一方面,本公开实施例提供一种图像编辑方法,包括:
接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令;接收用户输入的存储指令;响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
第二方面,本公开实施例提供一种电子设备,包括:
接收单元,用于接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;
处理单元,用于响应所述编辑指令编辑所述预览图像;
显示单元,用于显示编辑后的预览图像;
存储单元,用于存储所述编辑指令;
所述接收单元,还用于接收用户输入的存储指令;
所述处理单元,还用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加 载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
第三方面,本公开实施例提供一种电子设备,包括:至少一个处理器和存储器;
所述存储器存储计算机执行指令;
所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述至少一个处理器执行如上第一方面以及第一方面各种可能的设计所述的图像编辑方法。
第四方面,本公开实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上第一方面以及第一方面各种可能的设计所述的图像编辑方法。
第五方面,本公开实施例提供一种计算机程序产品,所述计算机程序产品包括:计算机程序,所述计算机程序存储在可读存储介质中,电子设备的至少一个处理器从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得电子设备执行如上第一方面及第一方面各种可能的设计所述的图像编辑方法。
第六方面,本公开实施例提供一种计算机程序,所述计算机程序被处理器执行时实现如上第一方面以及第一方面各种可能的设计所述的图像编辑方法。
本实施例提供的图像编辑方法、设备、储存介质、计算机产品及计算机程序,当电子设备检测到用户对分辨率较高的待处理图像进行处理时,生成并显示该待处理图像的预览图像。用户对预览图像编辑的过程中,电子设备依次存储编辑指令。当用户保存编辑后的预览图像时,电子设备根据存储的编辑指令,将编辑指令对应的分块加载到内存中,并根据编辑指令对分块进行编辑,根据编辑后的分块生成目标图像。采用该种方案,对分辨率较高的待处理图像进行编辑时,无需将整个待处理图像一次性的加载到内存中,而是仅加载编辑指令对应的分块,使得加载到内存中的数据比较少,从而克服编辑分辨率较高的图像时内存或CPU不够用导致的系统崩溃的问题。
附图说明
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1A是本公开实施例提供的图像编辑方法的一种运行环境示意图;
图1B是本公开实施例提供的图像编辑方法的另一种运行环境示意图;
图2是本公开实施例提供的图像编辑方法的流程图;
图3是本公开提供的图像编辑的过程示意图;
图4是本公开实施例提供的图像编辑方法中的局部编辑示意图;
图5是本公开实施例提供的图像编辑方法中的局部编辑示意图;
图6是本公开实施例提供的图像编辑方法中的全局编辑示意图;
图7是本公开实施例提供的图像编辑方法中的全局编辑示意图;
图8为本公开实施例提供的电子设备的结构框图;
图9是本公开实施例的电子设备的结构示意图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
日常生活中,用户利用手机等电子设备查看图像的时候,经常会遇到有一些超大图像。超大图像指大小特别大或分辨率非常高的图像,如4K、8K的图像等。然而,电子设备的内存、CPU能的性能时有限的。若完全加载超大图像,会给内存、CPU等带来非常大的开销,甚至由于内存不够用导致电子设备崩溃。目前常见的方式是分块加载,即只对用户可见部分进行编解码处理,避免图像占用过多的内存。该技术在电子地图方面得到广泛的应用。例如,用户利用导航应用程序(application,APP)导航时,导航APP的界面上的区域是以用户定位为中心的一片区域,而非整个地图。
随着技术的飞速发展,用户除了利用电子设备查看图像外,还通过各种图像编辑APP对图像进行编辑。编辑过程中,需要将整个图像加载到内存。这是因为分块加载很难满足图像编辑的需求。例如,当需要对一张人脸图像进行美颜处理时,需要提取出人脸关键点等基础数据。而人脸关键点等基础数据是基于整张图像的,若将图像进行分块加载则很难对图像进行美颜处理。另外,由于对整图进行编辑比较简单易操作,因此,即使是对图像进行局部区域的处理,现有技术中也是加载整张图像。
图像编辑过程中,若待编辑的图像是大图,则将该图像加载到内存,容易造成内存过度消耗或不足的情况。另外,图像编辑过程中,由于需要执行图像处理算法等,会产生一些中间数据,而算法和中间数据会进一步的消耗内存,容易引发电子设备系统崩溃等。
显然,内存有限的电子设备无法支持对超大图像的处理。例如,目前很多手机是无法编辑4K、8K等超高清图像。
有鉴于此,本公开实施例提供一种图像编辑方法及设备,存储预览图像的编辑指令,根据编辑指令分块加载待处理图像并进行编辑,以克服编辑分辨率较高的图像时内存或CPU不够用导致的系统崩溃的问题。
图1A是本公开实施例提供的图像编辑方法的一种运行环境示意图。请参照图1A,该运行环境包括电子设备1,电子设备1例如具有显示屏的电子设备。电子设备1上安装了能够进行图像编辑的APP。用户利用该APP编辑图像。编辑过程中,用户通过APP上的图像导入按钮等导入图像,使得电子设备的显示屏上显示待处理图像的预览图像。之后,用户通过显示屏输入编辑指令,如选中贴纸等对预览图像进行编辑。电子设备根据用户对预览图像的编辑指令,分块加载待处理图像并对待处理图像进行编辑。待处理图像例如为电子设备1拍摄的图像;或者,待处理图像是电子设备1通过拷贝等方式储存到本地的图像。
图1B是本公开实施例提供的图像编辑方法的另一种运行环境示意图。请参照图1B,该运行环境包括电子设备1和服务器2,电子设备1和服务器2之间建立网络连接。服务器2上例如存储海量图像,电子设备1能够从服务器1上下载图像并进行编辑,编辑过程可参见上述图1A的描述,此处不再赘述。
上述图1A和图1B中,电子设备1上的APP为系统自带的APP、第三方的APP等,本公开实施例并不限制。
上述图1A和图1B中,电子设备1为台式电子设备或移动电子设备,台式电子设备如电视、 电脑等,移动电子设备如手机、平板电脑、笔记本电脑、可穿戴电子设备、智能家居设备等。服务器是独立设置的服务器或多个服务器组成的服务器集群等。
需要说明的是虽然图1A和图1B中是以电子设备1为执行主体对图像进行处理。然而,本公开实施例并不以此为限制。例如,用户对预览图像进行编辑时,电子设备1依次存储该些编辑指令,并将该些编辑指令发送给存储了待处理图像的服务器2,由服务器2根据编辑指令依次加载待处理图像的分块,并对分块执行图像处理。
图2是本公开实施例提供的图像编辑方法的流程图。本实施例的执行主体是上述图1A和图1B中的电子设备。本实施例包括:
101、接收用户输入的编辑指令。
该编辑指令用于编辑待处理图像的预览图像。所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率。
示例性的,待处理图像为一个大图,如4K或8K的高清图像,该图像的分辨率比较高,高于电子设备的屏幕的分辨率,导致电子设备无法加载或即使成功加载但消耗的内存等比较多。当用户需要对待处理图像进行编辑时,用户点击待处理图像,则电子设备根据屏幕分辨率,针对该待处理图像生成一张预览图像,将该预览图像加载到内存,并将预览图像显示在显示屏上。该预览图像的分辨率小于或等于电子设备的屏幕的分辨率。同时,该预览图像的分辨率低于待处理图像,也就是说,待处理图像损失一部分像素得到预览图像。由于损失了部分像素,若对预览图像进行放大等,当放大到一定倍数时,预览图像模糊。但是,若对待处理图像进行放大,当放大同样倍数时,待处理图像很有可能不会模糊。是否会模糊取决于屏幕像素和图像像素的关系。例如,待处理图像的宽度是1080像素,待处理图像在720宽度的手机上展示时,当待处理图像的放大倍数为1.0-2.0之间时,待处理图像不会模糊。当放大倍数超过2倍时,则很有可能模糊。待处理图像的预览图像是根据电子设备的屏幕分辨率生成的,因此,当预览图像被放大时会变的模糊。在放大过程中,可以根据局部加载的方式来改善“模糊”,即在放大操作的时候从待处理图像中加载对应区域来生成新的预览图像。
用户对预览图像进行编辑时,从电子设备的界面上选择美颜、美妆等从而输入编辑指令。
本申请实施例中,编辑预览图像指对预览图像进行调整,如调整预览图像的亮度、对比度、饱和度等。或者,编辑预览图像指对预览图像添加滤镜、应用美颜等。
102、响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令。
示例性的,用户每输入一次编辑指令,则电子设备根据该编辑指令编辑预览图像的同时存储该编辑指令。当编辑指令超过2条时,本次编辑指令编辑的对象是上一次编辑指令编辑后的预览图像。也就是说,每次编辑是在上一次编辑的基础上对预览图像进行编辑。编辑后,电子设备的显示屏上实时显示编辑效果,以供用户查看。
103、接收用户输入的存储指令。
104、响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,分块是对所述待处理图像进行划分得到的。
其中,所述待处理图像包含多个分块。
步骤103和步骤104中,用户对预览图像编辑完毕后,点击界面上的编辑指令,触发电子设备根据存储的编辑指令对待处理图像(即原图)进行编辑。电子设备对原图进行编辑的过程中,将编辑指令对应的分块加载到内存,并根据编辑指令对分块进行编辑。最后,根据编辑后的分块生成目标图像。例如,若用户对预览图像进行局部编辑,则分块是待处理图像的局部区域。再如,若用户对预览图像整体编辑,则电子设备对整个待处理图像进行分块,每次加载编辑指令对应的一个或多个分块,并对该些分块进行编辑。之后,电子设备利用编辑后的分块生成目标图像。
本公开实施例提供的图像编辑方法,当电子设备检测到用户对分辨率较高的待处理图像进行处理时,生成并显示该待处理图像的预览图像。用户对预览图像编辑的过程中,电子设备依次存储编辑指令。当用户保存编辑后的预览图像时,电子设备根据存储的编辑指令,将编辑指令对应的分块加载到内存中,并根据编辑指令对分块进行编辑,根据编辑后的分块生成目标图像。采用该种方案,对分辨率较高的待处理图像进行编辑时,无需将整个待处理图像一次性的加载到内存中,而是仅加载编辑指令对应的分块,使得加载到内存中的数据比较少,从而克服编辑分辨率较高的图像时内存或CPU不够用导致的系统崩溃的问题。
上述实施例中,电子设备对分块编辑完毕后利用编辑后的分块生成目标图像时,利用编辑后的分块覆盖待处理图像的对应位置,从而得到目标图像。或者,电子设备对待处理图像进行复制,得到副本图像,利用编辑后的分块覆盖副本图像的对应位置。
采用该种方案,实现利用编辑后的分块生成目标图像的目的。
上述实施例中,用户对预览图像进行局部编辑或对全局编辑。下面,对电子设备如何对待处理图像进行局部编辑和全局编辑分别进行详细说明。
首先,电子设备对预览图像进行局部编辑。局部编辑是指对预览图像的部分区域,如对人脸区域进行美颜等,而无需对人脸区域以外的其他区域进行编辑。
图3是本公开提供的图像编辑的过程示意图。请参照图3,用户点击电子设备显示屏上的图像编辑APP的图标,进入图像选择界面。该图像选择界面显示至少一幅缩略图。用户点击至少一幅缩略图中的某个缩略图(以下称之为目标缩略图),以向电子设备发送选择指令。电子设备响应该选择请求,根据目标缩略图对应的待处理图像生成预览图像,并显示预览图像。例如,待处理图像为一个4K的图像,则预览图像为一个1K的图像。其中,电子设备生成预览图像的过程对用户而言是无感的。当然,电子设备也能够通过语音提示、文字提示等方式,告知用户:待处理图像的分辨率比较高,用户是否同意生成预览图像。
对于电子设备而言,待处理图像是否为大图通常与该电子设备的性能有关。例如,对于低端机而言,分辨率超过1920×1080的图像就是超大图像;而对于高端机型而言,分辨率超过4096×2160的图像才是超大图像。因此,当用户选中目标缩略图时,电子设备只有在判断出待处理图像为超大图像时,才生成预览图像。
示例性的,当用户选中目标缩略图时,电子设备读取该目标缩略图对应的待处理图像的图像信息。然后,根据所述图像信息,判断所述待处理图像的大小是否大于预设阈值。若待处理图像的分辨率大于预设阈值,则根据待处理图像的分辨率和电子设备的分辨率等生成预览图像。例如,若电子设备的显示屏的分辨率为1920×1080,待处理图像的分辨率为4096×2160,则生成分辨率为1920×1080的预览图像。若待处理图像的分辨率小于或等于预设阈值,则直接加载待处理图像,并对待处理图像进行编辑。若待处理图像的分辨率大于所述预设阈值,则根据待处理图像生成预览图像。其中,所述预设阈值是根据所述电子设备的中 央处理器CPU的大小、图形处理器(Graphics Processing Unit,GPU)的大小、屏幕分辨率的大小和内存大小中的至少一个确定出的。
采用该种方案,只有在待处理图像为超大图像时,电子设备才针对该待处理图像生成预览图像并进行编辑,节约图像处理步骤。
电子设备显示预览图像后,电子设备的显示屏上还显示各种图像编辑工具。例如,针对人像,图像编辑工具包括美颜、美妆、面部重塑、瘦脸健身、五官立体等。另外,电子设备还显示其他编剧工具标签,如滤镜、编辑、创作等。用户选中不同的工具标签,电子设备就显示相应类别的工具。用户根据需求或喜好等,选中喜好的编辑工具对图像进行编辑。电子设备根据用户对编辑工具的操作生成编辑指令对预览图像进行编辑。编辑过程中,每次编辑是在上一次编辑的基础上对预览图像进行编辑。例如,用户首先选择面部重塑,则电子设备根据用户的操作对预览图像中人物的面部进行重塑,并实时显示编辑效果。之后,用户选择五官立体,则电子设备对经过面部重塑的预览图像中的人脸的五官进行调整,并实时显示编辑效果。
当用户对预览图像完成编辑后,点击保存按钮。此时,将所述编辑指令对应的分块加载到内存,以编辑所述分块,并利用编辑后的分块生成目标图像。示例性的,请见图4。
图4是本公开实施例提供的图像编辑方法中的局部编辑示意图。请参照图4,用户输入存储指令后,电子设备根据预览图像的局部区域,从待处理图像中提取出分块。然后,电子设备将分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块。最后,利用编辑后的分块生成所述目标图像,从而完成对待处理图像的编辑。
采用该种方案,由于对待处理图像进行编辑时,仅加载了待处理图像的一部分,即分块,因此,能够降低内存消耗。
当用户对预览图像进行多次编辑时,即编辑指令至少为两条时,电子设备在用户对预览图像进行编辑的过程中,根据至少两条编辑指令依次编辑所述预览图像,显示编辑后的预览图像,并按照输入顺序依次储存所述至少一条编辑指令。之后,对分块进行编辑时,电子设备将所述分块加载到内存,按照存储的至少两条编辑指令的存储顺序,获取编辑指令并依次编辑所述分块,得到编辑后的分块。
示例性的,因为待处理图像没发在内存中加载,若强行加载会导致内存问题,如内存溢出(Out Of Memory,OOM)。本申请实施例中,用户所有编辑都基于预览图像的,用户看到的编辑效果也是对预览图像的编辑效果。在用户操作完成保存时,按照用户对预览图像的编辑顺序与编辑方式依次对原图中对应分块进行编辑。
编辑过程中,要保证对待处理图像的编辑和对预览图像的编辑一致。这是因为编辑的时候,每条编辑指令的编辑对象都是上一个编辑指令的编辑结果。也就是说,每次编辑是在上一个编辑指令编辑的基础上叠加。例如,对预览图像的编辑顺序为:先调整亮度,再添加滤镜。则与分块的编辑顺序也应该为:先调整亮度,再添加滤镜。如果预览图像的编辑顺序与分块的编辑顺序不同,则导致对分块进行多次编辑的叠加效果和对预览图像进行多次编辑的叠加效果不一致,甚至会出现偏差。
本申请实施例中,电子设备按照输入顺序依次存储用户输入的多个编辑指令。之后,对待处理图像进行编辑时,对分块按顺序执行上述的多个编辑指令,以保证对待处理图像的编辑过程和对预览图像的编辑过程一致,到达理想编辑效果。
上述局部编辑过程中,很有可能存在局部区域比较大的现象。此时若将待处理图像的中 的分块加载内存,则同样会导致内存开销大的问题。因此,当所述分块的大小超过预设大小时,电子设备需要将分块划分为多个子块,其中,预设大小例如为电子设备单次加载量的最大值。之后,电子设备在内存中依次加载所述多个子块,根据所述编辑指令对所述多个子块中的每个子块进行编辑,以得到多个编辑后的子块,根据所述多个编辑后的子块,生成编辑后的分块。示例性的,请按照图5。
图5是本公开实施例提供的图像编辑方法中的局部编辑示意图。请参照图5,电子设备根据预览图像的局部区域,从待处理图像中提取出分块后,若该分块比较大,则电子设备将该分块划分为20个子块。之后,每次加载部分子块,如依次加载20个子块中的每个子块。再如,按照从上往下的顺序,依次加载第一行、第二行、第三行、第四行和第五行的子块。
采用该种方案,局部编辑过程中,对分块进行子块划分后再加载子块,由于子块的大小小于分块的大小,因此能够降低内存等的开销。
电子设备可以采用不同的方式灵活的对待处理图像进行分块。例如,电子设备按照行对待处理图像进行分块,即将连续的多行像素作为一个分块;再如,电子设备按照列对待处理图像进行分块,即将连续的多列像素作为一个分块;又如,电子设备同时行和列对待处理图像进行分块。又如,电子设备按照区域对待处理图像进行分块,比如,假设待处理图像包含山、水和草地,则将待处理图像分为三个分块,依次为山、水和草地。
其次,电子设备对预览图像进行全局编辑。全局编辑指对整个预览图像进行编辑。例如,对整个预览图像进行亮度调节等。
全局编辑图像过程中,用户选中目标缩略图并生成预览图像的过程可参见上述图3的描述,此处不再赘述。
当用户对预览图像完成编辑后,点击保存按钮。此时,电子设备对待处理图像进行分块,以得到多个分块。然后,电子设备每次在内存中加载所述多个分块中的部分分块,根据所述编辑指令对所述部分分块中的每个分块进行编辑,以得到多个编辑后的分块。最后,电子设备根据所述多个编辑后的分块,生成所述目标图像。示例性的,可参见图6。
图6是本公开实施例提供的图像编辑方法中的全局编辑示意图。请参照图6,用户输入存储指令后,电子设备识别出存储的编辑指令是对整个预览图像进行编辑。此时,电子设备将待处理图像划分为多个子块,如图中,每个小方格表示一个子块。之后,电子设备依次加载该些子块。例如,每次加载一个子块;再如,每次加载一行或一列子块等,本公开实施例并不限制。
采用该种方案,由于对待处理图像进行全局编辑时,仅加载了待处理图像中的一部分,即一个或多个子块。因此,能够有效降低内存等的消耗。
上述实施例中,电子设备对待处理图像进行分块,以得到多个分块时,先从内存找那个确定出用于加载分块的缓存,然后,根据固定缓存的大小对待处理图像进行划分,以将所述待处理图像划分为多个分块,其中,所述固定缓存用于加载所述多个分块。
示例性的,电子设备根据图像处理算法所需的内存大小等,从内存中选择出适当大小的部分内存作为图像处理过程中的固定缓存。每次加载时,加载固定个数的分块,使得多个分块并行处理。
这样一来,图像处理过程中使用固定缓存,由于该固定缓存相对恒定,不会发生波动、内存不足、内存溢出等异常现象。因此,能够保证图像处理的稳定性。而且,对多个分块并行处理,能够提高图像处理速度。
上述实施例中,电子设备根据所述固定缓存的大小对所述待处理图像进行分块,以将所述待处理图像划分为多个分块时,先根据所述固定缓存的大小,确定分块的尺寸。然后,电子设备根据所述分块的尺寸,对所述待处理图像进行网格划分,以将所述待处理图像划分为多个分块,所述多个分块中相邻的两个分块具有重叠部分。
再请参照图5和图6,电子设备通过网格划分方式对分块或待处理图像进行划分。以对待处理图像进行分块为例,电子设备根据图像处理算法确定采用哪种划分方式。例如,电子设备对某个区域执行图像算法时,仅需要该区域内的数据就能够执行图像算法。此时,电子设备采用网格式划分策略,对待处理图像进行网格划分。后续对待处理图像编辑的过程中,能够对多个分块进行并行处理,从而提高图像处理速度。该种场景中,图像处理算法例如为贴纸、局部美颜等。
再如,电子设备对某个区域执行图像算法时,除了需要知道该区域内像素的数据外,还需要知道周边像素的信息。此时,电子设备采用滑动窗口策略。此时,多个分块中相邻的两个分块具有重叠部分。示例性,请参见图7。
图7是本公开实施例提供的图像编辑方法中的全局编辑示意图。请参照图7,对于每两个相邻的子块而言,斜线填充部分同时属于该两个子块。这样一来,对相邻的两个分块进行处理时,先对第一个分块进行处理,再对第二个分块进行处理,对第二个分块进行处理时,能够获知第一分块部分像素的信息,使得处理后的图像效果更好,提高图像处理的准确性。该种场景中,图像处理算法例如为整体美颜、亮度调节、对比度调节等。
采用该种方案,通过网格划分方式划分待处理图像,实现准确划分待处理图像的目的。
上述实施例中,电子设备根据编辑指令对预览图像的编辑,大致分为两种情况:对像素的编辑以及对位置的编辑。例如,亮度调节时,需要对像素及邻近像素进行调节,这时无需进行位置映射。对位置进行编辑时,需要对预览图像中的第一像素和分块中的第二像素进行位置映射。
映射过程中,电子设备首先响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,根据所述预览图像中的第一像素,从所述分块中确定出第二像素,所述第二像素在所述待处理图像中的位置根据所述第一像素在所述预览图像中的位置和缩放比例确定出,所述缩放比例是根据所述待处理图像生成所述预览图像的缩放比例。然后,电子设备根据所述编辑指令对所述第一像素的编辑,编辑所述第二像素以得到编辑后的分块,利用所述编辑后的分块生成目标图像。
例如,对待处理图像中的人脸添加一个滤镜,则需要知道人脸在待处理图像中的位置,以及人脸中每个部位的位置,即人脸点位图。此时,需要进行位置映射。位置映射是指:用户看到的效果是对预览图像的编辑效果,为了对待处理图像进行同样的编辑达到同样的效果,将预览图像中每个被编辑的第一像素的位置,按照缩放比例等,在待处理图像中找到第二像素,然后根据第一像素的编辑,编辑第二像素。其中,缩放比例指从原始的待处理图像生成预览图像时的缩放比例。
根据第一像素的位置确定第二像素的位置时,利用第一像素的坐标乘以缩放比例,就能够得到第二像素的位置坐标。
采用该种方案,保证对待处理图像的编辑与对预览图像的编辑一致,实现准确编辑待处理图像的目的。
需要说明的时,上述实施例中,用户直接编辑的是预览图像,电子设备显示的是对预览 图像的编辑效果。但是,最终目的是编辑原始的待处理图像。比如,在预览图像中对眉毛进行编辑,最终根据对预览图像的编辑,编辑原始的待处理图像。
上述实施例中,当电子设备生成目标图像后,电子设备还删除上述的预览图像和存储的编辑指令,从而释放电子设备的存储空间。
对应于上文实施例的图像编辑方法,图8为本公开实施例提供的电子设备100的结构框图。为了便于说明,仅示出了与本公开实施例相关的部分。参照图8,所述设备包括:接收单元11、处理单元12、显示单元13和存储单元14。
其中,接收单元11,用于接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;
处理单元12,用于响应所述编辑指令编辑所述预览图像;
显示单元13,用于显示编辑后的预览图像;
存储单元14,用于存储所述编辑指令;
所述接收单元11,还用于接收用户输入的存储指令;
所述处理单元12,还用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
在本公开的一个实施例中,所述编辑指令用于编辑所述预览图像的局部区域,所述处理单元12,用于根据所述预览图像的局部区域,从所述待处理图像中提取出对应的分块,将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块,利用编辑后的分块生成所述目标图像。
在本公开的一个实施例中,所述处理单元12,用于当所述分块的大小超过预设大小时,将所述分块划分为多个子块;在内存中依次加载所述多个子块,根据所述编辑指令对所述多个子块中的每个子块进行编辑,以得到多个编辑后的子块,根据所述多个编辑后的子块,生成编辑后的分块。
在本公开的一个实施例中,所述编辑指令用于编辑所述预览图像的整个区域,所述处理单元12,用于对所述待处理图像进行分块,以得到多个分块,每次在内存中加载所述多个分块中的部分分块,根据所述编辑指令对所述部分分块中的每个分块进行编辑,以得到多个编辑后的分块,根据所述多个编辑后的分块,生成所述目标图像。
在本公开的一个实施例中,所述处理单元12,用于从所述内存中确定出固定缓存,所述固定缓存用于加载所述多个分块,根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,其中,所述固定缓存用于加载所述多个分块。
在本公开的一个实施例中,所述处理单元12根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块时,用于根据所述固定缓存的大小,确定分块的尺寸,根据所述分块的尺寸,对所述待处理图像进行网格划分,以将所述待处理图像划分为多个分块,所述多个分块中相邻的两个分块具有重叠部分。
在本公开的一个实施例中,所述接收单元11在接收用户输入的编辑指令之前,还接收所述用户输入的选择指令,所述选择指令用于从至少一个缩略图中选中目标缩略图,所述目标缩略图为待处理图像的缩略图,所述至少一个缩略图显示于电子设备的显示屏上;
所述处理单元12,还用于响应所述选择请求,生成所述待处理图像的预览图像。
在本公开的一个实施例中,所述处理单元12,用于读取所述待处理图像的图像信息,根据所述图像信息,判断所述待处理图像的分辨率是否大于预设阈值,所述预设阈值是根据所述电子设备的中央处理器CPU的大小、图形处理器GPU的大小、屏幕分辨率的大小和内存大小中的至少一个确定出的。若所述待处理图像的分辨率大于所述预设阈值,则根据所述待处理图像生成所述预览图像。
在本公开的一个实施例中,所述编辑指令至少为两条,所述处理单元12在响应所述编辑指令编辑所述预览图像时,用于根据至少两条编辑指令依次编辑所述预览图像;
所述显示单元13,用于根据至少两条编辑指令依次编辑所述预览图像;
所述存储单元14,用于按照输入顺序依次储存所述至少两条编辑指令;
所述处理单元12,还用于将所述分块加载到内存,按照存储的至少两条编辑指令的存储顺序,获取编辑指令并依次编辑所述分块,得到编辑后的分块。
在本公开的一个实施例中,所述处理单元12响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像时,用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,根据所述预览图像中的第一像素,从所述分块中确定出第二像素,所述第二像素在所述待处理图像中的位置根据所述第一像素在所述预览图像中的位置和缩放比例确定出,所述缩放比例是根据所述待处理图像生成所述预览图像的缩放比例,根据所述编辑指令对所述第一像素的编辑,编辑所述第二像素以得到编辑后的分块,利用所述编辑后的分块生成目标图像。
在本公开的一个实施例中,所述处理单元12利用编辑后的分块生成目标图像时,用于利用编辑后的分块替换所述待处理图像中对应位置的分块,得到所述目标图像。
本实施例提供的设备,可用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,本实施例此处不再赘述。
图9是本公开实施例的电子设备900的结构示意图,该电子设备900可以为终端设备或服务器。其中,终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,简称PDA)、平板电脑(Portable Android Device,简称PAD)、便携式多媒体播放器(Portable Media Player,简称PMP)、车载终端(例如车载导航终端)、可穿戴电子设备等等的移动终端以及诸如数字TV、台式计算机、智能家居设备等等的固定终端。图9示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图9所示,电子设备900可以包括处理装置(例如中央处理器、图形处理器等)901,其可以根据存储在只读存储器(Read Only Memory,简称ROM)902中的程序或者从存储装置908加载到随机访问存储器(Random Access Memory,简称RAM)903中的程序而执行各种适当的动作和处理,以实现本公开上述流程图所示的方法。在RAM 903中,还存储有电子设备900操作所需的各种程序和数据。处理装置901、ROM 902以及RAM 903通过总线904彼此相连。输入/输出(I/O)接口905也连接至总线904。
通常,以下装置可以连接至I/O接口905:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置906;包括例如液晶显示器(Liquid Crystal Display,简称LCD)、扬声器、振动器等的输出装置907;包括例如磁带、硬盘等的存储装置908;以及通信装置909。通信装置909可以允许电子设备900与其他设备进行无线或有线通信 以交换数据。虽然图9示出了具有各种装置的电子设备900,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置909从网络上被下载和安装,或者从存储装置908被安装,或者从ROM 902被安装。在该计算机程序被处理装置901执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备执行上述实施例所示的方法。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(Local Area Network,简称LAN)或广域网(Wide Area Network,简称WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基 本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Intergrated Circuit,ASIC)、专用标准产品(Application Specific Standard Product,ASSP)、片上系统(System on a Chip,SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
第一方面,根据本公开的一个或多个实施例,提供了一种图像编辑方法,包括:接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令;接收用户输入的存储指令;响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
根据本公开的一个或多个实施例,所述编辑指令用于编辑所述预览图像的局部区域,所述将所述编辑指令对应的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:根据所述预览图像的局部区域,从所述待处理图像中提取出对应的分块;将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块;利用编辑后的分块生成所述目标图像。
根据本公开的一个或多个实施例,所述将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块,包括:当所述分块的大小超过预设大小时,将所述分块划分为多个子块,在内存中依次加载所述多个子块,根据所述编辑指令对所述多个子块中的每个子块进行编辑,以得到多个编辑后的子块,根据所述多个编辑后的子块,生成编辑后的分块。
根据本公开的一个或多个实施例,所述编辑指令用于编辑所述预览图像的整个区域,所述将所述编辑指令对应的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:对所述待处理图像进行分块,以得到多个分块;每次在内存 中加载所述多个分块中的部分分块,根据所述编辑指令对所述部分分块中的每个分块进行编辑,以得到多个编辑后的分块;根据所述多个编辑后的分块,生成所述目标图像。
根据本公开的一个或多个实施例,所述对所述待处理图像进行分块,以得到多个分块,包括:从所述内存中确定出固定缓存,根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,其中,所述固定缓存用于加载所述多个分块。
根据本公开的一个或多个实施例,所述根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,包括:根据所述固定缓存的大小,确定分块的尺寸;根据所述分块的尺寸,对所述待处理图像进行网格划分,以将所述待处理图像划分为多个分块,所述多个分块中相邻的两个分块具有重叠部分。
根据本公开的一个或多个实施例,所述接收用户输入的编辑指令之前,还包括:接收所述用户输入的选择指令,所述选择指令用于从至少一个缩略图中选中目标缩略图,所述目标缩略图为待处理图像的缩略图,所述至少一个缩略图显示于电子设备的显示屏上;响应所述选择请求,生成所述待处理图像的预览图像。
根据本公开的一个或多个实施例,所述响应所述选择请求,生成所述待处理图像的预览图像,包括:读取所述待处理图像的图像信息;根据所述图像信息,判断所述待处理图像的分辨率是否大于预设阈值,所述预设阈值是根据所述电子设备的中央处理器CPU的大小、图形处理器GPU的大小、屏幕分辨率的大小和内存大小中的至少一个确定出的;若所述待处理图像的分辨率大于所述预设阈值,则根据所述待处理图像生成所述预览图像。
根据本公开的一个或多个实施例,所述编辑指令至少为两条,所述响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令,包括:根据至少两条编辑指令依次编辑所述预览图像,显示编辑后的预览图像,并按照输入顺序依次储存所述至少两条编辑指令;所述将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块,包括:将所述分块加载到内存,按照存储的至少两条编辑指令的存储顺序,获取编辑指令并依次编辑所述分块,得到编辑后的分块。
根据本公开的一个或多个实施例,所述响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,根据所述预览图像中的第一像素,从所述分块中确定出第二像素,所述第二像素在所述待处理图像中的位置根据所述第一像素在所述预览图像中的位置和缩放比例确定出,所述缩放比例是根据所述待处理图像生成所述预览图像的缩放比例;根据所述编辑指令对所述第一像素的编辑,编辑所述第二像素以得到编辑后的分块,利用所述编辑后的分块生成目标图像。
根据本公开的一个或多个实施例,所述利用编辑后的分块生成目标图像,包括:利用编辑后的分块替换所述待处理图像中对应位置的分块,得到所述目标图像。
第二方面,根据本公开的一个或多个实施例,提供了一种电子设备,包括:
接收单元,用于接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;
处理单元,用于响应所述编辑指令编辑所述预览图像;
显示单元,用于显示编辑后的预览图像;
存储单元,用于存储所述编辑指令;
所述接收单元,还用于接收用户输入的存储指令;
所述处理单元,还用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
根据本公开的一个或多个实施例,所述编辑指令用于编辑所述预览图像的局部区域,所述处理单元,用于根据所述预览图像的局部区域,从所述待处理图像中提取出对应的分块;将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块;利用编辑后的分块生成所述目标图像。
根据本公开的一个或多个实施例,所述处理单元,用于当所述分块的大小超过预设大小时,将所述分块划分为多个子块;在内存中依次加载所述多个子块,根据所述编辑指令对所述多个子块中的每个子块进行编辑,以得到多个编辑后的子块;根据所述多个编辑后的子块,生成编辑后的分块。
根据本公开的一个或多个实施例,所述编辑指令用于编辑所述预览图像的整个区域,所述处理单元,用于对所述待处理图像进行分块,以得到多个分块;每次在内存中加载所述多个分块中的部分分块,根据所述编辑指令对所述部分分块中的每个分块进行编辑,以得到多个编辑后的分块;根据所述多个编辑后的分块,生成所述目标图像。
根据本公开的一个或多个实施例,所述处理单元,用于从所述内存中确定出固定缓存;根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,其中,所述固定缓存用于加载所述多个分块。
根据本公开的一个或多个实施例,所述处理单元根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块时,用于根据所述固定缓存的大小,确定分块的尺寸;根据所述分块的尺寸,对所述待处理图像进行网格划分,以将所述待处理图像划分为多个分块,所述多个分块中相邻的两个分块具有重叠部分。
根据本公开的一个或多个实施例,所述接收单元在接收用户输入的编辑指令之前,还接收所述用户输入的选择指令,所述选择指令用于从至少一个缩略图中选中目标缩略图,所述目标缩略图为待处理图像的缩略图,所述至少一个缩略图显示于电子设备的显示屏上;
所述处理单元,还用于响应所述选择请求,生成所述待处理图像的预览图像。
根据本公开的一个或多个实施例,所述处理单元,用于读取所述待处理图像的图像信息;根据所述图像信息,判断所述待处理图像的分辨率是否大于预设阈值,所述预设阈值是根据所述电子设备的中央处理器CPU的大小、图形处理器GPU的大小、屏幕分辨率的大小和内存大小中的至少一个确定出的;若所述待处理图像的分辨率大于所述预设阈值,则根据所述待处理图像生成所述预览图像。
根据本公开的一个或多个实施例,所述编辑指令至少为两条,所述处理单元在响应所述编辑指令编辑所述预览图像时,用于根据至少两条编辑指令依次编辑所述预览图像;
所述显示单元,用于显示编辑后的预览图像;
所述存储单元,用于按照输入顺序依次储存所述至少两条编辑指令;
所述处理单元,还用于将所述分块加载到内存,按照存储的至少两条编辑指令的存储顺序,获取编辑指令并依次编辑所述分块,得到编辑后的分块。
根据本公开的一个或多个实施例,所述处理单元响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分 块生成目标图像时,用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,根据所述预览图像中的第一像素,从所述分块中确定出第二像素,所述第二像素在所述待处理图像中的位置根据所述第一像素在所述预览图像中的位置和缩放比例确定出,所述缩放比例是根据所述待处理图像生成所述预览图像的缩放比例,根据所述编辑指令对所述第一像素的编辑,编辑所述第二像素以得到编辑后的分块,利用所述编辑后的分块生成目标图像。
根据本公开的一个或多个实施例,所述处理单元利用编辑后的分块生成目标图像时,用于利用编辑后的分块替换所述待处理图像中对应位置的分块,得到所述目标图像。
第三方面,根据本公开的一个或多个实施例,提供了一种电子设备,包括:至少一个处理器和存储器;
所述存储器存储计算机执行指令;
所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述至少一个处理器执行如上所述的图像编辑方法。
第四方面,根据本公开的一个或多个实施例,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上所述的图像编辑方法。
第五方面,根据本公开的一个或多个实施例,提供了一种计算机程序产品,包括计算机执行指令,所述执行指令在被处理器执行时,实现如上所述的图像编辑方法。
第六方面,根据本公开的一个或多个实施例,提供了一种计算机程序,所述计算机程序被处理器执行时实现如上所述的图像编辑方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (16)

  1. 一种图像编辑方法,其特征在于,包括:
    接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;
    响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令;
    接收用户输入的存储指令;
    响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
  2. 根据权利要求1所述的图像编辑方法,其特征在于,所述编辑指令用于编辑所述预览图像的局部区域,所述将所述编辑指令对应的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:
    根据所述预览图像的局部区域,从所述待处理图像中提取出对应的分块;
    将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块;
    利用编辑后的分块生成所述目标图像。
  3. 根据权利要求2所述的图像编辑方法,其特征在于,所述将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块,包括:
    当所述分块的大小超过预设大小时,将所述分块划分为多个子块;
    在内存中依次加载所述多个子块,根据所述编辑指令对所述多个子块中的每个子块进行编辑,以得到多个编辑后的子块;
    根据所述多个编辑后的子块,生成编辑后的分块。
  4. 根据权利要求1所述的图像编辑方法,其特征在于,所述编辑指令用于编辑所述预览图像的整个区域,所述将所述编辑指令对应的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:
    对所述待处理图像进行分块,以得到多个分块;
    每次在内存中加载所述多个分块中的部分分块,根据所述编辑指令对所述部分分块中的每个分块进行编辑,以得到多个编辑后的分块;
    根据所述多个编辑后的分块,生成所述目标图像。
  5. 根据权利要求4所述的图像编辑方法,其特征在于,所述对所述待处理图像进行分块,以得到多个分块,包括:
    从所述内存中确定出固定缓存;
    根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,其中,所述固定缓存用于加载所述多个分块。
  6. 根据权利要求5所述的图像编辑方法,其特征在于,所述根据所述固定缓存的大小对所述待处理图像进行划分,以将所述待处理图像划分为多个分块,包括:
    根据所述固定缓存的大小,确定分块的尺寸;
    根据所述分块的尺寸,对所述待处理图像进行网格划分,以将所述待处理图像划分为多个分块,所述多个分块中相邻的两个分块具有重叠部分。
  7. 根据权利要求1至6中任一项所述的图像编辑方法,其特征在于,所述接收用户输入 的编辑指令之前,还包括:
    接收所述用户输入的选择指令,所述选择指令用于从至少一个缩略图中选中目标缩略图,所述目标缩略图为待处理图像的缩略图,所述至少一个缩略图显示于电子设备的显示屏上;
    响应所述选择请求,生成所述待处理图像的预览图像。
  8. 根据权利要求7所述的图像编辑方法,其特征在于,所述响应所述选择请求,生成所述待处理图像的预览图像,包括:
    读取所述待处理图像的图像信息;
    根据所述图像信息,判断所述待处理图像的分辨率是否大于预设阈值,所述预设阈值是根据所述电子设备的中央处理器CPU的大小、图形处理器GPU的大小、屏幕分辨率的大小和内存大小中的至少一个确定出的;
    若所述待处理图像的分辨率大于所述预设阈值,则根据所述待处理图像生成所述预览图像。
  9. 根据权利要求1至8中任一项所述的图像编辑方法,其特征在于,所述编辑指令至少为两条,所述响应所述编辑指令编辑所述预览图像,显示编辑后的预览图像,并存储所述编辑指令,包括:
    根据至少两条编辑指令依次编辑所述预览图像,显示编辑后的预览图像,并按照输入顺序依次储存所述至少两条编辑指令;
    所述将所述分块加载到内存,根据所述编辑指令对所述分块进行编辑,以得到编辑后的分块,包括:
    将所述分块加载到内存,按照存储的至少两条编辑指令的存储顺序,获取编辑指令并依次编辑所述分块,得到编辑后的分块。
  10. 根据权利要求1至9中任一项所述的图像编辑方法,其特征在于,所述响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,包括:
    响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,根据所述预览图像中的第一像素,从所述分块中确定出第二像素,所述第二像素在所述待处理图像中的位置根据所述第一像素在所述预览图像中的位置和缩放比例确定出,所述缩放比例是根据所述待处理图像生成所述预览图像的缩放比例;
    根据所述编辑指令对所述第一像素的编辑,编辑所述第二像素以得到编辑后的分块,利用所述编辑后的分块生成目标图像。
  11. 根据权利要求1至10中任一项所述的图像编辑方法,其特征在于,所述利用编辑后的分块生成目标图像,包括:
    利用编辑后的分块替换所述待处理图像中对应位置的分块,得到所述目标图像。
  12. 一种图像编辑的电子设备,其特征在于,包括:
    接收单元,用于接收用户输入的编辑指令,所述编辑指令用于编辑预览图像,所述预览图像是根据电子设备的屏幕分辨率对待处理图像进行处理生成的,所述预览图像的分辨率低于所述待处理图像的分辨率;
    处理单元,用于响应所述编辑指令编辑所述预览图像;
    显示单元,用于显示编辑后的预览图像;
    存储单元,用于存储所述编辑指令;
    所述接收单元,还用于接收用户输入的存储指令;
    所述处理单元,还用于响应所述存储指令,将所述编辑指令对应的待处理图像的分块加载到内存,以根据所述编辑指令编辑所述分块,并利用编辑后的分块生成目标图像,其中,所述分块是对所述待处理图像进行划分得到的。
  13. 一种电子设备,其特征在于,包括:至少一个处理器和存储器;
    所述存储器存储计算机执行指令;
    所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述至少一个处理器执行如权利要求1至11中任一项所述的图像编辑方法。
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如权利要求1至11中任一项所述的图像编辑方法。
  15. 一种计算机程序产品,其特征在于,包括计算机执行指令,所述计算机执行指令在被处理器执行时实现如权利要求1至11中任一项所述的图像编辑方法。
  16. 一种计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至11中任一项所述的图像编辑方法。
PCT/CN2022/072316 2021-01-29 2022-01-17 图像编辑方法及设备 WO2022161199A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/263,516 US20240104811A1 (en) 2021-01-29 2022-01-17 Image editing method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110129764.0 2021-01-29
CN202110129764.0A CN114820878A (zh) 2021-01-29 2021-01-29 图像编辑方法及设备

Publications (1)

Publication Number Publication Date
WO2022161199A1 true WO2022161199A1 (zh) 2022-08-04

Family

ID=82525849

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/072316 WO2022161199A1 (zh) 2021-01-29 2022-01-17 图像编辑方法及设备

Country Status (3)

Country Link
US (1) US20240104811A1 (zh)
CN (1) CN114820878A (zh)
WO (1) WO2022161199A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399033A (zh) * 2008-08-15 2009-04-01 广东威创视讯科技股份有限公司 在拼墙上显示高分辨率图像的方法
CN102663664A (zh) * 2012-03-02 2012-09-12 石家庄铁道大学 超大纹理图像的处理方法
CN103123718A (zh) * 2011-11-21 2013-05-29 腾讯科技(深圳)有限公司 一种图像处理方法和系统
WO2015179459A1 (en) * 2014-05-22 2015-11-26 Microsoft Technology Licensing, Llc Editing based on thumbnail images
CN110187924A (zh) * 2019-05-29 2019-08-30 吉林亿联银行股份有限公司 图片加载方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399033A (zh) * 2008-08-15 2009-04-01 广东威创视讯科技股份有限公司 在拼墙上显示高分辨率图像的方法
CN103123718A (zh) * 2011-11-21 2013-05-29 腾讯科技(深圳)有限公司 一种图像处理方法和系统
CN102663664A (zh) * 2012-03-02 2012-09-12 石家庄铁道大学 超大纹理图像的处理方法
WO2015179459A1 (en) * 2014-05-22 2015-11-26 Microsoft Technology Licensing, Llc Editing based on thumbnail images
CN110187924A (zh) * 2019-05-29 2019-08-30 吉林亿联银行股份有限公司 图片加载方法及装置

Also Published As

Publication number Publication date
US20240104811A1 (en) 2024-03-28
CN114820878A (zh) 2022-07-29

Similar Documents

Publication Publication Date Title
US20210235093A1 (en) Backward-compatible video capture and distribution
US20160313966A1 (en) User terminal device providing user interaction and method therefor
KR20160120343A (ko) 크로스 플랫폼 렌더링 엔진
CN110070496B (zh) 图像特效的生成方法、装置和硬件装置
WO2014134912A1 (zh) 一种绘图方法、装置及终端
WO2020220773A1 (zh) 图片预览信息的显示方法、装置、电子设备及计算机可读存储介质
CN110568982B (zh) 在线演示文稿中的图片裁剪方法、装置、存储介质及设备
US20220310125A1 (en) Method and apparatus for video production, device and storage medium
WO2023279914A1 (zh) 控件编辑方法、装置、设备、可读存储介质及产品
EP4210320A1 (en) Video processing method, terminal device and storage medium
JP2021506196A (ja) ビデオ処理方法、装置、端末および媒体
CN113613067B (zh) 视频处理方法、装置、设备及存储介质
EP4343580A1 (en) Media file processing method and apparatus, device, readable storage medium, and product
KR20140141046A (ko) 디스플레이 장치 및 그 제어 방법
CN111258519B (zh) 屏幕分屏实现方法、装置、终端和介质
WO2024046284A1 (zh) 绘制动画生成方法、装置、设备、可读存储介质及产品
WO2022161199A1 (zh) 图像编辑方法及设备
CN110134905B (zh) 一种页面更新显示方法、装置、设备及存储介质
US20230412891A1 (en) Video processing method, electronic device and medium
CN112153439A (zh) 互动视频处理方法、装置、设备及可读存储介质
US8754908B2 (en) Optimized on-screen video composition for mobile device
US12019669B2 (en) Method, apparatus, device, readable storage medium and product for media content processing
WO2020224158A1 (zh) 编辑方法、计算机可读存储介质及终端
WO2020133386A1 (zh) 一种笔记局部选取方法、装置、电子终端和可读存储介质
WO2021018176A1 (zh) 文字特效处理方法及装置

Legal Events

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

Ref document number: 22745075

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18263516

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22745075

Country of ref document: EP

Kind code of ref document: A1