WO2022242397A1 - 一种图像处理方法、装置及计算机可读存储介质 - Google Patents

一种图像处理方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2022242397A1
WO2022242397A1 PCT/CN2022/087785 CN2022087785W WO2022242397A1 WO 2022242397 A1 WO2022242397 A1 WO 2022242397A1 CN 2022087785 W CN2022087785 W CN 2022087785W WO 2022242397 A1 WO2022242397 A1 WO 2022242397A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
information
image
size information
processed
Prior art date
Application number
PCT/CN2022/087785
Other languages
English (en)
French (fr)
Inventor
刘军煜
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2022242397A1 publication Critical patent/WO2022242397A1/zh
Priority to US18/073,343 priority Critical patent/US20230094362A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20224Image subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Definitions

  • the present application relates to the field of computer technology, in particular to an image processing method, device and computer-readable storage medium.
  • An embodiment of the present application provides an image processing method, including:
  • the target size information is size information of a thumbnail to be generated corresponding to the image to be processed
  • the aspect ratio of the target image is the same as the aspect ratio of the target size information
  • Scaling the target image to the target size information to generate the thumbnail image with the target size information.
  • the embodiment of the present application also provides an image processing device, including:
  • an acquisition unit configured to acquire the image to be processed and the corresponding size information of the image to be processed
  • a first determining unit configured to determine the target center point of the image to be processed according to the position information of the facial feature information in the image to be processed;
  • a second determining unit configured to determine cropping size information according to an aspect ratio relationship between the size information and target size information, where the target size information is the size of the thumbnail to be generated and corresponding to the image to be processed information;
  • a cropping unit configured to crop the image to be processed based on the target center point and the cropping size information to obtain a target image, the aspect ratio of the target image is the same as the aspect ratio of the target size information;
  • a scaling unit configured to scale the target image to the target size information, and generate the thumbnail image with the target size information.
  • An embodiment of the present application further provides a computer-readable storage medium, where a plurality of instructions are stored in the computer-readable storage medium, and the instructions are suitable for being loaded by a processor to execute the steps in the above image processing method.
  • the embodiment of the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the above-mentioned image processing is realized when the processor executes the computer program steps in the method.
  • the embodiment of the present application also provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a storage medium.
  • the processor of the computer device reads the computer instructions from the storage medium, and the processor executes the computer instructions, so that the computer performs the steps in the above-mentioned image processing method.
  • FIG. 1 is a schematic diagram of a scene of an image processing system provided by an embodiment of the present application
  • FIG. 2 is a schematic flow chart of an image processing method provided in an embodiment of the present application.
  • Fig. 3 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG. 4a is a schematic diagram of a scene of an image processing method provided by an embodiment of the present application.
  • FIG. 4b is a schematic diagram of another scene of the image processing method provided by the embodiment of the present application.
  • FIG. 4c is a schematic diagram of another scene of the image processing method provided by the embodiment of the present application.
  • FIG. 4d is a schematic diagram of another scene of the image processing method provided by the embodiment of the present application.
  • FIG. 4e is a schematic diagram of another scene of the image processing method provided by the embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an image processing device provided in an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a server provided by an embodiment of the present application.
  • Embodiments of the present application provide an image processing method, device, and computer-readable storage medium, which can improve image processing efficiency.
  • FIG. 1 is a schematic diagram of the scene of the image processing system provided by the embodiment of the present application, including: terminal 11 and server 12 (the image processing system can also include other terminals except terminal 11, the specific number of terminals Not limited here), the terminal 11 and the server 12 can be connected through a communication network, and the communication network can include a wireless network and a wired network, wherein the wireless network includes a wireless wide area network, a wireless local area network, a wireless metropolitan area network, and a wireless personal network. One or more combinations of nets.
  • the network includes network entities such as routers and gateways, which are not shown in the figure.
  • the terminal 11 can exchange information with the server 12 through the communication network, for example, the terminal 11 sends the image to be processed to the server 12 through the client.
  • the image processing system may include an image processing device, and the image processing device may specifically be integrated in a computer device, the computer device may be a terminal 11 or a server 12, and the terminal 11 may be a mobile phone, a tablet computer, a notebook computer, a smart TV , wearable smart devices, desktop computers and other equipment.
  • the server 12 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing Cloud servers for basic cloud computing services such as cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
  • the server 12 can obtain the image to be processed and the corresponding size information of the image to be processed; determine the center point of the target according to the position information of the facial feature information in the image to be processed; The aspect ratio relationship between the information determines the cropping size information; based on the target center point and the cropping size information, the image to be processed is cropped to obtain the target image, and the aspect ratio of the target image is the same as that of the target size information ;Scale the target image to the target size information.
  • Terminal 11 can comprise client, and this client can be video client, game client, instant messaging client and document editing client etc., and terminal 11 can send the video frame that carries out game in the game client as image to be processed to server 12.
  • the embodiment of the present application provides an image processing method, which can be executed by the terminal or the server, or jointly executed by the terminal and the server; the embodiment of the present application takes the image processing method executed by the server as an example for illustration.
  • FIG. 2 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • the image processing method includes:
  • step 101 an image to be processed and size information corresponding to the image to be processed are obtained.
  • the image to be processed can be a game picture in the game client, a picture of a certain frame in the video client or a picture in the instant messaging client, etc.
  • the format of the image to be processed can be a bitmap (Bitmap, bmp), JPEG (Joint Photographic Experts Group), etc., are not specifically limited here.
  • the thumbnail In order to attract users to watch the content such as the video or game corresponding to the image to be processed, it is necessary to make a thumbnail corresponding to the image to be processed.
  • the thumbnail generally has a fixed size, and the fixed size is different from the size ratio of the image to be processed.
  • the thumbnail is a part of the image to be processed, that is, the image to be processed needs to be cropped. Cutting the image to be processed manually is relatively inefficient. Therefore, in order to realize subsequent automatic cutting in the embodiment of the present application, the image to be processed and the corresponding size information of the image to be processed can be obtained in advance.
  • the size information can be width multiplied by height, For example 1280 pixels times 720 pixels.
  • step 102 the target center point is determined according to the position information of the facial feature information in the image to be processed.
  • the face will be cropped as the main body of the image to be processed, so the face area needs to be reserved as the target center point of the image to be processed.
  • facial feature information can be recognized in combination with computer vision technology.
  • This computer vision technology (Computer Vision, CV) is a science that studies how to make a machine "see”. And the computer replaces the human eye to carry out machine vision such as recognition, tracking and measurement of the target, and further performs graphic processing, so that the computer processing becomes an image that is more suitable for human eye observation or transmission to the instrument for detection.
  • computer vision studies related theories and technologies trying to build artificial intelligence systems that can obtain information from images or multidimensional data.
  • Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content/behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and maps It also includes common face recognition, fingerprint recognition and other biometric recognition technologies.
  • the face feature information may be feature expression information of facial features, and the center point of the position information of the face feature information may be used as the target center point, so that the face can be used as the subject for subsequent cropping.
  • the step of determining the target center point according to the position information of the face feature information in the image to be processed may include:
  • the multiple identification frames are connected to generate a target connection frame, and the target center point is determined according to the target connection frame.
  • the face feature information in the image to be processed can be identified through Convolutional Neural Networks (CNN), which can be constructed by imitating the biological visual perception mechanism, so it can be used to identify The face feature information in the image to be processed, and the face feature information can be selected with a rectangular or circular identification box.
  • CNN Convolutional Neural Networks
  • the face in the image to be processed can be single or multiple, when there are multiple faces, multiple faces need to be displayed together as the main body, so that the face in the image to be processed can be detected in advance Contains single or multiple identification boxes, each identification box represents a face.
  • each identification box represents a face.
  • the image to be processed contains multiple identification frames
  • the multiple identification frames can be connected to form a target connection frame area, and the center point of the target connection frame can be used as The target center point ensures that subsequent cropping can keep as many faces as possible as the main body.
  • step 103 cropping size information is determined according to the aspect ratio relationship between the size information and the target size information.
  • the target size information is the size information of the thumbnail image corresponding to the image to be processed (that is, the poster image) to be generated, and is the size information of the image desired by the system or the user.
  • the width Aspect ratio refers to the ratio between the width and height of an image.
  • the size of the image to be processed can be directly scaled to the size of the thumbnail to realize thumbnail creation.
  • the aspect ratio of the image to be processed Different from the aspect ratio of the thumbnail, in order to realize the production of the thumbnail in the embodiment of the present application, the aspect ratio of the image to be processed can be converted to be the same as the aspect ratio of the thumbnail.
  • it can be fixed. Processes one side of the image and crops the other so that the cropped image has the same aspect ratio as the thumbnail.
  • the height side can be fixed and the width side can be cropped.
  • the cropped image has the same aspect ratio as the thumbnail.
  • the aspect ratio of the image to be processed is smaller than that of the thumbnail, you can fix the width side and crop the height side.
  • the image has the same aspect ratio as the thumbnail.
  • step 104 the image to be processed is cropped based on the target center point and cropping size information to obtain a target image.
  • the target center point in order to unify the aspect ratio of the image to be processed and the thumbnail, and realize the poster image of thumbnail size information, the target center point can be used as the relative reference center, that is, the target center point can be used as the cropping reference center, through the cropping
  • the size information is used to crop the image to be processed to obtain a target image with the same aspect ratio as that of the thumbnail.
  • step 105 the target image is scaled to the target size information.
  • the target image can be directly scaled to the target size information to generate a thumbnail with the target size information, that is, the following
  • the face is the main body and the poster image with the same size as the thumbnail is used as a publicity, so that the operator can process a large number of images more conveniently and quickly, and the target image scaled to the target size information is displayed, which can be treated well Images for publicity.
  • a custom layer or control may be added to the zoomed target image to increase the publicity effect.
  • the embodiment of the present application obtains the image to be processed and the corresponding size information of the image to be processed; determines the center point of the target according to the position information of the facial feature information in the image to be processed; The aspect ratio relationship determines the cropping size information; crops the image to be processed based on the target center point and the cropping size information to obtain the target image; scales the target image to the target size information.
  • the target center point of the image is determined according to the face feature information
  • the cropping size information is determined according to the aspect ratio relationship between the size information and the target size information for cropping to obtain a target image with an aspect ratio that meets the requirements.
  • the image is scaled to the target size information, and a thumbnail that meets the requirements is quickly generated.
  • the embodiment of the present application does not require manual intervention, which greatly improves the efficiency of image processing.
  • FIG. 3 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • the method flow may include:
  • step 201 the server acquires the image to be processed and the size information corresponding to the image to be processed.
  • the image to be processed 10 may be a frame of the XX video, in order to make a poster of the XX video for publicity, the embodiment of the present application may pre-acquire the image to be processed 10 and Corresponding size information of the image to be processed, the size information may be 1280 pixels multiplied by 720 pixels.
  • step 202 the server extracts the face feature information in the image to be processed through the trained multi-task convolutional neural network model, and determines the corresponding identification frame according to the position information of the face feature information.
  • the multi-task convolutional neural network is a multi-task neural network model for face detection tasks.
  • This model mainly uses three cascaded networks, and uses candidate boxes plus classification
  • the idea of the machine is used to perform fast and efficient face detection.
  • the position information marks the identification frame 11 (candidate frame) and the identification frame 12, the identification frame can be a rectangle, and the identification frame contains the face feature information of a single face.
  • step 203 when the server detects that a single identification frame is included in the image to be processed, the target center point is determined according to the single identification frame.
  • the center point of the rectangle of the single identification frame may be directly used as the target center point.
  • step 204 when the server detects that the image to be processed contains multiple identification frames, connect the multiple identification frames to generate a target connection frame, and determine the target center point according to the target connection frame.
  • the server detects that the image 10 to be processed contains a plurality of identification frames, that is, the identification frame 11 and the identification frame 12, the identification frame 11 and the identification frame 12 are connected to generate a containing identification frame.
  • the target connection frame 13 of the frame 11 and the identification frame 12, and the center point of the target connection frame 13 is used as the target center point 14, so as to ensure that the subsequent cropping can keep as many faces as possible as the main body.
  • step 205 when the server detects that the aspect ratio of the size information is greater than the aspect ratio of the target size information, acquire the first height information of the size information, the second width information of the target size information, and the second height of the target size information information, calculating the third width information based on the first height information, the second width information and the second height information, and determining the cropping size information according to the third width information and the first height information.
  • the aspect ratio of the image to be processed is different from the aspect ratio of the thumbnail image (that is, the poster image).
  • the aspect ratio of the image to be processed can be converted to Same aspect ratio as the thumbnail, specifically:
  • the first width information of the image to be processed is w and the first height information is h
  • the second width information of the target size information of the thumbnail is w' and the second height information is h'
  • the ratio is equal to the aspect ratio w'/h' of the target size information, and using the w1 and h as the cropping size information to crop the image to be processed can make the cropped image have the same aspect ratio as the thumbnail.
  • step 206 when the server detects that the aspect ratio of the size information is smaller than the aspect ratio of the target size information, acquire the first width information of the size information, the second width information of the target size information, and the second height of the target size information information, calculate the third height information based on the first width information, the second width information and the second height information, and determine the cropping size information according to the third height information and the first width information.
  • the ratio of is equal to the aspect ratio w'/h' of the target size information, and the w and h1 are used as the cropping size information to crop the image to be processed, so that the cropped image has the same aspect ratio as the thumbnail.
  • step 207 the server crops the image to be processed according to the cropping size information to obtain a cropped image.
  • the server may use the target center point as a cropping reference center, and crop the image to be processed according to the cropping size information, to obtain a cropped image framed by a dashed line.
  • step 208 when the server detects that the position of the target center point in the cropped image is in the upper half region of the cropped image, the cropped image is determined as the target image.
  • the server can detect in advance whether the target center point of the cropped image is in the The upper half area of the cropped image, when the server detects that the position of the target center point in the cropped image is in the upper half area of the cropped image, it means that the face is in the upper half area of the image, and the The cropped image is determined as the target image.
  • step 209 when the server detects that the position of the center point of the target in the cropped image is not in the upper half of the cropped image, obtain the first target identification frame corresponding to the target face feature information in the image to be processed .
  • the server when the server detects that the target center point in the cropped image is not in the upper half of the cropped image, it means that the face 21 is in the lower half of the image.
  • the embodiment of the present application can obtain the first target identification frame 22 corresponding to the target face feature information in the image to be processed, and the area of the first target identification frame can be determined by the coordinates of the upper left corner (x1, y1) and the coordinates of the lower right corner (x2, y2) to represent.
  • step 210 the server expands the first target logo frame by a preset multiple to obtain the expanded second target logo frame, and obtains the fourth width information, the fourth height information, and the second target size information of the second target logo frame. Width information and second height information for target size information.
  • the preset multiple can be 2 or 3 times, etc., and can be set according to the actual image processing situation or the user. Please continue to refer to FIG. 4d.
  • the preset multiple is 2 for illustration.
  • the first target mark frame 22 expands 2 times, obtains the second target mark frame 24 after expansion, the area of this second target mark frame 24 can be by the coordinate (x3, y3) of the upper left corner and the coordinate (x4, y4) of the lower right corner ) to indicate that since the aspect ratio of the second target logo frame is different from that of the thumbnail image, it is necessary to supplement the second target logo frame, that is, the fourth width information x4- of the second target logo frame can be obtained x3, fourth height information y4-y3, second width information w' of the target size information, and second height information h' of the target size information.
  • the server calculates the fifth height information based on the fourth width information, the second width information and the second height information, and determines the sixth height information according to the difference between the fifth height information and the fourth height information, according to The fourth width information and the sixth height information determine the size information of the additional frame, combine the second target identification frame with the additional frame to obtain a third target identification frame, and determine the third target identification frame as the target image.
  • the server can calculate the fifth height information through the formula h'(x4-x3)/w' based on the condition that the width of the second target identification frame 24 is fixed, and the fourth height information of the second target identification frame 24
  • the ratio of the width information to the calculated fifth height information is equal to the aspect ratio of the thumbnail, that is, the calculated fifth height information can make the second target logo frame 24 equal to the aspect ratio of the thumbnail .
  • the sixth height information is determined according to the difference between the fifth height information and the fourth height information, please also refer to FIG. 4e, and the second target identification is determined according to the fourth width information and sixth height information
  • the size information of the additional frame 25 connected below the frame 24, the second target identification frame 24 and the additional frame 25 are combined to obtain the third target identification frame, the aspect ratio of the third target identification frame is equal to the width of the thumbnail The height ratios are equal, and then the third target identification frame can be determined as the target image.
  • the server can select the color information from the border between the second target identification frame 24 and the additional frame 25, determine the target color information with the most color information, such as purple, and then use this Purple generates additional box 25 colors.
  • transparency gradient processing can also be performed between the middle position of the target image and the division position of the additional frame 25 .
  • the target image is deleted.
  • the target image in order to prevent the main body of the target image from exceeding the outside of the image to be processed, it is necessary to detect whether the area in the target image belongs to the image to be processed, that is, whether there is a part of the target image that does not belong to the image to be processed, such as the coordinates of the center point of the target Be (x5, y5), can calculate whether this target image has the region that exceeds this to-be-processed image according to the coordinate of this center point and the width and height of target image, when detecting that the region in this target image does not belong to this to-be-processed image, that is, when the target image has an area beyond the image to be processed, it means that the target image is unqualified and cannot be cropped, and the target image can be deleted.
  • the target image when it is detected that the area in the target image belongs to the processed image, that is, the target image does not exceed the area of the processed image, it means that the target image is qualified, and subsequent steps are performed.
  • step 212 when the server detects that the sharpness information of the scaled target image meets the preset threshold, the scaled target image is retained, a preset display control is added to the scaled target image, and the target image is scaled to the target size information.
  • the server can also filter the clarity of the target image, and filter the unclear target image to ensure the quality of the target image.
  • the embodiment of the present application can use the Laplacian of OpenCV (cross-platform computer vision and machine learning software library)
  • the (Laplace) operator calculation principle evaluates the sharpness information. The principle is that if the variance of an image is high, it means that the image has a wide range of responses, including class edges and non-class edges. This is a normal image. Representative of focused images. But if the variance is low, then there is a small spread of the response, which indicates that there are few edges in the image. And the blurrier the image, the fewer the edges. Therefore, it can be used to detect whether it is blurred, and the Laplacian operator can be used for edge detection. Therefore, a reasonable preset threshold can be set, for example, 0.8.
  • the server detects that the sharpness information of the scaled target image is greater than 0.8, that is, the sharpness information of the target image meets the preset threshold, the scaled target image can be retained, please continue to refer to Figure 4e, and the scaled A preset display control 26 is added to the final target image to enhance the publicity effect of the target image.
  • the target image can be scaled to the target size information. Since the aspect ratio is the same, the target image can be directly scaled to the size of the target size information, and a corresponding poster image can be generated for publicity without manual intervention. Improve the efficiency of image processing.
  • the embodiment of the present application obtains the image to be processed and the corresponding size information of the image to be processed; determines the center point of the target according to the position information of the facial feature information in the image to be processed; The aspect ratio relationship determines the cropping size information; crops the image to be processed based on the target center point and the cropping size information to obtain a target image; scales the target image to the target size information, and generates a thumbnail with the target size information.
  • the target center point of the image is determined according to the face feature information
  • the cropping size information is determined according to the aspect ratio relationship between the size information and the target size information for cropping to obtain a target image with an aspect ratio that meets the requirements.
  • the image is scaled to the target size information, and a thumbnail that meets the requirements is quickly generated.
  • the embodiment of the present application does not require manual intervention, which greatly improves the efficiency of image processing.
  • the target image when it is detected that the position of the center point of the target in the cropped image is not in the upper half of the cropped area, the target image is generated in an expanded manner to ensure that the face is always in the target image.
  • Reasonable location without manual follow-up modification, further improves the efficiency of image processing and ensures the effect of publicity.
  • the embodiment of the present application further provides a device based on the above image processing method.
  • the meanings of the nouns are the same as those in the above image processing method, and for specific implementation details, please refer to the description in the method embodiments.
  • FIG. 5 is a schematic structural diagram of an image processing device provided by an embodiment of the present application, wherein the image processing device may include an acquisition unit 301, a first determination unit 302, a second determination unit 303, a cropping unit 304, and a scaling unit 305 etc.
  • the acquiring unit 301 is configured to acquire the image to be processed and the corresponding size information of the image to be processed.
  • the first determining unit 302 is configured to acquire the image to be processed and the corresponding size information of the image to be processed.
  • the first determining unit 302 includes:
  • the obtaining subunit is used to obtain the identification frame corresponding to the face feature information in the image to be processed
  • the first determination subunit is used to determine the center point of the target according to the single identification frame when it is detected that the image to be processed contains a single identification frame;
  • the second determining subunit is configured to, when it is detected that the image to be processed contains a plurality of identification frames, connect the plurality of identification frames to generate a target connection frame, and determine the target center point according to the target connection frame.
  • the acquisition subunit is used for:
  • the face feature information in the image to be processed is extracted through the trained multi-task convolutional neural network model.
  • a corresponding identification frame is determined according to the position information of the facial feature information.
  • the second determining unit 303 is configured to determine cropping size information according to the aspect ratio relationship between the size information and target size information, where the target size information is the size of the thumbnail to be generated and corresponding to the image to be processed information.
  • the second determining unit 303 includes a third determining subunit, configured to:
  • the aspect ratio of the size information is greater than the aspect ratio of the target size information, acquiring the first height information of the size information, the second width information of the target size information, and the second height information of the target size information;
  • the cropping size information is determined according to the third width information and the first height information.
  • the second determining unit 303 further includes a fourth determining subunit, configured to:
  • the aspect ratio of the size information is smaller than the aspect ratio of the target size information, acquiring the first width information of the size information, the second width information of the target size information and the second height information of the target size information;
  • the cropping size information is determined according to the third height information and the first width information.
  • the cropping unit 304 is configured to crop the image to be processed based on the target center point and the cropping size information to obtain a target image, and the aspect ratio of the target image is the same as that of the target size information.
  • the clipping unit 304 includes:
  • a cropping subunit configured to crop the image to be processed according to the cropping size information to obtain a cropped image, which includes the target center point;
  • the fifth determination subunit is configured to determine the cropped image as the target image when it is detected that the position of the target center point in the cropped image is in the upper half region of the cropped image.
  • the cropping unit further includes:
  • the obtaining subunit is used to obtain the first target identification corresponding to the target face feature information in the image to be processed when it is detected that the position of the target center point in the cropped image is not in the upper half area of the cropped image frame;
  • the expansion subunit is used to expand the first target identification frame by a preset multiple to obtain an expanded second target identification frame;
  • the aspect ratio of the third target identification frame is the same as the aspect ratio of the target size information
  • the sixth determination subunit is configured to determine the third target identification frame as the target image.
  • the adding subunit is used for:
  • the fifth height information is calculated based on the fourth width information, the second width information and the second height information, and the ratio of the fourth width information of the second target logo frame to the calculated fifth height information is equal to the aspect ratio of the target size information;
  • the second target identification frame is combined with the additional frame to obtain a third target identification frame.
  • the device further includes a deletion unit, configured to:
  • the target image is deleted.
  • the scaling unit 305 is configured to scale the target image to target size information, and generate the thumbnail image with the target size information.
  • the device further includes an add-on unit for:
  • the zoomed target image When it is detected that the sharpness information of the zoomed target image satisfies a preset threshold, the zoomed target image is retained;
  • the embodiment of the present application obtains the image to be processed and the corresponding size information of the image to be processed through the acquisition unit 301; the first determination unit 302 determines the target center point according to the position information of the facial feature information in the image to be processed; the second The determination unit 303 determines the cropping size information according to the aspect ratio relationship between the size information and the target size information; the cropping unit 304 crops the image to be processed based on the target center point and the cropping size information to obtain the target image; the scaling unit 305 scales the target image To target size information, generate a thumbnail with the target size information.
  • the target center point of the image is determined according to the face feature information
  • the cropping size information is determined according to the aspect ratio relationship between the size information and the target size information for cropping to obtain a target image with an aspect ratio that meets the requirements.
  • the image is scaled to the target size information, and a thumbnail that meets the requirements is quickly generated.
  • the embodiment of the present application also provides a computer device, which can be a server or a terminal, as shown in Figure 6, which shows a schematic structural diagram of the server involved in the embodiment of the present application, specifically:
  • the computer device may include a processor 401 of one or more processing cores, a memory 402 of one or more computer-readable storage media, a power supply 403, an input unit 404 and other components.
  • a processor 401 of one or more processing cores may include a processor 401 of one or more processing cores, a memory 402 of one or more computer-readable storage media, a power supply 403, an input unit 404 and other components.
  • FIG. 6 is not limited to the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange different components. in:
  • the processor 401 is the control center of the computer equipment, and uses various interfaces and lines to connect various parts of the entire computer equipment, and runs or executes software programs and/or modules stored in the memory 402, and calls stored in the memory 402. Data, perform various functions of computer equipment and process data, so as to monitor the computer equipment as a whole.
  • the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user Interfaces and applications, etc., the modem processor mainly handles wireless communications. It can be understood that the foregoing modem processor may not be integrated into the processor 401 .
  • the memory 402 can be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402 .
  • the memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playback function, an image playback function, etc.); The data created by the use of the server, etc.
  • the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.
  • the memory 402 may further include a memory controller to provide the processor 401 with access to the memory 402 .
  • the computer device also includes a power supply 403 for supplying power to various components.
  • the power supply 403 can be logically connected to the processor 401 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.
  • the power supply 403 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
  • the computer device can also include an input unit 404, which can be used to receive input numeric or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
  • an input unit 404 which can be used to receive input numeric or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
  • the computer device may also include a display unit, etc., which will not be repeated here.
  • the processor 401 in the computer device loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the executable file stored in the The application programs in the memory 402, so as to realize the various method steps provided by the foregoing embodiments, are as follows:
  • the computer device in the embodiment of the present application can obtain the image to be processed and the corresponding size information of the image to be processed; determine the target center point according to the position information of the facial feature information in the image to be processed; The aspect ratio relationship between the information determines the cropping size information; crops the image to be processed based on the target center point and the cropping size information to obtain the target image; scales the target image to the target size information.
  • the target center point of the image is determined according to the face feature information
  • the cropping size information is determined according to the aspect ratio relationship between the size information and the target size information for cropping to obtain a target image with an aspect ratio that meets the requirements.
  • the image is scaled to the target size information, and a thumbnail that meets the requirements is quickly generated.
  • the embodiment of the present application does not require manual intervention, which greatly improves the efficiency of image processing.
  • an embodiment of the present application provides a computer-readable storage medium, which stores a plurality of instructions that can be loaded by a processor to perform the steps in any image processing method provided in the embodiments of the present application.
  • the command can perform the following steps:
  • a computer program product or computer program comprising computer instructions stored in a computer readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various implementation manners provided in the foregoing embodiments.
  • the computer-readable storage medium may include: a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and the like.

Abstract

本申请实施例公开了一种图像处理方法、装置及计算机可读存储介质,本申请实施例通过获取待处理图像和待处理图像相应的尺寸信息;根据待处理图像中的人脸特征信息的位置信息确定所述待处理图像的目标中心点;根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息;基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像;将目标图像缩放至目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。

Description

一种图像处理方法、装置及计算机可读存储介质
本申请要求于2021年5月17日提交中国专利局、申请号为202110534980.3名称为“一种图像处理方法、装置及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种图像处理方法、装置及计算机可读存储介质。
背景
随着电子技术的成熟,越来越多的数码产品产生、流行与普及,为广大百姓带来极大的便利,在日常生活中,用户可以通过数码产品随时拍摄出或者制作出属于自己的视频作品。
为了吸引用户观看视频,需要手动对视频作品中的图像进行选取和编辑,制作出合适的图像作为视频海报图进行投放。
技术内容
本申请实施例提供一种图像处理方法,包括:
获取待处理图像和所述待处理图像相应的尺寸信息;
根据所述待处理图像中的人脸特征信息的位置信息确定所述待处理图像的目标中心点;
根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息;
基于所述目标中心点和所述裁剪尺寸信息对所述待处理图像进行裁剪,得到目标图像,所述目标图像的宽高比与所述目标尺寸信息的宽高比相同;
将所述目标图像缩放至所述目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。
本申请实施例还提供一种图像处理装置,包括:
获取单元,用于获取待处理图像和所述待处理图像相应的尺寸信息;
第一确定单元,用于根据所述待处理图像中的人脸特征信息的位置信息确定所述待处理图像的目标中心点;
第二确定单元,用于根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息;
裁剪单元,用于基于所述目标中心点和所述裁剪尺寸信息对所述待处理图像进行裁剪,得到目标图像,所述目标图像的宽高比与所述目标尺寸信息的宽高比相同;
缩放单元,用于将所述目标图像缩放至所述目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有多条指令,所述指令适于处理器进行加载,以执行上述图像处理方法中的步骤。
本申请实施例还提供一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可以在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述图像处理方法中的步骤。
本申请实施例还提供一种计算机程序产品或计算机程序,所述计算机程序产品或计算机程序包括计算机指令,所述计算机指令存储在存储介质中。计算机设备的处理器从存储介质读取所述计算机指令,处理器执行所述计算机指令,使得所述计算机上述图像处理方法中的步骤。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的图像处理系统的场景示意图;
图2是本申请实施例提供的图像处理方法的流程示意图;
图3是本申请实施例提供的图像处理方法的另一流程示意图;
图4a为本申请实施例提供的图像处理方法的场景示意图;
图4b为本申请实施例提供的图像处理方法的另一场景示意图;
图4c为本申请实施例提供的图像处理方法的另一场景示意图;
图4d为本申请实施例提供的图像处理方法的另一场景示意图;
图4e为本申请实施例提供的图像处理方法的另一场景示意图;
图5是本申请实施例提供的图像处理装置的结构示意图;
图6是本申请实施例提供的服务器的结构示意图。
实施方式
将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
相关技术中,通过人工选取、制作合适的图像作为视频海报的过程比较繁琐和低效,造成图像处理的效率较低。本申请实施例提供一种图像处理方法、装置、及计算机可读存储介质,可以提升图像处理的效率。
请参阅图1,图1为本申请实施例所提供的图像处理系统的场景示意图,包括:终端11和服务器12(该图像处理系统还可以包括除终端11之外的其他终端,终端具体个数在此处不作限定),终端11与服务器12之间可以通过通信网络连接,该通信网络,可以包括无线网络以及有线网络,其中无线网络包括无线广域网、无线局域网、无线城域网、以及无线个人网中的一种或多种的组合。网络中包括路由器、网关等等网络实体,图中并未示意出。终端11可以通过通信网络与服务器12进行信息交互,比如终端11通过客户端将待处理图像发送至服务器12。
该图像处理系统可以包括图像处理装置,该图像处理装置具体可以集成在计算机设备中,该计算机设备可以为终端11或者服务器12等设备,该终端11可以为手机、平板电脑、笔记本电脑、智能电视、穿戴式智能设备、台式电脑等设备。以该图像处理方法由服务器12执行为例,该服务器12可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据和人工智能平台等基础云计算服务的云服务器。如图1所示,该服务器12可以获取待处理图像和该待处理图像相应的尺寸信息;根据该待处理图像中的人脸特征信息的位置信息确定目标中心点;根据该尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于该目标中心点和裁剪尺寸信息对该待处理图像进行裁剪,得到目标图像,该目标图像的宽高比与目标尺寸信息的宽高比相同;将该目标图像缩放至目标尺寸信息。
终端11可以包括客户端,该客户端可以是视频客户端、游戏客户端、即时通讯客户端和文档编辑客户端等,终端11可以将游戏客户端中进行游戏的视频帧作为待处理图像发送至服务器12。
需要说明的是,图1所示的图像处理系统的场景示意图仅仅是一个示例,本申请实施例描述的图像处理系统以及场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着图像处理系统的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
以下分别进行详细说明。
本申请实施例提供了一种图像处理方法,该方法可以由终端或服务器执行,也可以由终端和服务器共同执行;本申请实施例以图像处理方法由服务器执行为例来进行说明。
请参阅图2,图2是本申请实施例提供的图像处理方法的流程示意图。该图像处理方法包括:
在步骤101中,获取待处理图像和待处理图像相应的尺寸信息。
其中,该待处理图像可以为游戏客户端中的游戏图片、视频客户端中的某一帧的图片或者即时通讯客户端中的图片等等,该待处理图像的格式可以为位图(Bitmap,bmp),JPEG(Joint Photographic Experts Group)等等,此处不作具体限定。
为了吸引用户观看该待处理图像对应的视频或者游戏等内容,需要制作该待处理图像对应的缩略图,该缩略图也可以称为海报图,该海报图可以作为对该载体的宣传方式,由于缩略图一般具有固定的尺寸,该固定的尺寸与该待处理图像的尺寸比例不同,该缩略图为该待处理图像的一部分,即需要对该待处理图像进行裁剪。通过人工对待处理进行裁剪,效率比较差,因此,本申请实施例为了实现后续的自动裁剪,可以预先获取待处理图像以及该待处理图像相应的尺寸信息,该尺寸信息可以为宽度乘以高度,例如1280像素乘以720像素。
在步骤102中,根据待处理图像中的人脸特征信息的位置信息确定目标中心点。
其中,在实际的使用场景中,对于有人脸的待处理图像,人脸会作为待处理图像的主体进行裁剪,因此,人脸区域部分需要作为待处理图像的目标中心点进行优先保留。
在本申请实施例中,可以结合计算机视觉技术识别人脸特征信息,该计算机视觉技术(Computer Vision,CV)是一门研究如何使机器“看”的科学,更进一步的说,就是指用摄影机和电脑代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图形处理,使电脑处理成为更适合人眼观察或传送给仪器检测的图像。作为一个科学学科,计算机视觉研究相关的理论和技术,试图建立能够从图像或者多维数据中获取信息的人工智能系统。计算机视觉技术通常包括图像处理、图像识别、图像语义理解、图像检索、OCR、视频处理、视频语义理解、视频内容/行为识别、三维物体重建、3D技术、虚拟现实、增强现实、同步定位与地图构建等技术,还包括常见的人脸识别、指纹识别等生物特征识别技术。该人脸特征信息可以为人脸的五官具有的特征表达信息,可以将该人脸特征信息的位置信息的中心点作为目标中心点,进而实现后续可以将人脸作为主体进行裁剪。
在一些实施方式中,该根据待处理图像中的人脸特征信息的位置信息确定目标中心点的步骤,可以包括:
(1)获取该待处理图像中人脸特征信息相应的标识框;
(2)当检测到该待处理图像中包含单个标识框时,根据该单个标识框确定目标中心点;
(3)当检测到该待处理图像中包含多个标识框时,将该多个标识框连通,生成目标连接框,并根据该目标连接框确定目标中心点。
其中,可以通过卷积神经网络(Convolutional Neural Networks,CNN)识别出待处理图像中的人脸特征信息,该卷积神经网络可以仿造生物的视知觉(visual perception)机制构建,所以可以用于识别待处理图像中的人脸特征信息,并可以以矩形或者圆形的标识框选中该人脸特征信息。
进一步的,由于该待处理图像中的人脸可以为单个或者多个,当人脸为多个时,需要将多个人脸一并作为主体进行显示,以此,可以预先检测该待处理图像中包含单个或者多个标识框,每一标识框代表一个人脸。当检测到该待处理图像中包含单个标识框时,说明该待处理图像中只包含单个人脸,可以直接将该单个标识框的中心点作为目标中心点。
当检测到该待处理图像中包含多个标识框时,说明该待处理图像中包含多个人脸,可以将该多个标识框连通成为一个目标连接框区域,将该目标连接框的中心点作为目标中心点,保证后续裁剪可以尽量保留多个人脸作为主体。
在步骤103中,根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息。
其中,该目标尺寸信息为要生成的、与所述待处理图像对应的缩略图(即海报图)的尺寸信息,为系统或者用户希望得到的图像的尺寸信息,为了提升裁剪的效率,该宽高比指图像的宽度和高度之间的比率。
当该待处理图像与缩略图的宽高比一致时,可以直接将该待处理图像的尺寸缩放至缩略图的尺寸,实现缩略图制作,而实际的使用中,该待处理图像的宽高比与该缩略图的宽高比不同,本申请实施例为了实现缩略图的制作,可以将该待处理图像的宽高比转换至与该缩略图的宽高比相同,为了裁剪方便,可以固定待处理图像的一条边,对另一条边进行裁剪,使得裁剪后的图像与所缩略图的宽高比相同。
具体为当待处理图像的宽高比大于缩略图的宽高比时,可以固定高度边,对宽度边进行裁剪,假设待处理图像的宽高分别是w和h,缩略图的宽高分别是w’和h’,为了使得w/h=w’/h’,可以求出裁剪后的宽度w1=hw’/h’,以该w1和h作为裁剪尺寸信息对待处理图像进行裁剪,可以使得裁剪后的图像与缩略图的宽高比相同。
当待处理图像的宽高比小于缩略图的宽高比时,可以固定宽度边,对高度边进行裁剪,假设原图的宽高分别是w和h,裁图后的宽高分别是w’和h’,为了使得w/h=w’/h’,可以求出裁剪后的高度h1=wh’/w’,以该w和h1作为裁剪尺寸信息对待处理图像进行裁剪,可以使得裁剪后的图像与缩略图的宽高比相同。
在步骤104中,基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像。
其中,为了统一该待处理图像和缩略图的宽高比,实现制作缩略图尺寸信息的海报图,可以以该目标中心点作为相对参考中心,即将该目标中心点作为裁剪参考中心,通过该裁剪尺寸信息对该待处理图像进行裁剪,得到宽高比和缩略图的宽高比相同的目标图像。
在步骤105中,将目标图像缩放至目标尺寸信息。
其中,由于目标图像在经过裁剪之后的宽高比和目标图像的宽高比一致,所以可以直接将该目标图像缩放至目标尺寸信息,生成具有所述目标尺寸信息的缩略图,也即得到以人脸作为主体且与该缩略图大小一致的海报图作为宣传,使得运营人员可以更加方便且快捷的处理大批图像,且以该缩放至目标尺寸信息的目标图像进行展示,可以很好的对待处理图像进行宣传。
在一实施方式中,可以为该缩放后的目标图像添加自定义的图层或者控件,增加宣传效果。
由上述可知,本申请实施例通过获取待处理图像和待处理图像相应的尺寸信息;根据待处理图像中的人脸特征信息的位置信息确定目标中心点;根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像;将目标图像缩放至目标尺寸信息。以此,根据人脸特征信息确定图像的目标中心点,并根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息进行裁剪,得到宽高比符合要求的目标图像,并将目标图像缩放至目标尺寸信息,快速生成符合要求的缩略图,相对于需要人工进行海报图选取和编辑的方案,本申请实施例无需人工干涉,极大的提升了图像处理的效率。
结合上述实施例所描述的方法,以下将举例作进一步详细说明。
在本实施例中,将以该图像处理装置具体集成在服务器中为例进行说明,具体参照以下说明。
请参阅图3,图3为本申请实施例提供的图像处理方法的另一流程示意图。该方法流程可以包括:
在步骤201中,服务器获取待处理图像和待处理图像相应的尺寸信息。
其中,请一并参阅图4a所示,该待处理图像10可以为XX视频中的一帧图片,为了制作该XX视频的海报图用于宣传,本申请实施例可以预先获取待处理图像10和待处理图像相应的尺寸信息,该尺寸信息可以为1280像素乘以720像素。
在步骤202中,服务器通过训练后的多任务卷积神经网络模型提取待处理图像中的人脸特征信息,根据人脸特征信息的位置信息确定相应的标识框。
其中,该多任务卷积神经网络(Multi-task convolutional neural network,MTCNN)为用于人脸检测任务的多任务神经网络模型,该模型主要采用了三个级联的网络,采用候选框加分类器的思想,进行快速高效的人脸检测,以此,请继续参阅图4a所示,服务器可以通过训练后的MTCNN模型提取待处理图像10中的人脸特征信息,进而根据该人脸特征信息的位置信息标定标识框11(候选框)和标识框12,该标识框可以为矩形,该标识框包含单一人脸的人脸特征信息。
在步骤203中,当服务器检测到待处理图像中包含单个标识框时,根据单个标识框确定目标中心点。
其中,当服务器检测到待处理图像中只包含单个标识框时,可以直接将该单个标识框的矩形中心点作为目标中心点。
在步骤204中,当服务器检测到待处理图像中包含多个标识框时,将多个标识框连通,生成目标连接框,并根据目标连接框确定目标中心点。
其中,请一并参阅图4b所示,当服务器检测到待处理图像10中包含多个标识框,即标识框11和标识框12时,将该标识框11和标识框12连通,生成包含标识框11和标识框12的目标连接框13,并将该目标连接框13的中心点作为目标中心点14,保证后续裁剪可以尽量保留多个人脸作为主体。
在步骤205中,当服务器检测到尺寸信息的宽高比大于目标尺寸信息的宽高比时,获取尺寸信息的第一高度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息,基于第一高度信息、第二宽度信息和第二高度信息计算出第三宽度信息,根据第三宽度信息和第一高度信息确定裁剪尺寸信息。
实际的使用中,该待处理图像的宽高比与缩略图(即海报图)的宽高比不同,本申请实施例为 了实现缩略图的制作,可以将该待处理图像的宽高比转换至与该缩略图的宽高比相同,具体为:
请一并参阅图4c所示,该待处理图像的第一宽度信息为w和第一高度信息为h,缩略图的目标尺寸信息的第二宽度信息为w’和第二高度信息为h’,当服务器检测到尺寸信息的宽高比w/h大于缩略图的目标尺寸信息的宽高比w’/h时’,可以固定第一高度信息h边,对第一宽度信息w边进行裁剪,为了使得w/h=w’/h’,可以求出裁剪后的第三宽度信息w1=hw’/h’,计算出的所述第三宽度信息w1与所述第一高度信息h的比值等于所述目标尺寸信息的宽高比w’/h’,以该w1和h作为裁剪尺寸信息对待处理图像进行裁剪,可以使得裁剪后的图像与缩略图的宽高比相同。
在步骤206中,当服务器检测到尺寸信息的宽高比小于目标尺寸信息的宽高比时,获取尺寸信息的第一宽度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息,基于第一宽度信息、第二宽度信息和第二高度信息计算出第三高度信息,根据第三高度信息和第一宽度信息确定裁剪尺寸信息。
其中,当服务器检测到尺寸信息的宽高比w/h小于缩略图的目标尺寸信息的宽高比w’/h’时,可以固定第一宽度信息w边,对第一高度信息h边进行裁剪,为了使得w/h=w’/h’,可以求出裁剪后的第三高度信息h1=wh’/w’,所述第一宽度信息w与计算出的所述第三高度信息h1的比值等于所述目标尺寸信息的宽高比w’/h’,以该w和h1作为裁剪尺寸信息对待处理图像进行裁剪,可以使得裁剪后的图像与缩略图的宽高比相同。
在步骤207中,服务器根据裁剪尺寸信息对待处理图像进行裁剪,得到裁剪后的图像。
其中,请一并参阅图4c所示,服务器可以将该目标中心点作为裁剪参考中心,根据裁剪尺寸信息对待处理图像进行裁剪,得到虚线框框定的裁剪后的图像。
在步骤208中,当服务器检测到裁剪后的图像中的目标中心点的位置处于裁剪后的图像的上半区域时,将裁剪后的图像确定为目标图像。
其中,请一并参阅图4d所示,裁剪后的图像23中包含中线C,该中线C将该裁剪后的图像分为上半区域和下半区域,在实际的场景中,当人脸处于下半区域时进行裁剪,会导致缩略图中的人脸处于图像下半区域,影响缩略图的宣传效果和美观,以此,服务器可以预先检测该裁剪后的图像的目标中心点的位置是否处于裁剪后的图像的上半区域,当服务器检测到裁剪后的图像中的目标中心点的位置处于裁剪后的图像的上半区域时,说明该人脸处于图像的上半区域,可以直接将该裁剪后的图像确定为目标图像。
在步骤209中,当服务器检测到裁剪后的图像中的目标中心点的位置不处于裁剪后的图像的上半区域时,获取待处理图像中的目标人脸特征信息相应的第一目标标识框。
其中,请一并参阅图4d所示,当服务器检测到裁剪后的图像中的目标中心点不处于裁剪后的图像的上半区域时,说明该人脸21处于图像的下半区域。为了避免影响缩略图的宣传效果和美观,本申请实施例可以获取待处理图像中的目标人脸特征信息相应的第一目标标识框22,该第一目标标识框的区域可以由左上角的坐标(x1,y1)和右下角的坐标(x2,y2)进行表示。
在步骤210中,服务器将第一目标标识框扩充预设倍数,得到扩充后的第二目标标识框,获取第二目标标识框的第四宽度信息、第四高度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息。
其中,该预设倍数可以为2或者3倍等,可以根据实际图像处理情况或者用户进行设置,请继续参阅图4d,在本申请实施例中以该预设倍数为2进行说明,服务器可以将第一目标标识框22扩充2倍,得到扩充后的第二目标标识框24,该第二目标标识框24的区域可以由左上角的坐标(x3,y3)和右下角的坐标(x4,y4)进行表示,由于该第二目标标识框的宽高比与缩略图的宽高比不同,需要对该第二目标标识框进行补充,即可以获取第二目标标识框的第四宽度信息x4-x3、第四高度信息y4-y3、目标尺寸信息的第二宽度信息w’和目标尺寸信息的第二高度信息h’。
在步骤211中,服务器基于第四宽度信息、第二宽度信息和第二高度信息计算出第五高度信息,根据第五高度信息和第四高度信息之间的差值确定第六高度信息,根据第四宽度信息和第六高度信息确定附加框的尺寸信息,将第二目标标识框合并附加框,得到第三目标标识框,将第三目标标识框确定为目标图像。
其中,服务器可以基于该第二目标标识框24的宽度固定的情况下,通过公式h’(x4-x3)/w’计算出第五高度信息,该第二目标标识框24的所述第四宽度信息与计算出的所述第五高度信息的比值等于缩略图的宽高比,也即计算出的所述第五高度信息可以使该第二目标标识框24与缩略图的宽高比相等。
进一步的,根据该第五高度信息和第四高度信息之间的差值确定第六高度信息,请一并参阅图 4e所示,根据该第四宽度信息和第六高度信息确定第二目标标识框24下方连接的附加框25的尺寸信息,将该第二目标标识框24和附加框25进行合并,可以得到第三目标标识框,该第三目标标识框的宽高比与缩略图的宽高比相等,进而可以将该第三目标标识框确定为目标图像。
在一实施方式中,为了目标图像的美观效果,服务器可以从第二目标标识框24中选取与附加框25交接边中选取颜色信息,确定颜色信息最多的目标颜色信息,例如紫色,进而以该紫色生成附加框25的颜色。并且,为了进一步的增加目标图像的美观效果,还可以从目标图像的中间位置到附加框25的分割位置之间做透明度渐变处理。
在一实施方式中,当检测到该目标图像中的区域不属于该待处理图像时,删除该目标图像。
其中,为了避免目标图像的主体超出待处理图像的外部,需要检测该目标图像中的区域是否属于该待处理图像,即目标图像是否有不属于待处理图像的部分,例如该目标中心点的坐标为(x5,y5),可以根据该中心点的坐标和目标图像的宽度和高度计算出该目标图像是否有超出该待处理图像的区域,当检测到该目标图像中的区域不属于该待处理图像时,即目标图像有超出该待处理图像的区域时,说明该目标图像不合格,无法裁剪,可以将该目标图像删除。相应的,当检测到该目标图像中的区域属于该处理图像时,即目标图像没有超出该处理图像的区域,说明该目标图像合格,执行后续步骤。
在步骤212中,当服务器检测到缩放后的目标图像的清晰度信息满足预设阈值时,保留缩放后的目标图像,为缩放后的目标图像添加预设显示控件,将目标图像缩放至目标尺寸信息。
其中,服务器还可以对该目标图像的清晰度进行筛选,将不清晰的目标图像进行过滤,保证目标图像的质量,本申请实施例可以使用OpenCV(跨平台计算机视觉和机器学习软件库)的Laplacian(拉普拉斯)算子计算原理进行清晰度信息评估,原理为如果一幅图像的方差较高,那么就说明图像有广泛的响应,包括类边和非类边,这是一幅正常的聚焦图像的代表。但如果方差很低,那么就会有很小的响应扩散,这表明图像中几乎没有边缘。而图像越模糊,边缘就越少。所以可以用来检测是否模糊,而拉普拉斯算子可以用来边缘检测,因此,可以设定合理的预设阈值,例如为0.8。
当服务器检测到缩放后的目标图像的清晰度信息大于0.8时,即该目标图像的清晰度信息满足预设阈值,可以保留该缩放后的目标图像,请继续参阅图4e,还可以为该缩放后的目标图像添加预设显示控件26,用于增强该目标图像的宣传效果。
最后,可以将该目标图像缩放至目标尺寸信息,由于宽高比相同,所以可以将该目标图像直接缩放至目标尺寸信息的大小,生成相应的海报图进行宣传,无需人工进行干预,极大的提升了图像处理的效率。
由上述可知,本申请实施例通过获取待处理图像和待处理图像相应的尺寸信息;根据待处理图像中的人脸特征信息的位置信息确定目标中心点;根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像;将目标图像缩放至目标尺寸信息,生成具有所述目标尺寸信息的缩略图。以此,根据人脸特征信息确定图像的目标中心点,并根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息进行裁剪,得到宽高比符合要求的目标图像,并将目标图像缩放至目标尺寸信息,快速生成符合要求的缩略图,相对于需要人工进行海报图选取和编辑的方案,本申请实施例无需人工干涉,极大的提升了图像处理的效率。
进一步的,本申请实施例还可以实现当检测到裁剪后的图像中的目标中心点的位置不处于裁剪后的上半区域时,通过扩充的方式生成目标图像,保证人脸在目标图像中始终处于合理的位置,无需人工进行后续修改,进一步的提升了图像处理的效率,并保证了宣传的效果。
为便于更好的实施本申请实施例提供的图像处理方法,本申请实施例还提供一种基于上述图像处理方法的装置。其中名词的含义与上述图像处理方法中相同,具体实现细节可以参考方法实施例中的说明。
请参阅图5,图5为本申请实施例提供的图像处理装置的结构示意图,其中该图像处理装置可以包括获取单元301、第一确定单元302、第二确定单元303、裁剪单元304以及缩放单元305等。
获取单元301,用于获取待处理图像和该待处理图像相应的尺寸信息。
第一确定单元302,用于获取待处理图像和该待处理图像相应的尺寸信息。
在一些实施方式中,该第一确定单元302,包括:
获取子单元,用于获取该待处理图像中人脸特征信息相应的标识框;
第一确定子单元,用于当检测到该待处理图像中包含单个标识框时,根据该单个标识框确定目标中心点;
第二确定子单元,用于当检测到该待处理图像中包含多个标识框时,将该多个标识框连通,生成目标连接框,并根据该目标连接框确定目标中心点。
在一些实施方式中,该获取子单元,用于:
通过训练后的多任务卷积神经网络模型提取该待处理图像中的人脸特征信息。
根据该人脸特征信息的位置信息确定相应的标识框。
第二确定单元303,用于根据该尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息。
在一些实施方式中,该第二确定单元303,包括第三确定子单元,用于:
当检测到该尺寸信息的宽高比大于目标尺寸信息的宽高比时,获取尺寸信息的第一高度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息;
基于该第一高度信息、第二宽度信息和第二高度信息计算出第三宽度信息,计算出的所述第三宽度信息与所述第一高度信息的比值等于所述目标尺寸信息的宽高比;
根据该第三宽度信息和第一高度信息确定裁剪尺寸信息。
在一些实施例中,该第二确定单元303,还包括第四确定子单元,用于:
当检测到该尺寸信息的宽高比小于目标尺寸信息的宽高比时,获取尺寸信息的第一宽度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息;
基于该第一宽度信息、第二宽度信息和第二高度信息计算出第三高度信息,所述第一宽度信息与计算出的所述第三高度信息的比值等于所述目标尺寸信息的宽高比;
根据该第三高度信息和第一宽度信息确定裁剪尺寸信息。
裁剪单元304,用于基于该目标中心点和裁剪尺寸信息对该待处理图像进行裁剪,得到目标图像,该目标图像的宽高比与目标尺寸信息的宽高比相同。
在一些实施例中,该裁剪单元304,包括:
裁剪子单元,用于根据该裁剪尺寸信息对该待处理图像进行裁剪,得到裁剪后的图像,该裁剪后的图像中包含该目标中心点;
第五确定子单元,用于当检测到该裁剪后的图像中的目标中心点的位置处于裁剪后的图像的上半区域时,将该裁剪后的图像确定为目标图像。
在一些实施例中,该裁剪单元,还包括:
获取子单元,用于当检测到该裁剪后的图像中的目标中心点的位置不处于裁剪后的图像的上半区域时,获取待处理图像中的目标人脸特征信息相应的第一目标标识框;
扩充子单元,用于将该第一目标标识框扩充预设倍数,得到扩充后的第二目标标识框;
添加子单元,用于为该第二目标标识框添加附加框,得到添加后的第三目标标识框,该第三目标标识框的宽高比和该目标尺寸信息的宽高比相同;
第六确定子单元,用于将该第三目标标识框确定为目标图像。
在一些实施例中,该添加子单元,用于:
获取该第二目标标识框的第四宽度信息、第四高度信息、目标尺寸信息的第二宽度信息和目标尺寸信息的第二高度信息;
基于该第四宽度信息、第二宽度信息和第二高度信息计算出第五高度信息,所述第二目标标识框的所述第四宽度信息与计算出的所述第五高度信息的比值等于所述目标尺寸信息的宽高比;
根据该第五高度信息和该第四高度信息之间的差值确定第六高度信息;
根据该第四宽度信息和第六高度信息确定附加框的尺寸信息;
将第二目标标识框合并该附加框,得到第三目标标识框。
在一些实施例中,该装置,还包括删除单元,用于:
当检测到该目标图像中的区域不属于该待处理图像时,删除该目标图像。
缩放单元305,用于将该目标图像缩放至目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。
在一些实施例中,该装置,还包括添加单元,用于:
当检测到缩放后的目标图像的清晰度信息满足预设阈值时,保留该缩放后的目标图像;
为该缩放后的目标图像添加预设显示控件。
以上各个单元的具体实施可参见前面的实施例,在此不再赘述。
由上述可知,本申请实施例通过获取单元301获取待处理图像和待处理图像相应的尺寸信息;第一确定单元302根据待处理图像中的人脸特征信息的位置信息确定目标中心点;第二确定单元 303根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;裁剪单元304基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像;缩放单元305将目标图像缩放至目标尺寸信息,生成具有所述目标尺寸信息的缩略图。以此,根据人脸特征信息确定图像的目标中心点,并根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息进行裁剪,得到宽高比符合要求的目标图像,并将目标图像缩放至目标尺寸信息,快速生成符合要求的缩略图,相对于需要人工进行海报图选取和编辑的方案,本申请实施例无需人工干涉,极大的提升了图像处理的效率。
本申请实施例还提供一种计算机设备,该计算机设备可以为服务器或终端,如图6所示,其示出了本申请实施例所涉及的服务器的结构示意图,具体来讲:
该计算机设备可以包括一个或者一个以上处理核心的处理器401、一个或一个以上计算机可读存储介质的存储器402、电源403和输入单元404等部件。本领域技术人员可以理解,图6中示出的计算机设备结构并不构成对计算机设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:
处理器401是该计算机设备的控制中心,利用各种接口和线路连接整个计算机设备的各个部分,通过运行或执行存储在存储器402内的软件程序和/或模块,以及调用存储在存储器402内的数据,执行计算机设备的各种功能和处理数据,从而对计算机设备进行整体监控。在一些实施例中,处理器401可包括一个或多个处理核心;在一些实施例中,处理器401可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器401中。
存储器402可用于存储软件程序以及模块,处理器401通过运行存储在存储器402的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器402可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据服务器的使用所创建的数据等。此外,存储器402可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器402还可以包括存储器控制器,以提供处理器401对存储器402的访问。
计算机设备还包括给各个部件供电的电源403,在一些实施例中,电源403可以通过电源管理系统与处理器401逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源403还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。
计算机设备还可包括输入单元404,该输入单元404可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。
尽管未示出,计算机设备还可以包括显示单元等,在此不再赘述。具体在本实施例中,计算机设备中的处理器401会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器402中,并由处理器401来运行存储在存储器402中的应用程序,从而实现前述实施例提供的各种方法步骤,如下:
获取待处理图像和该待处理图像相应的尺寸信息;根据该待处理图像中的人脸特征信息的位置信息确定目标中心点;根据该尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于该目标中心点和裁剪尺寸信息对该待处理图像进行裁剪,得到目标图像,该目标图像的宽高比与目标尺寸信息的宽高比相同;将该目标图像缩放至目标尺寸信息。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对图像处理方法的详细描述,此处不再赘述。
由上述可知,本申请实施例的计算机设备可以通过获取待处理图像和待处理图像相应的尺寸信息;根据待处理图像中的人脸特征信息的位置信息确定目标中心点;根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于目标中心点和裁剪尺寸信息对待处理图像进行裁剪,得到目标图像;将目标图像缩放至目标尺寸信息。以此,根据人脸特征信息确定图像的目标中心点,并根据尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息进行裁剪,得到宽高比符合要求的目标图像,并将目标图像缩放至目标尺寸信息,快速生成符合要求的缩略图,相对于需要人工进行海报图选取和编辑的方案,本申请实施例无需人工干涉,极大的提升了图像处理的效率。
本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过指令来完成,或通过指令控制相关的硬件来完成,该指令可以存储于一计算机可读存储介质中,并由处理器进行加载和执行。
为此,本申请实施例提供一种计算机可读存储介质,其中存储有多条指令,该指令能够被处理器进行加载,以执行本申请实施例所提供的任一种图像处理方法中的步骤。例如,该指令可以执行如下步骤:
获取待处理图像和该待处理图像相应的尺寸信息;根据该待处理图像中的人脸特征信息的位置信息确定目标中心点;根据该尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息;基于该目标中心点和裁剪尺寸信息对该待处理图像进行裁剪,得到目标图像,该目标图像的宽高比与目标尺寸信息的宽高比相同;将该目标图像缩放至目标尺寸信息。
根据本申请的一个方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述实施例提供的各种实现方式中提供的方法。
以上各个操作的具体实施可参见前面的实施例,在此不再赘述。
其中,该计算机可读存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。
由于该计算机可读存储介质中所存储的指令,可以执行本申请实施例所提供的任一种图像处理方法中的步骤,因此,可以实现本申请实施例所提供的任一种图像处理方法所能实现的有益效果,详见前面的实施例,在此不再赘述。
以上对本申请实施例所提供的一种图像处理方法、装置及计算机可读存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (17)

  1. 一种图像处理方法,由计算机设备执行,包括:
    获取待处理图像和所述待处理图像相应的尺寸信息;
    根据所述待处理图像中的人脸特征信息的位置信息确定所述待处理图像的目标中心点;
    根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息;
    基于所述目标中心点和所述裁剪尺寸信息对所述待处理图像进行裁剪,得到目标图像,所述目标图像的宽高比与所述目标尺寸信息的宽高比相同;
    将所述目标图像缩放至所述目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。
  2. 根据权利要求1所述的图像处理方法,其中,所述根据所述待处理图像中的人脸特征信息的位置信息确定目标中心点,包括:
    获取所述待处理图像中人脸特征信息相应的标识框;
    当检测到所述待处理图像中包含单个标识框时,根据所述单个标识框确定所述目标中心点;
    当检测到所述待处理图像中包含多个标识框时,将所述多个标识框连通,生成目标连接框,并根据所述目标连接框确定所述目标中心点。
  3. 根据权利要求2所述的图像处理方法,其中,所述获取所述待处理图像中人脸特征信息相应的标识框,包括:
    通过训练后的多任务卷积神经网络模型提取所述待处理图像中的人脸特征信息;
    根据所述人脸特征信息的位置信息确定相应的标识框。
  4. 根据权利要求1所述的图像处理方法,其中,所述根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,包括:
    当检测到所述尺寸信息的宽高比大于所述目标尺寸信息的宽高比时,获取所述尺寸信息的第一高度信息、所述目标尺寸信息的第二宽度信息和所述目标尺寸信息的第二高度信息;
    基于所述第一高度信息、所述第二宽度信息和所述第二高度信息计算出第三宽度信息,计算出的所述第三宽度信息与所述第一高度信息的比值等于所述目标尺寸信息的宽高比;
    根据所述第三宽度信息和第一高度信息确定裁剪尺寸信息。
  5. 根据权利要求1所述的图像处理方法,其中,所述根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,包括:
    当检测到所述尺寸信息的宽高比小于所述目标尺寸信息的宽高比时,获取所述尺寸信息的第一宽度信息、所述目标尺寸信息的第二宽度信息和所述目标尺寸信息的第二高度信息;
    基于所述第一宽度信息、所述第二宽度信息和所述第二高度信息计算出第三高度信息,所述第一宽度信息与计算出的所述第三高度信息的比值等于所述目标尺寸信息的宽高比;
    根据所述第三高度信息和所述第一宽度信息确定裁剪尺寸信息。
  6. 根据权利要求1至5任一项所述的图像处理方法,其中,所述基于所述目标中心点和所述裁剪尺寸信息对所述待处理图像进行裁剪,得到目标图像,包括:
    根据所述裁剪尺寸信息对所述待处理图像进行裁剪,得到裁剪后的图像,所述裁剪后的图像中包含所述目标中心点;
    当检测到所述裁剪后的图像中的目标中心点的位置处于裁剪后的图像的上半区域时,将所述裁剪后的图像确定为目标图像。
  7. 根据权利要求6所述的图像处理方法,其中,所述方法还包括:
    当检测到所述裁剪后的图像中的目标中心点的位置不处于裁剪后的图像的上半区域时,获取所述待处理图像中的目标人脸特征信息相应的第一目标标识框;
    将所述第一目标标识框扩充预设倍数,得到扩充后的第二目标标识框;
    为所述第二目标标识框添加附加框,得到添加后的第三目标标识框,所述第三目标标识框的宽高比和所述目标尺寸信息的宽高比相同;
    将所述第三目标标识框确定为目标图像。
  8. 根据权利要求7所述的图像处理方法,其中,所述为所述第二目标标识框添加附加框,得到添加后的第三目标标识框,包括:
    获取所述第二目标标识框的第四宽度信息、第四高度信息、目标尺寸信息的第二宽度信息和目 标尺寸信息的第二高度信息;
    基于所述第四宽度信息、第二宽度信息和第二高度信息计算出第五高度信息,所述第二目标标识框的所述第四宽度信息与计算出的所述第五高度信息的比值等于所述目标尺寸信息的宽高比;
    根据所述第五高度信息和所述第四高度信息之间的差值确定第六高度信息;
    根据所述第四宽度信息和第六高度信息确定附加框的尺寸信息;
    将第二目标标识框合并所述附加框,得到第三目标标识框。
  9. 根据权利要求1所述的图像处理方法,其中,所述方法还包括:
    当检测到缩放后的目标图像的清晰度信息满足预设阈值时,保留所述缩放后的目标图像;
    为所述缩放后的目标图像添加预设显示控件。
  10. 根据权利要求1-9中任一项所述的图像处理方法,其中,所述方法还包括:
    当检测到所述目标图像中的区域不属于所述待处理图像时,删除所述目标图像。
  11. 一种图像处理装置,包括:
    获取单元,用于获取待处理图像和所述待处理图像相应的尺寸信息;
    第一确定单元,用于根据所述待处理图像中的人脸特征信息的位置信息确定所述待处理图像的目标中心点;
    第二确定单元,用于根据所述尺寸信息和目标尺寸信息之间的宽高比关系确定裁剪尺寸信息,所述目标尺寸信息为要生成的、与所述待处理图像对应的缩略图的尺寸信息;
    裁剪单元,用于基于所述目标中心点和所述裁剪尺寸信息对所述待处理图像进行裁剪,得到目标图像,所述目标图像的宽高比与所述目标尺寸信息的宽高比相同;
    缩放单元,用于将所述目标图像缩放至所述目标尺寸信息,生成具有所述目标尺寸信息的所述缩略图。
  12. 根据权利要求11所述的图像处理装置,其中,所述第一确定单元,包括:
    获取子单元,用于获取所述待处理图像中人脸特征信息相应的标识框;
    第一确定子单元,用于当检测到所述待处理图像中包含单个标识框时,根据所述单个标识框确定所述目标中心点;
    第二确定子单元,用于当检测到所述待处理图像中包含多个标识框时,将所述多个标识框连通,生成目标连接框,并根据所述目标连接框确定所述目标中心点。
  13. 根据权利要求12所述的图像处理装置,其中,所述获取子单元,用于:
    通过训练后的多任务卷积神经网络模型提取所述待处理图像中的人脸特征信息;
    根据所述人脸特征信息的位置信息确定相应的标识框。
  14. 根据权利要求11所述的图像处理装置,其中,所述第二确定单元,包括第三确定子单元,用于:
    当检测到所述尺寸信息的宽高比大于所述目标尺寸信息的宽高比时,获取所述尺寸信息的第一高度信息、所述目标尺寸信息的第二宽度信息和所述目标尺寸信息的第二高度信息;
    基于所述第一高度信息、所述第二宽度信息和所述第二高度信息计算出第三宽度信息,计算出的所述第三宽度信息与所述第一高度信息的比值等于所述目标尺寸信息的宽高比;
    根据所述第三宽度信息和第一高度信息确定裁剪尺寸信息。
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有多条指令,所述指令适于处理器进行加载,以执行权利要求1至10任一项所述的图像处理方法中的步骤。
  16. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1-10中任一项所述的图像处理方法中的步骤。
  17. 一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中,计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行如权利要求1-10中任一项所述的图像处理方法中的步骤。
PCT/CN2022/087785 2021-05-17 2022-04-20 一种图像处理方法、装置及计算机可读存储介质 WO2022242397A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/073,343 US20230094362A1 (en) 2021-05-17 2022-12-01 Image processing method and apparatus, and computer-readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110534980.3A CN113763242A (zh) 2021-05-17 2021-05-17 一种图像处理方法、装置及计算机可读存储介质
CN202110534980.3 2021-05-17

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/073,343 Continuation US20230094362A1 (en) 2021-05-17 2022-12-01 Image processing method and apparatus, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2022242397A1 true WO2022242397A1 (zh) 2022-11-24

Family

ID=78787062

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/087785 WO2022242397A1 (zh) 2021-05-17 2022-04-20 一种图像处理方法、装置及计算机可读存储介质

Country Status (3)

Country Link
US (1) US20230094362A1 (zh)
CN (1) CN113763242A (zh)
WO (1) WO2022242397A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763242A (zh) * 2021-05-17 2021-12-07 腾讯科技(深圳)有限公司 一种图像处理方法、装置及计算机可读存储介质
CN116342639A (zh) * 2021-12-22 2023-06-27 华为技术有限公司 图像显示方法及其电子设备和介质
CN114679591A (zh) * 2021-12-30 2022-06-28 广州方硅信息技术有限公司 直播间的视频比例切换方法、装置、介质以及计算机设备

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060188173A1 (en) * 2005-02-23 2006-08-24 Microsoft Corporation Systems and methods to adjust a source image aspect ratio to match a different target aspect ratio
CN103914689A (zh) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 基于人脸识别的图片裁剪方法及装置
CN108776970A (zh) * 2018-06-12 2018-11-09 北京字节跳动网络技术有限公司 图像处理方法和装置
CN110136142A (zh) * 2019-04-26 2019-08-16 微梦创科网络科技(中国)有限公司 一种图像裁剪方法、装置、电子设备
CN112446255A (zh) * 2019-08-31 2021-03-05 华为技术有限公司 一种视频图像处理方法及装置
CN112700454A (zh) * 2020-12-28 2021-04-23 北京达佳互联信息技术有限公司 图像裁剪方法、装置、电子设备及存储介质
CN112927241A (zh) * 2021-03-08 2021-06-08 携程旅游网络技术(上海)有限公司 图片截取和缩略图生成方法、系统、设备及储存介质
CN113538502A (zh) * 2021-01-13 2021-10-22 腾讯科技(深圳)有限公司 图片裁剪方法、装置、电子设备及存储介质
CN113709386A (zh) * 2021-03-19 2021-11-26 腾讯科技(深圳)有限公司 图像处理方法、装置、计算机设备及计算机可读存储介质
CN113763242A (zh) * 2021-05-17 2021-12-07 腾讯科技(深圳)有限公司 一种图像处理方法、装置及计算机可读存储介质

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060188173A1 (en) * 2005-02-23 2006-08-24 Microsoft Corporation Systems and methods to adjust a source image aspect ratio to match a different target aspect ratio
CN103914689A (zh) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 基于人脸识别的图片裁剪方法及装置
CN108776970A (zh) * 2018-06-12 2018-11-09 北京字节跳动网络技术有限公司 图像处理方法和装置
CN110136142A (zh) * 2019-04-26 2019-08-16 微梦创科网络科技(中国)有限公司 一种图像裁剪方法、装置、电子设备
CN112446255A (zh) * 2019-08-31 2021-03-05 华为技术有限公司 一种视频图像处理方法及装置
CN112700454A (zh) * 2020-12-28 2021-04-23 北京达佳互联信息技术有限公司 图像裁剪方法、装置、电子设备及存储介质
CN113538502A (zh) * 2021-01-13 2021-10-22 腾讯科技(深圳)有限公司 图片裁剪方法、装置、电子设备及存储介质
CN112927241A (zh) * 2021-03-08 2021-06-08 携程旅游网络技术(上海)有限公司 图片截取和缩略图生成方法、系统、设备及储存介质
CN113709386A (zh) * 2021-03-19 2021-11-26 腾讯科技(深圳)有限公司 图像处理方法、装置、计算机设备及计算机可读存储介质
CN113763242A (zh) * 2021-05-17 2021-12-07 腾讯科技(深圳)有限公司 一种图像处理方法、装置及计算机可读存储介质

Also Published As

Publication number Publication date
CN113763242A (zh) 2021-12-07
US20230094362A1 (en) 2023-03-30

Similar Documents

Publication Publication Date Title
WO2022242397A1 (zh) 一种图像处理方法、装置及计算机可读存储介质
US11836859B2 (en) Textured mesh building
CN111612873B (zh) Gif图片生成方法、装置及电子设备
US11176355B2 (en) Facial image processing method and apparatus, electronic device and computer readable storage medium
WO2015123605A1 (en) Photo composition and position guidance in an imaging device
WO2021164550A1 (zh) 图像分类方法及装置
US11949848B2 (en) Techniques to capture and edit dynamic depth images
CN105430269B (zh) 一种应用于移动终端的拍照方法及装置
CN112532882B (zh) 图像显示方法和装置
WO2021139764A1 (zh) 图像处理方法、装置、电子装置及存储介质
US9767541B2 (en) Techniques for automatically correcting groups of images
CN113645476A (zh) 画面处理方法、装置、电子设备及存储介质
WO2023272495A1 (zh) 徽标标注方法及装置、徽标检测模型更新方法及系统、存储介质
JP2010224706A (ja) 似顔絵作成システム、制御サーバ、クライアント端末、似顔絵作成方法、およびプログラム
Koçberber et al. Video retargeting: video saliency and optical flow based hybrid approach
WO2024055676A1 (zh) 图像压缩方法、装置、计算机设备及计算机可读存储介质
CN113420176B (zh) 搜题方法、题目框绘制方法和装置、设备及存储介质
US20190114814A1 (en) Method and system for customization of pictures on real time dynamic basis
CN114219945A (zh) 缩略图获取方法、装置、电子设备以及存储介质
CN114170289A (zh) 图像处理方法、装置、计算机设备及计算机可读存储介质
CN117440178A (zh) 视频处理方法、装置、电子设备及计算机存储介质
CN112328345A (zh) 用于确定主题色的方法、装置、电子设备及可读存储介质
CN114942854A (zh) 一种gif动图的截图方法和相关设备
CN117670737A (zh) 图像处理方法、装置和计算机可读存储介质
CN113888554A (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: 22803722

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE