Picture correction method, electronic equipment, storage medium and program product
By parsing Exif data and rotating images, the problem of incorrect orientation of images taken by user devices on different devices and platforms is solved, and the normal use of images on multiple platforms is achieved.
Patent Information
- Application Number
- CN202510723440.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-10-24
AI Technical Summary
When images taken by user devices are uploaded to other platforms, they are in the wrong orientation, resulting in inability to use them normally. Existing technologies cannot fundamentally solve this problem, especially in terms of compatibility issues between different devices and platforms.
By parsing the Exif data of the original image, the target image data, including the image width, height, and gravity sensor direction, is obtained to determine whether the actual content direction is consistent with the preset direction. If not, the image is rotated to the preset direction and the Exif data is adjusted to ensure the consistency of the image direction, so that the image can be used normally on different devices and platforms.
It realizes automatic correction of image orientation on different devices and platforms, ensures that the images meet the usage requirements, solves the compatibility issues between devices and platforms, and ensures that the images are displayed normally on various platforms.
Smart Images

Figure CN120833283A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a picture correction method, an electronic device, a storage medium and a program product. BACKGROUND
[0002] The AI photographing function can generate a professional dress picture of a standard dress image based on a standard half-length picture uploaded by a user. During the user test of the AI photographing function, it is found that the pictures taken by the camera of some models are reversed by 270 degrees or 90 degrees after uploading, resulting in the failure of generating a portrait. However, the rule of picture rotation is not fixed, and the front camera and the rear camera of the same device or different devices may be different. The usual way is to make special judgment and processing for the device model when a device is found, which cannot fundamentally eliminate the occurrence of such problems and is passive to make logical judgment and processing after the problem occurs. Therefore, it is necessary to provide a picture direction error solution scheme independent of platforms and devices, so that the pictures taken can be normally used on different devices and platforms. SUMMARY
[0003] The present application provides a picture correction method, an electronic device, a storage medium and a program product to solve the defects that the pictures taken by the user device are directionally incorrect after uploading to other platforms and cannot be normally used, and to realize a picture direction error solution scheme independent of platforms and devices, so that the pictures taken can be normally used on different devices and platforms.
[0004] The present application provides a picture correction method, comprising the following steps: obtaining an original picture taken by a user device, and obtaining target picture data by analyzing Exif data of the original picture; wherein the target picture data comprises a picture width, a picture height and a gravity sensor direction; in response to the relationship between the picture width and the picture height not satisfying a preset size relationship, or the direction of the gravity sensor not being a preset direction, obtaining an actual content direction of the original picture according to the picture content of the original picture; and in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture.
[0005] According to the picture correction method provided by the present application, after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: in response to the relationship between the picture width and the picture height not satisfying the preset size relationship, adjusting the relationship between the picture width and the picture height in the Exif data to satisfy the preset size relationship; and in response to the direction of the gravity sensor not being the preset direction, adjusting the direction of the gravity sensor in the Exif data to the preset direction.
[0006] According to the picture correction method provided by the application, the preset size relationship is that the picture width is less than the picture height, and the preset direction of the gravity sensor is 0 degree; the method further comprises: displaying prompt information of vertical photographing on the upper interface of the original picture.
[0007] According to the picture correction method provided by the application, the original picture is a portrait upper body picture; after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: generating a professional dress picture based on the rotated portrait upper body picture.
[0008] According to the picture correction method provided by the application, the actual content direction of the original picture is obtained according to the picture content of the original picture, comprising: determining the contour of the person in the portrait upper body picture; the variation rule of the line spacing between the contours of the person is obtained by scanning the contour of the person from left to right and from top to bottom, and the actual content direction is determined according to the variation rule of the line spacing between the contours of the person.
[0009] According to the picture correction method provided by the application, the contour information of the person in the portrait upper body picture is determined, comprising: extracting portrait feature information by using a HOG picture recognition algorithm, and determining the contour information according to the portrait feature information.
[0010] According to the picture correction method provided by the application, after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: performing picture information integrity checking on the original picture after direction adjustment.
[0011] The application further provides a picture correction device, comprising the following modules: a first acquisition module, configured to: acquire an original picture taken by a user equipment, and acquire target picture data by analyzing Exif data of the original picture; wherein the target picture data comprises picture width, picture height and gravity sensor direction; a second acquisition module, configured to: in response to a relationship between the picture width and the picture height not satisfying a preset size relationship, or a direction of the gravity sensor not being a preset direction, acquire an actual content direction of the original picture according to picture content of the original picture; and a picture rotation module, configured to: in response to the actual content direction being inconsistent with the preset direction, adjust the actual content direction to the preset direction by rotating the original picture.
[0012] The application further provides an electronic equipment, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the picture correction method according to any one of the above-mentioned methods when executing the computer program.
[0013] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement any one of the picture correction methods.
[0014] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement any one of the picture correction methods.
[0015] The picture correction method, the electronic device, the storage medium and the program product provided by the application, by acquiring the original picture shot by the user equipment, acquiring the target picture data by analyzing the Exif data of the original picture, the target picture data comprising the picture width, the picture height and the direction of the gravity sensor, in response to the relationship between the picture width and the picture height not satisfying the preset size relationship, or the direction of the gravity sensor not being the preset direction, acquiring the actual content direction of the original picture according to the picture content of the original picture, in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture, the correction when the picture direction is wrong is realized, the picture shot by the user equipment is ensured to meet the use requirement after correction, the picture direction error solution scheme independent of the platform and the equipment is realized, and the picture after shooting can be normally used on different equipment and platforms. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0017] Figure 1 is one of the flowcharts of the picture correction method provided by the application.
[0018] Figure 2 is the second flowchart of the picture correction method provided by the application.
[0019] Figure 3 is the third flowchart of the picture correction method provided by the application.
[0020] Figure 4 is the structural schematic diagram of the picture correction device provided by the application.
[0021] Figure 5 is the structural schematic diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0022] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the protection scope of the present application.
[0023] It is found through problem positioning that, due to different settings of different manufacturers of device sensors, the photographing direction and the sensor direction information in the Exif data of a picture do not match on some models of devices, which leads to the fact that the direction of the picture taken by some devices is wrong when the picture is displayed on other devices or other systems.
[0024] Figure 1 is one of the flowcharts of the picture correction method provided by the present application, as shown in Figure 1 The method comprises the following steps. Step S1: obtaining an original picture taken by a user device, and obtaining target picture data by analyzing Exif data of the original picture; wherein the target picture data comprises a picture width, a picture height and a gravity sensor direction.
[0025] The execution subject of the picture correction method provided by the present application can be referred to as a picture correction device.
[0026] The user device can be a mobile terminal device such as a mobile phone. The user takes a picture by using the user device and uploads the picture to the picture correction device. The picture correction device obtains an original picture taken by the user device. The picture correction device can obtain the original picture taken by the user device by calling a bottom-layer photographing API of the user device. The original picture is not a picture processed by an upper-layer camera application of the user device, but a basic picture taken by the user device. For example, the upper-layer camera application of the user device can be set to take a picture according to a 1:1 ratio, but the ratio of the original picture is limited to 4:3.
[0027] The Exchangeable image file format (Exif) is specially set for the photos of digital cameras, and can record the attribute information and shooting data of digital photos. Target picture data is obtained by analyzing Exif data of an original picture, wherein the target picture data includes picture width, picture height, and a gravity sensor direction. The gravity sensor direction is related to a posture when shooting, and includes 0°, 90°, 180°, and 270°. Taking a mobile phone as an example, wherein the gravity sensor is 0°, which means that the mobile phone is vertically normally shot. The gravity sensor is 90°, which means that the mobile phone is rotated 90 degrees clockwise in the 0-degree direction. The gravity sensor is 180°, which means that the mobile phone is rotated 180 degrees clockwise in the 0-degree direction. The gravity sensor is 270°, which means that the mobile phone is rotated 270 degrees clockwise in the 0-degree direction.
[0028] In step S2, in response to the relationship between the picture width and the picture height not satisfying a preset size relationship, or the direction of the gravity sensor not being a preset direction, an actual content direction of the original picture is obtained according to picture content of the original picture.
[0029] The relationship between the picture width and the picture height in the target picture data is obtained. If the relationship between the picture width and the picture height does not satisfy a preset size relationship, an actual content direction of the original picture is obtained according to picture content of the original picture. For example, the preset size relationship is that the width is less than the height, and the relationship between the picture width and the picture height in the target picture data is that the width is greater than the height. Therefore, the relationship between the picture width and the picture height does not satisfy the preset size relationship, and the actual content direction of the original picture is obtained according to the picture content of the original picture.
[0030] Alternatively, if the direction of the gravity sensor is not the preset direction, the actual content direction of the original picture is obtained according to the picture content of the original picture. For example, if the preset direction of the gravity sensor is 0°, and the direction of the gravity sensor in the target picture data is 90°, the direction of the gravity sensor is not the preset direction, and the actual content direction of the original picture is obtained according to the picture content of the original picture.
[0031] The relationship between the picture width and the picture height is related to the direction of the gravity sensor. When the direction of the gravity sensor is 0° and 180°, the picture width is less than the picture height. When the direction of the gravity sensor is 90° and 270°, the picture width is greater than the picture height.
[0032] By default, the shooting direction of a user meets the requirement of the preset direction. For example, the direction of the gravity sensor is 0°, and the user shoots vertically by default. If the relationship between the picture width and the picture height satisfies the preset size relationship, and the direction of the gravity sensor is the preset direction, it is considered that the shooting direction and the sensor direction are consistent, and no correction processing is required.
[0033] Step S3, in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture.
[0034] The preset direction is the direction of the gravity sensor, including 0°, 90°, 180° and 270°, which respectively represent vertical upward, clockwise rotation by 90 degrees on the basis of vertical upward (i.e. pointing to the right), clockwise rotation by 180 degrees on the basis of vertical upward (i.e. pointing downward) and clockwise rotation by 270 degrees on the basis of vertical upward (i.e. pointing to the left). Whether the actual content direction and the preset direction are consistent is determined. For example, if the actual content direction is vertical upward and the preset direction is 0°, the actual content direction and the preset direction are consistent; if the actual content direction is 90 degrees (to the right) and the preset direction is 0°, the actual content direction and the preset direction are inconsistent.
[0035] If the actual content direction is inconsistent with the preset direction, the actual content direction is adjusted to the preset direction by rotating the original picture. For example, if the actual content direction is 90 degrees (to the right) and the preset direction is 0°, the actual content direction and the preset direction are consistent by rotating the original picture counterclockwise by 90 degrees. After the actual content direction and the preset direction are adjusted to be consistent, the corrected picture can be normally used for subsequent processing, solving the problem that the uploaded picture is incorrect and cannot be normally used due to different user devices and different models, so that the original picture uploaded by different models of user devices can be normally used.
[0036] If the actual content direction is consistent with the preset direction, the picture can be directly used. For example, the user is horizontally shooting a picture, such as shooting with the gravity sensor direction being 90°, and the sensor direction in the Exif data is also 90°, which is consistent with the picture, so that the picture uploaded by the user is stored and displayed by counterclockwise rotation by 90 degrees, which can still be normally processed.
[0037] The picture correction method provided by the application obtains the original picture shot by the user device, obtains the target picture data by analyzing the Exif data of the original picture, the target picture data includes the picture width, the picture height and the direction of the gravity sensor, in response to the relationship between the picture width and the picture height not satisfying the preset size relationship or the direction of the gravity sensor not being the preset direction, the actual content direction of the original picture is obtained according to the picture content of the original picture, in response to the actual content direction being inconsistent with the preset direction, the actual content direction is adjusted to the preset direction by rotating the original picture, the correction when the picture direction is incorrect is realized, it is ensured that the picture shot by the user device after correction meets the use requirement, the picture direction incorrect solution scheme independent of the platform and the device is realized, so that the picture after shooting can be normally used on different devices and platforms.
[0038] Figure 2 is a flowchart of the picture correction method provided by the present application. As shown in the figure, after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: Figure 2 Step S4: in response to the relationship between the picture width and the picture height not satisfying the preset size relationship, adjusting the relationship between the picture width and the picture height in the Exif data to satisfy the preset size relationship; in response to the gravity sensor direction not being the preset direction, adjusting the gravity sensor direction in the Exif data to be the preset direction.
[0039] Exif data is used to describe a picture. After picture correction, the Exif data needs to be adjusted to be consistent with the picture information. In application, a typical example in which a picture cannot be used is that a user originally takes a picture vertically, but after uploading, the picture is rotated 90° to the left. The reason is that the mobile phone system incorrectly marks the gravity sensor direction as 90°, so that after uploading, the picture is rotated 90° counterclockwise to be able to be normally displayed in the forward direction.
[0040] After the actual content direction is adjusted to the preset direction by rotating the original picture, the picture direction meets the requirements, and the Exif data needs to be adjusted accordingly to avoid the situation that the corrected picture cannot be normally used again. Here, the Exif data is adjusted so that the relationship between the picture width and the picture height in the Exif data is consistent with the preset size relationship, and the gravity sensor direction is consistent with the preset direction. The Exif data of the picture is consistent with the picture, and when uploaded to different platforms or systems, the picture can be normally used.
[0041] Therefore, after the actual content direction is adjusted to the preset direction by rotating the original picture, if the relationship between the picture width and the picture height does not satisfy the preset size relationship, the relationship between the picture width and the picture height in the Exif data is adjusted to satisfy the preset size relationship; if the gravity sensor direction is not the preset direction, the gravity sensor direction in the Exif data is adjusted to be the preset direction.
[0042] The picture correction method provided by the present application adjusts the relationship between the picture width and the picture height in the Exif data to satisfy the preset size relationship in response to the relationship between the picture width and the picture height not satisfying the preset size relationship, and adjusts the gravity sensor direction in the Exif data to be the preset direction in response to the gravity sensor direction not being the preset direction, so that the corrected picture is consistent with its Exif data, and the corrected original picture can be normally used on different platforms or systems.
[0043] According to the picture correction method provided in the application, the preset size relationship is that the picture width is less than the picture height, and the preset direction of the gravity sensor is 0 degree; the method further comprises: displaying prompt information of vertical shooting on the uploading interface of the original picture.
[0044] In the embodiment, the preset size relationship is that the picture width is less than the picture height, and the preset direction of the gravity sensor is 0 degree, that is, it corresponds to the case of vertical shooting. Although the user holds the mobile phone horizontally to take a picture, for example, the direction of the gravity sensor is 90 degrees, the uploaded picture will be rotated counterclockwise by 90 degrees to be displayed in the normal direction, and further processing can be supported, but based on the requirement of the platform for picture optimization processing, the uploaded picture has better picture effect after being processed according to the requirement. Therefore, based on the requirement of the preset size relationship and the direction of the gravity sensor, the angle of the picture taken by the user can be determined, and the corresponding user shooting prompt information can be displayed.
[0045] In order to make the uploaded picture more in line with the requirement and facilitate processing, when the preset size relationship is that the picture width is less than the picture height and the preset direction of the gravity sensor is 0 degree, since it corresponds to the case of vertical shooting, the prompt information of vertical shooting can be displayed on the uploading interface of the original picture.
[0046] The picture correction method provided in the application, by presetting the size relationship that the picture width is less than the picture height and the preset direction of the gravity sensor is 0 degree, displays the prompt information of vertical shooting on the uploading interface of the original picture, which is beneficial to obtain the original picture in line with the shooting requirement.
[0047] According to the picture correction method provided in the application, the original picture is a portrait upper body picture; after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: generating a professional dress picture based on the rotated portrait upper body picture.
[0048] In the embodiment, the original picture is a portrait upper body picture. The ID photo is usually an upper body picture, and based on the uploaded portrait upper body picture, further processing can be performed, such as AI dressing processing, to generate a standard professional dress picture. The AI dressing processing can be realized by calling a photographing component in the cloud.
[0049] The Exif data of the generated professional dress picture is consistent with the picture, which can ensure that the professional dress picture is normally used in different platforms and systems.
[0050] The picture correction method provided in the application generates a professional dress picture based on the rotated portrait upper body picture by uploading the portrait upper body picture, and realizes the automatic generation of the professional dress picture.
[0051] The picture correction method provided by the application comprises the following steps: determining a contour of a person in the upper body portrait of the person; and obtaining a variation rule of line spacing of the contour of the person by scanning the contour of the person from left to right and from top to bottom, and determining the actual content direction according to the variation rule of line spacing of the contour of the person.
[0052] For the upper body portrait of the person, the actual content direction is the direction in which the head of the person points. When the actual content direction of the original picture is obtained according to the picture content of the original picture, first, the contour of the person in the upper body portrait of the person is determined, the contour of the person comprises contour lines of the person, the variation rule of line spacing of the contour lines of the person is obtained by scanning the contour of the person from left to right and from top to bottom, and the actual content direction is determined according to the variation rule of line spacing of the contour lines of the person. For example, if the head of the person points upward, when the contour of the person is scanned from top to bottom, the variation rule of line spacing of the contour lines of the person is from small to large, and when the contour of the person is scanned from left to right, the line spacing of the contour lines of the person first changes from small to large and then changes from large to small. If the head of the person points leftward, when the contour of the person is scanned from top to bottom, the line spacing of the contour lines of the person changes from small to large and then changes from large to small, and when the contour of the person is scanned from left to right, the line spacing of the contour lines of the person changes from small to large. Similarly, when the head of the person points downward and rightward, the variation rules of line spacing of the contour lines of the person when the contour of the person is scanned from left to right and from top to bottom can be determined.
[0053] Therefore, the variation rule of line spacing of the contour lines of the person can be obtained by scanning the contour of the person from left to right and from top to bottom, and the actual content direction can be determined according to the variation rule of line spacing of the contour lines of the person.
[0054] The picture correction method provided by the application comprises the following steps: determining a contour of a person in the upper body portrait of the person; and obtaining a variation rule of line spacing of the contour of the person by scanning the contour of the person from left to right and from top to bottom, and determining the actual content direction according to the variation rule of line spacing of the contour of the person.
[0055] The picture correction method provided by the application comprises the following steps: determining a contour of a person in the upper body portrait of the person; and obtaining a variation rule of line spacing of the contour of the person by scanning the contour of the person from left to right and from top to bottom, and determining the actual content direction according to the variation rule of line spacing of the contour of the person.
[0056] In the step of determining the contour information of the person in the upper body portrait of the person, the HOG (Histogram of Oriented Gradients) picture recognition algorithm can be used to extract portrait feature information, the portrait feature information comprises the shape and the edge of the main body of the person, and the contour information is determined according to the portrait feature information.
[0057] In addition, other picture recognition algorithms can be used to determine the contour information of the person in the upper body picture of the person. For example, edge orientation histograms, scale-invariant feature transform descriptors, shape contexts, and the like.
[0058] The picture correction method provided by the present application improves the efficiency and accuracy of obtaining the contour information of the person in the upper body picture of the person by using the HOG picture recognition algorithm to extract portrait feature information and determining the contour information according to the portrait feature information.
[0059] According to the picture correction method provided by the present application, after the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: performing picture information integrity checking on the original picture after direction adjustment.
[0060] After the actual content direction is adjusted to the preset direction by rotating the original picture, since the rotation of the picture involves the processing of each pixel point, the picture information integrity checking can be performed on the original picture after direction adjustment, such as integrity checking by checking the image size, to ensure that the rotation operation of the image is correct and accurate.
[0061] Figure 3 Fig. 3 is a flowchart of a picture correction method provided by the present application. Figure 3 As shown in Fig. 3, the method comprises: obtaining an original picture taken by a user equipment; obtaining Exif data of the original picture; obtaining target picture data according to the Exif data; determining whether the target picture data meets preset requirements; wherein the target picture data comprises picture width, picture height, and gravity sensor direction, the preset requirements comprise that the relationship between the picture width and the picture height meets a preset size relationship, and the direction of the gravity sensor is a preset direction; if the target picture data meets the preset requirements, the process ends; if the target picture data does not meet the preset requirements, the next step is performed; determining an actual content direction of the original picture by using a HOG picture recognition algorithm; determining whether the actual content direction is consistent with a preset direction; if the actual content direction is consistent with the preset direction, the process ends; if the actual content direction is not consistent with the preset direction, the next step is performed; adjusting the actual content direction to the preset direction by rotating the original picture; correcting the Exif data according to the preset requirements; The picture information integrity is checked; if the integrity check passes, the step of obtaining the Exif data of the original picture can be returned again to further verify whether the target picture data of the corrected picture meets the preset requirement, and if the preset requirement is met, the process ends; if the preset requirement is not met, the process is re-performed; if the integrity check fails, it indicates that the picture rotation this time is abnormal, and the process can end and the reason can be found.
[0062] The picture correction method provided by the application adjusts the actual content direction to the preset direction by rotating the original picture, and then checks the picture information integrity of the original picture after the direction adjustment, thereby improving the reliability of the original picture rotation operation.
[0063] The picture correction method provided by the application can solve the problem that the original picture uploaded by the user cannot be normally processed due to the complexity of the mobile terminal device and the diversity of the system in the market, so that the original picture of different types of mobile terminal devices can be normally processed. Moreover, the application actively identifies and corrects the picture, rather than passively waiting for the problem to occur and then making logical judgment and processing. In addition, the Exif data of the corrected picture is consistent with the picture, which can be used on different devices and platforms, can realize one-time modification of all platforms and system adaptation, completely solves the picture direction display problem, and ensures that the picture can be displayed in the correct direction on each platform and each system.
[0064] The picture correction device provided by the application is described below, and the picture correction device described below can be correspondingly referred to the picture correction method described above.
[0065] Figure 4 is a structural schematic diagram of the picture correction device provided by the application. As shown in Figure 4 The picture correction device provided by the application includes a first acquisition module 10, a second acquisition module 20 and a picture rotation module 30, wherein: the first acquisition module 10 is used to obtain an original picture taken by a user device, and obtain target picture data by analyzing the Exif data of the original picture; wherein the target picture data includes picture width, picture height and gravity sensor direction; the second acquisition module 20 is used to obtain the actual content direction of the original picture according to the picture content of the original picture in response to the relationship between the picture width and the picture height not meeting the preset size relationship, or the direction of the gravity sensor not being the preset direction; the picture rotation module 30 is used to adjust the actual content direction to the preset direction by rotating the original picture in response to the actual content direction being inconsistent with the preset direction.
[0066] The image correction device provided by the present invention obtains the original image taken by the user device and obtains the target image data by parsing the EXIF data of the original image, the target image data including the image width, the image height and the gravity sensor direction. In response to the relationship between the image width and the image height not satisfying the preset size relationship, or the direction of the gravity sensor is not the preset direction, the actual content direction of the original image is obtained according to the image content of the original image. In response to the actual content direction being inconsistent with the preset direction, the actual content direction is adjusted to the preset direction by rotating the original image, thereby realizing correction when the image direction is wrong, ensuring that the image taken by the user device meets the use requirements after correction, realizing a solution to image direction errors that is independent of the platform and device, and enabling the taken image to be normally used on different devices and platforms.
[0067] Figure 5 An example of a physical structure diagram of an electronic device is shown below. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call logic instructions in the memory 530 to execute an image correction method, which includes: obtaining an original image captured by a user device, and obtaining target image data by parsing Exif data of the original image; wherein the target image data includes image width, image height, and gravity sensor direction; in response to the relationship between the image width and the image height not satisfying a preset size relationship, or the direction of the gravity sensor is not a preset direction, obtaining the actual content direction of the original image based on the image content of the original image; and in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original image.
[0068] In addition, the logic instructions in the memory 530 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0069] In another aspect, the present application also provides a computer program product, which comprises a computer program, and the computer program can execute the picture correction method provided by the above-mentioned methods when executed by a processor. The method comprises: obtaining an original picture taken by a user equipment, and obtaining target picture data by analyzing Exif data of the original picture; wherein the target picture data comprises a picture width, a picture height, and a gravity sensor direction; in response to a relationship between the picture width and the picture height not satisfying a preset size relationship, or the direction of the gravity sensor not being a preset direction, obtaining an actual content direction of the original picture according to picture content of the original picture; and in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture.
[0070] In another aspect, the present application also provides a computer program product, which comprises a computer program, and the computer program can execute the picture correction method provided by the above-mentioned methods when executed by a processor. The method comprises: obtaining an original picture taken by a user equipment, and obtaining target picture data by analyzing Exif data of the original picture; wherein the target picture data comprises a picture width, a picture height, and a gravity sensor direction; in response to a relationship between the picture width and the picture height not satisfying a preset size relationship, or the direction of the gravity sensor not being a preset direction, obtaining an actual content direction of the original picture according to picture content of the original picture; and in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture.
[0071] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0072] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0073] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for image correction, characterized in that: The method comprises: acquiring an original picture taken by a user equipment, and acquiring target picture data by analyzing Exif data of the original picture, wherein the target picture data comprises a picture width, a picture height, and a gravity sensor direction; in response to a relationship between the picture width and the picture height not satisfying a preset size relationship, or the gravity sensor direction not being a preset direction, acquiring an actual content direction of the original picture according to picture content of the original picture; in response to the actual content direction being inconsistent with the preset direction, adjusting the actual content direction to the preset direction by rotating the original picture.
2. The picture correction method of claim 1, wherein, After the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: in response to the relationship between the picture width and the picture height not satisfying the preset size relationship, adjusting the relationship between the picture width and the picture height in the Exif data to satisfy the preset size relationship; and in response to the gravity sensor direction not being the preset direction, adjusting the gravity sensor direction in the Exif data to be the preset direction.
3. The picture correction method of claim 1, wherein, The preset size relationship is that the picture width is smaller than the picture height, and the preset direction of the gravity sensor is 0 degrees; the method further comprises: displaying prompt information of vertical photographing on an upload interface of the original picture.
4. The picture correction method of claim 1, wherein, The original picture is a portrait upper body picture; After the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: generating a professional dress picture based on the rotated portrait upper body picture.
5. The picture correction method of claim 4, wherein, The acquiring of the actual content direction of the original picture according to the picture content of the original picture comprises: determining a human contour in the portrait upper body picture; acquiring a human contour line spacing variation rule by scanning the human contour from left to right and from top to bottom, and determining the actual content direction according to the human contour line spacing variation rule.
6. The picture correction method of claim 5, wherein, The determining of the contour information of the human in the portrait upper body picture comprises: extracting portrait feature information by using a HOG picture recognition algorithm, and determining the contour information according to the portrait feature information.
7. The picture correction method of claim 1, wherein, After the actual content direction is adjusted to the preset direction by rotating the original picture, the method further comprises: performing picture information integrity verification on the original picture after direction adjustment.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The processor executes the computer program to implement the picture correction method according to any one of claims 1 to 7. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the picture correction method according to any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the picture correction method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Picture transmission method and device, computer equipment and computer readable storage medium
CN113329137A
Identification photo correction method and device based on browser, equipment and medium
CN116630197A
Apparatus and method for for editing photograph image
KR1020130022474A
Image processing device and method
US20050104848A1
Method of and system for image processing and computer program
US20060098256A1