WO2023036257A1 - 图像处理方法及设备 - Google Patents

图像处理方法及设备 Download PDF

Info

Publication number
WO2023036257A1
WO2023036257A1 PCT/CN2022/117897 CN2022117897W WO2023036257A1 WO 2023036257 A1 WO2023036257 A1 WO 2023036257A1 CN 2022117897 W CN2022117897 W CN 2022117897W WO 2023036257 A1 WO2023036257 A1 WO 2023036257A1
Authority
WO
WIPO (PCT)
Prior art keywords
image data
ratio
image
processing
application program
Prior art date
Application number
PCT/CN2022/117897
Other languages
English (en)
French (fr)
Inventor
施磊
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023036257A1 publication Critical patent/WO2023036257A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects

Definitions

  • Embodiments of the present disclosure relate to the technical field of image processing, and in particular, to an image processing method and device.
  • Electronic equipment may be provided with an image capture device to capture images or capture video including images.
  • Various application programs can also run on the electronic device, and the application program can call the image acquisition device of the electronic device to realize image capture or video capture, and the captured image can be displayed and stored through the application program.
  • Embodiments of the present disclosure provide an image processing method and device, which can reduce the computational complexity when an application program captures images or videos.
  • an embodiment of the present disclosure provides an image processing method, including:
  • the ratio of the first image data is different from the ratio of the second image data, and the ratio of the first image data is a ratio supported by the image acquisition device , the ratio of the second image data is a ratio supported by the application program;
  • the first processing is performed on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • An image data acquisition module configured to call the image acquisition device through the application program to acquire the first image data
  • an image cropping module configured to crop the first image data into second image data, the ratio of the first image data is different from the ratio of the second image data, and the ratio of the first image data is the ratio of the A ratio supported by the image acquisition device, where the ratio of the second image data is a ratio supported by the application program;
  • a special effect processing module configured to perform special effect processing on the second image data
  • the first processing module is configured to perform first processing on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;
  • the memory stores computer-executable instructions
  • the at least one processor executes the computer-executed instructions stored in the memory, so that the electronic device implements the method as described in the first aspect.
  • an embodiment of the present disclosure provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, the computing device implements the first aspect. the method described.
  • an embodiment of the present disclosure provides a computer program, the computer program is used to implement the method described in the first aspect.
  • an embodiment of the present disclosure provides a computer program product, including computer instructions, where the computer instructions are used to implement the method described in the first aspect.
  • An embodiment of the present disclosure provides an image processing method and device, the method comprising: calling an image acquisition device through an application program to acquire first image data; cutting the first image data into second image data, and the first image
  • the ratio of the data is different from the ratio of the second image data, the ratio of the first image data is the ratio supported by the image acquisition device, and the ratio of the second image data is the ratio supported by the application program; performing special effect processing on the second image data; performing first processing on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • the first image data may be cropped once before the special effect processing, display and storage are performed.
  • the one-time cropping in the embodiment of the present disclosure also helps to reduce the computational complexity during image capture or video capture.
  • FIG. 1 exemplarily shows a schematic diagram of an image capturing process of an application program applicable to an embodiment of the present disclosure
  • FIG. 2 exemplarily shows a flowchart of steps of an image processing method provided by an embodiment of the present disclosure
  • Figure 3 and Figure 4 exemplarily show two schematic diagrams of the proportional relationship between the first image data and the target area
  • 5 to 7 exemplarily show a schematic diagram of screen rotation of a terminal device provided by an embodiment of the present disclosure
  • FIG. 8 exemplarily shows a detailed flowchart of an image processing method provided by an embodiment of the present disclosure
  • FIG. 9 exemplarily shows a structural block diagram of an image processing device provided by an embodiment of the present disclosure.
  • Fig. 10 and Fig. 11 exemplarily show structural block diagrams of two kinds of electronic devices provided by the embodiments of the present disclosure.
  • FIG. 1 exemplarily shows a schematic diagram of an image capturing process of an application program.
  • the image capture process mainly includes the following steps: data acquisition, texture conversion, special effect processing, display, encoding and storage.
  • the data acquisition is used to call an image acquisition device to collect image data
  • the image acquisition device may include but not limited to: a camera, a mobile phone, and a video camera.
  • the texture conversion is used to convert the texture type of the image data, wherein the texture type refers to the way of representing the texture.
  • the texture type of image data can be converted from an OES texture to a 2D texture.
  • Special effect processing can add special effects to the image data of the two-dimensional texture, including modifying the color, adding text, adding special effect pictures, etc.
  • Display is used to render image data after special effects processing or texture conversion to the screen.
  • Coding is used to compress the image data after special effect processing or texture conversion to reduce the storage space of the image data.
  • Storage is used to store encoded image data in the form of files, and image data obtained by different compression algorithms correspond to different file formats.
  • the file format can include but not limited to: joint photographic experts group (joint photographic experts group, JPEG), tag image file format (tag image file format, TIF), bitmap (bitmap, BMP), not Processed (RAW), etc.
  • the image data collected by the image acquisition device when displaying, if it is found that the ratio of the image data collected by the image acquisition device is inconsistent with the target ratio of the image data supported by the application program, the image data collected by the image acquisition device can be clipped to the target ratio and then used in the application. displayed in the program. Similarly, when storing, if it is found that the ratio of the image data collected by the image acquisition device is not consistent with the target ratio, the image data collected by the image acquisition device can be clipped to the target ratio, encoded and stored.
  • the target ratio may be a ratio supported by the application program, or a ratio set by the user in the application program.
  • the embodiment of the present disclosure may cut out the first image data collected by the image acquisition device to obtain the second image data before special effect processing, so as to perform special effect processing, display, encoding and storage on the second image data.
  • the amount of data to be processed during special effect processing can be reduced, thereby reducing the computational complexity of special effect processing, and finally reducing the computational complexity of image shooting or video shooting.
  • the one cropping in the present disclosure also helps to reduce the computational complexity of image capture or video capture.
  • Fig. 2 exemplarily shows a flowchart of steps of an image processing method provided by an embodiment of the present disclosure.
  • the method shown in Figure 2 can be applied in electronic equipment, as shown in Figure 2, the image processing method includes:
  • S101 Obtain first image data by invoking an image acquisition device through an application program.
  • the application program refers to any program that can capture and use images.
  • a social application can send the captured image.
  • the application program runs on the terminal device.
  • the application program takes an image, it first calls the image acquisition device of the terminal device to obtain the first image data, and then displays or stores the first image data in the application program after processing the first image data.
  • the above-mentioned image acquisition device presets at least one candidate ratio, and selects one candidate ratio as the ratio of the first image data.
  • the first image data corresponds to a first texture
  • the first texture is a texture supported by the image acquisition device when performing image display.
  • the first texture is usually an OES texture.
  • S102 Crop the first image data into second image data, the ratio of the first image data is different from the ratio of the second image data, the ratio of the first image data is the ratio supported by the image acquisition device, and the ratio of the second image data is The ratios supported by the application.
  • the ratio of the second image data used by the application program is different from the ratio of the first image data used by the image acquisition device.
  • the ratio of the first image data can be 2:1, that is, the ratio of the width and height of the image corresponding to the first image data is 2:1
  • the ratio of the second image data can be 1:1, that is, the ratio of the second
  • the ratio of the width to the height of the image corresponding to the image data is 1:1.
  • the ratio of the first image data can be 1:1, that is, the ratio of the width and height of the image corresponding to the first image data is 1:1
  • the ratio of the second image data can be 2:1, that is, the ratio of the image corresponding to the first image data is 2:1.
  • the ratio of the width to the height of the image corresponding to the second image data is 2:1.
  • the texture used by the application program for image display may be the same as or different from the first texture.
  • the texture of the application is referred to as the second texture.
  • the image data needs to be converted from the first texture to the second texture, and the second texture is usually a two-dimensional texture.
  • the above clipping process can be integrated into the texture conversion process. Compared with clipping the first image data alone, the clipping process and the texture conversion process are integrated together to further reduce the processing steps required for image processing, thereby further reducing the time consumed for image shooting or video shooting.
  • the texture type conversion is only performed on some pixels in the first image data, and this part of pixels is determined according to the ratio of the second image data.
  • the target area may be determined in the first image data according to the ratio of the second image data; then, the texture of the target area is converted from the first type to the second type to obtain the second image data composed of the target area.
  • the first type is the texture type supported by the image acquisition device for image display
  • the second type is the texture type supported by the application program for image display.
  • the first type may be an OES texture
  • the second type may be a two-dimensional texture
  • the above-mentioned target area is the pixel area with the largest area in the first image data, and the proportion is the proportion of the second image data. Therefore, it can be ensured that the obtained second image data retains as much image information as possible, and the definition of the second image data can be improved.
  • Fig. 3 and Fig. 4 exemplarily show two schematic diagrams of the proportional relationship between the first image data and the target area. Referring to FIG. 3 or FIG. 4 , the area A1 formed by the bold line is the image area corresponding to the first image data, and the area A2 formed by the shaded part is the target area.
  • the ratio of the width to the height of A1 is 2:1, that is, the ratio of the first image data is the ratio of the height of the first image data to the width of the first image data 2:1, and the width of the target area The ratio of and high is equal to the ratio 1:1 of the second image data.
  • the height of the target area in FIG. 3 is the same as the height of the first image data, and the width of the target area is smaller than the width of the first image data.
  • the target area shown in FIG. 3 is located in the middle of the image area corresponding to the first image data. In practical applications, the target area can move horizontally along the direction of width.
  • the ratio of the width to the height of A1 is 1:1, and the ratio of the width to the height of the target area is equal to the ratio of 2:1 of the second image data. It can be seen that the width of the target area in FIG. 4 is the same as the width of the first image data, and the height of the target area is smaller than the height of the first image data. It can be understood that the target area shown in FIG. 4 is located in the middle of the image area corresponding to the first image data. In practical applications, the target area can move vertically along the direction of the height.
  • the height of the target area is equal to the height of the first image data.
  • the width of the target area is equal to the width of the first image data.
  • the target area when selecting the target area, it is also necessary to determine the target area according to the key image information in the first image data, so that the target area includes the key image information.
  • the key image information may include: human face, human body, animal, building and so on.
  • special effect processing may include but not limited to: modifying colors, adding text, adding special effect images, etc.
  • S104 Perform first processing on the second image data after special effect processing, where the first processing includes at least one of the following: displaying in an interface of an application program, encoding, and storing.
  • encoding and storing may include: first, encoding the second image data to obtain an image file; then, storing the image file in a storage area corresponding to the application program.
  • the above-mentioned storage area may be a storage area divided for application programs on the terminal device, and is used to store data generated by the application programs during operation.
  • the storage area can be memory, cache, or disk.
  • the ratio of the second image data may also be adjusted. Two ways of adjusting the ratio of the second image data will be described in detail below.
  • the ratio of the second image data is adjusted.
  • the screen rotation angle is an angle during the rotation process of the screen of the terminal device running the above application program, and the rotation may be performed by the user.
  • the preset angle threshold may be set according to an actual application scenario.
  • the preset angle threshold may be 90 degrees, so that when the user adjusts the terminal device from landscape to portrait or from portrait to portrait, the ratio of the second image data can be adjusted.
  • the ratio of the second image data may be determined by the ratio of the width and height of the terminal device after the terminal device is rotated.
  • the ratio of the second image data is close to, or even the same as, the ratio of the height to the width of the terminal device. For example, if the ratio of the width to the height of the terminal device is 1:2, when the terminal device is adjusted from a horizontal screen to a vertical screen, the ratio of the second image data is also adjusted from 2:1 to 1:2. When the vertical screen is adjusted to the horizontal screen, the ratio of the second image data can also be adjusted from 1:2 to 2:1.
  • the second way is to receive the target ratio input in the application program; and adjust the ratio of the second image data to the target ratio.
  • the target ratio may be any ratio input by the user.
  • the application program can pre-set the conditions of the target ratio to avoid unreasonable target ratios and affect the display effect.
  • the ratio of the second image data is adjusted to the target ratio; when the target ratio input by the user does not satisfy the condition, the ratio of the second image data is not adjusted.
  • the foregoing conditions may include at least one of the following: a value type condition, and a value range condition.
  • the value range of the target ratio can be 1:2 to 2:1.
  • the ratio of the second image data can be adjusted to 2:1;
  • it is 10:1 the ratio of the second image data may not be adjusted.
  • the adjusted scale of the second image data may not match or match the scale of the first image data. If the ratio of the first image data is the closest ratio to the ratio of the second image data among the candidate ratios of the image acquisition device, then the ratio of the first image data matches the ratio of the second image data; otherwise, the ratio of the first image data The scale of the data does not match the scale of the second image data.
  • the first image data may be re-acquired using the scale of the first image data. That is, before and after adjusting the ratio of the second image data, the ratio of the first image data is the same.
  • a ratio that matches the adjusted ratio of the second image data can be selected from the candidate ratios of the image acquisition device as the first image data proportion. That is, before and after adjusting the ratio of the second image data, the ratio of the first image data is different.
  • the ratio of the first image data is the closest ratio to the adjusted ratio of the second image data among the candidate ratios. In this way, it can be ensured that the first image data includes as many valid pixels as possible and as few invalid pixels as possible.
  • valid pixels are pixels in the second image data
  • invalid pixels are pixels not in the second image data. In this way, the invalid pixels collected by the image collection device can be reduced as far as possible, thereby reducing the computational complexity of the image collection device.
  • the preview of the image acquisition device can also be restarted according to the adjusted ratio of the first image data, so as to enter the step of invoking the image acquisition device through the application program to obtain the first image data.
  • the preview of the restarted image acquisition device corresponds to the same scale as the adjusted first image data, so that the newly acquired first image data corresponds to the adjusted scale.
  • the steps after S101 need to be continued.
  • the ratio of the second image data is adjusted.
  • the first angle can also be determined according to the screen rotation angle, and the sum of the first angle and the screen rotation angle is 0 degrees or 360 degrees; according to the first Transpose the second image data by an angle.
  • 5 to 7 exemplarily show schematic diagrams of screen rotation of a terminal device provided by an embodiment of the present disclosure.
  • the screen of the terminal device is in a vertical state, and the image captured by the image acquisition device is directly displayed on the screen in a vertical state.
  • the screen of the terminal device is rotated 90 degrees counterclockwise to the horizontal screen state, since the image capture device is fixed on the terminal device, the shooting angle of the image capture device is also rotated 90 degrees counterclockwise.
  • the captured image is directly displayed on the screen and becomes a horizontal state.
  • the display in Fig. 6 is not convenient for the user to view the image, so after the screen of the terminal device is rotated, the image collected by the image acquisition device needs to be reversely rotated, that is, the image data is transposed.
  • the image captured by the image acquisition device needs to be rotated 90 degrees clockwise, so that after the screen of the terminal device shown in Figure 5 is rotated, the image shown in Figure 7 can be obtained .
  • the first image data corresponds to the image collected by the image acquisition device
  • the second image data obtained in S102 corresponds to the image after the screen is rotated, so that the second image data can be transposed, that is, the image corresponding to the second image data is first processed.
  • Angle of rotation The sum of the first angle and the screen rotation angle is 0 or 360 degrees, so that the image corresponding to the second image data is in the same horizontal or vertical state as before the screen rotation.
  • Fig. 8 exemplarily shows a detailed flowchart of an image processing method provided by an embodiment of the present disclosure.
  • the image processing method in FIG. 8 shows the relationship between the aforementioned multiple processes.
  • the screen rotation angle can be monitored, and when the screen rotation angle is greater than or equal to the preset angle threshold, adjust the first The ratio of the second image data; on the other hand, a target ratio input in the application program can be received, and the ratio of the second image data can be adjusted.
  • the screen rotation angle is smaller than the preset angle threshold, the ratio of the second image data is not adjusted, and the monitoring is continued.
  • the current task can be cleaned up, including but not limited to: the conversion task of the current second image data, the rendering task of the current second image data, and the clipping of the first image data to the second Two image data.
  • it is determined whether to adjust the scale of the first image data when adjusting the ratio of the first image data, restart the preview of the image acquisition device, and enter the step of S101 to reacquire the first image data, and execute steps S102 to S104 after S101.
  • step S104 is executed.
  • FIG. 9 exemplarily shows a structural block diagram of an image processing apparatus provided in an embodiment of the present disclosure.
  • the image processing device 200 includes: an image data acquisition module 201 , an image cropping module 202 , a special effect processing module 203 and a first processing module 204 .
  • the image data acquisition module 201 is used to call the image acquisition device through the application program to acquire the first image data.
  • An image cropping module 202 configured to crop the first image data into second image data, the ratio of the first image data is different from the ratio of the second image data, and the ratio of the first image data is the ratio of the first image data a ratio supported by the image acquisition device, and the ratio of the second image data is a ratio supported by the application program.
  • a special effect processing module 203 configured to perform special effect processing on the second image data.
  • the first processing module 204 is configured to perform first processing on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • the image cropping module 202 is further configured to: determine a target area in the first image data, the ratio of the target area is equal to the ratio of the second image data;
  • the texture of the first type is converted from the first type to the second type to obtain the second image data composed of the target area, the first type is the texture type supported by the image acquisition device for image display, and the second type is The texture types supported by the application for image display.
  • the height of the target area is the height of the first image data; if the ratio of the first image data is smaller than the ratio of the second image data, the width of the target area is the width of the first image data.
  • the image cropping module 202 is further configured to: determine the key image information included in the first image data; determine the area including the key image information in the first image data as the the target area.
  • the above device further includes a first ratio adjustment module, configured to adjust the ratio of the first image data when the screen rotation angle is greater than or equal to a preset angle threshold before cropping the first image data into the second image data.
  • a first ratio adjustment module configured to adjust the ratio of the first image data when the screen rotation angle is greater than or equal to a preset angle threshold before cropping the first image data into the second image data. The proportion of the second image data described above.
  • the above-mentioned device also includes a target ratio receiving module and a ratio adjustment module:
  • the target ratio receiving module is configured to receive the target ratio input in the application program before clipping the first image data into the second image data.
  • a second scale adjustment module configured to adjust the scale of the second image data to the target scale.
  • the above-mentioned device further includes a third ratio adjustment module, configured to, if the ratio of the adjusted second image data does not match the ratio of the first image data, the candidate from the image acquisition device In the ratio, a ratio matching the adjusted ratio of the second image data is selected as the ratio of the first image data.
  • a third ratio adjustment module configured to, if the ratio of the adjusted second image data does not match the ratio of the first image data, the candidate from the image acquisition device In the ratio, a ratio matching the adjusted ratio of the second image data is selected as the ratio of the first image data.
  • the above device further includes a loop processing module, configured to select a ratio that matches the adjusted ratio of the second image data from the candidate ratios of the image acquisition device as the first image data After the ratio of the first image data is adjusted, the preview of the image acquisition device is restarted according to the adjusted ratio of the first image data, so as to enter the step of invoking the image acquisition device through the application program to obtain the first image data.
  • a loop processing module configured to select a ratio that matches the adjusted ratio of the second image data from the candidate ratios of the image acquisition device as the first image data After the ratio of the first image data is adjusted, the preview of the image acquisition device is restarted according to the adjusted ratio of the first image data, so as to enter the step of invoking the image acquisition device through the application program to obtain the first image data.
  • the above-mentioned device also includes a first angle determination module and an image transposition module:
  • a first angle determination module configured to determine a first angle according to the screen rotation angle before performing the first processing on the second image data after the special effect processing, and the sum of the first angle and the screen rotation angle is 0 degrees or 360 degrees.
  • An image transposition module configured to transpose the second image data after special effect processing according to the first angle.
  • the image processing device provided in this embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 2 above, and its implementation principle and technical effect are similar, so this embodiment will not repeat them here.
  • Fig. 10 exemplarily shows a structural block diagram of an electronic device 600 provided by an embodiment of the present disclosure.
  • the electronic device 600 includes a memory 602 and at least one processor 601;
  • the memory 602 stores computer-executable instructions
  • At least one processor 601 executes the computer-executed instructions stored in the memory 602, so that the electronic device 601 implements the aforementioned method in FIG. 2 .
  • the electronic device may also include a receiver 603 and a transmitter 604, the receiver 603 is used to receive information from other devices or devices and forwards it to the processor 601, and the transmitter 604 is used to send information to other devices or devices .
  • FIG. 11 it shows a schematic structural diagram of an electronic device 900 suitable for implementing the embodiments of the present disclosure
  • the electronic device 900 may be a terminal device.
  • the terminal equipment may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, personal digital assistant (personal digital assistant, PDA), tablet computer (portable android device, PAD), portable multimedia player (portable media player) , PMP), mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, and the like.
  • PDA personal digital assistant
  • PAD portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • PMP portable multimedia player
  • FIG. 11 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 900 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) Various appropriate actions and processes are executed by a program loaded into a random access memory (random access memory, RAM) 903 .
  • RAM random access memory
  • various programs and data necessary for the operation of the electronic device 900 are also stored.
  • the processing device 901, ROM 902, and RAM 903 are connected to each other through a bus 904.
  • An input/output (I/O) interface 905 is also connected to the bus 904 .
  • an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; including, for example, a liquid crystal display (liquid crystal display, LCD) , an output device 907 such as a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909.
  • the communication means 909 may allow the electronic device 900 to perform wireless or wired communication with other devices to exchange data. While FIG. 11 shows electronic device 900 having various means, it should be understood that it is not a requirement to implement or have all of the illustrated means, and more or fewer means may instead be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, where the computer program includes program codes for executing the methods shown in the flowcharts.
  • the computer program may be downloaded and installed from a network via communication means 909, or from storage means 908, or from ROM 902.
  • the processing device 901 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more conductors, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Erasable programmable read-only memory (EPROM), optical fiber, compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above combination.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable signal medium may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • the program code contained on the computer readable medium may be transmitted by any appropriate medium, including but not limited to: electric wire, optical cable, radio frequency (radio frequency, RF), etc., or any suitable combination of the above.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device is made to execute the methods shown in the above-mentioned embodiments.
  • Computer program code for carrying out the operations of the present disclosure can be written in one or more programming languages, or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional Procedural Programming Language - such as "C" or a similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer ( For example, use an Internet service provider to connect via the Internet).
  • LAN local area network
  • WAN wide area network
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the unit does not constitute a limitation of the unit itself under certain circumstances, for example, the first obtaining unit may also be described as "a unit for obtaining at least two Internet Protocol addresses".
  • exemplary types of hardware logic components include: field-programmable gate array (FPGA), application specific integrated circuit (ASIC), application-specific standard product (application Specific standard parts, ASSP), system on chip (system on chip, SOC), complex programmable logic device (complex programmable logic device, CPLD) and so on.
  • FPGA field-programmable gate array
  • ASIC application specific integrated circuit
  • ASSP application-specific standard product
  • SOC system on chip
  • complex programmable logic device complex programmable logic device
  • CPLD complex programmable logic device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • an image processing method including:
  • the ratio of the first image data is different from the ratio of the second image data, and the ratio of the first image data is a ratio supported by the image acquisition device , the ratio of the second image data is a ratio supported by the application program;
  • the first processing is performed on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • the clipping the first image data into the second image data includes:
  • the first type is a texture type supported by the image acquisition device for image display
  • the second type is a texture type supported by the application program for image display.
  • the height of the target area is the first The height of the image data; if the ratio of the first image data is smaller than the ratio of the second image data, then the width of the target area is the width of the first image data.
  • the determining the target area in the first image data includes:
  • An area including the key image information in the first image data is determined as the target area.
  • the fifth example of the first aspect before clipping the first image data into the second image data, it further includes:
  • the ratio of the second image data is adjusted.
  • the sixth example of the first aspect before clipping the first image data into the second image data, it further includes:
  • the seventh example of the first aspect further includes:
  • the adjusted ratio of the second image data does not match the ratio of the first image data, from the candidate ratios of the image acquisition device, select a ratio that matches the adjusted ratio of the second image data as the selected ratio.
  • the ratio that matches the adjusted ratio of the second image data is selected from the candidate ratios of the image acquisition device as the selected ratio After the ratio of the first image data, it also includes:
  • before performing the first processing on the second image data after the special effect processing further includes:
  • the second image data after the special effect processing is transposed according to the first angle.
  • an image processing device including:
  • An image data acquisition module configured to call the image acquisition device through the application program to acquire the first image data
  • an image cropping module configured to crop the first image data into second image data, the ratio of the first image data is different from the ratio of the second image data, and the ratio of the first image data is the ratio of the A ratio supported by the image acquisition device, where the ratio of the second image data is a ratio supported by the application program;
  • a special effect processing module configured to perform special effect processing on the second image data
  • the first processing module is configured to perform first processing on the second image data after the special effect processing, and the first processing includes at least one of the following: displaying in the interface of the application program, encoding and storing.
  • the image cropping module is further used for:
  • the first type is a texture type supported by the image acquisition device for image display
  • the second type is a texture type supported by the application program for image display.
  • the height of the target area is the first The height of the image data; if the ratio of the first image data is smaller than the ratio of the second image data, then the width of the target area is the width of the first image data.
  • the image cropping module is further used for:
  • An area including the key image information in the first image data is determined as the target area.
  • the device further includes:
  • a target ratio receiving module configured to receive the target ratio input in the application program before clipping the first image data into the second image data
  • a second scale adjustment module configured to adjust the scale of the second image data to the target scale.
  • the device further includes a third ratio adjustment module, configured to if the adjusted ratio of the second image data is the same as the If the proportions of the first image data do not match, a proportion matching the adjusted proportion of the second image data is selected from the candidate proportions of the image acquisition device as the proportion of the first image data.
  • a third ratio adjustment module configured to if the adjusted ratio of the second image data is the same as the If the proportions of the first image data do not match, a proportion matching the adjusted proportion of the second image data is selected from the candidate proportions of the image acquisition device as the proportion of the first image data.
  • the device further includes a loop processing module, configured to select and adjust the adjusted first After the ratio of the two image data matches the ratio as the ratio of the first image data, restart the preview of the image acquisition device according to the adjusted ratio of the first image data to enter the image acquisition device invoked by the application A step of acquiring first image data.
  • a loop processing module configured to select and adjust the adjusted first After the ratio of the two image data matches the ratio as the ratio of the first image data, restart the preview of the image acquisition device according to the adjusted ratio of the first image data to enter the image acquisition device invoked by the application A step of acquiring first image data.
  • the device further includes:
  • a first angle determination module configured to determine a first angle according to the screen rotation angle before performing the first processing on the second image data after the special effect processing, and the sum of the first angle and the screen rotation angle is 0 degrees or 360 degrees;
  • the image transposition module is used to transpose the second image data after the special effect processing according to the first angle.
  • the memory stores computer-executable instructions
  • the at least one processor executes the computer-executed instructions stored in the memory, so that the electronic device implements the method according to any one of the first aspect.
  • a computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, Making a computing device implement the method of any one of the first aspects.
  • a computer program is provided, the computer program is used to implement the method described in any one of the first aspect.
  • a computer program product including computer instructions, where the computer instructions are used to implement the method described in any one of the first aspect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

一种图像处理方法及设备,涉及图像处理技术领域。该方法包括:通过应用程序调用图像采集装置获取第一图像数据;将第一图像数据裁剪为第二图像数据,第一图像数据的比例与第二图像数据的比例不同,第一图像数据的比例是图像采集装置支持的比例,第二图像数据的比例是应用程序支持的比例;对第二图像数据进行特效处理;对特效处理之后的第二图像数据进行第一处理,第一处理包括以下至少一种:显示在应用程序的界面中、编码并存储。该方法可以在进行特效处理、显示以及存储之前对第一图像数据进行一次裁剪,以降低特效处理时所要处理的数据量,进而降低特效处理的计算复杂度,最终减小图像拍摄或视频拍摄的计算复杂度。

Description

图像处理方法及设备
相关申请的交叉引用
本申请要求于2021年09月13日提交中国专利局、申请号为202111066745.4、发明名称为“图像处理方法及设备”的中国专利申请的优先权,其全部内容通过引用并入本文。
技术领域
本公开实施例涉及图像处理技术领域,尤其涉及一种图像处理方法及设备。
背景技术
随着电子设备的迅速发展,电子设备的功能日益强大。电子设备可以设置有图像采集装置以拍摄图像或拍摄包括图像的视频。电子设备上还可以运行各种应用程序,应用程序可以调用电子设备的图像采集装置以实现图像拍摄或视频拍摄,拍摄得到的图像可以通过应用程序进行显示以及存储。
在上述方案中,如何降低应用程序拍摄图像或视频时的计算复杂度是亟待解决的问题。
发明内容
本公开实施例提供一种图像处理方法及设备,可以降低应用程序拍摄图像或视频时的计算复杂度。
第一方面,本公开实施例提供一种图像处理方法,包括:
通过应用程序调用图像采集装置获取第一图像数据;
将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
对所述第二图像数据进行特效处理;
对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
第二方面,本公开实施例提供一种图像处理装置,包括:
图像数据获取模块,用于通过应用程序调用图像采集装置获取第一图像数据;
图像裁剪模块,用于将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
特效处理模块,用于对所述第二图像数据进行特效处理;
第一处理模块,用于对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
第三方面,本公开实施例提供一种电子设备,包括:至少一个处理器和存储器;
所述存储器存储计算机执行指令;
所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述电子设备实现如第一方面所述的方法。
第四方面,本公开实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,使计算设备实现如第一方面所述的方法。
第五方面,本公开实施例提供一种计算机程序,所述计算机程序用于实现如第一方面所述的方法。
第六方面,本公开实施例提供一种计算机程序产品,包括计算机指令,所述计算机指令用于实现如第一方面所述的方法。
本公开实施例提供了一种图像处理方法及设备,该方法包括:通过应用程序调用图像采集装置获取第一图像数据;将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;对所述第二图像数据进行特效处理;对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。本公开实施例可以在进行特效处理、显示以及存储之前对第一图像数据进行一次裁剪。如此,可以降低特效处理时所要处理的数据量,进而降低了特效处理的计算复杂度,最终降低了图像拍摄或视频拍摄时的计算复杂度。此外,相对于现有技术的两次裁剪,本公开实施例的一次裁剪也有助于降低图像拍摄或视频拍摄时的计算复杂度。
附图说明
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1示例性示出了本公开实施例适用的一种应用程序的图像拍摄过程示意图;
图2示例性示出了本公开实施例提供的一种图像处理方法的步骤流程图;
图3、图4示例性示出了第一图像数据和目标区域之间的两种比例关系示意图;
图5至7示例性示出了本公开实施例提供的一种终端设备的屏幕旋转示意图;
图8示例性示出了本公开实施例提供的一种图像处理方法的详细流程图;
图9示例性示出了为本公开实施例提供的一种图像处理装置的结构框图;
图10、图11示例性示出了为本公开实施例提供的两种电子设备的结构框图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
本公开实施例可以应用于应用程序的图像拍摄过程中。图1示例性示出了一种应用程序的图像拍摄过程示意图。参照图1所示,图像拍摄过程主要包括以下步骤:数据采集、纹理转换、特效处理、显示、编码和存储。
其中,数据采集用于调用图像采集装置采集图像数据,图像采集装置可以包括但不限于:相机、手机、摄像头。
纹理转换用于对图像数据的纹理类型进行转换,其中,纹理类型是指表示纹理的方式。例如,可以将图像数据的纹理类型从OES纹理转换为二维纹理。
特效处理可以对二维纹理的图像数据添加特效,包括修改颜色、添加文字、添加特效画面等。
显示用于将特效处理之后或纹理转换之后的图像数据渲染到屏幕中。
编码用于对特效处理之后或纹理转换之后的图像数据进行压缩以减小图像数据的存储空间。
存储用于将编码之后的图像数据以文件的形式进行存储,不同压缩算法得到的图像数据对应不同的文件格式。其中,按照压缩算法不同,文件格式可以包括但不限于:联合摄影专家组(joint photographic experts group,JPEG)、标签图像文件格式(tag image file format,TIF)、位图(bitmap,BMP)、未经加工的(RAW)等。
现有技术中,在进行显示时,如果发现图像采集装置采集的图像数据的比例与应用程序支持的图像数据的目标比例不一致,则可以将图像采集装置采集的图像数据剪裁为目标比例后在应用程序中进行显示。同样地,在进行存储时,如果发现图像采集装置采集的图像数据的比例与目标比例不一致,则可以将图像采集装置采集的图像数据裁剪为目标比例后进行编码并存储。其中,目标比例可以是应用程序支持的比例,也可以是用户在应用程序中设置的比例。
可以看出,上述方案在特效处理之后进行裁剪,导致特效处理的数据量较大,进而导致特效处理消耗的时长较大,最终导致拍摄图像或视频所消耗的时长较大。
为了解决上述问题,本公开实施例可以在进行特效处理之前,对图像采集装置采集的第一图像数据进行裁剪得到第二图像数据,以对第二图像数据进行特效处理、显示、编码并存储。如此,可以降低特效处理时所要处理的数据量,进而降低了特效处理的计算复杂度,最终减小图像拍摄或视频拍摄时的计算复杂度。并且相对于两次裁剪,本公开的一次裁剪也有助于降低图像拍摄或视频拍摄时的计算复杂度。
可以理解的是,由于计算复杂度降低,从而图像拍摄或视频拍摄所消耗的时长也减小。
下面以具体的实施例对本公开实施例的技术方案以及本公开的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本公开实施例进行描述。
图2示例性示出了本公开实施例提供的一种图像处理方法的步骤流程图。图2所示的方法可以应用在电子设备中,参照图2所示,该图像处理方法包括:
S101:通过应用程序调用图像采集装置获取第一图像数据。
其中,应用程序是指可以拍摄图像、使用图像的任意程序。例如,社交应用程序,可以将拍摄的图像发送出去。
应用程序是运行于终端设备上,应用程序在拍摄图像时,首先要调用终端设备的图像采集装置获取第一图像数据,然后对第一图像数据进行处理之后,在应用程序中 显示或存储。
上述图像采集装置预设了至少一个候选比例,并从中选取一个候选比例作为第一图像数据的比例。
在一种实施例中,第一图像数据对应第一纹理,第一纹理是图像采集装置进行图像显示时支持的纹理。例如,第一纹理通常为OES纹理。
S102:将第一图像数据裁剪为第二图像数据,第一图像数据的比例与第二图像数据的比例不同,第一图像数据的比例是图像采集装置支持的比例,第二图像数据的比例是应用程序支持的比例。
可以理解的是,应用程序使用的第二图像数据的比例与图像采集装置使用的第一图像数据的比例不同。例如,第一图像数据的比例可以为2:1,也就是第一图像数据对应的图像的宽和高的比值为2:1,第二图像数据的比例可以为1:1,也就是第二图像数据对应的图像的宽和高的比值为1:1。又例如,第一图像数据的比例可以为1:1,也就是第一图像数据对应的图像的宽和高的比值为1:1,第二图像数据的比例可以为2:1,也就是第二图像数据对应的图像的宽和高的比值为2:1。
当第一图像数据和第二图像数据的比例不同时,需要将第一图像数据裁剪为第二图像数据。
在本公开实施例中,应用程序进行图像显示时的纹理可以与第一纹理相同,也可以不同。当不同时,将应用程序的纹理称为第二纹理。此时,需要将图像数据从第一纹理转换为第二纹理,第二纹理通常为二维纹理。
在一种实施例中,可以将上述裁剪过程集成在纹理转换过程中。相对于单独对第一图像数据进行裁剪,裁剪过程和纹理转换过程集成在一起进一步减少了图像处理所需要进行的处理步骤,进而进一步减小图像拍摄或视频拍摄所消耗的时长。
在将裁剪过程和纹理转换过程集成时,只对第一图像数据中的部分像素进行纹理类型的转换,这部分像素是根据第二图像数据的比例确定的。具体地,可以根据第二图像数据的比例在第一图像数据中确定目标区域;然后,将目标区域的纹理从第一类型转换为第二类型,得到目标区域构成的第二图像数据。第一类型是图像采集装置进行图像显示时支持的纹理类型,第二类型是应用程序进行图像显示时支持的纹理类型。
其中,第一类型可以是OES纹理,第二类型可以是二维纹理。
上述目标区域是第一图像数据中面积最大,且比例为第二图像数据的比例的像素区域。从而,可以尽量保证得到的第二图像数据保留最多的图像信息,提高第二图像数据的清晰度。图3、图4示例性示出了第一图像数据和目标区域之间的两种比例关系示意图。参照图3或图4所示,加粗线构成的区域A1为第一图像数据所对应的图像区域,阴影部分构成的区域A2为目标区域。
参照图3所示,A1的宽和高的比值为2:1,也就是第一图像数据的比例为第一图像数据的高与第一图像数据的宽的比值2:1,目标区域的宽和高的比值等于第二图像数据的比例1:1。可以看出,图3中的目标区域的高和第一图像数据的高相同,目标区域的宽小于第一图像数据的宽。可以理解的是,图3中示出的目标区域位于第一图像数据所对应的图像区域的中间位置。在实际应用中,目标区域可以沿宽所在的方向上水平移动。
参照图4所示,A1的宽和高的比值为1:1,目标区域的宽和高的比值等于第二图像数据的比例2:1。可以看出,图4中的目标区域的宽和第一图像数据的宽相同,目标区域的高小于第一图像数据的高。可以理解的是,图4中示出的目标区域位于第一图像数据所对应的图像区域的中间位置。在实际应用中,目标区域可以沿高所在的方向上竖直移动。
综上所述,参照图3所示,为了使目标区域的面积最大,当第一图像数据的比例大于第二图像数据的比例时,目标区域的高等于第一图像数据的高。参照图4所示,为了使目标区域的面积最大,当第一图像数据的比例小于第二图像数据的比例时,目标区域的宽等于第一图像数据的宽。
在实际应用中,在选取目标区域时,还需要根据第一图像数据中的关键图像信息确定目标区域,以使目标区域中包括关键图像信息。其中,关键图像信息可以包括:人脸、人体、动物、建筑等。
S103:对第二图像数据进行特效处理。
其中,特效处理可以包括但不限于:修改颜色、添加文字、添加特效画面等。
S104:对特效处理之后的第二图像数据进行第一处理,第一处理包括以下至少一种:显示在应用程序的界面中、编码并存储。
可以理解的是,显示在应用程序的界面中,以及,存储在应用程序对应的存储区中这两个步骤是相互独立,互不影响的。
其中,编码并存储可以包括:首先,对第二图像数据进行编码,得到图像文件;然后,将图像文件存储到应用程序对应的存储区中。
上述存储区可以是在终端设备上为应用程序划分的存储区,用于存储应用程序在运行过程中生成的数据。存储区可以为内存、缓存、磁盘。
在一种实施例中,在将第一图像数据裁剪为第二图像数据之前,还可以调整第二图像数据的比例。下面详细说明两种调整第二图像数据的比例的方式。
第一种方式,在屏幕旋转角度大于或等于预设角度阈值时,调整第二图像数据的比例。
其中,屏幕旋转角度是运行上述应用程序的终端设备的屏幕在旋转过程中的角度,该旋转可以是用户进行的。其中,预设角度阈值可以根据实际应用场景设定。例如,预设角度阈值可以为90度,从而用户将终端设备从横屏调整为竖屏,或将终端设备从竖屏调整为竖屏时,可以调整第二图像数据的比例。
具体地,第二图像数据的比例可以由终端设备旋转后终端设备的宽和高的比例确定。在一种实施例中,第二图像数据的比例与终端设备的高和宽的比例接近,甚至相同。例如,若终端设备的宽和高的比例为1:2,则终端设备在从横屏调整为竖屏时,第二图像数据的比例也从2:1调整为1:2,终端设备在从竖屏调整为横屏时,第二图像数据的比例也可以从1:2调整为2:1。
第二种方式,接收在应用程序中输入的目标比例;将第二图像数据的比例调整为目标比例。
其中,目标比例可以是用户输入的任意比例。
当然,应用程序可以预先设置目标比例的条件,以避免出现不合理的目标比例,影响显示效果。当用户输入的目标比例满足该条件时,将第二图像数据的比例调整为该目标比例;当用户输入的目标比例不满足该条件时,不调整第二图像数据的比例。
上述条件可以包括以下至少一种:取值类型的条件、取值范围的条件。例如,目标比例的取值范围可以为1:2到2:1,当用户输入的目标比例为2:1时,可以将第二图像数据的比例调整为2:1;当用户输入的目标比例为10:1时,可以不调整第二图像数据的比例。
在调整第二图像数据的比例之后,调整后的第二图像数据的比例可能和第一图像数据的比例不匹配或匹配。若第一图像数据的比例是图像采集装置的候选比例中,与 第二图像数据的比例最接近的比例,则该第一图像数据的比例与第二图像数据的比例匹配;否则该第一图像数据的比例与第二图像数据的比例不匹配。
当调整后的第二图像数据的比例和第一图像数据的比例匹配时,不需要调整第一图像数据的比例。在调整第二图像数据的比例之后,可以采用该第一图像数据的比例重新采集第一图像数据。即调整第二图像数据的比例前后,第一图像数据的比例相同。
当调整后的第二图像数据的比例和第一图像数据的比例不匹配时,可以从图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为第一图像数据的比例。即调整第二图像数据的比例前后,第一图像数据的比例不同。
其中,第一图像数据的比例是候选比例中与调整后的第二图像数据的比例最接近的比例。如此,可以保证第一图像数据中包括尽量多的有效像素,并且包括尽量少的无效像素。其中,有效像素是在第二图像数据中的像素,无效像素是不在第二图像数据中的像素。这样,可以尽量减少图像采集装置采集的无效像素,进而降低图像采集装置的计算复杂度。
在上述调整第一图像数据的比例之后,还可以根据调整后的第一图像数据的比例重新启动图像采集装置的预览,以进入通过应用程序调用图像采集装置获取第一图像数据的步骤。
其中,重新启动的图像采集装置的预览与调整后的第一图像数据对应相同的比例,以使重新获取的第一图像数据对应调整后的比例。在重新获取第一图像数据之后,需要继续执行S101以后的各个步骤。
对于上述第一种方式,在屏幕旋转角度大于或等于预设角度阈值时,调整第二图像数据的比例。在调整第二图像数据的比例之后,对第二图像数据进行第一处理之前,还可以根据屏幕旋转角度确定第一角度,第一角度与屏幕旋转角度之和为0度或360度;根据第一角度将第二图像数据进行转置。
图5至7示例性示出了本公开实施例提供的一种终端设备的屏幕旋转示意图。
参照图5所示,终端设备的屏幕为竖屏状态,图像采集装置采集的图像直接显示在屏幕中为竖直状态。将终端设备的屏幕逆时针旋转90度到横屏状态之后,由于图像采集装置在终端设备上固定,从而图像采集装置的拍摄角度也被逆时针旋转90度。
如图6所示,图像采集装置的拍摄角度被旋转之后,采集的图像直接显示在屏幕中会变成横向状态。可以看出,图6中的显示并不方便用户查看图像,从而在终端设备的屏幕被旋转之后,需要对图像采集装置采集的图像进行相反的旋转,也就是对图 像数据进行转置。例如,当终端设备的屏幕逆时针旋转90度时,需要将图像采集装置采集的图像顺时针旋转90度,从而图5所示的终端设备的屏幕在旋转之后,可以得到图7所示的图像。
如图7所示,终端设备的屏幕被旋转到横屏时,显示的图像仍为竖直状态,可以方便用户查看图像。
基于上述原理,我们在得到第二图像数据时,需要对第二图像数据进行旋转。第一图像数据对应图像采集装置采集的图像,S102得到的第二图像数据对应旋转屏幕之后的图像,从而可以对第二图像数据进行转置,也就是对第二图像数据对应的图像进行第一角度的旋转。第一角度与屏幕旋转角度之和为0或360度,以使第二图像数据对应的图像与旋转屏幕之前处于相同的水平或竖直状态。
图8示例性示出了本公开实施例提供的一种图像处理方法的详细流程图。图8中的图像处理方法示出了前述多种处理之间的关系,参照图8所示,一方面,可以监听屏幕旋转角度,并在屏幕旋转角度大于或等于预设角度阈值时,调整第二图像数据的比例;另一方面,可以接收在应用程序中输入的目标比例,并调整第二图像数据的比例。当然,如果屏幕旋转角度小于预设角度阈值时,不调整第二图像数据的比例,并持续监听。
在调整第二图像数据的比例之后,一方面,可以清理当前任务,包括但不限于:当前第二图像数据的转换任务、当前第二图像数据的渲染任务,并将第一图像数据裁剪为第二图像数据。另一方面,判断是否调整第一图像数据的比例。在调整第一图像数据的比例时,重新启动图像采集装置的预览,并进入S101的步骤重新获取第一图像数据,执行S101之后的步骤S102至S104。在不调整第一图像数据的比例时,执行步骤S104。
对应于上文实施例的图像处理方法,图9示例性示出了本公开实施例提供的一种图像处理装置的结构框图。为了便于说明,仅示出了与本公开实施例相关的部分。参照图9,上述图像处理装置200包括:图像数据获取模块201、图像裁剪模块202、特效处理模块203和第一处理模块204。
其中,图像数据获取模块201,用于通过应用程序调用图像采集装置获取第一图像数据。
图像裁剪模块202,用于将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像 采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例。
特效处理模块203,用于对所述第二图像数据进行特效处理。
第一处理模块204,用于对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
在一种实施例中,上述图像裁剪模块202,还用于:在所述第一图像数据中确定目标区域,所述目标区域的比例等于所述第二图像数据的比例;将所述目标区域的纹理从第一类型转换为第二类型,得到所述目标区域构成的第二图像数据,所述第一类型是所述图像采集装置进行图像显示时支持的纹理类型,所述第二类型是所述应用程序进行图像显示时支持的纹理类型。
在一种实施例中,若所述第一图像数据的比例大于第二图像数据的比例,则所述目标区域的高为所述第一图像数据的高;若所述第一图像数据的比例小于第二图像数据的比例,则所述目标区域的宽为所述第一图像数据的宽。
在一种实施例中,上述图像裁剪模块202,还用于:确定所述第一图像数据中包括的关键图像信息;将所述第一图像数据中包括所述关键图像信息的区域确定为所述目标区域。
在一种实施例中,上述装置还包括第一比例调整模块,用于在将所述第一图像数据裁剪为第二图像数据之前,在屏幕旋转角度大于或等于预设角度阈值时,调整所述第二图像数据的比例。
在一种实施例中,上述装置还包括目标比例接收模块和比例调整模块:
目标比例接收模块,用于在将所述第一图像数据裁剪为第二图像数据之前,接收在所述应用程序中输入的目标比例。
第二比例调整模块,用于将所述第二图像数据的比例调整为所述目标比例。
在一种实施例中,上述装置还包括第三比例调整模块,用于若调整后的第二图像数据的比例与所述第一图像数据的比例不匹配,则从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例。
在一种实施例中,上述装置还包括循环处理模块,用于在从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例之后,根据调整后的第一图像数据的比例重新启动所述图像采集装置的预览,以进入所述通过应用程序调用图像采集装置获取第一图像数据的步骤。
在一种实施例中,上述装置还包括第一角度确定模块和图像转置模块:
第一角度确定模块,用于在对特效处理之后的第二图像数据进行第一处理之前,根据所述屏幕旋转角度确定第一角度,所述第一角度与所述屏幕旋转角度之和为0度或360度。
图像转置模块,用于根据所述第一角度将特效处理之后的第二图像数据进行转置。
本实施例提供的图像处理装置,可用于执行上述图2所示的方法实施例的技术方案,其实现原理和技术效果类似,本实施例此处不再赘述。
图10示例性示出了本公开实施例提供的一种电子设备600的结构框图。该电子设备600包括存储器602和至少一个处理器601;
其中,存储器602存储计算机执行指令;
至少一个处理器601执行存储器602存储的计算机执行指令,使得电子设备601实现前述图2中的方法。
此外,该电子设备还可以包括接收器603和发送器604,接收器603用于接收从其余装置或设备的信息,并转发给处理器601,发送器604用于将信息发送到其余装置或设备。
进一步地,参考图11,其示出了适于用来实现本公开实施例的电子设备900的结构示意图,该电子设备900可以为终端设备。其中,终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(personal digital assistant,PDA)、平板电脑(portable android device,PAD)、便携式多媒体播放器(portable media player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图11示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图11所示,电子设备900可以包括处理装置(例如中央处理器、图形处理器等)901,其可以根据存储在只读存储器(read only memory,ROM)902中的程序或者从存储装置908加载到随机访问存储器(random access memory,RAM)903中的程序而执行各种适当的动作和处理。在RAM 903中,还存储有电子设备900操作所需的各种程序和数据。处理装置901、ROM 902以及RAM 903通过总线904彼此相连。输入/输出(input/output,I/O)接口905也连接至总线904。
通常,以下装置可以连接至I/O接口905:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置906;包括例如液晶显示器(liquid  crystal display,LCD)、扬声器、振动器等的输出装置907;包括例如磁带、硬盘等的存储装置908;以及通信装置909。通信装置909可以允许电子设备900与其他设备进行无线或有线通信以交换数据。虽然图11示出了具有各种装置的电子设备900,但是应理解的是,并不要求实施或具备所有示出的装置,可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置909从网络上被下载和安装,或者从存储装置908被安装,或者从ROM 902被安装。在该计算机程序被处理装置901执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(erasable programmable read-only memory,EPROM)、光纤、便携式紧凑磁盘只读存储器(compact disc read-only memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(radio frequency,RF)等等,或者上述的任意合适的组合。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备执行上述实施例所示的方法。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(local area network,LAN)或广域网(wide area network,WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品及计算机程序的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(field-programmable gate array,FPGA)、专用集成电路(application specific integrated circuit,ASIC)、专用标准产品(application specific standard parts,ASSP)、片上系统(system on chip,SOC)、复杂可编程逻辑设备(complex programmable logic device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
在第一方面的第一种示例中,本公开实施例提供了一种图像处理方法,包括:
通过应用程序调用图像采集装置获取第一图像数据;
将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
对所述第二图像数据进行特效处理;
对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
基于第一方面的第一种示例,在第一方面的第二种示例中,所述将所述第一图像数据裁剪为第二图像数据,包括:
在所述第一图像数据中确定目标区域,所述目标区域的比例等于所述第二图像数据的比例;
将所述目标区域的纹理从第一类型转换为第二类型,得到所述目标区域构成的第二图像数据,所述第一类型是所述图像采集装置进行图像显示时支持的纹理类型,所述第二类型是所述应用程序进行图像显示时支持的纹理类型。
基于第一方面的第二种示例,在第一方面的第三种示例中,若所述第一图像数据的比例大于第二图像数据的比例,则所述目标区域的高为所述第一图像数据的高;若所述第一图像数据的比例小于第二图像数据的比例,则所述目标区域的宽为所述第一图像数据的宽。
基于第一方面的第二或第三种示例,在第一方面的第四种示例中,所述在所述第一图像数据中确定目标区域,包括:
确定所述第一图像数据中包括的关键图像信息;
将所述第一图像数据中包括所述关键图像信息的区域确定为所述目标区域。
基于第一方面的第一种示例,在第一方面的第五种示例中,所述将所述第一图像数据裁剪为第二图像数据之前,还包括:
在屏幕旋转角度大于或等于预设角度阈值时,调整所述第二图像数据的比例。
基于第一方面的第一种示例,在第一方面的第六种示例中,所述将所述第一图像数据裁剪为第二图像数据之前,还包括:
接收在所述应用程序中输入的目标比例;
将所述第二图像数据的比例调整为所述目标比例。
基于第一方面的第五或第六种示例,在第一方面的第七种示例中,还包括:
若调整后的第二图像数据的比例与所述第一图像数据的比例不匹配,则从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例。
基于第一方面的第七种示例,在第一方面的第八种示例中,所述从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例之后,还包括:
根据调整后的第一图像数据的比例重新启动所述图像采集装置的预览,以进入所述通过应用程序调用图像采集装置获取第一图像数据的步骤。
基于第一方面的第五种示例,在第一方面的第九种示例中,所述对特效处理之后的第二图像数据进行第一处理之前,还包括:
根据所述屏幕旋转角度确定第一角度,所述第一角度与所述屏幕旋转角度之和为0度或360度;
根据所述第一角度将特效处理之后的第二图像数据进行转置。
在第二方面的第一种示例中,提供了一种图像处理装置,包括:
图像数据获取模块,用于通过应用程序调用图像采集装置获取第一图像数据;
图像裁剪模块,用于将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
特效处理模块,用于对所述第二图像数据进行特效处理;
第一处理模块,用于对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
基于第二方面的第一种示例,在第二方面的第二种示例中,所述图像裁剪模块,还用于:
在所述第一图像数据中确定目标区域,所述目标区域的比例等于所述第二图像数据的比例;
将所述目标区域的纹理从第一类型转换为第二类型,得到所述目标区域构成的第二图像数据,所述第一类型是所述图像采集装置进行图像显示时支持的纹理类型,所述第二类型是所述应用程序进行图像显示时支持的纹理类型。
基于第二方面的第二种示例,在第二方面的第三种示例中,若所述第一图像数据的比例大于第二图像数据的比例,则所述目标区域的高为所述第一图像数据的高;若所述第一图像数据的比例小于第二图像数据的比例,则所述目标区域的宽为所述第一图像数据的宽。
基于第二方面的第二或第三种示例,在第二方面的第四种示例中,所述图像裁剪模块,还用于:
确定所述第一图像数据中包括的关键图像信息;
将所述第一图像数据中包括所述关键图像信息的区域确定为所述目标区域。
基于第二方面的第一种示例,在第二方面的第五种示例中,所述装置还包括第一比例调整模块,用于将所述第一图像数据裁剪为第二图像数据之前,在屏幕旋转角度大于或等于预设角度阈值时,调整所述第二图像数据的比例。
基于第二方面的第一种示例,在第二方面的第六种示例中,所述装置还包括:
目标比例接收模块,用于将所述第一图像数据裁剪为第二图像数据之前,接收在所述应用程序中输入的目标比例;
第二比例调整模块,用于将所述第二图像数据的比例调整为所述目标比例。
基于第二方面的第五或第六种示例,在第二方面的第七种示例中,所述装置还包括第三比例调整模块,用于若调整后的第二图像数据的比例与所述第一图像数据的比例不匹配,则从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例。
基于第二方面的第七种示例,在第二方面的第八种示例中,所述装置还包括循环处理模块,用于在从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例之后,根据调整后的第一图像数据的 比例重新启动所述图像采集装置的预览,以进入所述通过应用程序调用图像采集装置获取第一图像数据的步骤。
基于第二方面的第五种示例,在第二方面的第九种示例中,所述装置还包括:
第一角度确定模块,用于在对特效处理之后的第二图像数据进行第一处理之前,根据所述屏幕旋转角度确定第一角度,所述第一角度与所述屏幕旋转角度之和为0度或360度;
图像转置模块,用于根据第一角度将特效处理之后的第二图像数据进行转置。
第三方面,根据本公开的一个或多个实施例,提供了一种电子设备,包括:至少一个处理器和存储器;
所述存储器存储计算机执行指令;
所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述电子设备实现第一方面任一项所述的方法。
第四方面,根据本公开的一个或多个实施例,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,使计算设备实现第一方面任一项所述的方法。
第五方面,根据本公开的一个或多个实施例,提供了一种计算机程序,所述计算机程序用于实现第一方面任一项所述的方法。
第六方面,根据本公开的一个或多个实施例,提供了一种计算机程序产品,包括计算机指令,所述计算机指令用于实现第一方面任一项所述的方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (14)

  1. 一种图像处理方法,包括:
    通过应用程序调用图像采集装置获取第一图像数据;
    将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
    对所述第二图像数据进行特效处理;
    对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
  2. 根据权利要求1所述的方法,其中,所述将所述第一图像数据裁剪为第二图像数据,包括:
    在所述第一图像数据中确定目标区域,所述目标区域的比例等于所述第二图像数据的比例;
    将所述目标区域的纹理从第一类型转换为第二类型,得到所述目标区域构成的第二图像数据,所述第一类型是所述图像采集装置进行图像显示时支持的纹理类型,所述第二类型是所述应用程序进行图像显示时支持的纹理类型。
  3. 根据权利要求2所述的方法,其中,
    若所述第一图像数据的比例大于所述第二图像数据的比例,则所述目标区域的高为所述第一图像数据的高;
    若所述第一图像数据的比例小于所述第二图像数据的比例,则所述目标区域的宽为所述第一图像数据的宽。
  4. 根据权利要求2或3所述的方法,其中,所述在所述第一图像数据中确定目标区域,包括:
    确定所述第一图像数据中包括的关键图像信息;
    将所述第一图像数据中包括所述关键图像信息的区域确定为所述目标区域。
  5. 根据权利要求1至4任一项所述的方法,其中,所述将所述第一图像数据裁剪为第二图像数据之前,还包括:
    在屏幕旋转角度大于或等于预设角度阈值时,调整所述第二图像数据的比例。
  6. 根据权利要求5所述的方法,其中,所述对特效处理之后的第二图像数据进行第一处理之前,还包括:
    根据所述屏幕旋转角度确定第一角度,所述第一角度与所述屏幕旋转角度之和为0度或360度;
    根据所述第一角度将特效处理之后的第二图像数据进行转置。
  7. 根据权利要求1至4任一项所述的方法,其中,所述将所述第一图像数据裁剪为第二图像数据之前,还包括:
    接收在所述应用程序中输入的目标比例;
    将所述第二图像数据的比例调整为所述目标比例。
  8. 根据权利要求5至7任一项所述的方法,还包括:
    若调整后的第二图像数据的比例与所述第一图像数据的比例不匹配,则从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例。
  9. 根据权利要求8所述的方法,其中,所述从所述图像采集装置的候选比例中,选取与调整后的第二图像数据的比例匹配的比例作为所述第一图像数据的比例之后,还包括:
    根据调整后的第一图像数据的比例重新启动所述图像采集装置的预览,以进入所述通过应用程序调用图像采集装置获取第一图像数据的步骤。
  10. 一种图像处理装置,包括:
    图像数据获取模块,用于通过应用程序调用图像采集装置获取第一图像数据;
    图像裁剪模块,用于将所述第一图像数据裁剪为第二图像数据,所述第一图像数据的比例与所述第二图像数据的比例不同,所述第一图像数据的比例是所述图像采集装置支持的比例,所述第二图像数据的比例是所述应用程序支持的比例;
    特效处理模块,用于对所述第二图像数据进行特效处理;
    第一处理模块,用于对特效处理之后的第二图像数据进行第一处理,所述第一处理包括以下至少一种:显示在所述应用程序的界面中、编码并存储。
  11. 一种电子设备,包括:至少一个处理器和存储器;
    所述存储器存储计算机执行指令;
    所述至少一个处理器执行所述存储器存储的计算机执行指令,使得所述电子设备实现如权利要求1至9任一项所述的方法。
  12. 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,使计算设备实现如权利要求1至9任一项所述的方法。
  13. 一种计算机程序,所述计算机程序用于实现如权利要求1至9任一项所述的方法。
  14. 一种计算机程序产品,所述计算机程序产品包括计算机指令,所述计算机指令用于实现如权利要求1至9任一项所述的方法。
PCT/CN2022/117897 2021-09-13 2022-09-08 图像处理方法及设备 WO2023036257A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111066745.4 2021-09-13
CN202111066745.4A CN115809957A (zh) 2021-09-13 2021-09-13 图像处理方法及设备

Publications (1)

Publication Number Publication Date
WO2023036257A1 true WO2023036257A1 (zh) 2023-03-16

Family

ID=85481110

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/117897 WO2023036257A1 (zh) 2021-09-13 2022-09-08 图像处理方法及设备

Country Status (2)

Country Link
CN (1) CN115809957A (zh)
WO (1) WO2023036257A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103020900A (zh) * 2012-11-15 2013-04-03 北京小米科技有限责任公司 一种图像处理方法及装置
JP2014050027A (ja) * 2012-09-03 2014-03-17 Make Softwear:Kk 写真シール作成装置、写真シール作成装置の制御方法、及び写真シール作成装置の制御プログラム
CN111356000A (zh) * 2018-08-17 2020-06-30 北京达佳互联信息技术有限公司 视频合成方法、装置、设备及存储介质
CN111415399A (zh) * 2020-03-19 2020-07-14 北京奇艺世纪科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN112073765A (zh) * 2019-06-10 2020-12-11 海信视像科技股份有限公司 一种显示设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014050027A (ja) * 2012-09-03 2014-03-17 Make Softwear:Kk 写真シール作成装置、写真シール作成装置の制御方法、及び写真シール作成装置の制御プログラム
CN103020900A (zh) * 2012-11-15 2013-04-03 北京小米科技有限责任公司 一种图像处理方法及装置
CN111356000A (zh) * 2018-08-17 2020-06-30 北京达佳互联信息技术有限公司 视频合成方法、装置、设备及存储介质
CN112073765A (zh) * 2019-06-10 2020-12-11 海信视像科技股份有限公司 一种显示设备
CN111415399A (zh) * 2020-03-19 2020-07-14 北京奇艺世纪科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN115809957A (zh) 2023-03-17

Similar Documents

Publication Publication Date Title
US10986345B2 (en) Backward-compatible video capture and distribution
WO2022037251A1 (zh) 视频数据处理方法及装置
CN110288518B (zh) 图像处理方法、装置、终端及存储介质
TWI557683B (zh) Mipmap壓縮技術
WO2022135092A1 (zh) 屏幕共享显示方法、装置、设备及存储介质
CN110728622B (zh) 鱼眼图像处理方法、装置、电子设备及计算机可读介质
US20230260482A1 (en) Electronic device projection method, medium thereof, and electronic device
US11893770B2 (en) Method for converting a picture into a video, device, and storage medium
WO2024051536A1 (zh) 直播特效渲染方法、装置、设备、可读存储介质及产品
CN114040246A (zh) 图形处理器的图像格式转换方法、装置、设备及存储介质
CN115761090A (zh) 特效渲染方法、装置、设备、计算机可读存储介质及产品
WO2022111717A1 (zh) 图像处理方法、装置及电子设备
CN111738950B (zh) 图像处理方法及装置
WO2024022391A1 (zh) 多媒体数据传输方法、装置、电子设备及存储介质
WO2023036257A1 (zh) 图像处理方法及设备
CN114793283A (zh) 图像编码方法、图像解码方法、终端设备及可读存储介质
WO2022061723A1 (zh) 一种图像处理方法、设备、终端及存储介质
CN113592734B (zh) 图像处理方法、装置和电子设备
WO2024022427A1 (zh) 视频录制方法、装置、设备、存储介质和程序产品
WO2022206600A1 (zh) 一种投屏方法、系统及相关装置
US11756151B1 (en) End-cloud collaborative media data processing method and apparatus, device, and storage medium
WO2023035973A1 (zh) 视频处理方法、装置、设备及介质
WO2022166386A1 (zh) 图像显示方法、电子设备及存储介质
WO2021004171A1 (zh) 水波纹图像实现方法及装置
WO2023093474A1 (zh) 一种多媒体处理方法、装置、设备及介质

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 18573564

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE