WO2019128539A1 - Image definition obtaining method and apparatus, storage medium, and electronic device - Google Patents

Image definition obtaining method and apparatus, storage medium, and electronic device Download PDF

Info

Publication number
WO2019128539A1
WO2019128539A1 PCT/CN2018/116446 CN2018116446W WO2019128539A1 WO 2019128539 A1 WO2019128539 A1 WO 2019128539A1 CN 2018116446 W CN2018116446 W CN 2018116446W WO 2019128539 A1 WO2019128539 A1 WO 2019128539A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
target area
electronic device
pixel
picture
Prior art date
Application number
PCT/CN2018/116446
Other languages
French (fr)
Chinese (zh)
Inventor
张乐
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019128539A1 publication Critical patent/WO2019128539A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection

Definitions

  • the present application belongs to the field of image processing technologies, and in particular, to a method, an apparatus, a storage medium, and an electronic device for acquiring picture sharpness.
  • the electronic device In the process of taking a picture, the electronic device needs to evaluate the picture obtained by the camera module.
  • the electronic device can perform a sharpness evaluation on a picture using a sharpness evaluation algorithm.
  • commonly used definition evaluation algorithms include Sobel operators and the like.
  • the embodiment of the present application provides a method, an apparatus, a storage medium, and an electronic device for acquiring picture sharpness, which can improve the efficiency of acquiring picture clarity.
  • An embodiment of the present application provides a method for acquiring picture clarity, including:
  • the sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
  • An embodiment of the present application provides a device for acquiring picture sharpness, including:
  • a first acquiring module configured to acquire an original picture obtained by shooting according to a Bayer array
  • a first determining module configured to determine a target area from the original picture, and determine a distribution position of a pixel of a preset color from the target area
  • a second acquiring module configured to acquire a square value of a difference value of a luminance value of a pixel of a preset color in which the distribution position relationship in the target area is diagonally adjacent;
  • a second determining module configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
  • the embodiment of the present application provides a storage medium on which a computer program is stored.
  • the computer program is executed on a computer, the computer is caused to execute the flow in the method for acquiring picture sharpness provided by the embodiment of the present application.
  • the embodiment of the present application further provides an electronic device, including a memory, a processor, by using a computer program stored in the memory, to execute:
  • the sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
  • FIG. 1 is a schematic flowchart diagram of a method for acquiring picture sharpness provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of pixel distribution of a target area in an original picture provided by an embodiment of the present application.
  • FIG. 3 is another schematic flowchart of a method for acquiring picture sharpness provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a scenario for acquiring a picture sharpness according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application.
  • FIG. 7 is another schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 9 is another schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the embodiment of the present application provides a method for acquiring picture sharpness, which includes:
  • the obtaining a square value of a difference value of a brightness value of a pixel of a preset color in a diagonally adjacent positional relationship in the target area may include: determining, from the target area a target pixel having the same preset color pixel distribution at positions adjacent to the lower left diagonally adjacent to the lower right diagonal corner; obtaining a difference value of luminance values of each of the target pixels and pixels adjacent to the lower left diagonal thereof The squared value and obtain the square of the difference between the luminance value of each target pixel and the pixel adjacent to its lower right diagonal.
  • the determining the target area from the original picture may include: determining a target area from the original picture, where the target area is a rectangular area of a preset size.
  • the determining the target area from the original picture may include: determining a target area from the original picture, the target area being a required focus area.
  • the method before the acquiring the original image obtained by the Bayer array, the method further includes: acquiring the total running memory capacity of the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image. And the running memory capacity currently occupied; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
  • the acquiring the original image obtained by the Bayer array may include: if the percentage value is detected to be greater than the preset ratio threshold, acquiring the original image obtained by the Bayer array.
  • the method for acquiring the image sharpness may further include: adjusting the preset ratio threshold.
  • the adjusting the preset ratio threshold may include: acquiring a preset basic value; and increasing or decreasing the basic value according to the preset amplitude to obtain a preset proportional threshold.
  • the executive body of the embodiment of the present application may be an electronic device such as a smart phone or a tablet computer.
  • FIG. 1 is a schematic flowchart of a method for acquiring picture sharpness according to an embodiment of the present disclosure, where the process may include:
  • the electronic device In the process of taking a picture, the electronic device needs to evaluate the picture obtained by the camera module.
  • the electronic device can perform a sharpness evaluation on a picture using a sharpness evaluation algorithm.
  • a sharpness evaluation algorithm For example, commonly used definition evaluation algorithms include Sobel operators and the like.
  • Sobel operators When using these definition evaluation algorithms to obtain the sharpness of the picture, it is necessary to interpolate the original picture (Bayer Raw picture) obtained based on the Bayer array image, which results in low efficiency in obtaining picture sharpness.
  • the electronic device may first acquire an original picture (Bayer RAW picture) obtained based on the Bayer array.
  • the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
  • a target area is determined from the original picture, and a distribution position of pixels of a preset color is determined from the target area.
  • the electronic device can determine a target area from the original picture.
  • the target area is an area for obtaining the sharpness of the original picture.
  • the electronic device After determining the target area from the original picture taken by the Bayer array, the electronic device can determine the distribution position of the pixels of the preset color from the target area.
  • the electronic device can determine the distribution location of the green pixels from the target area.
  • the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
  • a square value of a difference value of luminance values of pixels of a preset color in which the distribution position relationship in the target area is diagonally adjacent is acquired.
  • the electronic device may acquire the square value of the difference of the brightness value of each of the two green pixels adjacent to the diagonally adjacent positional relationship in the target area.
  • diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
  • the figure is a schematic diagram of pixel distribution of a target area in a Bayer RAW image.
  • the pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
  • G01 and G10 are diagonally adjacent green pixels
  • G01 and G12 are diagonally adjacent green pixels
  • G12 and G21 are diagonally adjacent green pixels
  • G12 and G23 are diagonally adjacent green pixels. Pixel.
  • G01 and G23 are not diagonally adjacent green pixels
  • G01 and G21 are not diagonally adjacent green pixels.
  • the electronic device can obtain the squared value of the difference in their luminance values.
  • the green pixel of G01 has a luminance value of L01
  • the green pixel of G10 has a luminance value of L10.
  • the electronic device can obtain the squared value of the difference of their luminance values.
  • the green pixel of G01 has a luminance value of L01
  • the green pixel of G12 has a luminance value of L12.
  • the square values of all the differences are added to obtain a sum value, and the sum value is determined as the sharpness of the picture.
  • the electronic device can add the square values of all the differences to obtain a sum value.
  • the electronic device can then determine the sum value as the sharpness of the picture.
  • the embodiment of the present application can directly obtain the definition on the basis of the original image obtained by the Bayer array, without first interpolating the original image obtained by the Bayer array shooting, Then obtain the definition. Therefore, the embodiment of the present application can improve the efficiency of obtaining picture clarity.
  • the scheme in this embodiment has high robustness and stability. Moreover, the scheme in this embodiment has a high acquisition accuracy.
  • FIG. 3 is another schematic flowchart of a method for acquiring picture sharpness according to an embodiment of the present disclosure, where the process may include:
  • the electronic device acquires an original picture taken based on a Bayer array.
  • the electronic device can first obtain the original picture (Bayer RAW picture) obtained based on the Bayer array.
  • the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
  • the electronic device determines a target area from the original picture, the target area being a rectangular area of a preset size.
  • the electronic device can determine a target area from the original picture.
  • the target area is an area for obtaining the sharpness of the original picture.
  • the target area may be a rectangular area of a preset size.
  • the electronic device determines a distribution position of the pixels of the preset color from the target area.
  • the electronic device can determine the distribution position of the pixels of the preset color from the target area.
  • the electronic device can determine the distribution location of the green pixels from the target area.
  • the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
  • the electronic device determines, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonally adjacent to the lower right diagonal.
  • the electronic device may determine, from the target area, a target having a green pixel distribution at a position adjacent to the lower left diagonally adjacent to the lower right diagonal corner. Pixel.
  • the color of the target pixel is also a preset color.
  • diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
  • FIG. 2 is a schematic diagram of pixel distribution of a target area of a certain picture.
  • the pixels R00, R02, R20, and R22 are red pixels
  • G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels
  • B11, B13, B31, and B33 are blue pixels.
  • the electronic device can determine the green pixel G01 as the target pixel. Similarly, the electronic device can also determine the green pixels G12 and G21 as target pixels.
  • the electronic device may not determine the green pixel G03 as the target pixel.
  • the electronic device may not determine the green pixel G10 as the target pixel.
  • the electronic device may not determine the green pixels G23, G30, and G32 as the target pixels.
  • the electronic device acquires a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquires each target pixel and a pixel adjacent to a diagonally lower right corner thereof.
  • the square of the difference in luminance values is a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel.
  • the electronic device may acquire the square value of the difference between the brightness value of each target pixel and the same color pixel adjacent to the lower left diagonal of the target pixel, and acquire each target.
  • the electronic device may not obtain the square value of the difference between the luminance values of the pixels and their lower left diagonal adjacent pixels or the lower right diagonal adjacent pixels.
  • the electronic device adds all the squared values of the difference to obtain a sum value, and determines the sum value as the sharpness of the picture.
  • the square value of the difference between the luminance values of each of the target pixels and the pixels adjacent to the lower left diagonal of the target pixel, and the difference between the luminance values of the pixels adjacent to the lower right diagonal of the target pixel are obtained.
  • the electronic device can add the square values of all these differences to obtain a sum value.
  • the electronic device can then determine the sum value as the sharpness of the picture.
  • the electronic device can then determine the sum value C as the sharpness of the original picture.
  • the electronic device may also determine the sum value as the contrast of the original picture.
  • the process in which the electronic device determines the target area from the original picture in 202 may include:
  • the electronic device determines a target area from the original picture, the target area being a desired focus area.
  • the electronic device may determine the required focus area in the original picture as the target area.
  • the focus area needs to be the area with the highest resolution requirement in the original picture, so the required focus area can be determined as the target area for obtaining the sharpness of the original picture.
  • the following process may be further included:
  • the electronic device When the electronic device enters the shooting interface and needs to obtain the sharpness of the picture, the electronic device acquires the total running memory capacity of the electronic device and the currently occupied running memory capacity;
  • the electronic device obtains the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
  • the process of the electronic device in 201 acquiring the original image obtained by the Bayer array may include: if the percentage value is detected to be greater than the preset ratio threshold, the electronic device acquires the original image obtained by the Bayer array.
  • the electronic device can First, get the total running memory capacity of the electronic device, and the running memory capacity currently occupied.
  • the electronic device can obtain the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity, and detect whether the percentage value is greater than a preset ratio threshold.
  • the current computing power of the electronic device can be considered to be strong, and the electronic device can perform other operations to complete the photo shooting. For example, at this point the electronic device can perform direct calculations based on hardware logic to find the best focus position.
  • the electronic device can acquire the original picture taken based on the Bayer array, and execute the processes in the embodiments 201 to 206, thereby assisting the camera module to find The best focus position.
  • the technical solution of the embodiment can improve the efficiency of the electronic device to obtain picture clarity. Therefore, in the case where the remaining memory is insufficient, by using the flow in the present embodiment 201 to 206, it is possible to speed up the determination of the optimum focus position by the electronic device.
  • the value of the preset ratio threshold may be allowed to be adjusted.
  • the electronic device can first obtain hardware information such as the model of the processor. If it is determined according to the hardware information of the processor that the computing power of the processor is strong, the electronic device may increase the value of the preset ratio threshold by a certain amount. If it is determined that the computing power of the processor is poor according to the hardware information of the processor, the electronic device may lower the value of the preset ratio threshold.
  • the electronic device may set a basic value in advance, and when it is determined that the computing power of the processor is strong according to the hardware information of the processor, the electronic device may increase the basic value by a preset amplitude to obtain a preset proportional threshold. When it is determined that the computing power of the processor is poor according to the hardware information of the processor, the electronic device may reduce the base value by a preset amplitude to obtain a preset ratio threshold.
  • the embodiment may further include the following process: the electronic device adjusts the preset ratio threshold.
  • the electronic device when the electronic device performs the process of adjusting the preset ratio threshold, the electronic device may: the electronic device acquires a preset basic value; and the electronic device increases or decreases the basic value according to the preset amplitude to obtain the pre-prepared Set the proportional threshold.
  • the shooting mode of the camera of the electronic device includes a fast shooting mode, an automatic shooting mode, and a professional shooting mode
  • the technical solution provided in the embodiment of the present application may be used when the fast shooting mode is used, so that Increase the camera's focus speed for electronic devices.
  • the quick shooting mode may be a shooting mode for capturing a picture of a dynamic object.
  • FIG. 4 to FIG. 5 are schematic diagrams of a method for acquiring a picture sharpness according to an embodiment of the present application.
  • the camera module In the production process of the camera module, it is necessary to perform a shooting test on the camera module. Among them, the camera module needs to evaluate the resolution of several frames before and after the shooting, and determines the best focus position according to the resolution of the photos, so as to shoot the highest resolution photos. .
  • the sharpness of the original picture (Bayer RAW picture) or preview image captured by the camera is continuously increased, and the lens is driven from the second position to the first position.
  • the sharpness of the original or preview image captured by the camera is continuously reduced.
  • the electronic device can determine the second position as the best focus position and drive the lens to the second position to complete the shooting.
  • the electronic device can first obtain the original image taken based on the Bayer array.
  • the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
  • the electronic device may first acquire the first original picture obtained based on the Bayer array.
  • the electronic device can determine a target area from the first original picture.
  • the target area may be a rectangular area that requires a focus area, and the target area is a preset size.
  • the target area is a preset size. For example, as shown in FIG. 4, when the user clicks on the camera to capture the face area in the preview interface and wants to focus on the face, the face area needs to be the focus area (the dotted area in the figure indicates the face area that needs to be focused). . Therefore, the electronic device can determine the face area as the target area, and the target area can be a rectangular area of a preset size.
  • the electronic device may determine a distribution position of the green pixel from the target area, and determine, from the target area, a target pixel having a green pixel distribution at a position adjacent to a lower left diagonally opposite and a lower right diagonal opposite .
  • FIG. 2 is a pixel distribution diagram of a target area determined from the first original picture.
  • the green pixel G01 since the green pixel G10 is distributed at the lower left diagonally adjacent position, the green pixel G12 is distributed at the lower right diagonally adjacent position. Therefore, the electronic device can determine the green pixel G01 as the target pixel. Similarly, the electronic device can also determine the green pixels G12 and G21 as target pixels.
  • the electronic device may acquire a square value of a difference value of each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquire each target pixel and distribution The square of the difference in luminance values of pixels adjacent to the lower right diagonal.
  • the electronic device acquires the resolution of the second original picture corresponding to the second position to be D.
  • the electronic device acquires the resolution of the third original picture corresponding to the third position to be E.
  • the electronic device can determine the second position as the best focus position and drive the lens to the second position to complete the photo shooting.
  • the electronic device can prompt the tester to complete the focus (in the figure, the dotted frame of the face area is changed to a solid line frame to indicate that the focus is completed).
  • the camera button as shown in FIG. 5, to complete the photo shooting.
  • the embodiment of the present application provides a device for acquiring picture sharpness, which includes:
  • the first obtaining module is configured to obtain an original picture obtained by shooting according to a Bayer array.
  • a first determining module configured to determine a target area from the original picture, and determine a distribution position of pixels of a preset color from the target area.
  • a second acquiring module configured to acquire a square value of a difference value of a luminance value of a pixel of a preset color in which the distribution position relationship in the target area is diagonally adjacent.
  • a second determining module configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
  • the second obtaining module may be configured to: determine, from the target area, a pixel distribution having the same preset color in a position adjacent to a lower left diagonal and a lower right diagonal opposite a target pixel; obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquiring a luminance value of each target pixel and a pixel adjacent to a diagonally lower diagonal corner thereof The squared value of the difference.
  • the first determining module may be configured to: determine a target area from the original picture, where the target area is a rectangular area of a preset size.
  • the first determining module may be configured to: determine a target area from the original picture, where the target area is a required focus area.
  • the image clarity acquiring device may further include: a third acquiring module, configured to acquire a total running memory of the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image The capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
  • a third acquiring module configured to acquire a total running memory of the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image The capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
  • the first acquiring module may be configured to: if the percentage value is detected to be greater than a preset ratio threshold, obtain an original picture obtained by shooting according to a Bayer array.
  • the third acquiring module may be further configured to: adjust the preset ratio threshold.
  • the third obtaining module may be further configured to: obtain a preset basic value; and increase or decrease the basic value according to a preset amplitude to obtain a preset proportional threshold.
  • FIG. 6 is a schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present disclosure.
  • the image sharpness obtaining apparatus 300 may include: a first obtaining module 301, a first determining module 302, a second obtaining module 303, and a second determining module 304.
  • the first obtaining module 301 is configured to acquire an original picture obtained by shooting according to a Bayer array.
  • the first obtaining module 301 may first acquire an original picture (Bayer RAW picture) obtained based on the Bayer array.
  • the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
  • the first determining module 302 is configured to determine a target area from the original picture, and determine a distribution position of pixels of a preset color from the target area.
  • the first determining module 302 may determine a target area from the original image.
  • the target area is an area for obtaining the sharpness of the original picture.
  • the first determining module 302 may determine the distribution position of the pixels of the preset color from the target area.
  • the first determining module 302 can determine a distribution location of the green pixels from the target area.
  • the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
  • the second obtaining module 303 is configured to acquire a square value of a difference value of the luminance values of the pixels of the preset color in the target area.
  • the second obtaining module 303 may obtain the brightness value of each of the two green pixels adjacent to the diagonally distributed positional relationship in the target area. The squared value of the difference.
  • diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
  • the figure is a schematic diagram of pixel distribution of a target area in a Bayer RAW image.
  • the pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
  • G01 and G10 are diagonally adjacent green pixels
  • G01 and G12 are diagonally adjacent green pixels
  • G12 and G21 are diagonally adjacent green pixels
  • G12 and G23 are diagonally adjacent green pixels. Pixel.
  • G01 and G23 are not diagonally adjacent green pixels
  • G01 and G21 are not diagonally adjacent green pixels.
  • the second determining module 304 is configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
  • the second determining module 304 may add the square values of all the difference values to obtain a sum. value.
  • the second determination module 304 can then determine the sum value as the sharpness of the picture.
  • the second obtaining module 303 can be used to:
  • the second obtaining module 303 may determine, from the target area, that there are green pixels in the position adjacent to the lower left diagonal and the lower right diagonal. The target pixel of the distribution.
  • diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
  • FIG. 2 is a schematic diagram of pixel distribution of a target area of a certain picture.
  • the pixels R00, R02, R20, and R22 are red pixels
  • G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels
  • B11, B13, B31, and B33 are blue pixels.
  • the second acquisition module 303 can determine the green pixel G01 as the target pixel. Similarly, the second acquisition module 303 can also determine the green pixels G12 and G21 as target pixels.
  • the second obtaining module 303 may obtain a square value of a difference value between each target pixel and a luminance value of a same color pixel adjacent to a lower left diagonal of the target pixel, and acquire each The square of the difference between the target pixel and the luminance value of the same color pixel that is adjacent to its lower right diagonal.
  • the second determining module 304 may add R1, R2, R3, R4, R5, R6 to obtain a sum value C, and determine the sum value C as the sharpness of the first original picture.
  • the first determining module 302 can be used to:
  • a target area is determined from the original picture, the target area being a rectangular area of a preset size.
  • the first determining module 302 can determine a target area from the original picture.
  • the target area is an area for obtaining the sharpness of the original picture.
  • the target area may be a rectangular area of a preset size.
  • the first determining module 302 can be used to:
  • a target area is determined from the original picture, the target area being a desired focus area.
  • the first determining module 302 may determine the required focus area in the original picture as the target area.
  • the focus area needs to be the area with the highest resolution requirement in the original picture, so the required focus area can be determined as the target area for obtaining the sharpness of the original picture.
  • FIG. 7 is another schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application.
  • the image sharpness obtaining apparatus 300 may further include: a third obtaining module 305.
  • the third obtaining module 305 is configured to acquire the total running memory capacity of the electronic device and the currently occupied running memory capacity when the electronic device enters the shooting interface and needs to acquire the sharpness of the image; and acquire the currently occupied running The amount of memory capacity as a percentage of the total capacity of the running memory.
  • the first obtaining module 301 can be configured to: if the percentage value is detected to be greater than a preset ratio threshold, obtain an original picture that is obtained based on a Bayer array.
  • the third acquiring module The 305 can first obtain the total running memory capacity of the electronic device and the currently occupied running memory capacity.
  • the third obtaining module 305 can obtain the percentage value of the currently occupied running memory capacity as a percentage of the total running memory capacity, and detect whether the percentage value is greater than a preset ratio threshold.
  • the current computing power of the electronic device can be considered to be strong, and the electronic device can perform other operations to complete the photo shooting. For example, at this point the electronic device can perform direct calculations based on hardware logic to find the best focus position.
  • the first acquiring module 301 of the electronic device can acquire the original picture taken based on the Bayer array and perform subsequent steps, thereby assisting the camera module to find the most Good focus position.
  • the embodiment of the present application provides a computer readable storage medium, where a computer program is stored thereon, and when the computer program is executed on a computer, the computer is caused to execute the image sharpness obtaining method provided by the embodiment. A step of.
  • the embodiment of the present application further provides an electronic device, including a memory, and a processor, by using a computer program stored in the memory, to execute the process in the method for acquiring picture sharpness provided by the embodiment.
  • FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the electronic device 400 can include components such as an imaging unit 401, a memory 402, a processor 403, and the like. It will be understood by those skilled in the art that the structure of the electronic device shown in FIG. 8 does not constitute a limitation on the electronic device, and may include more or less components than those illustrated, or combine some components, or different component arrangements. .
  • the camera unit 401 can be used to capture an image.
  • Memory 402 can be used to store applications and data.
  • the application stored in the memory 402 contains executable code.
  • Applications can form various functional modules.
  • the processor 403 executes various functional applications and data processing by running an application stored in the memory 402.
  • the processor 403 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, executes the electronic device by running or executing an application stored in the memory 402, and calling data stored in the memory 402. The various functions and processing of data to provide overall monitoring of the electronic device.
  • the processor 403 in the electronic device loads the executable code corresponding to the process of one or more applications into the memory 402 according to the following instructions, and is executed by the processor 403 to be stored in the memory.
  • the electronic device 500 may include components such as an imaging unit 501, a memory 502, a processor 503, an input unit 504, an output unit 505, and the like.
  • the imaging unit 501 can be used to capture an image.
  • Memory 502 can be used to store applications and data.
  • the application stored in the memory 502 contains executable code.
  • Applications can form various functional modules.
  • the processor 503 executes various functional applications and data processing by running an application stored in the memory 502.
  • the processor 503 is a control center of the electronic device, and connects various parts of the entire electronic device using various interfaces and lines, executes the electronic device by running or executing an application stored in the memory 502, and calling data stored in the memory 502. The various functions and processing of data to provide overall monitoring of the electronic device.
  • the input unit 504 can be configured to receive input digits, character information or user characteristic information (such as fingerprints), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • the output unit 505 can be used to display information input by the user or information provided to the user as well as various graphical user interfaces of the electronic device, which can be composed of graphics, text, icons, video, and any combination thereof.
  • the output unit may include a display panel.
  • the processor 503 in the electronic device loads the executable code corresponding to the process of one or more applications into the memory 502 according to the following instructions, and is stored in the memory by the processor 503.
  • the processor 503 when the processor 503 performs the acquiring a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent positional relationship in the target area, the processor 503 may perform: from the Determining, in the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonal and adjacent to the lower right diagonal; acquiring each target pixel and a pixel adjacent to the lower left diagonal of the target pixel The square value of the difference of the luminance values, and the square value of the difference between the luminance values of each of the target pixels and the pixels adjacent to the lower right diagonal of the target pixel is obtained.
  • the processor 503 when the processor 503 performs the determining of the target area from the original picture, performing: determining, from the original picture, a target area, where the target area is a rectangular area of a preset size. .
  • the processor 503 when the processor 503 performs the determining of the target area from the original picture, it may be performed to: determine a target area from the original picture, where the target area is a required focus area.
  • the processor 503 may further perform: acquiring, when the electronic device enters the shooting interface and needs to acquire the sharpness of the image, acquiring the electronic device. Running the total memory capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
  • the processor 503 may perform: if the percentage value is greater than the preset ratio threshold, the original image obtained by the Bayer array is acquired.
  • the processor 503 may further perform: adjusting the preset ratio threshold.
  • the method may: perform: acquiring a preset basic value; and increasing or decreasing the basic value according to the preset amplitude to obtain a preset. Proportional threshold.
  • the image sharpness obtaining device provided by the embodiment of the present application belongs to the same concept as the image sharpness obtaining method in the above embodiment, and the image sharpness acquisition can be performed on the image sharpness obtaining device.
  • the image sharpness acquisition can be performed on the image sharpness obtaining device.
  • the specific implementation process of any of the methods provided in the method embodiments refer to the embodiment of the method for obtaining the picture clarity, which is not described here.
  • the program is implemented by controlling related hardware, which may be stored in a computer readable storage medium, such as in a memory, and executed by at least one processor, and may include, as the picture is clear during execution
  • the storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), a random access memory (RAM), or the like.
  • each functional module may be integrated into one processing chip, or each module may exist separately physically, or two or more modules may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated module if implemented in the form of a software functional module and sold or used as a standalone product, may also be stored in a computer readable storage medium, such as a read only memory, a magnetic disk or an optical disk, etc. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)
  • Color Television Image Signal Generators (AREA)

Abstract

Disclosed in the present application is an image definition obtaining method, comprising: obtaining an original image obtained by photographing based on a Bayer array; determining a target region from the original image, and determining distribution positions of pixels with a preset color in the target region; obtaining squared values of difference values of brightness values of the pixels with the preset color in the target region, wherein a relationship of the distribution positions of the pixels is that the pixels are diagonally adjacent; and performing addition on the square values of all the difference values to obtain a sum value, and determining the sum value as the definition of the image.

Description

图片清晰度的获取方法、装置、存储介质及电子设备Method, device, storage medium and electronic device for acquiring picture clarity
本申请要求于2017年12月28日提交中国专利局、申请号为201711464337.8、申请名称为“图片清晰度的获取方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 28, 2017, the Chinese Patent Office, the application number is 201711464337.8, and the application name is "acquisition method, device, storage medium and electronic device for picture clarity". This is incorporated herein by reference.
技术领域Technical field
本申请属于图片处理技术领域,尤其涉及一种图片清晰度的获取方法、装置、存储介质及电子设备。The present application belongs to the field of image processing technologies, and in particular, to a method, an apparatus, a storage medium, and an electronic device for acquiring picture sharpness.
背景技术Background technique
在拍摄图片的过程中,电子设备需要对摄像头模组获取到的图片进行清晰度评价。相关技术中,电子设备可以使用清晰度评价算法对图片进行清晰度评价。例如,常用的清晰度评价算法包括索贝尔算法(Sobel operator)等。In the process of taking a picture, the electronic device needs to evaluate the picture obtained by the camera module. In the related art, the electronic device can perform a sharpness evaluation on a picture using a sharpness evaluation algorithm. For example, commonly used definition evaluation algorithms include Sobel operators and the like.
发明内容Summary of the invention
本申请实施例提供一种图片清晰度的获取方法、装置、存储介质及电子设备,可以提高获取图片清晰度的效率。The embodiment of the present application provides a method, an apparatus, a storage medium, and an electronic device for acquiring picture sharpness, which can improve the efficiency of acquiring picture clarity.
本申请实施例提供一种图片清晰度的获取方法,包括:An embodiment of the present application provides a method for acquiring picture clarity, including:
获取基于拜耳阵列拍摄得到的原始图片;Obtaining the original image taken based on the Bayer array;
从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;Determining a target area from the original picture, and determining a distribution position of pixels of a preset color from the target area;
获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;Obtaining a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent preset color position in the target area;
将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。The sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
本申请实施例提供一种图片清晰度的获取装置,包括:An embodiment of the present application provides a device for acquiring picture sharpness, including:
第一获取模块,用于获取基于拜耳阵列拍摄得到的原始图片;a first acquiring module, configured to acquire an original picture obtained by shooting according to a Bayer array;
第一确定模块,用于从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;a first determining module, configured to determine a target area from the original picture, and determine a distribution position of a pixel of a preset color from the target area;
第二获取模块,用于获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;a second acquiring module, configured to acquire a square value of a difference value of a luminance value of a pixel of a preset color in which the distribution position relationship in the target area is diagonally adjacent;
第二确定模块,用于将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。And a second determining module, configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
本申请实施例提供一种存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行本申请实施例提供的图片清晰度的获取方法中的流程。The embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer is caused to execute the flow in the method for acquiring picture sharpness provided by the embodiment of the present application.
本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行:The embodiment of the present application further provides an electronic device, including a memory, a processor, by using a computer program stored in the memory, to execute:
获取基于拜耳阵列拍摄得到的原始图片;Obtaining the original image taken based on the Bayer array;
从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;Determining a target area from the original picture, and determining a distribution position of pixels of a preset color from the target area;
获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;Obtaining a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent preset color position in the target area;
将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。The sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
附图说明DRAWINGS
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其有益效果显而易见。The technical solutions of the present application and the beneficial effects thereof will be apparent from the detailed description of the specific embodiments of the present application.
图1是本申请实施例提供的图片清晰度的获取方法的流程示意图。FIG. 1 is a schematic flowchart diagram of a method for acquiring picture sharpness provided by an embodiment of the present application.
图2是本申请实施例提供的原始图片中目标区域的像素分布示意图。FIG. 2 is a schematic diagram of pixel distribution of a target area in an original picture provided by an embodiment of the present application.
图3是本申请实施例提供的图片清晰度的获取方法的另一流程示意图。FIG. 3 is another schematic flowchart of a method for acquiring picture sharpness provided by an embodiment of the present application.
图4至图5是本申请实施例提供的图片清晰度的获取方法的场景示意图。FIG. 4 is a schematic diagram of a scenario for acquiring a picture sharpness according to an embodiment of the present application.
图6是本申请实施例提供的图片清晰度的获取装置的结构示意图。FIG. 6 is a schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application.
图7是本申请实施例提供的图片清晰度的获取装置的另一结构示意图。FIG. 7 is another schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application.
图8是本申请实施例提供的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
图9是本申请实施例提供的电子设备的另一结构示意图。FIG. 9 is another schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
请参照图示,其中相同的组件符号代表相同的组件,本申请的原理是以实施在一适当的运算环境中来举例说明。以下的说明是基于所例示的本申请具体实施例,其不应被视为限制本申请未在此详述的其它具体实施例。Referring to the drawings, in which like reference numerals represent the same components, the principles of the present application are illustrated by way of example in a suitable computing environment. The following description is based on the specific embodiments of the present invention as illustrated, and should not be construed as limiting the specific embodiments that are not described herein.
本申请实施例提供一种图片清晰度的获取方法,其中,包括:The embodiment of the present application provides a method for acquiring picture sharpness, which includes:
获取基于拜耳阵列拍摄得到的原始图片;从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。Obtaining an original picture obtained by shooting according to a Bayer array; determining a target area from the original picture, and determining a distribution position of a pixel of a preset color from the target area; acquiring a distribution position relationship in the target area as a pair a square value of a difference value of luminance values of pixels of adjacent preset colors; summing the square values of all the difference values to obtain a sum value, and determining the sum value as the sharpness of the picture.
在一种实施方式中,所述获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值,可以包括:从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。In an implementation manner, the obtaining a square value of a difference value of a brightness value of a pixel of a preset color in a diagonally adjacent positional relationship in the target area may include: determining, from the target area a target pixel having the same preset color pixel distribution at positions adjacent to the lower left diagonally adjacent to the lower right diagonal corner; obtaining a difference value of luminance values of each of the target pixels and pixels adjacent to the lower left diagonal thereof The squared value and obtain the square of the difference between the luminance value of each target pixel and the pixel adjacent to its lower right diagonal.
在一种实施方式中,所述从所述原始图片中确定出目标区域,可以包括:从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。In an embodiment, the determining the target area from the original picture may include: determining a target area from the original picture, where the target area is a rectangular area of a preset size.
在一种实施方式中,所述从所述原始图片中确定出目标区域,可以包括:从所述原始 图片中确定出目标区域,所述目标区域为需要对焦区域。In an embodiment, the determining the target area from the original picture may include: determining a target area from the original picture, the target area being a required focus area.
在一种实施方式中,在所述获取基于拜耳阵列拍摄得到的原始图片之前,还可以包括:当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值。In an embodiment, before the acquiring the original image obtained by the Bayer array, the method further includes: acquiring the total running memory capacity of the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image. And the running memory capacity currently occupied; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
那么,所述获取基于拜耳阵列拍摄得到的原始图片,可以包括:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。Then, the acquiring the original image obtained by the Bayer array may include: if the percentage value is detected to be greater than the preset ratio threshold, acquiring the original image obtained by the Bayer array.
在一种实施方式中,所述图片清晰度的获取方法还可以包括:对所述预设比例阈值进行调整。In an embodiment, the method for acquiring the image sharpness may further include: adjusting the preset ratio threshold.
在一种实施方式中,所述对所述预设比例阈值进行调整,可以包括:获取预先设定的基础值;按照预设幅度提高或降低所述基础值,得到预设比例阈值。In an embodiment, the adjusting the preset ratio threshold may include: acquiring a preset basic value; and increasing or decreasing the basic value according to the preset amplitude to obtain a preset proportional threshold.
可以理解的是,本申请实施例的执行主体可以是诸如智能手机或平板电脑等的电子设备。It can be understood that the executive body of the embodiment of the present application may be an electronic device such as a smart phone or a tablet computer.
请参阅图1,图1是本申请实施例提供的图片清晰度的获取方法的流程示意图,流程可以包括:Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a method for acquiring picture sharpness according to an embodiment of the present disclosure, where the process may include:
在101中,获取基于拜耳阵列拍摄得到的原始图片。In 101, an original picture taken based on a Bayer array is acquired.
在拍摄图片的过程中,电子设备需要对摄像头模组获取到的图片进行清晰度评价。相关技术中,电子设备可以使用清晰度评价算法对图片进行清晰度评价。例如,常用的清晰度评价算法包括索贝尔算法(Sobel operator)等。然而,利用这些清晰度评价算法获取图片的清晰度时,需要先对基于拜耳阵列拍摄得到的原始图片(Bayer Raw图)进行插值处理,这导致其获取图片清晰度的效率较低。In the process of taking a picture, the electronic device needs to evaluate the picture obtained by the camera module. In the related art, the electronic device can perform a sharpness evaluation on a picture using a sharpness evaluation algorithm. For example, commonly used definition evaluation algorithms include Sobel operators and the like. However, when using these definition evaluation algorithms to obtain the sharpness of the picture, it is necessary to interpolate the original picture (Bayer Raw picture) obtained based on the Bayer array image, which results in low efficiency in obtaining picture sharpness.
在本申请实施例的101中,比如,当需要获取图片的清晰度(Resolution)时,电子设备可以先获取基于拜耳阵列拍摄得到的原始图片(Bayer RAW图)。In the 101 of the embodiment of the present application, for example, when it is necessary to acquire the resolution of the picture, the electronic device may first acquire an original picture (Bayer RAW picture) obtained based on the Bayer array.
需要说明的是,基于拜耳阵列拍摄得到的原始图片是指安装有拜耳阵列传感器的摄像头模组拍摄得到的未经加工处理的相机内部的原始图片。It should be noted that the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
在102中,从该原始图片中确定出目标区域,并从该目标区域中确定出预设颜色的像素的分布位置。In 102, a target area is determined from the original picture, and a distribution position of pixels of a preset color is determined from the target area.
比如,在获取到基于拜耳阵列拍摄得到的原始图片后,电子设备可以从该原始图片中确定出一个目标区域。该目标区域为用于获取本原始图片的清晰度的区域。For example, after acquiring the original picture taken based on the Bayer array, the electronic device can determine a target area from the original picture. The target area is an area for obtaining the sharpness of the original picture.
在从该基于拜耳阵列拍摄得到的原始图片中确定出目标区域后,电子设备可以从该目标区域中确定出预设颜色的像素的分布位置。After determining the target area from the original picture taken by the Bayer array, the electronic device can determine the distribution position of the pixels of the preset color from the target area.
例如,电子设备可以从该目标区域中确定出绿色像素的分布位置。当然,预设颜色也可以是其它颜色,如红色或蓝色。可以理解的是,此处举例不构成对本申请实施例的限定。For example, the electronic device can determine the distribution location of the green pixels from the target area. Of course, the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
在103中,获取该目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的 差值的平方值。In 103, a square value of a difference value of luminance values of pixels of a preset color in which the distribution position relationship in the target area is diagonally adjacent is acquired.
比如,在从该目标区域中确定出绿色像素的分布位置后,电子设备可以获取该目标区域中分布位置关系属于对角相邻的每两个绿色像素的亮度值的差值的平方值。For example, after determining the distribution position of the green pixel from the target area, the electronic device may acquire the square value of the difference of the brightness value of each of the two green pixels adjacent to the diagonally adjacent positional relationship in the target area.
需要说明的是,对角相邻是指两个像素在分布位置上的关系为这两个像素具有对顶角。It should be noted that diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
如图2所示,例如该图为Bayer RAW图中的目标区域的像素分布示意图。其中像素R00、R02、R20、R22为红色像素,G01、G03、G10、G12、G21、G23、G30、G32为绿色像素,B11、B13、B31、B33为蓝色像素。As shown in FIG. 2, for example, the figure is a schematic diagram of pixel distribution of a target area in a Bayer RAW image. The pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
那么,例如,G01和G10为对角相邻的绿色像素,G01和G12为对角相邻的绿色像素,G12和G21为对角相邻的绿色像素,G12和G23为对角相邻的绿色像素。但G01和G23不是对角相邻的绿色像素,G01和G21也不是对角相邻的绿色像素。Then, for example, G01 and G10 are diagonally adjacent green pixels, G01 and G12 are diagonally adjacent green pixels, G12 and G21 are diagonally adjacent green pixels, and G12 and G23 are diagonally adjacent green pixels. Pixel. However, G01 and G23 are not diagonally adjacent green pixels, and G01 and G21 are not diagonally adjacent green pixels.
比如,对于G01和G10这两个对角相邻的绿色像素,电子设备可以获取它们的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G10这个绿色像素的亮度值为L10。那么,电子设备可以获取R1=(L01-L10) 2。对于G01和G12这两个对角相邻的绿色像素,电子设备可以获取它们的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G12这个绿色像素的亮度值为L12。那么,电子设备可以获取R2=(L01-L12) 2For example, for two diagonally adjacent green pixels, G01 and G10, the electronic device can obtain the squared value of the difference in their luminance values. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G10 has a luminance value of L10. Then, the electronic device can acquire R1=(L01-L10) 2 . For the two diagonally adjacent green pixels G01 and G12, the electronic device can obtain the squared value of the difference of their luminance values. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G12 has a luminance value of L12. Then, the electronic device can acquire R2=(L01-L12) 2 .
在104中,将所有该差值的平方值相加得到和值,并将该和值确定为该图片的清晰度。In 104, the square values of all the differences are added to obtain a sum value, and the sum value is determined as the sharpness of the picture.
比如,在获取到所有对角相邻的绿色像素的亮度值的差值的平方值后,电子设备可以将所有这些差值的平方值相加,从而得到一个和值。然后,电子设备可以将该和值确定为该图片的清晰度。For example, after obtaining the square value of the difference of the luminance values of all the diagonally adjacent green pixels, the electronic device can add the square values of all the differences to obtain a sum value. The electronic device can then determine the sum value as the sharpness of the picture.
可以理解的是,由于本申请实施例中的技术方案可以直接在基于拜耳阵列拍摄得到的原始图片的基础上进行清晰度获取,而不需要先对基于拜耳阵列拍摄得到的原始图片进行插值处理,再进行清晰度获取。因此,本申请实施例可以提高获取图片清晰度的效率。It can be understood that, because the technical solution in the embodiment of the present application can directly obtain the definition on the basis of the original image obtained by the Bayer array, without first interpolating the original image obtained by the Bayer array shooting, Then obtain the definition. Therefore, the embodiment of the present application can improve the efficiency of obtaining picture clarity.
另外,由于本申请实施例中的技术方案不需要涉及图片识别,因此本实施例中的方案其鲁棒性和稳定性都较高。并且,本实施例中的方案其获取精度也较高。In addition, since the technical solution in the embodiment of the present application does not need to involve picture recognition, the scheme in this embodiment has high robustness and stability. Moreover, the scheme in this embodiment has a high acquisition accuracy.
请参阅图3,图3为本申请实施例提供的图片清晰度的获取方法的另一流程示意图,流程可以包括:Referring to FIG. 3, FIG. 3 is another schematic flowchart of a method for acquiring picture sharpness according to an embodiment of the present disclosure, where the process may include:
在201中,电子设备获取基于拜耳阵列拍摄得到的原始图片。In 201, the electronic device acquires an original picture taken based on a Bayer array.
比如,当需要获取图片的清晰度(Resolution)时,电子设备可以先获取基于拜耳阵列拍摄得到的原始图片(Bayer RAW图)。For example, when it is necessary to obtain the resolution of the picture, the electronic device can first obtain the original picture (Bayer RAW picture) obtained based on the Bayer array.
需要说明的是,基于拜耳阵列拍摄得到的原始图片是指安装有拜耳阵列传感器的摄像头模组拍摄得到的未经加工处理的相机内部的原始图片。It should be noted that the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
在202中,电子设备从该原始图片中确定出目标区域,该目标区域为预设尺寸的矩形区域。In 202, the electronic device determines a target area from the original picture, the target area being a rectangular area of a preset size.
比如,在获取到基于拜耳阵列拍摄得到的原始图片后,电子设备可以从该原始图片中确定出一个目标区域。该目标区域为用于获取本原始图片的清晰度的区域。其中,该目标区域可以为预设尺寸的矩形区域。For example, after acquiring the original picture taken based on the Bayer array, the electronic device can determine a target area from the original picture. The target area is an area for obtaining the sharpness of the original picture. The target area may be a rectangular area of a preset size.
在203中,电子设备从该目标区域中确定出预设颜色的像素的分布位置。In 203, the electronic device determines a distribution position of the pixels of the preset color from the target area.
比如,在从该基于拜耳阵列拍摄得到的原始图片中确定出目标区域后,电子设备可以从该目标区域中确定出预设颜色的像素的分布位置。For example, after the target area is determined from the original picture taken by the Bayer array, the electronic device can determine the distribution position of the pixels of the preset color from the target area.
例如,电子设备可以从该目标区域中确定出绿色像素的分布位置。当然,预设颜色也可以是其它颜色,如红色或蓝色。可以理解的是,此处举例不构成对本申请实施例的限定。For example, the electronic device can determine the distribution location of the green pixels from the target area. Of course, the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
在204中,电子设备从该目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素。In 204, the electronic device determines, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonally adjacent to the lower right diagonal.
比如,在从该目标区域中确定出绿色像素的分布位置后,电子设备可以从该目标区域中确定出在左下对角相邻和右下对角相邻的位置上均具有绿色像素分布的目标像素。其中,目标像素的颜色也为预设颜色。For example, after determining the distribution position of the green pixel from the target area, the electronic device may determine, from the target area, a target having a green pixel distribution at a position adjacent to the lower left diagonally adjacent to the lower right diagonal corner. Pixel. The color of the target pixel is also a preset color.
需要说明的是,对角相邻是指两个像素在分布位置上的关系为这两个像素具有对顶角。It should be noted that diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
例如,图2为某张图片的目标区域的像素分布示意图。如图2所示,其中像素R00、R02、R20、R22为红色像素,G01、G03、G10、G12、G21、G23、G30、G32为绿色像素,B11、B13、B31、B33为蓝色像素。For example, FIG. 2 is a schematic diagram of pixel distribution of a target area of a certain picture. As shown in FIG. 2, the pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
例如,对于图中的绿色像素G01而言,由于在其左下对角相邻位置分布有绿色像素G10,在其右下对角相邻位置分布有绿色像素G12。因此,电子设备可以将绿色像素G01确定为目标像素。同理,电子设备还可以将绿色像素G12和G21确定为目标像素。For example, for the green pixel G01 in the figure, since the green pixel G10 is distributed at its lower left diagonal adjacent position, the green pixel G12 is distributed at its lower right diagonal adjacent position. Therefore, the electronic device can determine the green pixel G01 as the target pixel. Similarly, the electronic device can also determine the green pixels G12 and G21 as target pixels.
而对于绿色像素G03而言,由于在其左下对角相邻位置分布有绿色像素G12,而在其右下对角相邻位置没有分布绿色像素。因此,电子设备可以不将绿色像素G03确定为目标像素。For the green pixel G03, since the green pixel G12 is distributed in the lower left diagonal position, the green pixel is not distributed in the lower right diagonal position. Therefore, the electronic device may not determine the green pixel G03 as the target pixel.
又如,对于绿色像素G10而言,由于在其右下对角相邻位置分布有绿色像素G21,而在其左下对角相邻位置没有分布绿色像素。因此,电子设备可以不将绿色像素G10确定为目标像素。For another example, for the green pixel G10, since the green pixel G21 is distributed at the diagonally adjacent position in the lower right corner thereof, the green pixel is not distributed in the lower left diagonally adjacent position. Therefore, the electronic device may not determine the green pixel G10 as the target pixel.
同理,电子设备也可以不将绿色像素G23、G30、G32确定为目标像素。Similarly, the electronic device may not determine the green pixels G23, G30, and G32 as the target pixels.
在205中,电子设备获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。In 205, the electronic device acquires a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquires each target pixel and a pixel adjacent to a diagonally lower right corner thereof. The square of the difference in luminance values.
比如,在确定出该目标区域中的目标像素之后,电子设备可以获取每一目标像素与分布于其左下对角相邻的同颜色像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的同颜色像素的亮度值的差值的平方值。For example, after determining the target pixel in the target area, the electronic device may acquire the square value of the difference between the brightness value of each target pixel and the same color pixel adjacent to the lower left diagonal of the target pixel, and acquire each target. The square of the difference between the pixel and the luminance value of the same color pixel that is adjacent to its lower right diagonal.
例如,对于绿色像素G01而言,电子设备可以先获取G01与其左下对角相邻的绿色 像素G10的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G10这个绿色像素的亮度值为L10。那么,电子设备可以获取R1=(L01-L10) 2。然后,电子设备可以获取G01与其右下对角相邻的绿色像素G12的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12。那么,电子设备可以获取R2=(L01-L12) 2For example, for the green pixel G01, the electronic device may first obtain the square value of the difference between the luminance values of G01 and the green pixel G10 adjacent to the lower left diagonal. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G10 has a luminance value of L10. Then, the electronic device can acquire R1=(L01-L10) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of G01 and the green pixel G12 adjacent to its lower right diagonal. For example, the green pixel of G12 has a luminance value of L12. Then, the electronic device can acquire R2=(L01-L12) 2 .
对于绿色像素G12而言,电子设备可以先获取G12与其左下对角相邻的绿色像素G21的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12,G21这个绿色像素的亮度值为L21。那么,电子设备可以获取R3=(L12-L21) 2。然后,电子设备可以获取G12与其右下对角相邻的绿色像素G23的亮度值的差值的平方值。例如,G23这个绿色像素的亮度值为L23。那么,电子设备可以获取R4=(L12-L23) 2For the green pixel G12, the electronic device may first obtain the square value of the difference between the luminance values of the green pixel G21 adjacent to the lower left diagonal of G12. For example, the green pixel of G12 has a luminance value of L12, and the green pixel of G21 has a luminance value of L21. Then, the electronic device can acquire R3=(L12-L21) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of the green pixel G23 adjacent to the lower right corner of the G12. For example, the green pixel of G23 has a luminance value of L23. Then, the electronic device can acquire R4=(L12-L23) 2 .
对于绿色像素G21而言,电子设备可以先获取G21与其左下对角相邻的绿色像素G30的亮度值的差值的平方值。例如,G21这个绿色像素的亮度值为L21,G30这个绿色像素的亮度值为L30。那么,电子设备可以获取R5=(L21-L30) 2。然后,电子设备可以获取G21与其右下对角相邻的绿色像素G32的亮度值的差值的平方值。例如,G32这个绿色像素的亮度值为L32。那么,电子设备可以获取R6=(L21-L32) 2For the green pixel G21, the electronic device may first obtain the square value of the difference between the luminance values of the green pixel G30 adjacent to the lower left diagonal of G21. For example, the green pixel of G21 has a luminance value of L21, and the green pixel of G30 has a luminance value of L30. Then, the electronic device can acquire R5=(L21-L30) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of the green pixel G32 adjacent to the lower right diagonal of G21. For example, the green pixel of G32 has a luminance value of L32. Then, the electronic device can acquire R6=(L21-L32) 2 .
而对于非目标像素G03、G10、G23、G30、G32,电子设备则可以不获取这些像素与其左下对角相邻像素或右下对角相邻像素的亮度值的差值的平方值。For the non-target pixels G03, G10, G23, G30, G32, the electronic device may not obtain the square value of the difference between the luminance values of the pixels and their lower left diagonal adjacent pixels or the lower right diagonal adjacent pixels.
在206中,电子设备将所有该差值的平方值相加得到和值,并将该和值确定为该图片的清晰度。In 206, the electronic device adds all the squared values of the difference to obtain a sum value, and determines the sum value as the sharpness of the picture.
比如,在获取到每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,以及与分布于其右下对角相邻的像素的亮度值的差值的平方值之后,电子设备可以将所有这些差值的平方值相加起来,从而得到一个和值。然后,电子设备可以将该和值确定为该图片的清晰度。For example, the square value of the difference between the luminance values of each of the target pixels and the pixels adjacent to the lower left diagonal of the target pixel, and the difference between the luminance values of the pixels adjacent to the lower right diagonal of the target pixel are obtained. After the square value, the electronic device can add the square values of all these differences to obtain a sum value. The electronic device can then determine the sum value as the sharpness of the picture.
例如,电子设备可以将上述R1、R2、R3、R4、R5、R6相加,得到一个和值C。即C=R1+R2+R3+R4+R5+R6。然后,电子设备可以将该和值C确定为该原始图片的清晰度。For example, the electronic device may add the above R1, R2, R3, R4, R5, and R6 to obtain a sum value C. That is, C=R1+R2+R3+R4+R5+R6. The electronic device can then determine the sum value C as the sharpness of the original picture.
在一种实施方式中,电子设备也可以将该和值确定为该原始图片的对比度(Contrast)。In an embodiment, the electronic device may also determine the sum value as the contrast of the original picture.
在一种实施方式中,202中电子设备从该原始图片中确定出目标区域的流程,可以包括:In an embodiment, the process in which the electronic device determines the target area from the original picture in 202 may include:
电子设备从该原始图片中确定出目标区域,该目标区域为需要对焦区域。The electronic device determines a target area from the original picture, the target area being a desired focus area.
比如,在获取到基于拜耳阵列拍摄得到的原始图片后,电子设备可以将该原始图片中需要对焦区域确定为目标区域。For example, after acquiring the original picture taken based on the Bayer array, the electronic device may determine the required focus area in the original picture as the target area.
需要说明的是,原始图片中需要对焦区域属于图片中清晰度要求最高的区域,因此可以将需要对焦区域确定为用于获取本原始图片的清晰度的目标区域。It should be noted that the focus area needs to be the area with the highest resolution requirement in the original picture, so the required focus area can be determined as the target area for obtaining the sharpness of the original picture.
在一种实施方式中,在201中电子设备获取基于拜耳阵列拍摄得到的原始图片之前,还可以包括如下流程:In an embodiment, before the electronic device acquires the original image captured by the Bayer array in 201, the following process may be further included:
当电子设备进入拍摄界面且需要获取图片的清晰度时,电子设备获取本电子设备的运行内存总容量和当前被占用的运行内存容量;When the electronic device enters the shooting interface and needs to obtain the sharpness of the picture, the electronic device acquires the total running memory capacity of the electronic device and the currently occupied running memory capacity;
电子设备获取该当前被占用的运行内存容量占该运行内存总容量的百分比值。The electronic device obtains the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
那么,201中电子设备获取基于拜耳阵列拍摄得到的原始图片的流程,可以包括:若检测到该百分比值大于预设比例阈值,则电子设备获取基于拜耳阵列拍摄得到的原始图片。Then, the process of the electronic device in 201 acquiring the original image obtained by the Bayer array may include: if the percentage value is detected to be greater than the preset ratio threshold, the electronic device acquires the original image obtained by the Bayer array.
比如,在用户使用电子设备的相机进行实际拍摄,即当电子设备进入拍摄界面并且需要获取拍摄到的前后几帧图片的清晰度,以辅助摄像头模组找到最佳的对焦位置时,电子设备可以先获取本电子设备的运行内存总容量,以及当前被占用的运行内存容量。For example, when the user uses the camera of the electronic device to perform actual shooting, that is, when the electronic device enters the shooting interface and needs to obtain the sharpness of several frames before and after the shooting, to assist the camera module to find the best focus position, the electronic device can First, get the total running memory capacity of the electronic device, and the running memory capacity currently occupied.
然后,电子设备可以获取该当前被占用的运行内存容量占该运行内存总容量的百分比值,并检测该百分比值是否大于预设比例阈值。Then, the electronic device can obtain the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity, and detect whether the percentage value is greater than a preset ratio threshold.
如果检测到该百分比值小于或等于预设比例阈值,那么可以认为电子设备当前的计算能力较强,此时电子设备可以执行其它操作,以完成照片拍摄。例如,此时电子设备可以基于硬件逻辑电路进行直接计算,从而找到最佳的对焦位置。If the percentage value is detected to be less than or equal to the preset ratio threshold, then the current computing power of the electronic device can be considered to be strong, and the electronic device can perform other operations to complete the photo shooting. For example, at this point the electronic device can perform direct calculations based on hardware logic to find the best focus position.
如果检测到该百分比值大于预设比例阈值,即电子设备剩余的运行内存不足,那么可以认为电子设备当前的计算能力较差。在这种情况下,为了避免因剩余的运行内存不足导致系统卡顿,电子设备可以获取基于拜耳阵列拍摄得到的原始图片,并执行本实施例201至206中的流程,从而辅助摄像头模组找到最佳的对焦位置。If it is detected that the percentage value is greater than the preset ratio threshold, that is, the remaining running memory of the electronic device is insufficient, the current computing capability of the electronic device may be considered to be poor. In this case, in order to avoid the system being stuck due to insufficient running memory, the electronic device can acquire the original picture taken based on the Bayer array, and execute the processes in the embodiments 201 to 206, thereby assisting the camera module to find The best focus position.
可以理解的是,由于本实施例的技术方案可以提高电子设备获取图片清晰度的效率。因此,在剩余内存不足的情况下,通过采用本实施例201至206中的流程的方式,可以加快电子设备确定出最佳对焦位置的速度。It can be understood that the technical solution of the embodiment can improve the efficiency of the electronic device to obtain picture clarity. Therefore, in the case where the remaining memory is insufficient, by using the flow in the present embodiment 201 to 206, it is possible to speed up the determination of the optimum focus position by the electronic device.
在一种实施方式中,可以允许对上述预设比例阈值的数值进行调整。比如,电子设备可以先获取处理器的型号等硬件信息。若根据处理器的硬件信息确定出本处理器的计算能力较强,那么电子设备可以将预设比例阈值的数值调高一些。若根据处理器的硬件信息确定出本处理器的计算能力较差,那么电子设备可以将预设比例阈值的数值调低一些。例如,电子设备可以事先设定一基础值,那么当根据处理器的硬件信息确定出本处理器的计算能力较强时,电子设备可以将该基础值提高预设幅度从而得到预设比例阈值。当根据处理器的硬件信息确定出本处理器的计算能力较差时,电子设备可以将该基础值降低预设幅度从而得到预设比例阈值。In an embodiment, the value of the preset ratio threshold may be allowed to be adjusted. For example, the electronic device can first obtain hardware information such as the model of the processor. If it is determined according to the hardware information of the processor that the computing power of the processor is strong, the electronic device may increase the value of the preset ratio threshold by a certain amount. If it is determined that the computing power of the processor is poor according to the hardware information of the processor, the electronic device may lower the value of the preset ratio threshold. For example, the electronic device may set a basic value in advance, and when it is determined that the computing power of the processor is strong according to the hardware information of the processor, the electronic device may increase the basic value by a preset amplitude to obtain a preset proportional threshold. When it is determined that the computing power of the processor is poor according to the hardware information of the processor, the electronic device may reduce the base value by a preset amplitude to obtain a preset ratio threshold.
即,在一种实施方式中,本实施例还可以包括如下流程:电子设备对预设比例阈值进行调整。That is, in an embodiment, the embodiment may further include the following process: the electronic device adjusts the preset ratio threshold.
在一种实施方式中,电子设备在执行对预设比例阈值进行调整的流程时,可以包括:电子设备获取预先设定的基础值;电子设备按照预设幅度提高或降低该基础值,得到预设比例阈值。In an embodiment, when the electronic device performs the process of adjusting the preset ratio threshold, the electronic device may: the electronic device acquires a preset basic value; and the electronic device increases or decreases the basic value according to the preset amplitude to obtain the pre-prepared Set the proportional threshold.
在另一种实施方式中,若电子设备的相机的拍摄模式包括快速拍摄模式、自动拍摄模 式和专业拍摄模式,那么可以在使用快速拍摄模式时使用本申请实施例中提供的技术方案,从而可以提高电子设备的相机对焦速度。快速拍摄模式可以是用于抓拍动态物体的图片的拍摄模式。In another embodiment, if the shooting mode of the camera of the electronic device includes a fast shooting mode, an automatic shooting mode, and a professional shooting mode, the technical solution provided in the embodiment of the present application may be used when the fast shooting mode is used, so that Increase the camera's focus speed for electronic devices. The quick shooting mode may be a shooting mode for capturing a picture of a dynamic object.
请参阅图4至图5,图4至图5为本申请实施例提供的图片清晰度的获取方法的场景示意图。Referring to FIG. 4 to FIG. 5 , FIG. 4 to FIG. 5 are schematic diagrams of a method for acquiring a picture sharpness according to an embodiment of the present application.
在摄像头模组的生产过程中,需要对摄像头模组进行拍摄测试。其中,摄像头模组在对焦环节需要对拍摄得到的前后几帧照片进行清晰度评价,并根据对这几帧照片的清晰度评价,确定出最佳的对焦位置,从而拍摄出清晰度最高的照片。例如,在将镜头由第一位置驱动到第二位置的过程中,摄像头拍摄得到的原始图片(Bayer RAW图)或预览图像的清晰度不断增大,而在将镜头由第二位置驱动到第三位置的过程中,摄像头拍摄得到的原始图片或预览图像的清晰度不断减小。那么,电子设备可以将第二位置确定为最佳对焦位置,并将镜头驱动到第二位置以完成拍摄。In the production process of the camera module, it is necessary to perform a shooting test on the camera module. Among them, the camera module needs to evaluate the resolution of several frames before and after the shooting, and determines the best focus position according to the resolution of the photos, so as to shoot the highest resolution photos. . For example, in the process of driving the lens from the first position to the second position, the sharpness of the original picture (Bayer RAW picture) or preview image captured by the camera is continuously increased, and the lens is driven from the second position to the first position. During the three-position process, the sharpness of the original or preview image captured by the camera is continuously reduced. Then, the electronic device can determine the second position as the best focus position and drive the lens to the second position to complete the shooting.
比如,在对生产出来的摄像头模组进行拍摄测试,且处于对焦环节时,电子设备可以先获取基于拜耳阵列拍摄得到的原始图片。需要说明的是,基于拜耳阵列拍摄得到的原始图片是指安装有拜耳阵列传感器的摄像头模组拍摄得到的未经加工处理的相机内部的原始图片。例如,将镜头驱动到第一位置时,电子设备可以先获取基于拜耳阵列拍摄得到的第一原始图片。For example, when the production of the camera module is tested and the focus is on, the electronic device can first obtain the original image taken based on the Bayer array. It should be noted that the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor. For example, when the lens is driven to the first position, the electronic device may first acquire the first original picture obtained based on the Bayer array.
然后,电子设备可以从该第一原始图片中确定出一个目标区域。其中,该目标区域可以为需要对焦区域,并且该目标区域为预设尺寸的矩形区域。例如,如图4所示,用户点击相机拍摄预览界面中的人脸区域,想要对焦到人脸,那么该人脸区域就是需要对焦区域(图中使用虚线框表示需要对焦的人脸区域)。因此,电子设备可以将该人脸区域确定为目标区域,并且该目标区域可以为预设尺寸的矩形区域。Then, the electronic device can determine a target area from the first original picture. The target area may be a rectangular area that requires a focus area, and the target area is a preset size. For example, as shown in FIG. 4, when the user clicks on the camera to capture the face area in the preview interface and wants to focus on the face, the face area needs to be the focus area (the dotted area in the figure indicates the face area that needs to be focused). . Therefore, the electronic device can determine the face area as the target area, and the target area can be a rectangular area of a preset size.
之后,电子设备可以从该目标区域中确定出绿色像素的分布位置,并从该目标区域中确定出在左下对角相邻和右下对角相邻的位置上均具有绿色像素分布的目标像素。Thereafter, the electronic device may determine a distribution position of the green pixel from the target area, and determine, from the target area, a target pixel having a green pixel distribution at a position adjacent to a lower left diagonally opposite and a lower right diagonal opposite .
例如,图2为从该第一原始图片中确定出来的目标区域的像素分布图。如图2所示,对于图中的绿色像素G01而言,由于在其左下对角相邻位置分布有绿色像素G10,在其右下对角相邻位置分布有绿色像素G12。因此,电子设备可以将绿色像素G01确定为目标像素。同理,电子设备还可以将绿色像素G12和G21确定为目标像素。For example, FIG. 2 is a pixel distribution diagram of a target area determined from the first original picture. As shown in FIG. 2, for the green pixel G01 in the figure, since the green pixel G10 is distributed at the lower left diagonally adjacent position, the green pixel G12 is distributed at the lower right diagonally adjacent position. Therefore, the electronic device can determine the green pixel G01 as the target pixel. Similarly, the electronic device can also determine the green pixels G12 and G21 as target pixels.
在确定出该目标区域中的目标像素之后,电子设备可以获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。After determining the target pixel in the target area, the electronic device may acquire a square value of a difference value of each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquire each target pixel and distribution The square of the difference in luminance values of pixels adjacent to the lower right diagonal.
例如,对于绿色像素G01而言,电子设备可以先获取G01与其左下对角相邻的绿色像素G10的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G10这个绿色像素的亮度值为L10。那么,电子设备可以获取R1=(L01-L10) 2。然后,电子设备 可以获取G01与其右下对角相邻的绿色像素G12的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12。那么,电子设备可以获取R2=(L01-L12) 2For example, for the green pixel G01, the electronic device may first obtain the square value of the difference between the luminance values of G01 and the green pixel G10 adjacent to the lower left diagonal. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G10 has a luminance value of L10. Then, the electronic device can acquire R1=(L01-L10) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of G01 and the green pixel G12 adjacent to its lower right diagonal. For example, the green pixel of G12 has a luminance value of L12. Then, the electronic device can acquire R2=(L01-L12) 2 .
对于绿色像素G12而言,电子设备可以先获取G12与其左下对角相邻的绿色像素G21的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12,G21这个绿色像素的亮度值为L21。那么,电子设备可以获取R3=(L12-L21) 2。然后,电子设备可以获取G12与其右下对角相邻的绿色像素G23的亮度值的差值的平方值。例如,G23这个绿色像素的亮度值为L23。那么,电子设备可以获取R4=(L12-L23) 2For the green pixel G12, the electronic device may first obtain the square value of the difference between the luminance values of the green pixel G21 adjacent to the lower left diagonal of G12. For example, the green pixel of G12 has a luminance value of L12, and the green pixel of G21 has a luminance value of L21. Then, the electronic device can acquire R3=(L12-L21) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of the green pixel G23 adjacent to the lower right corner of the G12. For example, the green pixel of G23 has a luminance value of L23. Then, the electronic device can acquire R4=(L12-L23) 2 .
对于绿色像素G21而言,电子设备可以先获取G21与其左下对角相邻的绿色像素G30的亮度值的差值的平方值。例如,G21这个绿色像素的亮度值为L21,G30这个绿色像素的亮度值为L30。那么,电子设备可以获取R5=(L21-L30) 2。然后,电子设备可以获取G21与其右下对角相邻的绿色像素G32的亮度值的差值的平方值。例如,G32这个绿色像素的亮度值为L32。那么,电子设备可以获取R6=(L21-L32) 2For the green pixel G21, the electronic device may first obtain the square value of the difference between the luminance values of the green pixel G30 adjacent to the lower left diagonal of G21. For example, the green pixel of G21 has a luminance value of L21, and the green pixel of G30 has a luminance value of L30. Then, the electronic device can acquire R5=(L21-L30) 2 . Then, the electronic device can acquire the square value of the difference between the luminance values of the green pixel G32 adjacent to the lower right diagonal of G21. For example, the green pixel of G32 has a luminance value of L32. Then, the electronic device can acquire R6=(L21-L32) 2 .
之后,电子设备可以将R1、R2、R3、R4、R5、R6相加,得到一个和值C。即C=R1+R2+R3+R4+R5+R6。在获取到和值C后,电子设备可以将该和值C确定为该第一原始图片的清晰度。Thereafter, the electronic device can add R1, R2, R3, R4, R5, and R6 to obtain a sum value C. That is, C=R1+R2+R3+R4+R5+R6. After obtaining the sum value C, the electronic device can determine the sum value C as the sharpness of the first original picture.
同理,例如在将镜头驱动到第二位置后,电子设备获取得到与该第二位置对应的第二原始图片的清晰度为D。在将镜头驱动到第三位置后,电子设备获取得到与该第三位置对应的第三原始图片的清晰度为E。Similarly, after the lens is driven to the second position, for example, the electronic device acquires the resolution of the second original picture corresponding to the second position to be D. After driving the lens to the third position, the electronic device acquires the resolution of the third original picture corresponding to the third position to be E.
例如,电子设备检测到在清晰度数值上C小于D,D大于E,那么电子设备就可以将第二位置确定为最佳对焦位置,并将镜头驱动到第二位置从而完成照片拍摄。For example, if the electronic device detects that C is less than D and D is greater than E in the sharpness value, the electronic device can determine the second position as the best focus position and drive the lens to the second position to complete the photo shooting.
例如,电子设备在将镜头驱动到第二位置后,可以提示测试人员对焦完成(图中通过将人脸区域的虚线框变为实线框表示对焦完成)。用户在得到该提示后,按下拍照按钮,如图5所示,完成照片拍摄。For example, after driving the lens to the second position, the electronic device can prompt the tester to complete the focus (in the figure, the dotted frame of the face area is changed to a solid line frame to indicate that the focus is completed). After the user gets the prompt, press the camera button, as shown in FIG. 5, to complete the photo shooting.
本申请实施例提供一种图片清晰度的获取装置,其中,包括:The embodiment of the present application provides a device for acquiring picture sharpness, which includes:
第一获取模块,用于获取基于拜耳阵列拍摄得到的原始图片。The first obtaining module is configured to obtain an original picture obtained by shooting according to a Bayer array.
第一确定模块,用于从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置。a first determining module, configured to determine a target area from the original picture, and determine a distribution position of pixels of a preset color from the target area.
第二获取模块,用于获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值。And a second acquiring module, configured to acquire a square value of a difference value of a luminance value of a pixel of a preset color in which the distribution position relationship in the target area is diagonally adjacent.
第二确定模块,用于将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。And a second determining module, configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
在一种实施方式中,所述第二获取模块可以用于:从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布 于其右下对角相邻的像素的亮度值的差值的平方值。In an embodiment, the second obtaining module may be configured to: determine, from the target area, a pixel distribution having the same preset color in a position adjacent to a lower left diagonal and a lower right diagonal opposite a target pixel; obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal of the target pixel, and acquiring a luminance value of each target pixel and a pixel adjacent to a diagonally lower diagonal corner thereof The squared value of the difference.
在一种实施方式中,所述第一确定模块可以用于:从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。In an embodiment, the first determining module may be configured to: determine a target area from the original picture, where the target area is a rectangular area of a preset size.
在一种实施方式中,所述第一确定模块可以用于:从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。In an embodiment, the first determining module may be configured to: determine a target area from the original picture, where the target area is a required focus area.
在一种实施方式中,所述图片清晰度的获取装置还可以包括:第三获取模块,用于当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值。In an embodiment, the image clarity acquiring device may further include: a third acquiring module, configured to acquire a total running memory of the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image The capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
那么,所述第一获取模块可以用于:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。Then, the first acquiring module may be configured to: if the percentage value is detected to be greater than a preset ratio threshold, obtain an original picture obtained by shooting according to a Bayer array.
在一种实施方式中,所述第三获取模块还可以用于:对所述预设比例阈值进行调整。In an implementation manner, the third acquiring module may be further configured to: adjust the preset ratio threshold.
在一种实施方式中,所述第三获取模块还可以用于:获取预先设定的基础值;按照预设幅度提高或降低所述基础值,得到预设比例阈值。In an embodiment, the third obtaining module may be further configured to: obtain a preset basic value; and increase or decrease the basic value according to a preset amplitude to obtain a preset proportional threshold.
请参阅图6,图6为本申请实施例提供的图片清晰度的获取装置的结构示意图。图片清晰度的获取装置300可以包括:第一获取模块301,第一确定模块302,第二获取模块303,以及第二确定模块304。Please refer to FIG. 6. FIG. 6 is a schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present disclosure. The image sharpness obtaining apparatus 300 may include: a first obtaining module 301, a first determining module 302, a second obtaining module 303, and a second determining module 304.
第一获取模块301,用于获取基于拜耳阵列拍摄得到的原始图片。The first obtaining module 301 is configured to acquire an original picture obtained by shooting according to a Bayer array.
比如,当需要获取图片的清晰度(Resolution)时,第一获取模块301可以先获取基于拜耳阵列拍摄得到的原始图片(Bayer RAW图)。For example, when it is necessary to obtain the resolution of the picture, the first obtaining module 301 may first acquire an original picture (Bayer RAW picture) obtained based on the Bayer array.
需要说明的是,基于拜耳阵列拍摄得到的原始图片是指安装有拜耳阵列传感器的摄像头模组拍摄得到的未经加工处理的相机内部的原始图片。It should be noted that the original picture taken based on the Bayer array image refers to the original picture inside the unprocessed camera captured by the camera module mounted with the Bayer array sensor.
第一确定模块302,用于从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置。The first determining module 302 is configured to determine a target area from the original picture, and determine a distribution position of pixels of a preset color from the target area.
比如,在第一获取模块301获取到基于拜耳阵列拍摄得到的原始图片后,第一确定模块302可以从该原始图片中确定出一个目标区域。该目标区域为用于获取本原始图片的清晰度的区域。For example, after the first obtaining module 301 obtains the original image captured by the Bayer array, the first determining module 302 may determine a target area from the original image. The target area is an area for obtaining the sharpness of the original picture.
在从该基于拜耳阵列拍摄得到的原始图片中确定出目标区域后,第一确定模块302可以从该目标区域中确定出预设颜色的像素的分布位置。After determining the target area from the original picture taken by the Bayer array, the first determining module 302 may determine the distribution position of the pixels of the preset color from the target area.
例如,第一确定模块302可以从该目标区域中确定出绿色像素的分布位置。当然,预设颜色也可以是其它颜色,如红色或蓝色。可以理解的是,此处举例不构成对本申请实施例的限定。For example, the first determining module 302 can determine a distribution location of the green pixels from the target area. Of course, the preset color can also be other colors, such as red or blue. It should be understood that the examples herein do not constitute a limitation on the embodiments of the present application.
第二获取模块303,用于获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值。The second obtaining module 303 is configured to acquire a square value of a difference value of the luminance values of the pixels of the preset color in the target area.
比如,在第一确定模块302从该目标区域中确定出绿色像素的分布位置后,第二获取模块303可以获取该目标区域中分布位置关系属于对角相邻的每两个绿色像素的亮度值的差值的平方值。For example, after the first determining module 302 determines the distribution position of the green pixel from the target area, the second obtaining module 303 may obtain the brightness value of each of the two green pixels adjacent to the diagonally distributed positional relationship in the target area. The squared value of the difference.
需要说明的是,对角相邻是指两个像素在分布位置上的关系为这两个像素具有对顶角。It should be noted that diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
如图2所示,例如该图为Bayer RAW图中的目标区域的像素分布示意图。其中像素R00、R02、R20、R22为红色像素,G01、G03、G10、G12、G21、G23、G30、G32为绿色像素,B11、B13、B31、B33为蓝色像素。As shown in FIG. 2, for example, the figure is a schematic diagram of pixel distribution of a target area in a Bayer RAW image. The pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
那么,例如,G01和G10为对角相邻的绿色像素,G01和G12为对角相邻的绿色像素,G12和G21为对角相邻的绿色像素,G12和G23为对角相邻的绿色像素。但G01和G23不是对角相邻的绿色像素,G01和G21也不是对角相邻的绿色像素。Then, for example, G01 and G10 are diagonally adjacent green pixels, G01 and G12 are diagonally adjacent green pixels, G12 and G21 are diagonally adjacent green pixels, and G12 and G23 are diagonally adjacent green pixels. Pixel. However, G01 and G23 are not diagonally adjacent green pixels, and G01 and G21 are not diagonally adjacent green pixels.
比如,对于G01和G10这两个对角相邻的绿色像素,第二获取模块303可以获取它们的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G10这个绿色像素的亮度值为L10。那么,第二获取模块303可以获取R1=(L01-L10) 2。对于G01和G12这两个对角相邻的绿色像素,第二获取模块303可以获取它们的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G12这个绿色像素的亮度值为L12。那么,电子设备可以获取R2=(L01-L12) 2For example, for the two diagonally adjacent green pixels G01 and G10, the second acquisition module 303 can obtain the square value of the difference of their luminance values. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G10 has a luminance value of L10. Then, the second obtaining module 303 can acquire R1=(L01-L10) 2 . For the two diagonally adjacent green pixels G01 and G12, the second acquisition module 303 can obtain the squared value of the difference of their luminance values. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G12 has a luminance value of L12. Then, the electronic device can acquire R2=(L01-L12) 2 .
第二确定模块304,用于将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。The second determining module 304 is configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
比如,在第二获取模块303获取到所有对角相邻的绿色像素的亮度值的差值的平方值后,第二确定模块304可以将所有这些差值的平方值相加,从而得到一个和值。然后,第二确定模块304可以将该和值确定为该图片的清晰度。For example, after the second obtaining module 303 obtains the square value of the difference value of the luminance values of all the diagonally adjacent green pixels, the second determining module 304 may add the square values of all the difference values to obtain a sum. value. The second determination module 304 can then determine the sum value as the sharpness of the picture.
在一种实施方式中,所述第二获取模块303可以用于:In an embodiment, the second obtaining module 303 can be used to:
从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;Determining, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonally adjacent to the lower right diagonal corner;
获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。Obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal thereof, and obtaining a difference value of each target pixel and a luminance value of a pixel adjacent to a lower right diagonal corner thereof The squared value.
比如,在从该目标区域中确定出绿色像素的分布位置后,第二获取模块303可以从该目标区域中确定出在左下对角相邻和右下对角相邻的位置上均具有绿色像素分布的目标像素。For example, after determining the distribution position of the green pixel from the target area, the second obtaining module 303 may determine, from the target area, that there are green pixels in the position adjacent to the lower left diagonal and the lower right diagonal. The target pixel of the distribution.
需要说明的是,对角相邻是指两个像素在分布位置上的关系为这两个像素具有对顶角。It should be noted that diagonally adjacent means that the relationship between two pixels in the distribution position is that the two pixels have a vertex angle.
例如,图2为某张图片的目标区域的像素分布示意图。如图2所示,其中像素R00、R02、R20、R22为红色像素,G01、G03、G10、G12、G21、G23、G30、G32为绿色像素,B11、B13、B31、B33为蓝色像素。For example, FIG. 2 is a schematic diagram of pixel distribution of a target area of a certain picture. As shown in FIG. 2, the pixels R00, R02, R20, and R22 are red pixels, G01, G03, G10, G12, G21, G23, G30, and G32 are green pixels, and B11, B13, B31, and B33 are blue pixels.
例如,对于图中的绿色像素G01而言,由于在其左下对角相邻位置分布有绿色像素 G10,在其右下对角相邻位置分布有绿色像素G12。因此,第二获取模块303可以将绿色像素G01确定为目标像素。同理,第二获取模块303还可以将绿色像素G12和G21确定为目标像素。For example, for the green pixel G01 in the figure, since the green pixel G10 is distributed at its lower left diagonal adjacent position, the green pixel G12 is distributed at its lower right diagonal adjacent position. Therefore, the second acquisition module 303 can determine the green pixel G01 as the target pixel. Similarly, the second acquisition module 303 can also determine the green pixels G12 and G21 as target pixels.
在确定出该目标区域中的目标像素之后,第二获取模块303可以获取每一目标像素与分布于其左下对角相邻的同颜色像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的同颜色像素的亮度值的差值的平方值。After determining the target pixel in the target area, the second obtaining module 303 may obtain a square value of a difference value between each target pixel and a luminance value of a same color pixel adjacent to a lower left diagonal of the target pixel, and acquire each The square of the difference between the target pixel and the luminance value of the same color pixel that is adjacent to its lower right diagonal.
例如,对于绿色像素G01而言,第二获取模块303可以先获取G01与其左下对角相邻的绿色像素G10的亮度值的差值的平方值。例如,G01这个绿色像素的亮度值为L01,G10这个绿色像素的亮度值为L10。那么,第二获取模块303可以获取R1=(L01-L10) 2。然后,第二获取模块303可以获取G01与其右下对角相邻的绿色像素G12的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12。那么,第二获取模块303可以获取R2=(L01-L12) 2For example, for the green pixel G01, the second acquisition module 303 may first obtain the square value of the difference between the luminance values of the green pixel G10 adjacent to the lower left diagonal of G01. For example, the green pixel of G01 has a luminance value of L01, and the green pixel of G10 has a luminance value of L10. Then, the second obtaining module 303 can acquire R1=(L01-L10) 2 . Then, the second acquisition module 303 can acquire the square value of the difference between the luminance values of the green pixel G12 adjacent to the lower right diagonal of G01. For example, the green pixel of G12 has a luminance value of L12. Then, the second obtaining module 303 can acquire R2=(L01-L12) 2 .
对于绿色像素G12而言,第二获取模块303可以先获取G12与其左下对角相邻的绿色像素G21的亮度值的差值的平方值。例如,G12这个绿色像素的亮度值为L12,G21这个绿色像素的亮度值为L21。那么,第二获取模块303可以获取R3=(L12-L21) 2。然后,第二获取模块303可以获取G12与其右下对角相邻的绿色像素G23的亮度值的差值的平方值。例如,G23这个绿色像素的亮度值为L23。那么,第二获取模块303可以获取R4=(L12-L23) 2For the green pixel G12, the second acquisition module 303 may first obtain the square value of the difference between the luminance values of the green pixel G21 adjacent to the lower left diagonal of G12. For example, the green pixel of G12 has a luminance value of L12, and the green pixel of G21 has a luminance value of L21. Then, the second obtaining module 303 can acquire R3=(L12-L21) 2 . Then, the second acquisition module 303 can acquire the square value of the difference between the luminance values of the green pixel G23 adjacent to the lower right diagonal of G12. For example, the green pixel of G23 has a luminance value of L23. Then, the second obtaining module 303 can acquire R4=(L12-L23) 2 .
对于绿色像素G21而言,第二获取模块303可以先获取G21与其左下对角相邻的绿色像素G30的亮度值的差值的平方值。例如,G21这个绿色像素的亮度值为L21,G30这个绿色像素的亮度值为L30。那么,第二获取模块303可以获取R5=(L21-L30) 2。然后,第二获取模块303可以获取G21与其右下对角相邻的绿色像素G32的亮度值的差值的平方值。例如,G32这个绿色像素的亮度值为L32。那么,第二获取模块303可以获取R6=(L21-L32) 2For the green pixel G21, the second acquisition module 303 may first obtain the square value of the difference between the luminance values of the green pixel G30 adjacent to the lower left diagonal of G21. For example, the green pixel of G21 has a luminance value of L21, and the green pixel of G30 has a luminance value of L30. Then, the second obtaining module 303 can acquire R5=(L21-L30) 2 . Then, the second acquisition module 303 can acquire the square value of the difference between the luminance values of the green pixel G32 adjacent to the lower right diagonal of G21. For example, the green pixel of G32 has a luminance value of L32. Then, the second obtaining module 303 can acquire R6=(L21-L32) 2 .
之后,第二确定模块304可以将R1、R2、R3、R4、R5、R6相加,得到一个和值C,并将该和值C确定为该第一原始图片的清晰度。Thereafter, the second determining module 304 may add R1, R2, R3, R4, R5, R6 to obtain a sum value C, and determine the sum value C as the sharpness of the first original picture.
在一种实施方式中,所述第一确定模块302可以用于:In an embodiment, the first determining module 302 can be used to:
从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。A target area is determined from the original picture, the target area being a rectangular area of a preset size.
比如,在获取到基于拜耳阵列拍摄得到的原始图片后,第一确定模块302可以从该原始图片中确定出一个目标区域。该目标区域为用于获取本原始图片的清晰度的区域。其中,该目标区域可以为预设尺寸的矩形区域。For example, after acquiring the original picture taken based on the Bayer array, the first determining module 302 can determine a target area from the original picture. The target area is an area for obtaining the sharpness of the original picture. The target area may be a rectangular area of a preset size.
在一种实施方式中,所述第一确定模块302可以用于:In an embodiment, the first determining module 302 can be used to:
从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。A target area is determined from the original picture, the target area being a desired focus area.
比如,在获取到基于拜耳阵列拍摄得到的原始图片后,第一确定模块302可以将该原 始图片中需要对焦区域确定为目标区域。For example, after acquiring the original picture taken based on the Bayer array, the first determining module 302 may determine the required focus area in the original picture as the target area.
需要说明的是,原始图片中需要对焦区域属于图片中清晰度要求最高的区域,因此可以将需要对焦区域确定为用于获取本原始图片的清晰度的目标区域。It should be noted that the focus area needs to be the area with the highest resolution requirement in the original picture, so the required focus area can be determined as the target area for obtaining the sharpness of the original picture.
请一并参阅图7,图7为本申请实施例提供的图片清晰度的获取装置的另一结构示意图。在一实施例中,图片清晰度的获取装置300还可以包括:第三获取模块305。Please refer to FIG. 7 . FIG. 7 is another schematic structural diagram of an apparatus for acquiring picture sharpness according to an embodiment of the present application. In an embodiment, the image sharpness obtaining apparatus 300 may further include: a third obtaining module 305.
第三获取模块305,用于当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值。The third obtaining module 305 is configured to acquire the total running memory capacity of the electronic device and the currently occupied running memory capacity when the electronic device enters the shooting interface and needs to acquire the sharpness of the image; and acquire the currently occupied running The amount of memory capacity as a percentage of the total capacity of the running memory.
那么,所述第一获取模块301可以用于:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。Then, the first obtaining module 301 can be configured to: if the percentage value is detected to be greater than a preset ratio threshold, obtain an original picture that is obtained based on a Bayer array.
比如,在用户使用电子设备相机进行实际拍摄,即当电子设备进入拍摄界面并且需要获取拍摄到的前后几帧图片的清晰度,以辅助摄像头模组找到最佳的对焦位置时,第三获取模块305可以先获取本电子设备的运行内存总容量,以及当前被占用的运行内存容量。For example, when the user uses the electronic device camera to perform actual shooting, that is, when the electronic device enters the shooting interface and needs to obtain the sharpness of several frames before and after the shooting, to assist the camera module to find the best focus position, the third acquiring module The 305 can first obtain the total running memory capacity of the electronic device and the currently occupied running memory capacity.
然后,第三获取模块305可以获取该当前被占用的运行内存容量占该运行内存总容量的百分比值,并检测该百分比值是否大于预设比例阈值。Then, the third obtaining module 305 can obtain the percentage value of the currently occupied running memory capacity as a percentage of the total running memory capacity, and detect whether the percentage value is greater than a preset ratio threshold.
如果检测到该百分比值小于或等于预设比例阈值,那么可以认为电子设备当前的计算能力较强,此时电子设备可以执行其它操作,以完成照片拍摄。例如,此时电子设备可以基于硬件逻辑电路进行直接计算,从而找到最佳的对焦位置。If the percentage value is detected to be less than or equal to the preset ratio threshold, then the current computing power of the electronic device can be considered to be strong, and the electronic device can perform other operations to complete the photo shooting. For example, at this point the electronic device can perform direct calculations based on hardware logic to find the best focus position.
如果检测到该百分比值大于预设比例阈值,即电子设备剩余的运行内存不足,那么可以认为电子设备当前的计算能力较差。在这种情况下,为了避免因剩余的运行内存不足导致系统卡顿,电子设备的第一获取模块301可以获取基于拜耳阵列拍摄得到的原始图片,并执行后续步骤,从而辅助摄像头模组找到最佳的对焦位置。If it is detected that the percentage value is greater than the preset ratio threshold, that is, the remaining running memory of the electronic device is insufficient, the current computing capability of the electronic device may be considered to be poor. In this case, in order to avoid the system being stuck due to insufficient running memory, the first acquiring module 301 of the electronic device can acquire the original picture taken based on the Bayer array and perform subsequent steps, thereby assisting the camera module to find the most Good focus position.
本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行如本实施例提供的图片清晰度的获取方法中的步骤。The embodiment of the present application provides a computer readable storage medium, where a computer program is stored thereon, and when the computer program is executed on a computer, the computer is caused to execute the image sharpness obtaining method provided by the embodiment. A step of.
本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行本实施例提供的图片清晰度的获取方法中的流程。The embodiment of the present application further provides an electronic device, including a memory, and a processor, by using a computer program stored in the memory, to execute the process in the method for acquiring picture sharpness provided by the embodiment.
请参阅图8,图8为本申请实施例提供的电子设备的结构示意图。Please refer to FIG. 8. FIG. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
该电子设备400可以包括摄像单元401、存储器402、处理器403等部件。本领域技术人员可以理解,图8中示出的电子设备的结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The electronic device 400 can include components such as an imaging unit 401, a memory 402, a processor 403, and the like. It will be understood by those skilled in the art that the structure of the electronic device shown in FIG. 8 does not constitute a limitation on the electronic device, and may include more or less components than those illustrated, or combine some components, or different component arrangements. .
摄像单元401可以用于拍摄图像。The camera unit 401 can be used to capture an image.
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程 序,从而执行各种功能应用以及数据处理。 Memory 402 can be used to store applications and data. The application stored in the memory 402 contains executable code. Applications can form various functional modules. The processor 403 executes various functional applications and data processing by running an application stored in the memory 402.
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器402内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 403 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, executes the electronic device by running or executing an application stored in the memory 402, and calling data stored in the memory 402. The various functions and processing of data to provide overall monitoring of the electronic device.
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:In this embodiment, the processor 403 in the electronic device loads the executable code corresponding to the process of one or more applications into the memory 402 according to the following instructions, and is executed by the processor 403 to be stored in the memory. The application in 402, thus executing:
获取基于拜耳阵列拍摄得到的原始图片;从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。Obtaining an original picture obtained by shooting according to a Bayer array; determining a target area from the original picture, and determining a distribution position of a pixel of a preset color from the target area; acquiring a distribution position relationship in the target area as a pair a square value of a difference value of luminance values of pixels of adjacent preset colors; summing the square values of all the difference values to obtain a sum value, and determining the sum value as the sharpness of the picture.
请参阅图9,电子设备500可以包括摄像单元501、存储器502、处理器503、输入单元504、输出单元505等部件。Referring to FIG. 9, the electronic device 500 may include components such as an imaging unit 501, a memory 502, a processor 503, an input unit 504, an output unit 505, and the like.
摄像单元501可以用于拍摄图像。The imaging unit 501 can be used to capture an image.
存储器502可用于存储应用程序和数据。存储器502存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器503通过运行存储在存储器502的应用程序,从而执行各种功能应用以及数据处理。 Memory 502 can be used to store applications and data. The application stored in the memory 502 contains executable code. Applications can form various functional modules. The processor 503 executes various functional applications and data processing by running an application stored in the memory 502.
处理器503是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器502内的应用程序,以及调用存储在存储器502内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 503 is a control center of the electronic device, and connects various parts of the entire electronic device using various interfaces and lines, executes the electronic device by running or executing an application stored in the memory 502, and calling data stored in the memory 502. The various functions and processing of data to provide overall monitoring of the electronic device.
输入单元504可用于接收输入的数字、字符信息或用户特征信息(比如指纹),以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The input unit 504 can be configured to receive input digits, character information or user characteristic information (such as fingerprints), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
输出单元505可用于显示由用户输入的信息或提供给用户的信息以及电子设备的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。输出单元可包括显示面板。The output unit 505 can be used to display information input by the user or information provided to the user as well as various graphical user interfaces of the electronic device, which can be composed of graphics, text, icons, video, and any combination thereof. The output unit may include a display panel.
在本实施例中,电子设备中的处理器503会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器502中,并由处理器503来运行存储在存储器502中的应用程序,从而执行:In this embodiment, the processor 503 in the electronic device loads the executable code corresponding to the process of one or more applications into the memory 502 according to the following instructions, and is stored in the memory by the processor 503. The application in 502, thus executing:
获取基于拜耳阵列拍摄得到的原始图片;从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。Obtaining an original picture obtained by shooting according to a Bayer array; determining a target area from the original picture, and determining a distribution position of a pixel of a preset color from the target area; acquiring a distribution position relationship in the target area as a pair a square value of a difference value of luminance values of pixels of adjacent preset colors; summing the square values of all the difference values to obtain a sum value, and determining the sum value as the sharpness of the picture.
在一种实施方式中,处理器503执行所述获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值时,可以执行:从所述目标区域中确定出在 左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。In an embodiment, when the processor 503 performs the acquiring a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent positional relationship in the target area, the processor 503 may perform: from the Determining, in the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonal and adjacent to the lower right diagonal; acquiring each target pixel and a pixel adjacent to the lower left diagonal of the target pixel The square value of the difference of the luminance values, and the square value of the difference between the luminance values of each of the target pixels and the pixels adjacent to the lower right diagonal of the target pixel is obtained.
在一种实施方式中,处理器503执行所述从所述原始图片中确定出目标区域时,可以执行:从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。In an embodiment, when the processor 503 performs the determining of the target area from the original picture, performing: determining, from the original picture, a target area, where the target area is a rectangular area of a preset size. .
在一种实施方式中,处理器503执行所述从所述原始图片中确定出目标区域时,可以执行:从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。In an embodiment, when the processor 503 performs the determining of the target area from the original picture, it may be performed to: determine a target area from the original picture, where the target area is a required focus area.
在一种实施方式中,处理器503在执行所述获取基于拜耳阵列拍摄得到的原始图片之前,还可以执行:当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值。In an implementation manner, before performing the acquiring the original image obtained by the Bayer array, the processor 503 may further perform: acquiring, when the electronic device enters the shooting interface and needs to acquire the sharpness of the image, acquiring the electronic device. Running the total memory capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity.
那么,处理器503执行所述获取基于拜耳阵列拍摄得到的原始图片时,可以执行:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。Then, when the processor 503 performs the acquiring the original image obtained by the Bayer array, the processor 503 may perform: if the percentage value is greater than the preset ratio threshold, the original image obtained by the Bayer array is acquired.
在一种实施方式中,处理器503还可以执行:对所述预设比例阈值进行调整。In an embodiment, the processor 503 may further perform: adjusting the preset ratio threshold.
在一种实施方式中,处理器503执行所述对所述预设比例阈值进行调整时,可以执行:获取预先设定的基础值;按照预设幅度提高或降低所述基础值,得到预设比例阈值。In an embodiment, when the processor 503 performs the adjustment on the preset ratio threshold, the method may: perform: acquiring a preset basic value; and increasing or decreasing the basic value according to the preset amplitude to obtain a preset. Proportional threshold.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对图片清晰度的获取方法的详细描述,此处不再赘述。In the above-mentioned embodiments, the descriptions of the various embodiments are all focused. For a part that is not detailed in a certain embodiment, reference may be made to the above detailed description of the method for obtaining picture sharpness, and details are not described herein again.
本申请实施例提供的所述图片清晰度的获取装置与上文实施例中的图片清晰度的获取方法属于同一构思,在所述图片清晰度的获取装置上可以运行所述图片清晰度的获取方法实施例中提供的任一方法,其具体实现过程详见所述图片清晰度的获取方法实施例,此处不再赘述。The image sharpness obtaining device provided by the embodiment of the present application belongs to the same concept as the image sharpness obtaining method in the above embodiment, and the image sharpness acquisition can be performed on the image sharpness obtaining device. For the specific implementation process of any of the methods provided in the method embodiments, refer to the embodiment of the method for obtaining the picture clarity, which is not described here.
需要说明的是,对本申请实施例所述图片清晰度的获取方法而言,本领域普通技术人员可以理解实现本申请实施例所述图片清晰度的获取方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读取存储介质中,如存储在存储器中,并被至少一个处理器执行,在执行过程中可包括如所述图片清晰度的获取方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。It should be noted that, in the method for obtaining the picture clarity according to the embodiment of the present application, a person skilled in the art may understand all or part of the process for implementing the picture clarity method according to the embodiment of the present application, which may be through a computer. The program is implemented by controlling related hardware, which may be stored in a computer readable storage medium, such as in a memory, and executed by at least one processor, and may include, as the picture is clear during execution The flow of an embodiment of the method of obtaining degrees. The storage medium may be a magnetic disk, an optical disk, a read only memory (ROM), a random access memory (RAM), or the like.
对本申请实施例的所述图片清晰度的获取装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中,所述存储介质譬如为只读存储器,磁盘或光盘等。For the image sharpness obtaining device of the embodiment of the present application, each functional module may be integrated into one processing chip, or each module may exist separately physically, or two or more modules may be integrated into one module. in. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. The integrated module, if implemented in the form of a software functional module and sold or used as a standalone product, may also be stored in a computer readable storage medium, such as a read only memory, a magnetic disk or an optical disk, etc. .
以上对本申请实施例所提供的一种图片清晰度的获取方法、装置、存储介质以及电子 设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The method, the device, the storage medium, and the electronic device for acquiring image sharpness provided by the embodiments of the present application are described in detail. The principles and implementation manners of the present application are described in the following. The descriptions are only used to help understand the method of the present application and its core ideas; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific embodiments and application scopes. The contents of this specification are not to be construed as limiting the application.

Claims (20)

  1. 一种图片清晰度的获取方法,其中,包括:A method for obtaining image sharpness, including:
    获取基于拜耳阵列拍摄得到的原始图片;Obtaining the original image taken based on the Bayer array;
    从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;Determining a target area from the original picture, and determining a distribution position of pixels of a preset color from the target area;
    获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;Obtaining a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent preset color position in the target area;
    将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。The sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
  2. 根据权利要求1所述的图片清晰度的获取方法,其中,所述获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值,包括:The method for acquiring picture sharpness according to claim 1, wherein the obtaining a square value of a difference value of a brightness value of a pixel of a preset color in a diagonally adjacent positional relationship in the target area includes:
    从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;Determining, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonally adjacent to the lower right diagonal corner;
    获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。Obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal thereof, and obtaining a difference value of each target pixel and a luminance value of a pixel adjacent to a lower right diagonal corner thereof The squared value.
  3. 根据权利要求2所述的图片清晰度的获取方法,其中,所述从所述原始图片中确定出目标区域,包括:The method for acquiring picture sharpness according to claim 2, wherein the determining the target area from the original picture comprises:
    从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。A target area is determined from the original picture, the target area being a rectangular area of a preset size.
  4. 根据权利要求3所述的图片清晰度的获取方法,其中,所述从所述原始图片中确定出目标区域,包括:The method for acquiring picture sharpness according to claim 3, wherein the determining the target area from the original picture comprises:
    从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。A target area is determined from the original picture, the target area being a desired focus area.
  5. 根据权利要求4所述的图片清晰度的获取方法,其中,在所述获取基于拜耳阵列拍摄得到的原始图片之前,还包括:The method for acquiring picture sharpness according to claim 4, further comprising: before the acquiring the original picture taken based on the Bayer array image,
    当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;Obtaining a total operating memory capacity of the electronic device and a currently occupied operating memory capacity when the electronic device enters the shooting interface and needs to obtain the sharpness of the image;
    获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值;Obtaining a percentage value of the currently occupied running memory capacity as a percentage of the total running memory capacity;
    所述获取基于拜耳阵列拍摄得到的原始图片,包括:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。The acquiring the original image obtained by the Bayer array image comprises: if the percentage value is detected to be greater than the preset ratio threshold, acquiring the original image obtained by the Bayer array.
  6. 根据权利要求5所述的图片清晰度的获取方法,其中,所述方法还包括:The method for obtaining picture sharpness according to claim 5, wherein the method further comprises:
    对所述预设比例阈值进行调整。Adjusting the preset ratio threshold.
  7. 根据权利要求6所述的图片清晰度的获取方法,其中,所述对所述预设比例阈值进行调整,包括:The method for acquiring picture sharpness according to claim 6, wherein the adjusting the preset ratio threshold comprises:
    获取预先设定的基础值;Obtain a preset base value;
    按照预设幅度提高或降低所述基础值,得到预设比例阈值。The base value is increased or decreased according to a preset amplitude to obtain a preset ratio threshold.
  8. 一种图片清晰度的获取装置,其中,包括:A device for acquiring picture sharpness, comprising:
    第一获取模块,用于获取基于拜耳阵列拍摄得到的原始图片;a first acquiring module, configured to acquire an original picture obtained by shooting according to a Bayer array;
    第一确定模块,用于从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;a first determining module, configured to determine a target area from the original picture, and determine a distribution position of a pixel of a preset color from the target area;
    第二获取模块,用于获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;a second acquiring module, configured to acquire a square value of a difference value of a luminance value of a pixel of a preset color in which the distribution position relationship in the target area is diagonally adjacent;
    第二确定模块,用于将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。And a second determining module, configured to add the square values of all the difference values to obtain a sum value, and determine the sum value as the sharpness of the picture.
  9. 根据权利要求8所述的图片清晰度的获取装置,其中,所述第二获取模块用于:The apparatus for acquiring picture sharpness according to claim 8, wherein the second obtaining module is configured to:
    从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的像素分布的目标像素;Determining, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonally adjacent to the lower right diagonal corner;
    获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。Obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal thereof, and obtaining a difference value of each target pixel and a luminance value of a pixel adjacent to a lower right diagonal corner thereof The squared value.
  10. 根据权利要求9所述的图片清晰度的获取装置,其中,所述第一确定模块用于:The apparatus for acquiring picture sharpness according to claim 9, wherein the first determining module is configured to:
    从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。A target area is determined from the original picture, the target area being a rectangular area of a preset size.
  11. 根据权利要求10所述的图片清晰度的获取装置,其中,所述第一确定模块用于:The apparatus for acquiring picture sharpness according to claim 10, wherein the first determining module is configured to:
    从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。A target area is determined from the original picture, the target area being a desired focus area.
  12. 根据权利要求11所述的图片清晰度的获取装置,其中,所述装置还包括:第三获取模块,用于当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值;The device for acquiring picture sharpness according to claim 11, wherein the device further comprises: a third obtaining module, configured to acquire the electronic device when the electronic device enters the shooting interface and needs to acquire the sharpness of the image Running the total memory capacity and the currently occupied running memory capacity; obtaining the percentage of the currently occupied running memory capacity as a percentage of the total running memory capacity;
    所述第一获取模块,用于:若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。The first acquiring module is configured to: if the percentage value is detected to be greater than a preset ratio threshold, obtain an original picture obtained by shooting according to a Bayer array.
  13. 一种存储介质,其上存储有计算机程序,其中,当所述计算机程序在计算机上执行时,使得所述计算机执行如权利要求1至7中任一项所述的方法。A storage medium having stored thereon a computer program, wherein when the computer program is executed on a computer, the computer is caused to perform the method of any one of claims 1 to 7.
  14. 一种电子设备,包括存储器,处理器,其中,所述处理器通过调用所述存储器中存储的计算机程序,用于执行:An electronic device comprising a memory, a processor, wherein the processor is configured to execute by calling a computer program stored in the memory:
    获取基于拜耳阵列拍摄得到的原始图片;Obtaining the original image taken based on the Bayer array;
    从所述原始图片中确定出目标区域,并从所述目标区域中确定出预设颜色的像素的分布位置;Determining a target area from the original picture, and determining a distribution position of pixels of a preset color from the target area;
    获取所述目标区域中分布位置关系为对角相邻的预设颜色的像素的亮度值的差值的平方值;Obtaining a square value of a difference value of a luminance value of a pixel of a preset color in a diagonally adjacent preset color position in the target area;
    将所有所述差值的平方值相加得到和值,并将所述和值确定为所述图片的清晰度。The sum of the squared values of all the differences is obtained to obtain a sum value, and the sum value is determined as the sharpness of the picture.
  15. 根据权利要求14所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 14, wherein the processor is operative to:
    从所述目标区域中确定出在左下对角相邻和右下对角相邻的位置均有相同预设颜色的 像素分布的目标像素;Determining, from the target area, a target pixel having a pixel distribution of the same preset color at positions adjacent to the lower left diagonal and adjacent to the lower right diagonal;
    获取每一目标像素与分布于其左下对角相邻的像素的亮度值的差值的平方值,并获取每一目标像素与分布于其右下对角相邻的像素的亮度值的差值的平方值。Obtaining a square value of a difference value between each target pixel and a luminance value of a pixel adjacent to a lower left diagonal thereof, and obtaining a difference value of each target pixel and a luminance value of a pixel adjacent to a lower right diagonal corner thereof The squared value.
  16. 根据权利要求15所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 15 wherein said processor is operative to:
    从所述原始图片中确定出目标区域,所述目标区域为预设尺寸的矩形区域。A target area is determined from the original picture, the target area being a rectangular area of a preset size.
  17. 根据权利要求16所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 16 wherein said processor is operative to:
    从所述原始图片中确定出目标区域,所述目标区域为需要对焦区域。A target area is determined from the original picture, the target area being a desired focus area.
  18. 根据权利要求17所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 17 wherein said processor is operative to:
    当电子设备进入拍摄界面且需要获取图片的清晰度时,获取所述电子设备的运行内存总容量和当前被占用的运行内存容量;Obtaining a total operating memory capacity of the electronic device and a currently occupied operating memory capacity when the electronic device enters the shooting interface and needs to obtain the sharpness of the image;
    获取所述当前被占用的运行内存容量占所述运行内存总容量的百分比值;Obtaining a percentage value of the currently occupied running memory capacity as a percentage of the total running memory capacity;
    若检测到所述百分比值大于预设比例阈值,则获取基于拜耳阵列拍摄得到的原始图片。If it is detected that the percentage value is greater than the preset ratio threshold, the original picture obtained based on the Bayer array is acquired.
  19. 根据权利要求18所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 18, wherein the processor is operative to:
    对所述预设比例阈值进行调整。Adjusting the preset ratio threshold.
  20. 根据权利要求19所述的电子设备,其中,所述处理器用于执行:The electronic device of claim 19, wherein the processor is operative to:
    获取预先设定的基础值;Obtain a preset base value;
    按照预设幅度提高或降低所述基础值,得到预设比例阈值。The base value is increased or decreased according to a preset amplitude to obtain a preset ratio threshold.
PCT/CN2018/116446 2017-12-28 2018-11-20 Image definition obtaining method and apparatus, storage medium, and electronic device WO2019128539A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711464337.8 2017-12-28
CN201711464337.8A CN108198189B (en) 2017-12-28 2017-12-28 Picture definition obtaining method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
WO2019128539A1 true WO2019128539A1 (en) 2019-07-04

Family

ID=62585210

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116446 WO2019128539A1 (en) 2017-12-28 2018-11-20 Image definition obtaining method and apparatus, storage medium, and electronic device

Country Status (2)

Country Link
CN (1) CN108198189B (en)
WO (1) WO2019128539A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108198189B (en) * 2017-12-28 2020-03-10 Oppo广东移动通信有限公司 Picture definition obtaining method and device, storage medium and electronic equipment
WO2020056629A1 (en) * 2018-09-19 2020-03-26 深圳市大疆创新科技有限公司 Bayer image detection method and device and machine-readable storage medium
CN109696788B (en) * 2019-01-08 2021-12-14 武汉精立电子技术有限公司 Quick automatic focusing method based on display panel
CN109993722B (en) * 2019-04-09 2023-04-18 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102903098A (en) * 2012-08-28 2013-01-30 四川虹微技术有限公司 Depth estimation method based on image definition difference
EP2955691A1 (en) * 2014-06-10 2015-12-16 Baumer Optronic GmbH Device for determining of colour fraction of an image pixel of a BAYER matrix
CN107172296A (en) * 2017-06-22 2017-09-15 维沃移动通信有限公司 A kind of image capturing method and mobile terminal
CN108198189A (en) * 2017-12-28 2018-06-22 广东欧珀移动通信有限公司 Acquisition methods, device, storage medium and the electronic equipment of picture clarity

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102903098A (en) * 2012-08-28 2013-01-30 四川虹微技术有限公司 Depth estimation method based on image definition difference
EP2955691A1 (en) * 2014-06-10 2015-12-16 Baumer Optronic GmbH Device for determining of colour fraction of an image pixel of a BAYER matrix
CN107172296A (en) * 2017-06-22 2017-09-15 维沃移动通信有限公司 A kind of image capturing method and mobile terminal
CN108198189A (en) * 2017-12-28 2018-06-22 广东欧珀移动通信有限公司 Acquisition methods, device, storage medium and the electronic equipment of picture clarity

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIU, XIAOFANG: "Studies on Definition Evaluation and Window Construction Algorithms in Auto-focusing System", STUDIES ON ELECTRONIC TECHNOLOGY & INFORMATION SCIENCE , CHINA MASTER'S THESES FULL-TEXT DATABASE 1138-320, 15 September 2017 (2017-09-15), pages 1138 - 320, ISSN: 1674-0246 *

Also Published As

Publication number Publication date
CN108198189B (en) 2020-03-10
CN108198189A (en) 2018-06-22

Similar Documents

Publication Publication Date Title
CN111028189B (en) Image processing method, device, storage medium and electronic equipment
WO2019128539A1 (en) Image definition obtaining method and apparatus, storage medium, and electronic device
WO2019105154A1 (en) Image processing method, apparatus and device
WO2018201809A1 (en) Double cameras-based image processing device and method
US10805508B2 (en) Image processing method, and device
US7450756B2 (en) Method and apparatus for incorporating iris color in red-eye correction
US8971628B2 (en) Face detection using division-generated haar-like features for illumination invariance
WO2018201875A1 (en) Image sensor, camera module, and electronic device
WO2015081556A1 (en) Photographing method for dual-camera device and dual-camera device
JP2009193421A (en) Image processing device, camera device, image processing method, and program
US11350063B2 (en) Circuit for correcting lateral chromatic abberation
US20220329729A1 (en) Photographing method, storage medium and electronic device
US11950012B2 (en) Apparatus, method of controlling the same, and storage medium
CN112164007A (en) Image display method and apparatus, terminal and readable storage medium
CN118613821A (en) Multi-mode demosaicing for raw image data
CN113592753B (en) Method and device for processing image shot by industrial camera and computer equipment
US11176643B1 (en) Circuit for correcting chromatic aberration through sharpening
CN115052097B (en) Shooting method and device and electronic equipment
WO2019148996A1 (en) Image processing method and device, storage medium, and electronic apparatus
CN110266965A (en) Image processing method, device, storage medium and electronic equipment
WO2015141185A1 (en) Imaging control device, imaging control method, and storage medium
US11252299B1 (en) High dynamic range color conversion using selective interpolation for different curves
CN110545375B (en) Image processing method, image processing device, storage medium and electronic equipment
CN111479074A (en) Image acquisition method and device, computer equipment and storage medium
US20190052803A1 (en) Image processing system, imaging apparatus, image processing apparatus, control method, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18893756

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18893756

Country of ref document: EP

Kind code of ref document: A1