WO2021190168A1 - 图像处理方法、装置、存储介质及电子设备 - Google Patents
图像处理方法、装置、存储介质及电子设备 Download PDFInfo
- Publication number
- WO2021190168A1 WO2021190168A1 PCT/CN2021/075100 CN2021075100W WO2021190168A1 WO 2021190168 A1 WO2021190168 A1 WO 2021190168A1 CN 2021075100 W CN2021075100 W CN 2021075100W WO 2021190168 A1 WO2021190168 A1 WO 2021190168A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- processed
- images
- candidate
- sub
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 35
- 238000012545 processing Methods 0.000 claims abstract description 77
- 238000001514 detection method Methods 0.000 claims description 51
- 230000011218 segmentation Effects 0.000 claims description 26
- 238000000034 method Methods 0.000 claims description 22
- 238000004590 computer program Methods 0.000 claims description 12
- 238000003708 edge detection Methods 0.000 claims description 12
- 238000009336 multiple cropping Methods 0.000 claims description 12
- 238000012216 screening Methods 0.000 claims description 9
- 238000001914 filtration Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 8
- 238000012549 training Methods 0.000 description 6
- 238000013135 deep learning Methods 0.000 description 4
- 238000013178 mathematical model Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 244000025254 Cannabis sativa Species 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000008447 perception Effects 0.000 description 2
- 239000013535 sea water Substances 0.000 description 2
- 238000013145 classification model Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 238000013441 quality evaluation Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/60—Rotation of whole images or parts thereof
-
- 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/136—Segmentation; Edge detection involving thresholding
-
- 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
-
- 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/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- This application relates to the field of image processing technology, and in particular to an image processing method, device, storage medium and electronic equipment.
- the embodiments of the present application provide an image processing method, device, storage medium, and electronic equipment, which can realize automatic secondary cropping processing of an image.
- the embodiment of the application provides an image processing method, which is applied to an electronic device, and the image processing method includes:
- the candidate image with the highest quality score is selected as the processing result image of the image to be processed.
- the image processing device provided by the embodiment of the present application is applied to electronic equipment, and the image processing device includes:
- the image acquisition module is used to acquire the image to be processed and to identify the horizontal dividing line of the image to be processed;
- An image rotation module configured to rotate the image to be processed to rotate the horizontal dividing line to a preset position, and crop the rotated image to be processed to obtain a cropped image
- An image division module configured to divide the cropped image into a plurality of sub-images, and use the sub-images and the image to be processed as candidate images for image quality scoring;
- the image screening module is used for screening the candidate image with the highest quality score as the processing result image of the image to be processed.
- the storage medium provided by the embodiment of the present application stores a computer program thereon, and when the computer program is loaded by a processor, the image processing method as provided in any embodiment of the present application is executed.
- the electronic device provided by the embodiment of the present application includes a processor and a memory, the memory stores a computer program, and the processor loads the computer program to execute the image processing method provided in any embodiment of the present application.
- FIG. 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
- Fig. 2 is an example diagram of an image processing interface in an embodiment of the present application.
- Fig. 3 is an example diagram of a selection sub-interface in an embodiment of the present application.
- Fig. 4 is a schematic diagram of rotating an image to be processed in an embodiment of the present application.
- Fig. 5 is a schematic diagram of an image to be processed after cropping and rotation in an embodiment of the present application.
- FIG. 6 is a schematic diagram of another flow of an image processing method provided by an embodiment of the present application.
- FIG. 7 is a schematic structural diagram of an image processing device provided by an embodiment of the present application.
- FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
- composition method that relies on experience has high requirements for users, and requires users to spend more time and energy to learn composition and accumulate experience, and it is difficult to get started quickly. In the absence of relevant experience and guidance, it is difficult for users to take high-quality images through electronic equipment.
- embodiments of the present application provide an image processing method, image processing device, storage medium, and electronic equipment.
- the execution subject of the image processing method may be the image processing device provided in the embodiment of the present application, or an electronic device integrated with the image processing device, where the image processing device may be implemented in hardware or software.
- the electronic device may be a device equipped with a processor and capable of processing, such as a smart phone, a tablet computer, a palmtop computer, a notebook computer, or a desktop computer.
- This application provides an image processing method, including:
- the candidate image with the highest quality score is selected as the processing result image of the image to be processed.
- the identifying the horizontal dividing line of the image to be processed includes:
- the dividing the cropped image into multiple sub-images includes:
- the cropped image When it is detected that the cropped image has a preset subject, the cropped image is divided into a plurality of sub-images including the preset subject, and the execution of the sub-image and the image to be processed is performed as candidate images Perform image quality scoring.
- the subject detection of the cropped image includes:
- Subject detection is performed on the objects in the bounding box of each object.
- the dividing the cropped image into a plurality of sub-images including the preset subject includes:
- the image content in the multiple cropping frames is intercepted to obtain the multiple sub-images.
- the method further includes:
- the to-be-processed image is randomly divided into multiple sub-images of different areas.
- the scoring the image quality of the sub-image and the image to be processed as candidate images includes:
- the quality score of the candidate image is obtained by weighting according to the multiple candidate scores.
- the performing image quality scores on the candidate images in multiple different quality dimensions to obtain multiple candidate scores includes:
- the corresponding scoring model is called to score the candidate images, and the candidate score of each quality dimension is obtained.
- the screening out the candidate image with the highest quality score as the processing result image of the image to be processed includes:
- the candidate image with the highest quality score is not unique, the candidate image with the highest quality score and the largest area is selected as the processing result image.
- FIG. 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
- the specific process of the image processing method provided by an embodiment of the present application may be as follows:
- an image to be processed is acquired, and the horizontal dividing line of the image to be processed is identified.
- the electronic device may determine the image to be processed for image processing based on a preset image processing cycle and a preset image selection rule, or when receiving an image processing instruction input by the user, according to the user
- the input image processing instruction determines the image to be processed for image processing, and so on.
- the embodiment of this application does not specifically limit the setting of image processing cycles, image selection rules, and image processing instructions.
- the settings can be set by the electronic device according to user input, or the manufacturer of the electronic device can perform defects on the electronic device. Province settings, etc.
- the image processing cycle is pre-configured as a natural week starting from Monday, and the image selection rule is configured as "select captured images for image processing".
- the electronic device can automatically trigger image processing on Mondays to capture
- the obtained image is determined to be a to-be-processed image that requires image processing.
- the electronic device may receive an input image processing instruction through an image processing interface including a request input interface.
- the request input interface may be in the form of an input box, and the user may request an input interface in the input box Enter the identification information of the image that needs to be image-processed, and enter confirmation information (such as directly pressing the Enter key of the keyboard) to input an image processing instruction, which carries the identification information of the image that needs to be image-processed.
- the electronic device can determine the to-be-processed image that needs to be image-processed according to the identification information in the received image processing instruction.
- the image processing interface described in Figure 2 also includes an "open" control.
- the electronic device detects that the open control is triggered, it will superimpose a selection sub-interface (such as As shown in Figure 3), the selection sub-interface provides the user with thumbnails of locally stored images that can be processed for image processing, such as image A, image B, image C, image D, image E, image F and other image thumbnails.
- the user can trigger the confirmation control provided in the selection sub-interface after selecting the thumbnail of the image that needs image processing to input image processing to the electronic device Instruction, the image processing instruction is associated with the thumbnail of the image selected by the user, and instructs the electronic device to use the image selected by the user as a to-be-processed image that requires image processing.
- the electronic device After acquiring the image to be processed, the electronic device further identifies the horizontal dividing line of the image to be processed.
- the horizontal dividing line can be visually understood as the dividing line of the scene in the image in the horizontal direction, such as the dividing line between blue sky and beach, the dividing line between blue sky and sea, and the dividing line between blue sky and grass.
- the image to be processed is rotated to rotate its horizontal dividing line to a preset position, and the rotated image to be processed is cropped to obtain a cropped image.
- a straight line that stretches horizontally can make the content of an image look wider, stable, and harmonious. If it is skewed relative to the frame of the image, it will give people a sense of instability. Therefore, after the electronic device recognizes the horizontal dividing line of the image to be processed, it rotates the horizontal dividing line of the image to be processed to a preset position, so that the horizontal dividing line of the image to be processed is parallel to the horizontal direction, as shown in FIG. 4 .
- the electronic device After rotating the horizontal dividing line of the image to be processed to be parallel to the horizontal direction, the electronic device further crops the rotated image to be processed to obtain a cropped image.
- the electronic device uses the largest inscribed rectangle to crop the rotated image to be processed to obtain a cropped image that retains the most image content, as shown in FIG. 5.
- the cropped image is divided into multiple sub-images, and the sub-images and the image to be processed are used as candidate images for image quality scoring.
- the electronic device After the cropped image is obtained by cropping, the electronic device further divides the cropped image into multiple sub-images.
- this application does not limit the manner and number of sub-images, which can be set by those of ordinary skill in the art according to actual needs.
- the electronic device After dividing the cropped image into multiple sub-images, the electronic device further uses the divided sub-images and the original image to be processed as candidate images, and performs image quality scores on each candidate image.
- the realization of image quality scoring can be divided into subjective scoring with reference and objective scoring without reference.
- Subjective reference scoring is to evaluate the quality of the image from the subjective perception of people. For example, given the original reference image, this reference picture is the picture with the best image quality, and the image quality score is based on this picture. It can be represented by average subjective score (Mean Opinion Score, MOS) or average subjective score difference (Differential Mean Opinion Score, DMOS).
- the objective non-reference score refers to the absence of the best reference picture, but to train a mathematical model and use the mathematical model to give a quantified value.
- the image quality score interval can be [1-10] points, where 1 point represents poor image quality , 10 points means that the image quality is very good, and the score can be a discrete value or a continuous value.
- the candidate image with the highest quality score is selected as the processing result image of the image to be processed.
- the electronic device After scoring the image quality of each candidate image, the electronic device further selects the candidate image with the highest quality score from each candidate image as the processing result image of the image to be processed.
- the electronic device divides the cropped image into 5 sub-images, which are sub-image A, sub-image B, sub-image C, sub-image D, and sub-image E. These sub-images and the original image to be processed will be regarded as candidate images. Perform image quality scoring, and if the quality score of the sub-image D is the highest, the electronic device uses the sub-image D as the processing result image of the image to be processed.
- the electronic device may further screen out the candidate image with the highest quality score and the largest area as the processing result image of the image to be processed.
- identifying the horizontal dividing line of the image to be processed includes:
- the electronic device can identify the horizontal dividing line of the image to be processed in the following manner.
- the electronic device performs semantic segmentation on the image to be processed, and divides the image to be processed into multiple image regions corresponding to different categories.
- semantic segmentation refers to dividing the image content into multiple regions, and each region corresponds to a category. It is expected that the pixels in the same region of the image after segmentation correspond to the same category.
- semantic segmentation can be regarded as the classification of image pixels, including threshold-based segmentation, region-based segmentation, and edge detection-based segmentation.
- it also includes semantic segmentation based on deep learning, such as DeepLab, MaskRCNN, etc.
- the semantic segmentation method can be selected by a person of ordinary skill in the art according to actual needs.
- the categories that need to be segmented are blue sky, grassland, beach, sea water and other categories related to the horizontal plane as constraints, and the to-be-processed image is segmented into multiple image regions.
- the electronic device After dividing the image to be processed into multiple image regions, the electronic device further recognizes the regional boundary lines between adjacent image regions, and these regional boundary lines are possible horizontal boundary lines. After that, the electronic device determines from the area demarcation line that the included angle with the horizontal direction is less than the preset angle, and this is recorded as the target area demarcation line.
- the preset angle there are no specific restrictions on the value of the preset angle in the embodiment of this application, and can be set by a person of ordinary skill in the art according to actual needs. For example, the embodiment of this application configures the preset angle to be 30 degrees. Therefore, the determined boundary line of the target area is the boundary line of the area whose included angle with the horizontal direction is less than 30 degrees.
- the electronic device also performs edge detection on the image to be processed to obtain the edge line of the image to be processed.
- the method of edge detection is not specifically limited in this application, and can be selected by a person of ordinary skill in the art according to actual needs. Taking the parallel differential operator method as an example, it uses the discontinuous nature of pixels in adjacent regions and uses first-order or second-order derivatives to detect edge points. Typical algorithms include Sobel, Laplacian, Roberts, and so on.
- the electronic device After detecting the edge line of the image to be processed, the electronic device further determines the edge line whose angle with the horizontal direction is less than the preset angle, and records it as the target edge line.
- the electronic device After determining the target area boundary line and the target edge line, the electronic device further determines the target edge line with the highest degree of coincidence and the target area boundary line, and fits the target edge line with the highest degree of coincidence and the target area boundary line into a straight line , As the horizontal dividing line of the image to be processed.
- the electronic device can also preprocess the target edge line and the target area boundary line, and delete the target edge line and/or the target edge line whose length is less than the preset length. Or the boundary of the target area.
- the preset length determination can be configured to be one-half of the length of the side of the image to be processed in the horizontal direction.
- dividing the cropped image into multiple sub-images includes:
- the cropped image is divided into a plurality of sub-images including the preset subject.
- the electronic device when the electronic device divides the cropped image into multiple sub-images, it first performs subject detection on the cropped image, that is, detects whether there is a preset subject in the cropped image.
- the preset subjects include clear subjects such as portraits, pets, and food.
- the sub-image divided by the electronic device includes the preset subject as a constraint, and the cropped image is divided into multiple sub-images.
- the final processed result image includes the preset subject, avoiding the processing to obtain a meaningless image.
- subject detection on the cropped image includes:
- object detection refers to the use of theories and methods in the fields of image processing and pattern recognition to detect target objects in an image, determine the semantic category of these target objects, and mark the position of the target object in the image.
- the electronic device when it performs subject detection on the cropped image, it first performs object detection on the image to be processed to obtain multiple object bounding boxes corresponding to different objects. Among them, the object bounding box represents the position of the corresponding object in the cropped image.
- object detection there are no specific restrictions on how to perform object detection in the embodiments of the present application, and a person of ordinary skill in the art can select an appropriate object detection method according to actual needs. For example, deep learning can be used to train an object detection model, and the object detection model can be used to perform object detection on pictures, including but not limited to SSD, Faster-RCNN, etc.
- the electronic device After detecting multiple object bounding boxes, the electronic device further performs subject detection on the objects in each object bounding box. In this way, compared to directly performing subject detection on the cropped image, the accuracy of subject detection can be effectively improved.
- dividing the cropped image into a plurality of sub-images including a preset subject includes:
- the electronic device may divide the cropped image into multiple sub-images including a preset subject in the following manner.
- the electronic device first determines the object bounding box of the object detected as the preset subject, and records it as the target object bounding box. Then, the electronic device recognizes whether there is any overlap between the bounding boxes of any two target objects. If there is overlap, the two overlapping target bounding boxes are merged into a merged bounding box by using the largest circumscribed rectangular box, that is, the merged bounding box is The largest circumscribed rectangular box of two overlapping target bounding boxes. In this way, it can be avoided that situations such as group photos or hugging pets are divided into different sub-images.
- the electronic device determines the target merged bounding box with the largest area, and takes the target merged bounding box with the largest area as a constraint, and randomly generates a plurality of cropping boxes of different shapes and/or sizes.
- the electronic device further intercepts the image content in each cropping frame to obtain multiple sub-images.
- the method further includes:
- the image to be processed is randomly divided into multiple sub-images of different areas.
- the electronic device randomly divides the image to be processed into different The area of multiple sub-images is transferred to the step of performing image quality scoring using the sub-images and the image to be processed as candidate images.
- the number of crop frames that need to be generated compared to the area size interval (0, 10%), (10%, 20%), ..., (90%, 100%) of the cropped image is N1, respectively , N2,..., N10. Then, randomly generate the coordinates of the upper left corner and the lower right corner of the crop box, calculate the area of the crop box, and add one to the corresponding area size interval count, and loop until each area The number of cropping frames corresponding to the size interval reaches the assumed number. Then, the image content in these randomly generated cropping frames is cut out, and the image to be processed can be randomly divided into multiple sub-images of different areas.
- scoring the image quality of the sub-image and the image to be processed as candidate images includes:
- the quality score of the candidate image is obtained by weighting the multiple candidate scores.
- the quality dimensions include, but are not limited to, dimensions such as composition, color matching, brightness, distortion, and noise.
- the electronic device may perform image quality scoring in the following manner.
- the electronic device For each quality dimension, invokes a pre-trained scoring model corresponding to the quality dimension to score the candidate images, and records the obtained score as a candidate score, so that multiple candidate scores can be obtained. Then, the electronic device performs a weighted operation on the multiple candidate scores according to the weights corresponding to each quality dimension to obtain the quality scores of the candidate images.
- each scoring model is only responsible for the scoring of one quality dimension, and finally the quality score of the candidate image is obtained by combining the scores of each scoring model.
- only one scoring model may be trained, and the scoring model is responsible for evaluating each quality dimension at the same time, and directly outputting the quality score.
- the classification model can be used as the basic model for training, and the output result is the confidence level of 10 classifications, and the confidence is taken
- the category with the highest degree can be used as the image quality score.
- the expected image quality evaluation scores are continuous, such as 1, 1.1, 1.3, ..., 9.5, 10.1, etc.
- the regression model can be used as the basic model for training, and the output result is a score with decimals. This result is directly As a quality score.
- training samples can be constructed as follows:
- Sample images are collected, and for each sample image, multiple people will manually score the sample images. Because everyone has different scoring standards for images, for example, some people tend to score most images with a median value of 5 or 6, and some people tend to expand the scoring distribution of images, and they think it is not good to score 1, 2 points. Score 8 or 9 points for images that you think are good. In order to eliminate the difference in scoring between people, the average of these scores is taken as the sample quality score of the sample image, and the sample image and its sample quality score are used as a training sample.
- supervised model training can be performed on the basic model according to the constructed training samples to obtain the scoring model.
- the flow of the image processing method provided by this application may also be:
- the electronic device acquires the image to be processed and recognizes the horizontal dividing line of the image to be processed.
- the electronic device may determine the image to be processed for image processing based on a preset image processing cycle and a preset image selection rule, or when receiving an image processing instruction input by the user, according to the user
- the input image processing instruction determines the image to be processed for image processing, and so on.
- the embodiment of this application does not specifically limit the setting of image processing cycles, image selection rules, and image processing instructions.
- the settings can be set by the electronic device according to user input, or the manufacturer of the electronic device can perform defects on the electronic device. Province settings, etc.
- the electronic device After acquiring the image to be processed, the electronic device further identifies the horizontal dividing line of the image to be processed.
- the horizontal dividing line can be visually understood as the dividing line of the scene in the image in the horizontal direction, such as the dividing line between blue sky and beach, the dividing line between blue sky and sea, and the dividing line between blue sky and grass.
- the electronic device may recognize the horizontal dividing line of the image to be processed in the following manner.
- the electronic device performs semantic segmentation on the image to be processed, and divides the image to be processed into multiple image regions corresponding to different categories.
- semantic segmentation refers to dividing the image content into multiple regions, and each region corresponds to a category. It is expected that the pixels in the same region of the image after segmentation correspond to the same category.
- semantic segmentation can be regarded as the classification of image pixels, including threshold-based segmentation, region-based segmentation, and edge detection-based segmentation.
- it also includes semantic segmentation based on deep learning, such as DeepLab, MaskRCNN, etc.
- the semantic segmentation method can be selected by a person of ordinary skill in the art according to actual needs.
- the categories that need to be segmented are blue sky, grassland, beach, sea water and other categories related to the horizontal plane as constraints, and the to-be-processed image is segmented into multiple image regions.
- the electronic device After dividing the image to be processed into multiple image regions, the electronic device further recognizes the regional boundary lines between adjacent image regions, and these regional boundary lines are possible horizontal boundary lines. After that, the electronic device determines from the area demarcation line that the included angle with the horizontal direction is less than the preset angle, and this is recorded as the target area demarcation line.
- the preset angle there are no specific restrictions on the value of the preset angle in the embodiment of this application, and can be set by a person of ordinary skill in the art according to actual needs. For example, the embodiment of this application configures the preset angle to be 30 degrees. Therefore, the determined boundary line of the target area is the boundary line of the area whose included angle with the horizontal direction is less than 30 degrees.
- the electronic device also performs edge detection on the image to be processed to obtain the edge line of the image to be processed.
- the method of edge detection is not specifically limited in this application, and can be selected by a person of ordinary skill in the art according to actual needs. Taking the parallel differential operator method as an example, it uses the discontinuous nature of pixels in adjacent regions and uses first-order or second-order derivatives to detect edge points. Typical algorithms include Sobel, Laplacian, Roberts, and so on.
- the electronic device After detecting the edge line of the image to be processed, the electronic device further determines the edge line whose angle with the horizontal direction is less than the preset angle, and records it as the target edge line.
- the electronic device After determining the target area boundary line and the target edge line, the electronic device further determines the target edge line with the highest degree of coincidence and the target area boundary line, and fits the target edge line with the highest degree of coincidence and the target area boundary line into a straight line , As the horizontal dividing line of the image to be processed.
- the electronic device can also preprocess the target edge line and the target area boundary line, and delete the target edge line and/or the target edge line whose length is less than the preset length. Or the boundary of the target area.
- the preset length determination can be configured to be one-half of the length of the side of the image to be processed in the horizontal direction.
- the electronic device rotates the image to be processed, and rotates the horizontal dividing line to be parallel to the horizontal direction.
- the electronic device uses the largest inscribed rectangular frame to crop the rotated image to be processed to obtain a cropped image.
- the electronic device After rotating the horizontal dividing line of the image to be processed to be parallel to the horizontal direction, the electronic device further crops the rotated image to be processed to obtain a cropped image.
- the electronic device uses the largest inscribed rectangle to crop the rotated image to be processed to obtain a cropped image that retains the most image content, as shown in FIG. 5.
- the electronic device detects whether there is a preset subject in the cropped image.
- the electronic device performs subject detection on the cropped image, that is, detects whether there is a preset subject in the cropped image.
- the preset subjects include clear subjects such as portraits, pets, and food.
- the electronic device when it performs subject detection on the cropped image, it first performs object detection on the image to be processed to obtain multiple object bounding boxes corresponding to different objects.
- the object bounding box represents the position of the corresponding object in the cropped image.
- deep learning can be used to train an object detection model
- the object detection model can be used to perform object detection on pictures, including but not limited to SSD, Faster-RCNN, etc.
- the electronic device After detecting multiple object bounding boxes, the electronic device further performs subject detection on the objects in each object bounding box, and determines whether there is a preset subject in them.
- the electronic device divides the cropped image into a plurality of sub-images including a preset subject, and proceeds to 207.
- the electronic device may divide the cropped image into a plurality of sub-images including the preset subject in the following manner.
- the electronic device first determines the object bounding box of the object detected as the preset subject, and records it as the target object bounding box. Then, the electronic device recognizes whether there is any overlap between the bounding boxes of any two target objects. If there is overlap, the two overlapping target bounding boxes are merged into a merged bounding box by using the largest circumscribed rectangular box, that is, the merged bounding box is The largest circumscribed rectangular box of two overlapping target bounding boxes. In this way, it can be avoided that situations such as group photos or hugging pets are divided into different sub-images.
- the electronic device determines the target merged bounding box with the largest area, and takes the target merged bounding box with the largest area as a constraint, and randomly generates a plurality of cropping boxes of different shapes and/or sizes.
- the electronic device further intercepts the image content in each cropping frame to obtain multiple sub-images.
- the electronic device randomly divides the image to be processed into multiple sub-images of different areas.
- the image to be processed is a landscape image
- the electronic device randomly divides the image to be processed into multiple sub-images of different areas. And transfer to the step of performing image quality scoring with sub-images and images to be processed as candidate images.
- the number of crop frames that need to be generated compared to the area size interval (0, 10%), (10%, 20%), ..., (90%, 100%) of the cropped image is N1, respectively , N2,..., N10. Then, randomly generate the coordinates of the upper left corner and the lower right corner of the crop box, calculate the area of the crop box, and add one to the corresponding area size interval count, and loop until each area The number of cropping frames corresponding to the size interval reaches the assumed number. Then, the image content in these randomly generated cropping frames is cut out, and the image to be processed can be randomly divided into multiple sub-images of different areas.
- the electronic device uses the sub-image and the image to be processed as candidate images for image quality scoring.
- the electronic device After dividing the cropped image into multiple sub-images, the electronic device further uses the divided sub-images and the original image to be processed as candidate images, and performs image quality scores on each candidate image.
- the realization of image quality scoring can be divided into subjective scoring with reference and objective scoring without reference.
- Subjective reference scoring is to evaluate the quality of the image from the subjective perception of people. For example, given the original reference image, this reference picture is the picture with the best image quality, and the image quality score is based on this picture. It can be represented by average subjective score (Mean Opinion Score, MOS) or average subjective score difference (Differential Mean Opinion Score, DMOS).
- the objective non-reference score refers to the absence of the best reference picture, but to train a mathematical model and use the mathematical model to give a quantified value.
- the image quality score interval can be [1-10] points, where 1 point represents poor image quality , 10 points means that the image quality is very good, and the score can be a discrete value or a continuous value.
- the electronic device screens out the candidate image with the highest quality score as the processing result image of the image to be processed.
- the electronic device After scoring the image quality of each candidate image, the electronic device further selects the candidate image with the highest quality score from each candidate image as the processing result image of the image to be processed.
- the electronic device divides the cropped image into 5 sub-images, which are sub-image A, sub-image B, sub-image C, sub-image D, and sub-image E. These sub-images and the original image to be processed will be regarded as candidate images. Perform image quality scoring, and if the quality score of the sub-image D is the highest, the electronic device uses the sub-image D as the processing result image of the image to be processed.
- the electronic device may further screen out the candidate image with the highest quality score and the largest area as the processing result image of the image to be processed.
- an image processing device is also provided.
- FIG. 7 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the application.
- the image processing device is applied to electronic equipment.
- the image processing device includes an image acquisition module 301, an image rotation module 302, an image division module 303, an image screening module 304, an adjustment prompt module 305, and an image shooting module 306, as follows:
- the image acquisition module 301 is used to acquire the image to be processed and to identify the horizontal dividing line of the image to be processed;
- the image rotation module 302 is configured to rotate the image to be processed to rotate its horizontal dividing line to a preset position, and crop the rotated image to be processed to obtain a cropped image;
- the image division module 303 is configured to divide the cropped image into multiple sub-images, and use the sub-images and the image to be processed as candidate images for image quality scoring;
- the image screening module 304 is used for screening the candidate image with the highest quality score as the processing result image of the image to be processed.
- the image acquisition module 301 when identifying the horizontal dividing line of the image to be processed, is used to:
- the image dividing module 303 when dividing the cropped image into multiple sub-images, is used to:
- the cropped image is divided into a plurality of sub-images including the preset subject.
- the image division module 303 when subject detection is performed on the cropped image, the image division module 303 is used to:
- Subject detection is performed on the objects in the bounding box of each object.
- the image dividing module 303 is used to:
- the image content in the multiple cropping frames is intercepted to obtain multiple sub-images.
- the image division module 303 is further configured to:
- the image to be processed is randomly divided into multiple sub-images of different areas.
- the image dividing module 303 is used to:
- the quality score of the candidate image is obtained by weighting the multiple candidate scores.
- the image processing device provided in this embodiment of the application belongs to the same concept as the image processing method in the above embodiment. Any method provided in the image processing method embodiment can be run on the image processing device, and its specific implementation For details of the process, refer to the above embodiment, which will not be repeated here.
- an electronic device is also provided.
- the electronic device includes a processor 401 and a memory 402.
- the processor 401 in the embodiment of the present application is a general-purpose processor, such as an ARM architecture processor.
- a computer program is stored in the memory 402, which may be a high-speed random access memory or a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
- the memory 402 may also include a memory controller to provide the processor 401 with access to the computer program in the memory 402 to implement the following functions:
- the candidate image with the highest quality score is selected as the processing result image of the image to be processed.
- the processor 401 when identifying the horizontal dividing line of the image to be processed, is configured to execute:
- the processor 401 when the cropped image is divided into multiple sub-images, the processor 401 is configured to execute:
- the cropped image is divided into a plurality of sub-images including the preset subject.
- the processor 401 when subject detection is performed on the cropped image, the processor 401 is configured to execute:
- Subject detection is performed on the objects in the bounding box of each object.
- the processor 401 when the cropped image is divided into a plurality of sub-images including a preset subject, the processor 401 is configured to execute:
- the image content in the multiple cropping frames is intercepted to obtain multiple sub-images.
- the processor 401 is further configured to execute:
- the image to be processed is randomly divided into multiple sub-images of different areas.
- the processor 401 when the sub-image and the image to be processed are used as candidate images for image quality scoring, the processor 401 is configured to execute:
- the quality score of the candidate image is obtained by weighting the multiple candidate scores.
- the processor 401 when image quality scores are performed on the candidate images in multiple different quality dimensions, and multiple candidate scores are obtained, the processor 401 is configured to execute:
- the corresponding scoring model is called to score the candidate images, and the candidate score of each quality dimension is obtained.
- the processor 401 when the candidate image with the highest quality score is selected as the processing result image of the image to be processed, the processor 401 is configured to execute:
- the candidate image with the highest quality score is not unique, the candidate image with the highest quality score and the largest area is selected as the processing result image.
- the electronic device provided in this embodiment of the application belongs to the same concept as the image processing method in the above embodiment. Any method provided in the image processing method embodiment can be run on the electronic device. The specific implementation process is detailed. See the embodiment of the feature extraction method, which will not be repeated here.
- the computer program may be stored in a computer readable storage medium, such as stored in the memory of an electronic device, and executed by a processor in the electronic device, and may include embodiments such as image processing methods during execution.
- the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, and the like.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
本申请公开了一种图像处理方法、装置、存储介质及电子设备,其中,获取待处理图像,并识别待处理图像的水平分界线;旋转待处理图像以将水平分界线旋转至预设位置,裁剪得到裁剪图像;将裁剪图像划分为多个子图像,并将子图像以及待处理图像作为候选图像进行图像质量评分;筛选出评分最高的候选图像作为待处理图像的处理结果图像。
Description
本申请要求于2020年03月25日提交中国专利局、申请号为202010219730.6、发明名称为“图像处理方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及图像处理技术领域,具体涉及一种图像处理方法、装置、存储介质及电子设备。
目前,人们的生活已离不开智能手机、平板电脑等电子设备,通过这些电子设备所提供的各种各样丰富的功能,使得人们能够随时随地的娱乐、办公等。比如,利用电子设备的拍摄功能,用户可以随时随地的通过电子设备进行拍摄。
发明内容
本申请实施例提供了一种图像处理方法、装置、存储介质及电子设备,能够实现对图像的自动二次裁剪处理。
本申请实施例提供图像处理方法,应用于电子设备,该图像处理方法包括:
获取待处理图像,并识别所述待处理图像的水平分界线;
旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;
将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;
筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
本申请实施例提供的图像处理装置,应用于电子设备,该图像处理装置包括:
图像获取模块,用于获取待处理图像,并识别所述待处理图像的水平分界线;
图像旋转模块,用于旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;
图像划分模块,用于将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;
图像筛选模块,用于筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
本申请实施例提供的存储介质,其上存储有计算机程序,当所述计算机程序被处理器加载时执行如本申请任一实施例提供的图像处理方法。
本申请实施例提供的电子设备,包括处理器和存储器,所述存储器存有计算机程序,所述处理器通过加载所述计算机程序,用于执行如本申请任一实施例提供的图像处理方法。
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的图像处理方法的一流程示意图。
图2是本申请实施例中图像处理界面的示例图。
图3是本申请实施例中选择子界面的示例图。
图4是本申请实施例中旋转待处理图像的示意图。
图5是本申请实施例中裁剪旋转后的待处理图像的示意图。
图6是本申请实施例提供的图像处理方法的另一流程示意图。
图7是本申请实施例提供的图像处理装置的一结构示意图。
图8是本申请实施例提供的电子设备的一结构示意图。
应当说明的是,以下的说明是通过所例示的本申请具体实施例,其不应被视为限制本申请未在此详述的其它具体实施例。
可以理解的是,依赖经验的构图方法对于用户具有较高的要求,需要用户花费较多的时间和精力学习构图和积累经验,难以快速上手。用户在缺乏相关经验和指导的情况下,很难通过电子设备拍摄出高质量的图像。
为此,本申请实施例提供一种图像处理方法、图像处理装置、存储介质以及电子设备。其中,该图像处理方法的执行主体可以是本申请实施例提供的图像处理装置,或者集成了该图像处理装置的电子设备,其中该图像处理装置可以采用硬件或者软件的方式实现。其中,电子设备可以是智能手机、平板电脑、掌上电脑、笔记本电脑、或者台式电脑等配置有处理器而具有处理能力的设备。
本申请提供一种图像处理方法,包括:
获取待处理图像,并识别所述待处理图像的水平分界线;
旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;
将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;
筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
可选地,在一实施例中,所述识别所述待处理图像的水平分界线,包括:
对所述待处理图像进行语义分割,得到多个图像区域;
识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;
对所述待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘线;
确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界 线拟合为一条直线,作为所述水平分界线。
可选地,在一实施例中,所述将所述裁剪图像划分为多个子图像,包括:
对所述裁剪图像进行主体检测;
当检测所述裁剪图像存在预设主体时,将所述裁剪图像划分为包括所述预设主体的多个子图像,并转入执行所述将所述子图像以及所述待处理图像作为候选图像进行图像质量评分。
可选地,在一实施例中,所述对所述裁剪图像进行主体检测,包括:
对所述待处理图像进行对象检测,得到对应不同对象的多个对象边界框;
对每一对象边界框内的对象进行主体检测。
可选地,在一实施例中,所述将所述裁剪图像划分为包括所述预设主体的多个子图像,包括:
确定出被检测为预设主体的对象的目标对象边界框;
将重叠的目标边界框合并得到合并边界框;
确定出面积最大的目标合并边界框,并随机生成包括所述目标合并边界框的多个裁剪框;
截取所述多个裁剪框内的图像内容得到所述多个子图像。
可选地,在一实施例中,所述对所述裁剪图像进行主体检测之后,还包括:
当检测到所述裁剪图像不存在预设主体时,随机将所述待处理图像划分为不同面积的多个子图像。
可选地,在一实施例中,所述将所述子图像以及所述待处理图像作为候选图像进行图像质量评分,包括:
在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分;
根据所述多个候选评分加权得到所述候选图像的质量评分。
可选地,在一实施例中,所述在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分,包括:
对于每一质量维度,调用对应的评分模型对候选图像进行评分,得到每一质量维度的候选评分。
可选地,在一实施例中,所述筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像,包括:
在质量评分最高的候选图像不唯一时,筛选出质量评分最高且面积最大的候选图像作为所述处理结果图像。
请参照图1,图1为本申请实施例提供的图像处理方法的流程示意图,本申请实施例提供的图像处理方法的具体流程可以如下:
在101中,获取待处理图像,并识别待处理图像的水平分界线。
本申请实施例中,电子设备可以基于预设的图像处理周期,按照预设的图像选取规则,确定需要进行图像处理的待处理图像,或者是在接收到用户输入的图像处理指令时,根据用户输入的图像处理指令确定需要进行图像处理的待处理图像,等等。
应当说明的是,本申请实施例对于图像处理周期、图像选取规则以及图像处理指令的设置均不做具体限定,可由电子设备根据用户输入进行设置,也可由电子设备的生产厂商对电子设备进行缺省设置, 等等。
比如,假设图像处理周期被预先配置为以周一为起点的自然周,且图像选取规则被配置为“选取拍摄的图像进行图像处理”这样,电子设备可以在每周一自动触发进行图像处理,将拍摄得到的图像确定为需要进行图像处理的待处理图像。
又比如,电子设备可以通过包括请求输入接口的图像处理界面接收输入的图像处理指令,如图2所示,该请求输入接口可以为输入框的形式,用户可以在该输入框形式的请求输入接口中键入需要进行图像处理的图像的标识信息,并输入确认信息(如直接按下键盘的回车键)以输入图像处理指令,该图像处理指令携带有需要进行图像处理的图像的标识信息。相应的,电子设备即可根据接收到的图像处理指令中的标识信息确定需要进行图像处理的待处理图像。
又比如,在图2所述的图像处理界面中,还包括“打开”控件,一方面,电子设备在侦测到该打开控件触发时,将在图像处理界面之上叠加显示选择子界面(如图3所示),该选择子界面向用户提供本地储存的可进行图像处理的图像的缩略图,如图像A、图像B、图像C、图像D、图像E、图像F等图像的缩略图,供用户查找并选中需要进行图像处理的图像的缩略图;另一方面,用户可以在选中需要进行图像处理的图像的缩略图之后,触发选择子界面提供的确认控件,以向电子设备输入图像处理指令,该图像处理指令与用户选中的图像的缩略图相关联,指示电子设备将用户选中的图像作为需要进行图像处理的待处理图像。
此外,本领域普通技术人员还可以根据实际需要设置其它输入图像处理指令的具体实现方式,本发明对此不做具体限制。
在获取到待处理图像之后,电子设备进一步识别待处理图像的水平分界线。其中,水平分界线可以形象的理解为图像中景物在水平方向的分界线,比如蓝天与沙滩的分界线,蓝天与海水的分界线,蓝天和草地的分界线等。
在102中,旋转待处理图像以将其水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像。
通常的,水平伸展的直线可以让图像的画面内容看起来更加宽阔、稳定、和谐,若其相对于图像的边框出现歪斜则会给人一种不稳定的感觉。因此,电子设备在识别到待处理图像的水平分界线之后,通过旋转待处理图像将其水平分界线旋转至预设位置,使得待处理图像的水平分界线与水平方向平行,如图4所示。
在将待处理图像的水平分界线旋转至与水平方向平行后,电子设备进一步裁剪旋转后的待处理图像得到裁剪图像。
比如,本申请实施例中,电子设备采用最大内接矩形对旋转后的待处理图像进行裁剪,得到保留最多图像内容的裁剪图像,如图5所示。
在103中,将裁剪图像划分为多个子图像,并将子图像以及待处理图像作为候选图像进行图像质量评分。
在裁剪得到裁剪图像之后,电子设备进一步将裁剪图像划分为多个子图像。其中,本申请对划分子 图像的方式以及个数不做限制,可由本领域普通技术人员根据实际需要进行设置。
在将裁剪图像划分多个子图像之后,电子设备进一步将划分得到的子图像以及原始的待处理图像作为候选图像,并对每一候选图像进行图像质量评分。
其中,图像质量评分的实现从方式上可分为主观有参考评分和客观无参考评分。主观有参考评分就是从人的主观感知来评价图像的质量,比如,给出原始参考图像,这张参考图片是图像质量最好的图片,在进行图像质量评分时则依据这张图片进行评分,可采用平均主观得分(Mean Opinion Score,MOS)或平均主观得分差异(Differential Mean Opinion Score,DMOS)表示。客观无参考评分指的是没有最佳参考图片,而是训练数学模型,使用数学模型给出量化值,比如,图像质量评分区间可以[1~10]分,其中,1分代表图像质量很差,10分代表图像质量很好,评分可以是离散值,也可以是连续值。
在104中,筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
在完成对各候选图像的图像质量评分之后,电子设备进一步从各候选图像中筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
比如,电子设备共将裁剪图像划分为5个子图像,分别为子图像A、子图像B、子图像C、子图像D以及子图像E,这些子图像以及原始的待处理图像将被作为候选图像进行图像质量评分,若其中子图像D的质量评分最高,则电子设备将子图像D作为待处理图像的处理结果图像。
此外,当质量评分最高的候选图像不唯一时,电子设备可以进一步筛选出质量评分最高且面积最大的候选图像作为待处理图像的处理结果图像。
由上可知,本申请中,首先通过获取待处理图像,并识别待处理图像的水平分界线;然后,旋转待处理图像以将水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;然后,将裁剪图像划分为多个子图像,并将子图像以及待处理图像作为候选图像进行图像质量评分;最后,筛选出评分最高的候选图像作为待处理图像的处理结果图像。由此,无需用户手动操作,即可由电子设备自动实现对图像的二次裁剪,达到提升图像质量的目的。
在一实施例中,识别待处理图像的水平分界线,包括:
(1)对待处理图像进行语义分割,得到多个图像区域;
(2)识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;
(3)对待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘线;
(4)确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为水平分界线。
本申请实施例中,电子设备可以按照以下方式识别待处理图像的水平分界线。
首先,电子设备对待处理图像进行语义分割,将待处理图像划分多个对应不同类别的图像区域。其中,语义分割是指将图像内容划分成多个区域,每个区域对应一个类别,期望分割后图像在相同区域内的像素都对应于同一个类别。在一定程度上可以将语义分割看作是图像像素的分类,包括基于阈值的分 割、基于区域的分割、基于边缘检测的分割等。此外,还包括基于深度学习的语义分割,比如DeepLab、MaskRCNN等。应当说明的是,本申请对语义分割的方式不做具体限定,可由本领域普通技术人员根据实际需要选取语义分割方式。示例性的,本申请中以所需要进行分割的类别为蓝天、草地、沙滩、海水等与水平面相关的类别为约束,将待处理图像分割为多个图像区域。
在将待处理图像分割为多个图像区域之后,电子设备进一步识别相邻图像区域间的区域分界线,这些区域分界线即为可能的水平分界线。之后,电子设备从区域分界线中确定出与水平方向夹角小于预设角度的区域分界线,记为目标区域分界线。应当说明的是,本申请实施例中对预设角度的取值不做具体限制,可由本领域普通技术人员根据实际需要进行设置,比如,本申请实施例将预设角度配置为30度,由此,确定出的目标区域分界线即与水平方向夹角小于30度的区域分界线。
另外,电子设备还对待处理图像进行边缘检测,得到待处理图像的边缘线。应当说明的是,本申请中对边缘检测的方式不做具体限制,可由本领域普通技术人员根据实际需要进行选取。以并行微分算子法为例,其利用相邻区域的像素不连续的性质,采用一阶或者二阶导数来检测边缘点,典型的算法有Sobel、Laplacian、Roberts等。在检测得到待处理图像的边缘线之后,电子设备进一步确定出与水平方向夹角小于预设角度的边缘线,记为目标边缘线。
在确定出目标区域分界线以及目标边缘线之后,电子设备进一步确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为待处理图像的水平分界线。
可选地,在确定重合度最高的目标边缘线和目标区域分界线之前,电子设备还可以对目标边缘线和目标区域分界线进行预处理,删除其中长度小于预设长度的目标边缘线和/或目标区域分界线。应当说明的是,本申请实施例中对预设长度确定其中不做具体限制,可由本领域普通技术人员根据实际需要进行配置。比如,可以将预设长度配置为待处理图像水平方向侧边长度的二分之一。
在一实施例中,将裁剪图像划分为多个子图像,包括:
(1)对裁剪图像进行主体检测;
(2)当检测裁剪图像存在预设主体时,将裁剪图像划分为包括预设主体的多个子图像。
本申请实施例中,电子设备在将裁剪图像划分为多个子图像时,首先对裁剪图像进行主体检测,即检测其中是否存在预设主体。其中,预设主体包括人像、宠物、美食等明确主体。
当检测到裁剪图像中存在预设主体时,电子设备划分的子图像包括预设主体为约束,将裁剪图像划分为多个子图像。由此,可以确保最终的处理结果图像包括预设主体,避免处理得到无意义的图像。
在一实施例中,对裁剪图像进行主体检测,包括:
(1)对待处理图像进行对象检测,得到对应不同对象的多个对象边界框;
(2)对每一对象边界框内的对象进行主体检测。
应当说明的是,对象检测是指利用图像处理与模式识别等领域的理论和方法,检测出图像中存在的目标对象,确定这些目标对象的语义类别,并标定出目标对象在图像中的位置。
本申请实施例中,电子设备在对裁剪图像进行主体检测时,首先对待处理图像进行对象检测,得到 对应不同对象的多个对象边界框。其中,对象边界框即表征了其对应的对象在裁剪图像中的位置。应当说明的是,本申请实施例中对于如何进行对象检测不做具体限制,可由本领域普通技术人员根据实际需要选取合适的对象检测方式。比如,可以采用深度学习的方式训练对象检测模型,利用对象检测模型对图片进行对象检测,包括但不限于SSD、Faster-RCNN等。
在检测得到多个对象边界框之后,电子设备进一步对每一对象边界框内的对象进行主体检测。这样,相较于直接对裁剪图像进行主体检测,能够有效提高主体检测的准确性。
在一实施例中,将裁剪图像划分为包括预设主体的多个子图像,包括:
(1)确定出被检测为预设主体的对象的目标对象边界框;
(2)将重叠的目标边界框合并得到合并边界框;
(3)确定出面积最大的目标合并边界框,并随机生成包括目标合并边界框的多个裁剪框;
(4)截取多个裁剪框内的图像内容得到多个子图像。
本申请实施例中,电子设备可以按照以下方式将裁剪图像划分为包括预设主体的多个子图像。
电子设备首先确定出被检测为预设主体的对象的对象边界框,记为目标对象边界框。然后,电子设备识别任意两个目标对象边界框之间是否有重叠,若有重叠,则采用最大外接矩形框的方式将重叠的两个目标边界框合并为合并边界框,也即合并边界框为相互重叠的两个目标边界框的最大外接矩形框。由此,可以避免合影或者怀抱宠物等情况被划分为不同的子图像。
之后,电子设备确定面积最大的目标合并边界框,并以包括面积最大的目标合并边界框为约束,随机生成多个不同形状和/或大小的裁剪框。
之后,电子设备进一步截取出各裁剪框内的图像内容得到多个子图像。
在一实施例中,对裁剪图像进行主体检测之后,还包括:
当检测到裁剪图像不存在预设主体时,随机将待处理图像划分为不同面积的多个子图像。
本申请实施例中,当检测到裁剪图像中不存在预设主体,也即是裁剪图像中不存在明确主体,比如待处理图像为风景类图像,此时电子设备随机将待处理图像划分为不同面积的多个子图像,并转入执行将子图像以及待处理图像作为候选图像进行图像质量评分的步骤。
示例性的,假定相较于裁剪图像的面积大小区间(0,10%]、(10%,20%]、……、(90%,100%]所需要生成的裁剪框的数量分别为N1、N2、……、N10。然后,随机生成裁剪框的左上角坐标和右下角坐标,并计算该裁剪框的面积,相应在对应的面积大小区间计数上加一,如此循环,直至每一面积大小区间对应的裁剪框数量达到假定数量。然后,截取出这些随机生成的裁剪框中的图像内容,即可将待处理图像随机划分为不同面积的多个子图像。
在一实施例中,将子图像以及待处理图像作为候选图像进行图像质量评分,包括:
(1)在多个不同质量维度分别对候选图像进行图像质量评分,得到多个候选评分;
(2)根据多个候选评分加权得到候选图像的质量评分。
其中,质量维度包括但不限于构图、色彩搭配、明暗度、失真度、噪点等维度。在将子图像以及待处理图像作为候选图像进行图像质量评分时,对于每一候选图像,电子设备可以按照如下方式进行图像 质量评分。
对于每一质量维度,电子设备调用预训练的与该质量维度对应的评分模型对候选图像进行评分,将得到评分记为候选评分,由此,可以得到多个候选评分。然后,电子设备根据各质量维度对应的权重,将多个候选评分进行加权运算,得到候选图像的质量评分。通俗的说,每一个评分模型只负责一个质量维度的评分,最后综合各评分模型的评分得到候选图像的质量评分。
可选的,在其它实施例中,还可以只训练一个评分模型,由该评分模型同时负责评估各质量维度,并直接输出质量评分。
示例性的,当期望的质量分数是离散的,如1,2,3,……,10等,则可以采用分类模型作为基础模型进行训练,输出的结果为10个分类的置信度,取置信度最高的那个分类即可作为图像的质量评分。当期望图像质量评估的分数是连续的,如1,1.1,1.3,……,9.5,10.1等,则可以采用回归模型作为基础模型进行训练,输出的结果为带有小数的分数,此结果直接作为质量评分。
比如,可以按照如下方式构建训练样本:
采集样本图像,对于每一样本图像,由多人对样本图像进行人工评分。由于每个人对于图像打分的标准不同,例如有些人倾向于将大多数图像都打中间值5、6分,有些人倾向于将图像的打分分布拉大,觉得不好的打1、2分,觉得好的图像打8、9分。为了排除人与人之间打分的差异,取这些分数的平均值作为样本图像的样本质量分数,将样本图像及其样本质量分数作为一个训练样本。
之后,即可根据构建训练样本对基础模型进行有监督的模型训练,得到评分模型。
请参照图6,本申请提供的图像处理方法的流程还可以为:
在201中,电子设备获取待处理图像,并识别待处理图像的水平分界线。
本申请实施例中,电子设备可以基于预设的图像处理周期,按照预设的图像选取规则,确定需要进行图像处理的待处理图像,或者是在接收到用户输入的图像处理指令时,根据用户输入的图像处理指令确定需要进行图像处理的待处理图像,等等。
应当说明的是,本申请实施例对于图像处理周期、图像选取规则以及图像处理指令的设置均不做具体限定,可由电子设备根据用户输入进行设置,也可由电子设备的生产厂商对电子设备进行缺省设置,等等。
在获取到待处理图像之后,电子设备进一步识别待处理图像的水平分界线。其中,水平分界线可以形象的理解为图像中景物在水平方向的分界线,比如蓝天与沙滩的分界线,蓝天与海水的分界线,蓝天和草地的分界线等。
示例性的,电子设备可以按照以下方式识别待处理图像的水平分界线。
首先,电子设备对待处理图像进行语义分割,将待处理图像划分多个对应不同类别的图像区域。其中,语义分割是指将图像内容划分成多个区域,每个区域对应一个类别,期望分割后图像在相同区域内的像素都对应于同一个类别。在一定程度上可以将语义分割看作是图像像素的分类,包括基于阈值的分割、基于区域的分割、基于边缘检测的分割等。此外,还包括基于深度学习的语义分割,比如DeepLab、 MaskRCNN等。应当说明的是,本申请对语义分割的方式不做具体限定,可由本领域普通技术人员根据实际需要选取语义分割方式。示例性的,本申请中以所需要进行分割的类别为蓝天、草地、沙滩、海水等与水平面相关的类别为约束,将待处理图像分割为多个图像区域。
在将待处理图像分割为多个图像区域之后,电子设备进一步识别相邻图像区域间的区域分界线,这些区域分界线即为可能的水平分界线。之后,电子设备从区域分界线中确定出与水平方向夹角小于预设角度的区域分界线,记为目标区域分界线。应当说明的是,本申请实施例中对预设角度的取值不做具体限制,可由本领域普通技术人员根据实际需要进行设置,比如,本申请实施例将预设角度配置为30度,由此,确定出的目标区域分界线即与水平方向夹角小于30度的区域分界线。
另外,电子设备还对待处理图像进行边缘检测,得到待处理图像的边缘线。应当说明的是,本申请中对边缘检测的方式不做具体限制,可由本领域普通技术人员根据实际需要进行选取。以并行微分算子法为例,其利用相邻区域的像素不连续的性质,采用一阶或者二阶导数来检测边缘点,典型的算法有Sobel、Laplacian、Roberts等。在检测得到待处理图像的边缘线之后,电子设备进一步确定出与水平方向夹角小于预设角度的边缘线,记为目标边缘线。
在确定出目标区域分界线以及目标边缘线之后,电子设备进一步确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为待处理图像的水平分界线。
可选地,在确定重合度最高的目标边缘线和目标区域分界线之前,电子设备还可以对目标边缘线和目标区域分界线进行预处理,删除其中长度小于预设长度的目标边缘线和/或目标区域分界线。应当说明的是,本申请实施例中对预设长度确定其中不做具体限制,可由本领域普通技术人员根据实际需要进行配置。比如,可以将预设长度配置为待处理图像水平方向侧边长度的二分之一。
在202中,电子设备旋转待处理图像,将水平分界线旋转至与水平方向平行。
通常的,水平伸展的直线可以让图像的画面内容看起来更加宽阔、稳定、和谐,若其相对于图像的边框出现歪斜则会给人一种不稳定的感觉。因此,电子设备在识别到待处理图像的水平分界线之后,通过旋转待处理图像将其水平分界线旋转至与水平方向平行,如图4所示。
在203中,电子设备利用最大内接矩形框裁剪旋转后的待处理图像得到裁剪图像。
在将待处理图像的水平分界线旋转至与水平方向平行后,电子设备进一步裁剪旋转后的待处理图像得到裁剪图像。
比如,本申请实施例中,电子设备采用最大内接矩形对旋转后的待处理图像进行裁剪,得到保留最多图像内容的裁剪图像,如图5所示。
在204中,电子设备检测裁剪图像中是否存在预设主体,是则转入205,否则转入206。
本申请实施例中,电子设备对裁剪图像进行主体检测,即检测其中是否存在预设主体。其中,预设主体包括人像、宠物、美食等明确主体。
示例性的,电子设备在对裁剪图像进行主体检测时,首先对待处理图像进行对象检测,得到对应不同对象的多个对象边界框。其中,对象边界框即表征了其对应的对象在裁剪图像中的位置。应当说明的 是,本申请实施例中对于如何进行对象检测不做具体限制,可由本领域普通技术人员根据实际需要选取合适的对象检测方式。比如,可以采用深度学习的方式训练对象检测模型,利用对象检测模型对图片进行对象检测,包括但不限于SSD、Faster-RCNN等。
在检测得到多个对象边界框之后,电子设备进一步对每一对象边界框内的对象进行主体检测,判断其中是否存在预设主体。
在205中,电子设备将裁剪图像划分为包括预设主体的多个子图像,转入207。
当检测到裁剪图像包括预设主体时,电子设备可以按照以下方式将裁剪图像划分为包括预设主体的多个子图像。
电子设备首先确定出被检测为预设主体的对象的对象边界框,记为目标对象边界框。然后,电子设备识别任意两个目标对象边界框之间是否有重叠,若有重叠,则采用最大外接矩形框的方式将重叠的两个目标边界框合并为合并边界框,也即合并边界框为相互重叠的两个目标边界框的最大外接矩形框。由此,可以避免合影或者怀抱宠物等情况被划分为不同的子图像。
之后,电子设备确定面积最大的目标合并边界框,并以包括面积最大的目标合并边界框为约束,随机生成多个不同形状和/或大小的裁剪框。
之后,电子设备进一步截取出各裁剪框内的图像内容得到多个子图像。
在206中,电子设备随机将待处理图像划分为不同面积的多个子图像。
当检测到裁剪图像中不存在预设主体,也即是裁剪图像中不存在明确主体,比如待处理图像为风景类图像,此时电子设备随机将待处理图像划分为不同面积的多个子图像,并转入执行将子图像以及待处理图像作为候选图像进行图像质量评分的步骤。
示例性的,假定相较于裁剪图像的面积大小区间(0,10%]、(10%,20%]、……、(90%,100%]所需要生成的裁剪框的数量分别为N1、N2、……、N10。然后,随机生成裁剪框的左上角坐标和右下角坐标,并计算该裁剪框的面积,相应在对应的面积大小区间计数上加一,如此循环,直至每一面积大小区间对应的裁剪框数量达到假定数量。然后,截取出这些随机生成的裁剪框中的图像内容,即可将待处理图像随机划分为不同面积的多个子图像。
在207中,电子设备将子图像以及待处理图像作为候选图像进行图像质量评分。
在将裁剪图像划分多个子图像之后,电子设备进一步将划分得到的子图像以及原始的待处理图像作为候选图像,并对每一候选图像进行图像质量评分。
其中,图像质量评分的实现从方式上可分为主观有参考评分和客观无参考评分。主观有参考评分就是从人的主观感知来评价图像的质量,比如,给出原始参考图像,这张参考图片是图像质量最好的图片,在进行图像质量评分时则依据这张图片进行评分,可采用平均主观得分(Mean Opinion Score,MOS)或平均主观得分差异(Differential Mean Opinion Score,DMOS)表示。客观无参考评分指的是没有最佳参考图片,而是训练数学模型,使用数学模型给出量化值,比如,图像质量评分区间可以[1~10]分,其中,1分代表图像质量很差,10分代表图像质量很好,评分可以是离散值,也可以是连续值。
在208中,电子设备筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
在完成对各候选图像的图像质量评分之后,电子设备进一步从各候选图像中筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
比如,电子设备共将裁剪图像划分为5个子图像,分别为子图像A、子图像B、子图像C、子图像D以及子图像E,这些子图像以及原始的待处理图像将被作为候选图像进行图像质量评分,若其中子图像D的质量评分最高,则电子设备将子图像D作为待处理图像的处理结果图像。
此外,当质量评分最高的候选图像不唯一时,电子设备可以进一步筛选出质量评分最高且面积最大的候选图像作为待处理图像的处理结果图像。
在一实施例中,还提供一种图像处理装置。请参照图7,图7为本申请实施例提供的图像处理装置的结构示意图。其中该图像处理装置应用于电子设备,该图像处理装置包括图像获取模块301、图像旋转模块302、图像划分模块303、图像筛选模块304、调整提示模块305以及图像拍摄模块306,如下:
图像获取模块301,用于获取待处理图像,并识别待处理图像的水平分界线;
图像旋转模块302,用于旋转待处理图像以将其水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;
图像划分模块303,用于将裁剪图像划分为多个子图像,并将子图像以及待处理图像作为候选图像进行图像质量评分;
图像筛选模块304,用于筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
在一实施例中,在识别待处理图像的水平分界线时,图像获取模块301用于:
对待处理图像进行语义分割,得到多个图像区域;
识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;
对待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘线;
确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为水平分界线。
在一实施例中,在将裁剪图像划分为多个子图像时,图像划分模块303用于:
对裁剪图像进行主体检测;
当检测裁剪图像存在预设主体时,将裁剪图像划分为包括预设主体的多个子图像。
在一实施例中,在对裁剪图像进行主体检测时,图像划分模块303用于:
对待处理图像进行对象检测,得到对应不同对象的多个对象边界框;
对每一对象边界框内的对象进行主体检测。
在一实施例中,在将裁剪图像划分为包括预设主体的多个子图像时,图像划分模块303用于:
确定出被检测为预设主体的对象的目标对象边界框;
将重叠的目标边界框合并得到合并边界框;
确定出面积最大的目标合并边界框,并随机生成包括目标合并边界框的多个裁剪框;
截取多个裁剪框内的图像内容得到多个子图像。
在一实施例中,在对裁剪图像进行主体检测之后,图像划分模块303还用于:
当检测到裁剪图像不存在预设主体时,随机将待处理图像划分为不同面积的多个子图像。
在一实施例中,在将子图像以及待处理图像作为候选图像进行图像质量评分时,图像划分模块303用于:
在多个不同质量维度分别对候选图像进行图像质量评分,得到多个候选评分;
根据多个候选评分加权得到候选图像的质量评分。
应当说明的是,本申请实施例提供的图像处理装置与上文实施例中的图像处理方法属于同一构思,在图像处理装置上可以运行图像处理方法实施例中提供的任一方法,其具体实现过程详见以上实施例,此处不再赘述。
在一实施例中,还提供一种电子设备,请参照图8,电子设备包括处理器401和存储器402。
本申请实施例中的处理器401是通用处理器,比如ARM架构的处理器。
存储器402中存储有计算机程序,其可以为高速随机存取存储器,还可以为非易失性存储器,比如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件等。相应地,存储器402还可以包括存储器控制器,以提供处理器401对存储器402中计算机程序的访问,实现如下功能:
获取待处理图像,并识别待处理图像的水平分界线;
旋转待处理图像以将其水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;
将裁剪图像划分为多个子图像,并将子图像以及待处理图像作为候选图像进行图像质量评分;
筛选出质量评分最高的候选图像作为待处理图像的处理结果图像。
在一实施例中,在识别待处理图像的水平分界线时,处理器401用于执行:
对待处理图像进行语义分割,得到多个图像区域;
识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;
对待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘线;
确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为水平分界线。
在一实施例中,在将裁剪图像划分为多个子图像时,处理器401用于执行:
对裁剪图像进行主体检测;
当检测裁剪图像存在预设主体时,将裁剪图像划分为包括预设主体的多个子图像。
在一实施例中,在对裁剪图像进行主体检测时,处理器401用于执行:
对待处理图像进行对象检测,得到对应不同对象的多个对象边界框;
对每一对象边界框内的对象进行主体检测。
在一实施例中,在将裁剪图像划分为包括预设主体的多个子图像时,处理器401用于执行:
确定出被检测为预设主体的对象的目标对象边界框;
将重叠的目标边界框合并得到合并边界框;
确定出面积最大的目标合并边界框,并随机生成包括目标合并边界框的多个裁剪框;
截取多个裁剪框内的图像内容得到多个子图像。
在一实施例中,在对裁剪图像进行主体检测之后,处理器401还用于执行:
当检测到裁剪图像不存在预设主体时,随机将待处理图像划分为不同面积的多个子图像。
在一实施例中,在将子图像以及待处理图像作为候选图像进行图像质量评分时,处理器401用于执行:
在多个不同质量维度分别对候选图像进行图像质量评分,得到多个候选评分;
根据多个候选评分加权得到候选图像的质量评分。
在一实施例中,在多个不同质量维度分别对候选图像进行图像质量评分,得到多个候选评分时,处理器401用于执行:
对于每一质量维度,调用对应的评分模型对候选图像进行评分,得到每一质量维度的候选评分。
在一实施例中,在筛选出质量评分最高的候选图像作为待处理图像的处理结果图像时,处理器401用于执行:
在质量评分最高的候选图像不唯一时,筛选出质量评分最高且面积最大的候选图像作为处理结果图像。
应当说明的是,本申请实施例提供的电子设备与上文实施例中的图像处理方法属于同一构思,在电子设备上可以运行图像处理方法实施例中提供的任一方法,其具体实现过程详见特征提取方法实施例,此处不再赘述。
需要说明的是,对本申请实施例的图像处理方法而言,本领域普通测试人员可以理解实现本申请实施例的图像处理方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读取存储介质中,如存储在电子设备的存储器中,并被该电子设备内的处理器执行,在执行过程中可包括如图像处理方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储器、随机存取记忆体等。
以上对本申请实施例所提供的一种图像处理方法、装置、存储介质及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。
Claims (20)
- 一种图像处理方法,其中,包括:获取待处理图像,并识别所述待处理图像的水平分界线;旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
- 根据权利要求1所述的图像处理方法,其中,所述识别所述待处理图像的水平分界线,包括:对所述待处理图像进行语义分割,得到多个图像区域;识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;对所述待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘线;确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为所述水平分界线。
- 根据权利要求1所述的图像处理方法,其中,所述将所述裁剪图像划分为多个子图像,包括:对所述裁剪图像进行主体检测;当检测所述裁剪图像存在预设主体时,将所述裁剪图像划分为包括所述预设主体的多个子图像,并转入执行所述将所述子图像以及所述待处理图像作为候选图像进行图像质量评分。
- 根据权利要求3所述的图像处理方法,其中,所述对所述裁剪图像进行主体检测,包括:对所述待处理图像进行对象检测,得到对应不同对象的多个对象边界框;对每一对象边界框内的对象进行主体检测。
- 根据权利要求4所述的图像处理方法,其中,所述将所述裁剪图像划分为包括所述预设主体的多个子图像,包括:确定出被检测为预设主体的对象的目标对象边界框;将重叠的目标边界框合并得到合并边界框;确定出面积最大的目标合并边界框,并随机生成包括所述目标合并边界框的多个裁剪框;截取所述多个裁剪框内的图像内容得到所述多个子图像。
- 根据权利要求3所述的图像处理方法,其中,所述对所述裁剪图像进行主体检测之后,还包括:当检测到所述裁剪图像不存在预设主体时,随机将所述待处理图像划分为不同面积的多个子图像。
- 根据权利要求1-6任一项所述的图像处理方法,其中,所述将所述子图像以及所述待处理图像作为候选图像进行图像质量评分,包括:在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分;根据所述多个候选评分加权得到所述候选图像的质量评分。
- 根据权利要求7所述的图像处理方法,其中,所述在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分,包括:对于每一质量维度,调用对应的评分模型对候选图像进行评分,得到每一质量维度的候选评分。
- 根据权利要求1-6任一项所述的图像处理方法,其中,所述筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像,包括:在质量评分最高的候选图像不唯一时,筛选出质量评分最高且面积最大的候选图像作为所述处理结果图像。
- 一种图像处理装置,应用于电子设备,其中,包括:图像获取模块,用于获取待处理图像,并识别所述待处理图像的水平分界线;图像旋转模块,用于旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;图像划分模块,用于将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;图像筛选模块,用于筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
- 一种存储介质,其上存储有计算机程序,其中,当所述计算机程序被处理器加载时执行:获取待处理图像,并识别所述待处理图像的水平分界线;旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
- 一种电子设备,包括处理器和存储器,所述存储器储存有计算机程序,其中,所述处理器通过加载所述计算机程序,用于执行:获取待处理图像,并识别所述待处理图像的水平分界线;旋转所述待处理图像以将所述水平分界线旋转至预设位置,并裁剪旋转后的待处理图像得到裁剪图像;将所述裁剪图像划分为多个子图像,并将所述子图像以及所述待处理图像作为候选图像进行图像质量评分;筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像。
- 根据权利要求12所述的电子设备,其中,在识别所述待处理图像的水平分界线时,所述处理器用于执行:对所述待处理图像进行语义分割,得到多个图像区域;识别相邻图像区域间的区域分界线,并确定出与水平方向夹角小于预设角度的目标区域分界线;对所述待处理图像进行边缘检测得到边缘线,并确定出与水平方向夹角小于预设角度的目标边缘 线;确定出重合度最高的目标边缘线和目标区域分界线,并将重合度最高的目标边缘线和目标区域分界线拟合为一条直线,作为所述水平分界线。
- 根据权利要求12所述的电子设备,其中,在将所述裁剪图像划分为多个子图像时,所述处理器用于执行:对所述裁剪图像进行主体检测;当检测所述裁剪图像存在预设主体时,将所述裁剪图像划分为包括所述预设主体的多个子图像,并转入执行所述将所述子图像以及所述待处理图像作为候选图像进行图像质量评分。
- 根据权利要求14所述的电子设备,其中,在对所述裁剪图像进行主体检测时,所述处理器用于执行:对所述待处理图像进行对象检测,得到对应不同对象的多个对象边界框;对每一对象边界框内的对象进行主体检测。
- 根据权利要求15所述的电子设备,其中,在将所述裁剪图像划分为包括所述预设主体的多个子图像时,所述处理器用于执行:确定出被检测为预设主体的对象的目标对象边界框;将重叠的目标边界框合并得到合并边界框;确定出面积最大的目标合并边界框,并随机生成包括所述目标合并边界框的多个裁剪框;截取所述多个裁剪框内的图像内容得到所述多个子图像。
- 根据权利要求14所述的电子设备,其中,在对所述裁剪图像进行主体检测之后,所述处理器还用于执行:当检测到所述裁剪图像不存在预设主体时,随机将所述待处理图像划分为不同面积的多个子图像。
- 根据权利要求12-17任一项所述的电子设备,其中,在将所述子图像以及所述待处理图像作为候选图像进行图像质量评分时,所述处理器用于执行:在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分;根据所述多个候选评分加权得到所述候选图像的质量评分。
- 根据权利要求18所述的电子设备,其中,在多个不同质量维度分别对所述候选图像进行图像质量评分,得到多个候选评分时,所述处理器用于执行:对于每一质量维度,调用对应的评分模型对候选图像进行评分,得到每一质量维度的候选评分。
- 根据权利要求12-17任一项所述的电子设备,其中,在筛选出质量评分最高的候选图像作为所述待处理图像的处理结果图像时,所述处理器用于执行:在质量评分最高的候选图像不唯一时,筛选出质量评分最高且面积最大的候选图像作为所述处理结果图像。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010219730.6A CN111415302B (zh) | 2020-03-25 | 2020-03-25 | 图像处理方法、装置、存储介质及电子设备 |
CN202010219730.6 | 2020-03-25 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021190168A1 true WO2021190168A1 (zh) | 2021-09-30 |
Family
ID=71494700
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/075100 WO2021190168A1 (zh) | 2020-03-25 | 2021-02-03 | 图像处理方法、装置、存储介质及电子设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111415302B (zh) |
WO (1) | WO2021190168A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114526709A (zh) * | 2022-02-21 | 2022-05-24 | 中国科学技术大学先进技术研究院 | 基于无人机的面积测量方法、设备及存储介质 |
CN115830028A (zh) * | 2023-02-20 | 2023-03-21 | 阿里巴巴达摩院(杭州)科技有限公司 | 图像评价方法、设备、系统及存储介质 |
CN116150421A (zh) * | 2023-04-23 | 2023-05-23 | 深圳竹云科技股份有限公司 | 图像的展示方法、装置、计算机设备和存储介质 |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111415302B (zh) * | 2020-03-25 | 2023-06-09 | Oppo广东移动通信有限公司 | 图像处理方法、装置、存储介质及电子设备 |
CN111860330B (zh) * | 2020-07-21 | 2023-08-11 | 陕西工业职业技术学院 | 基于多特征融合和卷积神经网络的苹果叶部病害识别方法 |
CN114549830A (zh) * | 2020-11-25 | 2022-05-27 | 博泰车联网科技(上海)股份有限公司 | 图片获取方法及装置、电子设备、计算机存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180249040A1 (en) * | 2017-02-24 | 2018-08-30 | Kyocera Document Solutions Inc. | Image processing device, image reading device, and image forming apparatus |
CN109523503A (zh) * | 2018-09-11 | 2019-03-26 | 北京三快在线科技有限公司 | 一种图像裁剪的方法和装置 |
CN110223301A (zh) * | 2019-03-01 | 2019-09-10 | 华为技术有限公司 | 一种图像裁剪方法和电子设备 |
CN110506292A (zh) * | 2017-04-13 | 2019-11-26 | 夏普株式会社 | 图像处理装置、摄像装置、终端装置、图像校正方法及图像处理程序 |
CN111415302A (zh) * | 2020-03-25 | 2020-07-14 | Oppo广东移动通信有限公司 | 图像处理方法、装置、存储介质及电子设备 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8422788B2 (en) * | 2008-08-26 | 2013-04-16 | Microsoft Corporation | Automatic image straightening |
CN104463780A (zh) * | 2014-12-23 | 2015-03-25 | 深圳供电局有限公司 | 一种移动终端上图片裁剪的方法及装置 |
CN107123123B (zh) * | 2017-05-02 | 2019-06-25 | 电子科技大学 | 基于卷积神经网络的图像分割质量评价方法 |
CN110634116B (zh) * | 2018-05-30 | 2022-04-05 | 杭州海康威视数字技术股份有限公司 | 一种面部图像评分方法及摄像机 |
CN110837750B (zh) * | 2018-08-15 | 2023-11-03 | 华为技术有限公司 | 一种人脸质量评价方法与装置 |
-
2020
- 2020-03-25 CN CN202010219730.6A patent/CN111415302B/zh active Active
-
2021
- 2021-02-03 WO PCT/CN2021/075100 patent/WO2021190168A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180249040A1 (en) * | 2017-02-24 | 2018-08-30 | Kyocera Document Solutions Inc. | Image processing device, image reading device, and image forming apparatus |
CN110506292A (zh) * | 2017-04-13 | 2019-11-26 | 夏普株式会社 | 图像处理装置、摄像装置、终端装置、图像校正方法及图像处理程序 |
CN109523503A (zh) * | 2018-09-11 | 2019-03-26 | 北京三快在线科技有限公司 | 一种图像裁剪的方法和装置 |
CN110223301A (zh) * | 2019-03-01 | 2019-09-10 | 华为技术有限公司 | 一种图像裁剪方法和电子设备 |
CN111415302A (zh) * | 2020-03-25 | 2020-07-14 | Oppo广东移动通信有限公司 | 图像处理方法、装置、存储介质及电子设备 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114526709A (zh) * | 2022-02-21 | 2022-05-24 | 中国科学技术大学先进技术研究院 | 基于无人机的面积测量方法、设备及存储介质 |
CN115830028A (zh) * | 2023-02-20 | 2023-03-21 | 阿里巴巴达摩院(杭州)科技有限公司 | 图像评价方法、设备、系统及存储介质 |
CN116150421A (zh) * | 2023-04-23 | 2023-05-23 | 深圳竹云科技股份有限公司 | 图像的展示方法、装置、计算机设备和存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111415302B (zh) | 2023-06-09 |
CN111415302A (zh) | 2020-07-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021190168A1 (zh) | 图像处理方法、装置、存储介质及电子设备 | |
WO2019128508A1 (zh) | 图像处理方法、装置、存储介质及电子设备 | |
US10147163B2 (en) | Systems and methods for automated image cropping | |
WO2019153739A1 (zh) | 基于人脸识别的身份认证方法、装置、设备和存储介质 | |
US7574054B2 (en) | Using photographer identity to classify images | |
US11176355B2 (en) | Facial image processing method and apparatus, electronic device and computer readable storage medium | |
KR101725884B1 (ko) | 이미지들에 대한 자동 프로세싱 | |
WO2018094648A1 (zh) | 拍摄构图引导方法及装置 | |
WO2020233178A1 (zh) | 一种图像处理方法、装置及电子设备 | |
US8532337B2 (en) | Object tracking method | |
WO2015149475A1 (zh) | 图片处理方法及装置 | |
WO2021135945A1 (zh) | 图像处理方法、装置、存储介质以及电子设备 | |
WO2022042670A1 (zh) | 基于眼部状态检测的图像处理方法、装置及存储介质 | |
US20190311186A1 (en) | Face recognition method | |
US9400924B2 (en) | Object recognition method and object recognition apparatus using the same | |
WO2020001219A1 (zh) | 图像处理方法和装置、存储介质、电子设备 | |
WO2016101524A1 (zh) | 纠正被摄物体拍摄倾斜方法、装置及移动终端、存储介质 | |
WO2019120018A1 (zh) | 照片的处理方法、装置、存储介质及电子设备 | |
Manh et al. | Small object segmentation based on visual saliency in natural images | |
Leal et al. | Smartphone camera document detection via Geodesic Object Proposals | |
CN111669492A (zh) | 一种终端对拍摄的数字图像进行处理的方法及终端 | |
JP2023540272A (ja) | ピクチャ処理方法、装置、デバイス及び記憶媒体 | |
CN111182207B (zh) | 图像拍摄方法、装置、存储介质及电子设备 | |
WO2018192244A1 (zh) | 一种智能设备的拍摄引导方法 | |
JP6175583B1 (ja) | 画像処理装置、実寸法表示方法、及び実寸法表示処理プログラム |
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: 21774936 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21774936 Country of ref document: EP Kind code of ref document: A1 |