CN114612485A - Image clipping method and device and storage medium - Google Patents
Image clipping method and device and storage medium Download PDFInfo
- Publication number
- CN114612485A CN114612485A CN202210234088.8A CN202210234088A CN114612485A CN 114612485 A CN114612485 A CN 114612485A CN 202210234088 A CN202210234088 A CN 202210234088A CN 114612485 A CN114612485 A CN 114612485A
- Authority
- CN
- China
- Prior art keywords
- image
- cut
- center point
- cutting frame
- target edge
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/12—Edge-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
The disclosure relates to an image cropping method, an image cropping device and a storage medium, and relates to the technical field of image processing. The method comprises the following specific steps: determining coordinates of a first image to be cut and a center point of a first cutting frame; acquiring a translation distance, a translation direction and a scaling according to the coordinate of the center point of the first cutting frame and the first image to be cut; and processing the first cutting frame according to the translation distance, the translation direction and the scaling to obtain a second cutting frame. According to the method and the device, the first cutting frame is subjected to translation and rotation conversion and is moved into the first image to be cut, the problem of display errors is avoided, a user can effectively observe the overall relation between the intercepted area to be cut and the intercepted image to be cut, and the use experience of the user is improved.
Description
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image cropping method and apparatus, and a storage medium.
Background
With the popularization of mobile phones, people use mobile phone cameras to shoot and edit shot images more and more frequently. In order to acquire a specific area in an image, the image needs to be cut by using an image cutting technology, but the prior art has many limitations on cutting the image, and cannot flexibly select and cut the area desired by a user.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides an image cropping method, apparatus, and storage medium. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an image cropping method, including:
determining coordinates of a first image to be cut and a center point of a first cutting frame;
acquiring a first distance from the center point of the first cutting frame to the edge of a first image to be cut, and determining an edge corresponding to the first distance as a first target edge;
amplifying the first image to be cut to obtain a second image to be cut and a second target edge, wherein the edge of the second image to be cut corresponding to the first target edge is the second target edge, and the range of the second image to be cut is larger than that of the first cutting frame;
acquiring image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge;
processing the first cutting frame according to the image editing configuration to obtain a second cutting frame;
and cutting the first image to be cut according to the second cutting frame.
Optionally, the image editing configuration comprises at least one of:
a direction of translation;
a translation distance;
and (4) scaling.
Optionally, the obtaining an image editing configuration according to the first crop box center point coordinate, the first target edge, and the second target edge includes:
acquiring a second distance from the center point of the first cutting frame to the second target edge;
obtaining the scaling according to the first distance and the second distance;
and determining the translation distance and the translation direction according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the first cutting frame.
Optionally, the processing the first crop box according to the image editing configuration to obtain a second crop box specifically includes:
moving the first cutting frame according to the translation distance and the translation direction, and scaling the first cutting frame according to the scaling ratio to obtain a second cutting frame;
and moving the second cutting frame and the first image to be cut to enable the center point of the first image to be cut to be superposed with the center point of the screen, wherein the relative positions of the second cutting frame and the first image to be cut are unchanged.
Optionally, the center point of the image to be cut is the center point of the canvas of the image to be cut.
Optionally, the center point of the image to be cropped is a center point of a key content area in the image to be cropped, wherein the step of acquiring the key content area includes: and acquiring the content weight of the image to be cut, and acquiring the key content area according to the content weight.
According to a second aspect of the embodiments of the present disclosure, there is provided an image cropping device, comprising:
the coordinate determination module is used for determining the coordinates of the first image to be cut and the center point of the first cutting frame;
the target edge determining module is used for acquiring a first distance from the center point of the first cutting frame to the edge of the first image to be cut, and determining an edge corresponding to the first distance as a first target edge;
the amplifying module is used for amplifying the first image to be cut to obtain a second image to be cut and a second target edge, wherein the edge of the second image to be cut corresponding to the first target edge is the second target edge, and the range of the second image to be cut is larger than that of the first cutting frame;
the editing configuration acquisition module is used for acquiring image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge;
the processing module is used for processing the first cutting frame according to the translation distance, the translation direction and the scaling to obtain a second cutting frame;
and the cutting module is used for cutting the first image to be cut according to the second cutting frame.
Optionally, the image editing configuration comprises at least one of:
a direction of translation;
a translation distance;
and (4) scaling.
Optionally, the edit configuration acquiring module includes:
the distance obtaining submodule is used for obtaining a second distance from the center point of the first cutting frame to the second target edge;
the scaling obtaining submodule is used for obtaining scaling according to the first distance and the second distance;
and the translation parameter determining submodule is used for determining a translation distance and a translation direction according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the second cutting frame.
Optionally, the processing module specifically includes:
the first processing submodule is used for moving the first cutting frame according to the translation distance and the translation direction, and scaling the first cutting frame according to the scaling ratio to obtain a second cutting frame;
and the second processing submodule is used for moving the second cutting frame and the first image to be cut so as to enable the center point of the first image to be cut to be superposed with the screen center point, wherein the relative positions of the second cutting frame and the first image to be cut are unchanged.
Optionally, the center point of the image to be cut is the center point of the canvas of the image to be cut.
Optionally, the center point of the image to be cropped is a center point of a key content area in the image to be cropped, wherein the step of acquiring the key content area includes: and acquiring the content weight of the image to be cut, and acquiring the key content area according to the content weight.
According to a third aspect of the embodiments of the present disclosure, there is provided an image cropping electronic device, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image cropping method of any of the first aspects above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having instructions therein, which when executed by a processor of an image cropping electronic device, enable the image cropping electronic device to perform the image cropping method as described in any one of the above first aspects.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of the above first aspects.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
through the embodiment of the application, the first cutting frame is moved to the first image to be cut through translation and rotation conversion, the problem of display errors is avoided, a user can effectively observe the overall relation between the intercepted area to be cut and the image to be cut, and the use experience of the user is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a method of image cropping, according to an exemplary embodiment.
FIG. 2 is a flow diagram illustrating a method of image cropping, according to an exemplary embodiment.
FIG. 3 is a flow diagram illustrating a method of image cropping, according to an exemplary embodiment.
Fig. 4 is a block diagram illustrating an image cropping device according to an exemplary embodiment.
FIG. 5 is a block diagram illustrating an apparatus in accordance with an example embodiment.
FIG. 6 is a block diagram illustrating an apparatus in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in other sequences than those illustrated or described herein. The implementations described in the exemplary embodiments below do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In the related technology, image cropping needs to select an area to be cropped in an image to be cropped by using a rectangular cropping frame, four edges of the cropping frame are respectively parallel to four edges of a mobile phone screen, and the cropping frame cannot rotate. The user can only perform operations such as translation, amplification, reduction, rotation and the like on the image to be cut. And carrying out the operations of enlarging and reducing on the cutting frame to select the area to be cut. When the magnification of the image to be cropped is too large, and a part of the image to be cropped is located outside the display range of the screen, in order to enable a user to observe the whole image to be cropped, in the prior art, the image to be cropped and the cropping frame are simultaneously rebounded, that is, the image to be cropped and the cropping frame are simultaneously reduced. However, the rebound operation causes black areas to appear in the screen of the mobile phone, and can cause the problem of display errors. And the user can not effectively observe the relation between the intercepted area to be cut and the whole image to be cut, thereby reducing the use experience of the user.
Fig. 1 is a flowchart illustrating an image cropping method, as shown in fig. 1, for use in image cropping, according to an exemplary embodiment, including the following steps.
In step 101, a first image to be cropped and first crop box center point coordinates are determined.
In the embodiment of the application, in order to enable a user to better observe the relationship between the region to be cropped and the first image to be cropped during screenshot, the first image to be cropped and the first cropping frame need to be zoomed. Since the user may not be accurate enough to translate and rotate the first image to be cropped by hand during screenshot, in order to correct the operation error of the user, the first image to be cropped needs to be scaled to ensure that the first cropping frame is included in the range of the first image to be cropped. In order to obtain the scaling, a linear equation of the edge of the first image to be cropped, the center point coordinate of the first image to be cropped and the center point coordinate of the first cropping frame need to be obtained.
In step 102, a first distance from the center point of the first cropping frame to the edge of the first image to be cropped is obtained, and the edge corresponding to the first distance is determined to be a first target edge.
In the embodiment of the application, a planar two-dimensional rectangular coordinate system is established with the center point of the first image to be cropped as an origin, and the distance from the center point of the first cropping frame to each edge of the first image to be cropped is calculated. Therefore, the shortest distance is selected as a first distance, and an edge corresponding to the first distance is determined as a first target edge.
In step 103, the first image to be cropped is enlarged, and a second image to be cropped and a second target edge are obtained, where an edge of the second image to be cropped corresponding to the first target edge is the second target edge, and a range of the second image to be cropped is larger than the first cropping frame.
In step 104, acquiring an image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge;
in the embodiment of the application, distances from a center point of the first cropping frame to four sides of the first image to be cropped are first obtained, and a first target side corresponding to a shortest first distance and the first distance is selected, where the first target side belongs to the first image to be cropped. And amplifying the first image to be cut, so that the range of a second image to be cut obtained after amplification is larger than that of the first cutting frame, and the zoom factor of the second image to be cut is not too large, and the minimum zoom factor is required to be obtained. I.e. the second image to be cropped just can wrap the first crop box. And then, acquiring a second distance from a second target edge corresponding to the first target edge to the center point of the first cutting frame. The second target edge belongs to the second image to be cut. And obtaining image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge, wherein the image editing configuration is used for processing the first cutting frame, so that the range of the first cutting frame after processing is smaller than that of the first image to be cut, and the situation that a user difficultly observes the relationship between the content in the cutting frame and the whole image to be cut is avoided.
Optionally, the image editing configuration comprises at least one of: a direction of translation; a translation distance; and (4) scaling.
In the embodiment of the application, the image can be translated in a fixed direction for a certain distance in the screen according to the translation direction and the translation distance; the image may be enlarged or reduced in the screen in an intermediate scale according to the scaling ratio. The image can be transformed in a two-dimensional plane according to the image editing configuration.
And obtaining the scaling according to the first distance and the second distance. And determining the translation distance and the translation direction according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the second cutting frame.
In step 105, the first cropping frame is processed according to the translation distance, the translation direction and the scaling ratio, and a second cropping frame is obtained.
In the embodiment of the present application, since the first image to be cropped is processed before, in actual processing, the first crop frame needs to be transformed by translation and rotation according to the translation distance, the translation direction, and the scaling. And carrying out reverse translation on the first cutting frame according to the translation distance and the translation direction, and carrying out directional scaling on the first cutting frame according to the scaling ratio, so that the second cutting frame can be obtained. At this time, the second cropping frame is within the range of the first image to be cropped and does not exceed the range of the first image to be cropped. And then, under the condition that the relative positions of the second cropping frame and the first image to be cropped are kept unchanged, the second cropping frame and the first image to be cropped are moved into a screen, so that the first image to be cropped and the screen are overlapped, namely the center point of the first image to be cropped and the center point of the screen are overlapped.
In step 106, the first image to be cropped is cropped according to the second cropping frame.
And after the second frame to be cut is obtained, cutting the first image to be cut according to the second cutting frame, and separating an area required to be cut by the user.
Through the embodiment of the application, the cutting frame is changed and moved to the first image to be cut, the problem of display error is avoided, a user can effectively observe the overall relation between the intercepted area to be cut and the image to be cut, and the use experience of the user is improved. Fig. 2 is a flowchart illustrating an image cropping method, according to an exemplary embodiment, for use in image cropping, as shown in fig. 2, further including the following steps in step 104 of fig. 1.
In step 201, a second distance from the center point of the first crop box to the second target edge is obtained.
In the embodiment of the application, the second image to be cut is obtained after the first image to be cut is enlarged. And the second image to be cut can just wrap the first cutting frame. And the edge of the second image to be cut corresponding to the first target edge is the second target edge. At this time, the scaling ratio can be calculated according to the second distance from the center point of the first cutting frame to the second target edge and the first distance.
In step 202, obtaining a scaling ratio according to the first distance and the second distance;
in the embodiment of the present application, the scaling ratio may be obtained by dividing the second distance by the first distance.
In step 203, a translation distance and a translation direction are determined according to coordinates of a center point of the first image to be cropped, a center point of the second image to be cropped and a center point of the second cropping frame.
In the embodiment of the application, the translation distance and the translation direction of the center point of the first image to be cut in the amplification process can be obtained according to an image position algorithm.
Fig. 3 is a flowchart illustrating a method for image cropping, as shown in fig. 3, for use in image cropping, according to an exemplary embodiment, wherein step 105 of fig. 1 comprises the following steps.
In step 301, the first cropping frame is moved according to the translation distance and the translation direction, and the first cropping frame is scaled according to the scaling ratio to obtain a second cropping frame;
in the embodiment of the present application, the scaling, the translation distance, and the translation direction acquired in the previous step are data required for processing the first image to be cropped. Because the first image to be cropped has the same size as the screen, the calculated amount of the processed image is reduced for convenience of processing, and during actual processing, the first cropping frame needs to be subjected to translation and rotation transformation according to the translation distance, the translation direction and the scaling. And carrying out reverse translation on the first cutting frame according to the translation distance and the translation direction, and carrying out directional scaling on the first cutting frame according to the scaling ratio, so that the second cutting frame can be obtained.
In step 302, the second cropping frame and the first image to be cropped are moved to make the center point of the first image to be cropped coincide with the screen center point, wherein the relative positions of the second cropping frame and the first image to be cropped are unchanged.
In the embodiment of the application, after the first cropping frame is translated and zoomed, the second cropping frame is within the range of the first image to be cropped and does not exceed the range of the first image to be cropped. And then, under the condition that the relative positions of the second cropping frame and the first image to be cropped are kept unchanged, the second cropping frame and the first image to be cropped are moved into a screen, so that the first image to be cropped and the screen are overlapped, namely the center point of the first image to be cropped and the center point of the screen are overlapped.
Optionally, the center point of the image to be cut is the center point of the canvas of the image to be cut.
In this embodiment of the application, the center point may be a canvas center point, that is, a geometric center point, of the image to be cut. After the translation distance and the translation direction are determined according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the first cutting frame, the second cutting frame obtained after the first cutting frame is processed according to the translation distance and the translation direction is closer to the center point of the second image to be cut.
In a possible embodiment, when the image to be cut is a rectangle, the center point of the canvas is the geometric center of the rectangle, that is, the intersection point of the diagonals of the rectangle.
Optionally, the center point of the image to be cropped is a center point of a key content area in the image to be cropped, wherein the step of acquiring the key content area includes: and acquiring the content weight of the image to be cut, and acquiring the key content area according to the content weight.
In the embodiment of the application, in order to enable the second cutting frame to cut out more important contents in the image to be cut out. And after the trained neural network is used for analyzing the image to be cut, such as encoding, decoding and the like, dividing the image to be cut into a plurality of content areas, wherein the weight of pixels in each content area is approximate. And obtaining the content weight of each content area, wherein the content weight represents the importance degree of the content area. And taking the gravity center of the content area with the highest content weight as the center point of the image to be cut. After the translation distance and the translation direction are determined according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the first cutting frame, the second cutting frame obtained after the first cutting frame is processed according to the translation distance and the translation direction is closer to the key content of the second image to be cut.
Fig. 4 is a block diagram illustrating an image cropping device according to an exemplary embodiment. Referring to fig. 4, the apparatus includes a coordinate determination module 410, a target edge determination module 420, an enlargement module 430, an edit configuration acquisition module 440, a processing module 450, and a cropping module 460.
A coordinate determining module 410, configured to determine coordinates of a center point of the first cropping frame and the first image to be cropped;
a target edge determining module 420, configured to obtain a shortest first distance from the center point of the first cropping frame to the edge of the first image to be cropped, and determine an edge corresponding to the first distance as a first target edge;
the enlarging module 430 is configured to enlarge the first image to be cut, and obtain a second image to be cut and a second target edge, where an edge of the second image to be cut corresponding to the first target edge is the second target edge, and a range of the second image to be cut is larger than the first cutting frame;
an editing configuration obtaining module 440, configured to obtain an image editing configuration according to the first crop box center point coordinate, the first target edge, and the second target edge;
the processing module 450 is configured to process the first crop box according to the translation distance, the translation direction, and the scaling ratio, and obtain a second crop box;
and the cropping module 460 is configured to crop the first image to be cropped according to the second cropping frame.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 5 is a block diagram illustrating an apparatus 500 for image cropping, according to an example embodiment. For example, the apparatus 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, the apparatus 500 may include one or more of the following components: a processing component 502, a memory 504, a power component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 502 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operation at the device 500. Examples of such data include instructions for any application or method operating on device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 506 provides power to the various components of the device 500. The power components 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 500.
The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 500 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, audio component 510 includes a Microphone (MIC) configured to receive external audio signals when apparatus 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 514 may detect an open/closed state of the device 500, the relative positioning of the components, such as a display and keypad of the apparatus 500, the sensor assembly 514 may also detect a change in the position of the apparatus 500 or a component of the apparatus 500, the presence or absence of user contact with the apparatus 500, orientation or acceleration/deceleration of the apparatus 500, and a change in the temperature of the apparatus 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the apparatus 500 and other devices in a wired or wireless manner. The apparatus 500 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the apparatus 500 to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
FIG. 6 is a block diagram illustrating an apparatus 600 for image cropping, according to an example embodiment. For example, the apparatus 600 may be provided as a server. Referring to fig. 6, the apparatus 600 includes a processing component 622 that further includes one or more processors and memory resources, represented by memory 632, for storing instructions, such as applications, that are executable by the processing component 622. The application programs stored in memory 632 may include one or more modules that each correspond to a set of instructions. Further, the processing component 622 is configured to execute instructions to perform the method … … described above
The apparatus 600 may also include a power component 626 configured to perform power management of the apparatus 600, a wired or wireless network interface 650 configured to connect the apparatus 600 to a network, and an input/output (I/O) interface 656. The apparatus 600 may operate based on an operating system stored in the memory 632, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (10)
1. An image cropping method, comprising:
determining coordinates of a first image to be cut and a center point of a first cutting frame;
acquiring a first distance from the center point of the first cutting frame to the edge of a first image to be cut, and determining an edge corresponding to the first distance as a first target edge;
amplifying the first image to be cut to obtain a second image to be cut and a second target edge, wherein the edge of the second image to be cut corresponding to the first target edge is the second target edge, and the range of the second image to be cut is larger than that of the first cutting frame;
acquiring image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge;
processing the first cutting frame according to the image editing configuration to obtain a second cutting frame;
and cutting the first image to be cut according to the second cutting frame.
2. The method of claim 1, wherein the image editing configuration comprises at least one of:
a direction of translation;
a translation distance;
and (4) scaling.
3. The method of claim 2, wherein obtaining an image editing configuration based on the first crop box center point coordinate, a first target edge, and the second target edge comprises:
acquiring a second distance from the center point of the first cutting frame to the second target edge;
obtaining the scaling according to the first distance and the second distance;
and determining the translation distance and the translation direction according to the coordinates of the center point of the first image to be cut, the center point of the second image to be cut and the center point of the first cutting frame.
4. The method according to claim 3, wherein the processing the first crop box according to the image editing configuration to obtain a second crop box specifically comprises:
moving the first cutting frame according to the translation distance and the translation direction, and scaling the first cutting frame according to the scaling ratio to obtain a second cutting frame;
and moving the second cropping frame and the first image to be cropped to enable the center point of the first image to be cropped to be superposed with the center point of the screen, wherein the relative positions of the second cropping frame and the first image to be cropped are unchanged.
5. The method of claim 4, wherein the image center point to be cropped is a canvas center point of the image to be cropped.
6. The method according to claim 4, wherein the central point of the image to be cropped is a central point of a key content area in the image to be cropped, and the step of obtaining the key content area comprises: and acquiring the content weight of the image to be cut, and acquiring the key content area according to the content weight.
7. An image cropping device, comprising:
the coordinate determination module is used for determining the coordinates of the first image to be cut and the center point of the first cutting frame;
the target edge determining module is used for acquiring a first distance from the center point of the first cutting frame to the edge of the first image to be cut, and determining an edge corresponding to the first distance as a first target edge;
the amplifying module is used for amplifying the first image to be cut to obtain a second image to be cut and a second target edge, wherein the edge of the second image to be cut corresponding to the first target edge is the second target edge, and the range of the second image to be cut is larger than that of the first cutting frame;
the editing configuration acquisition module is used for acquiring image editing configuration according to the coordinates of the center point of the first cutting frame, the first target edge and the second target edge;
the processing module is used for processing the first cutting frame according to the translation distance, the translation direction and the scaling to obtain a second cutting frame;
and the cutting module is used for cutting the first image to be cut according to the second cutting frame.
8. An image cropping electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image cropping method of any of claims 1 to 6.
9. A non-transitory computer readable storage medium having instructions therein which, when executed by a processor of an image cropping electronic device, enable the image cropping electronic device to perform the image cropping method of any of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210234088.8A CN114612485A (en) | 2022-03-10 | 2022-03-10 | Image clipping method and device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210234088.8A CN114612485A (en) | 2022-03-10 | 2022-03-10 | Image clipping method and device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114612485A true CN114612485A (en) | 2022-06-10 |
Family
ID=81862055
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210234088.8A Pending CN114612485A (en) | 2022-03-10 | 2022-03-10 | Image clipping method and device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114612485A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024087643A1 (en) * | 2022-10-27 | 2024-05-02 | 上海幻电信息科技有限公司 | Video cropping method and apparatus, electronic device, and storage medium |
-
2022
- 2022-03-10 CN CN202210234088.8A patent/CN114612485A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024087643A1 (en) * | 2022-10-27 | 2024-05-02 | 上海幻电信息科技有限公司 | Video cropping method and apparatus, electronic device, and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6134446B2 (en) | Image division method, image division apparatus, image division device, program, and recording medium | |
US11368632B2 (en) | Method and apparatus for processing video, and storage medium | |
CN109948494B (en) | Image processing method and device, electronic equipment and storage medium | |
CN108108418B (en) | Picture management method, device and storage medium | |
CN108062547B (en) | Character detection method and device | |
CN107888984B (en) | Short video playing method and device | |
CN104238911B (en) | Load icon display method and device | |
EP2975574B1 (en) | Method, apparatus and terminal for image retargeting | |
CN112013844B (en) | Method and device for establishing indoor environment map | |
CN109034150B (en) | Image processing method and device | |
CN106485660B (en) | Electronic map zooming method and device | |
CN111523346A (en) | Image recognition method and device, electronic equipment and storage medium | |
US9665925B2 (en) | Method and terminal device for retargeting images | |
CN108596957B (en) | Object tracking method and device | |
CN107730443B (en) | Image processing method and device and user equipment | |
CN114612485A (en) | Image clipping method and device and storage medium | |
US11252341B2 (en) | Method and device for shooting image, and storage medium | |
EP4304190A1 (en) | Focus chasing method, electronic device, and storage medium | |
CN114430457B (en) | Shooting method, shooting device, electronic equipment and storage medium | |
CN114666490B (en) | Focusing method, focusing device, electronic equipment and storage medium | |
CN105808102B (en) | Add the method and device of frame | |
CN114422687B (en) | Preview image switching method and device, electronic equipment and storage medium | |
CN108366237B (en) | Projection image adjusting method and device and computer readable storage medium | |
CN114418865A (en) | Image processing method, device, equipment and storage medium | |
CN107295229B (en) | The photographic method and device of mobile terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |