CN109672818B - A method and device for adjusting image quality - Google Patents
A method and device for adjusting image quality Download PDFInfo
- Publication number
- CN109672818B CN109672818B CN201710960703.2A CN201710960703A CN109672818B CN 109672818 B CN109672818 B CN 109672818B CN 201710960703 A CN201710960703 A CN 201710960703A CN 109672818 B CN109672818 B CN 109672818B
- Authority
- CN
- China
- Prior art keywords
- motion
- image
- ith
- areas
- group
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/95—Computational photography systems, e.g. light-field imaging systems
- H04N23/951—Computational photography systems, e.g. light-field imaging systems by using two or more images to influence resolution, frame rate or aspect ratio
Landscapes
- Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Image Analysis (AREA)
- Studio Devices (AREA)
- Image Processing (AREA)
Abstract
本申请公开了一种调整图像质量的方法及装置,该方法包括:将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像,根据n张采样图像中每相邻两个采样图像确定一组运动区域,获得n‑1组运动区域;根据n‑1组运动区域,确定n‑1组运动区域分别对应的像素位移;根据n‑1组运动区域分别对应的像素位移确定n‑1组运动区域分别对应的运动信息。通过上述方法可以实现通过采样处理降低图像分辨率,获得采样图像,并根据采样图像确定运动信息,使得到的运动信息用于调整图像质量。该方法具有低运算量低功耗的特点。
The present application discloses a method and a device for adjusting image quality. The method includes: performing sampling processing on n images continuously obtained in a camera preview process to obtain n sampled images, and according to each adjacent two images in the n sampled images A set of motion areas is determined from the sampled images, and n-1 groups of motion areas are obtained; according to the n-1 groups of motion areas, the pixel displacements corresponding to the n-1 groups of motion areas are determined respectively; the pixel displacements corresponding to the n-1 groups of motion areas are respectively determined Determine the motion information corresponding to the n-1 groups of motion areas respectively. Through the above method, it is possible to reduce the image resolution through sampling processing, obtain a sampled image, and determine motion information according to the sampled image, so that the obtained motion information is used to adjust the image quality. This method has the characteristics of low computational complexity and low power consumption.
Description
技术领域technical field
本申请涉及图像处理与计算机视觉领域,特别涉及一种调整图像质量的方法及装置。The present application relates to the fields of image processing and computer vision, and in particular, to a method and apparatus for adjusting image quality.
背景技术Background technique
一些移动电子设备(例如,手机)配备有摄影相机,其拍照场景中可能包含运动物体,则曝光时间内物体的移动拖影会出现模糊现象,造成成片率较低,影响拍摄效果。因此,准确检测物体运动非常重要,基于准确的物体运动信息可以控制曝光参数,进而提高成像质量,提高成片率。Some mobile electronic devices (eg, mobile phones) are equipped with photographic cameras, and the photographed scene may contain moving objects, and the moving smear of the objects during exposure time will appear blurred, resulting in a low filming rate and affecting the photographing effect. Therefore, it is very important to accurately detect object motion, and exposure parameters can be controlled based on accurate object motion information, thereby improving imaging quality and film yield.
现有技术中,一般运动检测方案分为两类:基于图像处理的运动检测方案和基于外部微电子器件的运动检测方案。In the prior art, general motion detection schemes are divided into two categories: motion detection schemes based on image processing and motion detection schemes based on external microelectronic devices.
例如,基于图像处理的运动检测方案包括背景法、光流法、时间差分法等。其中,背景法高度依赖场景,不适用于频繁变换的场景。光流法计算复杂,时耗和功耗比较高。时间差分法容易受噪声影响。For example, motion detection schemes based on image processing include background methods, optical flow methods, temporal difference methods, and the like. Among them, the background method is highly dependent on the scene and is not suitable for frequently changing scenes. The optical flow method is complicated to calculate, and the time consumption and power consumption are relatively high. The time difference method is susceptible to noise.
而基于外部微电子器件的运动检测方案依赖外部电子器件感应设备整体的位移,无法在设备稳定的情况下确定拍摄物体的运动状态,因此这种类型的运动检测方案适合用来做拍摄防抖处理。The motion detection scheme based on external microelectronic devices relies on the external electronic device to sense the overall displacement of the device, and cannot determine the motion state of the photographed object when the device is stable. Therefore, this type of motion detection scheme is suitable for shooting anti-shake processing. .
综上,现有运动检测方案均不适合应用于移动电子设备中的摄影相机拍摄运动物体使用。To sum up, none of the existing motion detection solutions are suitable for use in photographing moving objects with photographic cameras in mobile electronic devices.
发明内容SUMMARY OF THE INVENTION
本申请提供一种调整图像质量的方法及装置,用以为移动电子设备中的摄影相机提供准确的物体运动信息。The present application provides a method and apparatus for adjusting image quality, which are used to provide accurate object motion information for a photographic camera in a mobile electronic device.
第一方面,本申请提供一种调整图像质量的方法,该方法包括:In a first aspect, the present application provides a method for adjusting image quality, the method comprising:
处理器将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像,其中,第i张图像对应第i张采样图像,所述第i张图像为所述n张图像中的任一张图像,i和n均为正整数;根据所述n张采样图像中每相邻两个采样图像确定一组运动区域,获得n-1组运动区域,其中,第i组运动区域是根据所述第i个采样图像和第i+1个采样图像获得的,所述第i组运动区域包括所述第i个采样图像对应的运动区域和所述第i+1个采样图像对应的运动区域;根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移,其中,所述第i组运动区域对应的像素位移是指所述第i+1张采样图像对应的运动区域相对所述第i张采样图像对应的运动区域的像素位移;根据所述n-1组运动区域分别对应的像素位移确定所述n-1组运动区域分别对应的运动信息,所述n-1组运动区域分别对应的运动信息用于调整图像质量。The processor performs sampling processing on the n images continuously obtained in the camera preview process to obtain n sampled images, wherein the ith image corresponds to the ith sampled image, and the ith image is one of the n images. For any image of , i and n are positive integers; a group of motion regions is determined according to every two adjacent sampled images in the n sampled images, and n-1 groups of motion regions are obtained, wherein the i-th group of motion regions It is obtained according to the i-th sampled image and the i+1-th sampled image, and the i-th group of motion regions includes the motion region corresponding to the i-th sampled image and the i+1-th sampled image. according to the n-1 groups of motion areas, determine the pixel displacements corresponding to the n-1 groups of motion areas, wherein the pixel displacement corresponding to the i-th group of motion areas refers to the i+1-th group of motion areas The pixel displacement of the motion area corresponding to the sampled images relative to the motion area corresponding to the i-th sampled image; the motion corresponding to the n-1 groups of motion areas is determined according to the pixel displacements corresponding to the n-1 groups of motion areas respectively information, the motion information corresponding to the n-1 groups of motion regions is used to adjust the image quality.
通过上述方法,处理器可以通过对n张图像进行采样处理获得图像分辨率较低的n张采样图像,并根据n张采样图像中的每相邻两个采样图像确定一组运动区域,进一步计算出n-1组运动区域分别对应的像素位移,以及n-1组运动区域分别对应的运动信息。因此,通过上述方法可以实现通过采样处理降低图像分辨率,获得采样图像,并根据采样图像确定运动信息,使得到的运动信息用于调整图像质量。该方法具有低运算量低功耗的特点。Through the above method, the processor can obtain n sampled images with lower image resolution by sampling the n images, and determine a set of motion regions according to every two adjacent sampled images in the n sampled images, and further calculate The pixel displacements corresponding to the n-1 groups of motion regions, and the motion information corresponding to the n-1 groups of motion regions, respectively, are obtained. Therefore, through the above method, it is possible to reduce the image resolution through sampling processing, obtain a sampled image, and determine motion information according to the sampled image, so that the obtained motion information is used to adjust the image quality. This method has the characteristics of low computational complexity and low power consumption.
在一种可能的设计中,所述第i张采样图像是指在所述第i张图像的水平方向上经预设滤波处理后执行下采样,且在所述第i张图像的垂直方向上执行下采样后获得的图像。In a possible design, the i-th sampled image refers to performing downsampling after a preset filtering process in the horizontal direction of the i-th image, and in the vertical direction of the i-th image Image obtained after performing downsampling.
因此,通过上述方法,能够降低处理器的运算量和功耗,且能够有效避免采样图像闪烁问题。Therefore, by the above method, the calculation amount and power consumption of the processor can be reduced, and the problem of flickering of the sampled image can be effectively avoided.
在一种可能的设计中,所述预设滤波处理为无限脉冲响应滤波器IIR filter,或者有限脉冲响应滤波器FIR filter。In a possible design, the preset filtering process is an infinite impulse response filter IIR filter, or a finite impulse response filter FIR filter.
因此,本申请提供多种可能的预设滤波处理方式。Therefore, the present application provides multiple possible preset filtering processing methods.
在一种可能的设计中,处理器在根据所述n张采样图像中每相邻两个采样图像确定一组运动区域时可以采用以下方法:In a possible design, the processor may adopt the following method when determining a group of motion regions according to every two adjacent sampled images in the n sampled images:
针对所述第i张采样图像和所述第i+1张采样图像,执行:将所述第i张采样图像和所述第i+1张采样图像均分割成M×N个矩形窗,M和N均为正整数;计算M×N个第一相关系数,其中,第k个第一相关系数为所述第i张采样图像中第k个矩形窗与所述第i+1张采样图像中第k个矩形窗的相关系数,所述第k个第一相关系数为所述M×N个第一相关系数中的任一个第一相关系数,k为正整数;根据所述M×N个第一相关系数中小于等于第一预设相关系数阈值的第一相关系数对应的矩形窗,确定所述第i组运动区域,其中,所述第i张采样图像对应的运动区域包括的矩形窗与所述第i组运动区域中的所述第i+1张采样图像对应的运动区域包括的矩形窗一一对应。For the i-th sampled image and the i+1-th sampled image, perform: dividing both the i-th sampled image and the i+1-th sampled image into M×N rectangular windows, M and N are positive integers; calculate M×N first correlation coefficients, where the kth first correlation coefficient is the kth rectangular window in the i-th sampled image and the i+1-th sampled image The correlation coefficient of the kth rectangular window in , the kth first correlation coefficient is any one of the M×N first correlation coefficients, and k is a positive integer; according to the M×N Among the first correlation coefficients, the rectangular window corresponding to the first correlation coefficient that is less than or equal to the first preset correlation coefficient threshold is determined, and the ith group of motion regions is determined, wherein the motion region corresponding to the ith sampled image includes a rectangle The windows are in one-to-one correspondence with the rectangular windows included in the motion region corresponding to the i+1 th sampled image in the ith group of motion regions.
因此,通过上述方法,处理器可以确定第i+1张采样图像相对第i张采样图像存在运动物体,并确定出该运动物体所在区域。Therefore, through the above method, the processor can determine that there is a moving object in the i+1 th sampled image relative to the ith sampled image, and determine the region where the moving object is located.
在一种可能的设计中,所述第k个第一相关系数为所述第i张采样图像中第k个矩形窗在水平方向上的投影直方图与所述第i+1张采样图像中第k个矩形窗在水平方向上的投影直方图的相关系数,与所述第i张采样图像中第k个矩形窗在垂直方向上的投影直方图与所述第i+1张采样图像中第k个矩形窗在垂直方向上的投影直方图的相关系数之和。In a possible design, the k-th first correlation coefficient is the projection histogram of the k-th rectangular window in the i-th sampled image in the horizontal direction and the i+1-th sampled image The correlation coefficient of the projection histogram of the kth rectangular window in the horizontal direction and the projection histogram of the kth rectangular window in the vertical direction in the i-th sampling image and the i+1-th sampling image The sum of the correlation coefficients of the projected histograms of the kth rectangular window in the vertical direction.
因此,这里计算第一相关系数的相关系数算法可以为投影直方图法、图像直方图法、色彩特征法等,本申请对此不作限定。为了降低处理器的运算量和功耗,处理器可采用投影直方图法计算两个矩形窗的相关系数。Therefore, the correlation coefficient algorithm for calculating the first correlation coefficient here may be a projection histogram method, an image histogram method, a color feature method, etc., which is not limited in this application. In order to reduce the computational complexity and power consumption of the processor, the processor can use the projection histogram method to calculate the correlation coefficient of the two rectangular windows.
在一种可能的设计中,处理器在根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移时可以采用以下方法:In a possible design, the processor may use the following method when determining the pixel displacements corresponding to the n-1 groups of motion regions according to the n-1 groups of motion regions:
针对所述第i组运动区域,所述第i张采样图像对应的运动区域包括m个矩形窗,所述第i张采样图像对应的运动区域包括m个矩形窗,执行:采用预设算法计算m个像素位移,其中,第j个像素位移为所述第i+1张采样图像对应的运动区域中与所述第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗相对所述第i张采样图像对应的运动区域中第j个矩形窗的像素位移,m和j均为正整数;根据m个像素位移确定所述第i组运动区域对应的像素位移。For the i-th group of motion regions, the motion region corresponding to the i-th sampled image includes m rectangular windows, and the motion region corresponding to the i-th sampled image includes m rectangular windows. Perform: adopting a preset algorithm to calculate m pixel displacements, where the jth pixel displacement is relative to the rectangular window matching the jth rectangular window in the motion region corresponding to the i+1th sampling image in the motion region corresponding to the i+1th sampling image The pixel displacement of the j-th rectangular window in the motion region corresponding to the i-th sampled image, where m and j are both positive integers; the pixel displacement corresponding to the i-th group of motion regions is determined according to the m pixel displacements.
因此,通过上述方法,处理器能够实现在较低运算量和功耗基础上,确定物体运动的快慢和方向。Therefore, through the above method, the processor can realize the determination of the speed and direction of the movement of the object on the basis of lower calculation amount and power consumption.
在一种可能的设计中,所述第i组运动区域对应的运动信息包括以下至少一种:所述第i组运动区域对应的像素位移,所述第i组运动区域对应的运动速度标识、所述第i组运动区域对应的运动方向标识;其中,所述第i组运动区域对应的运动速度标识是根据所述第i组运动区域对应的像素位移的大小落入的预设位移大小阈值范围对应的运动速度标识;所述第i组运动区域对应的运动方向标识是根据所述第i组运动区域对应的像素位移的方向落入的预设角度范围对应的运动方向标识。In a possible design, the motion information corresponding to the ith group of motion areas includes at least one of the following: a pixel displacement corresponding to the ith group of motion areas, a motion speed identifier corresponding to the ith group of motion areas, The motion direction identification corresponding to the i-th group of motion regions; wherein, the motion speed identification corresponding to the i-th group of motion regions is a preset displacement size threshold that falls according to the size of the pixel displacement corresponding to the i-th group of motion regions The motion speed identifier corresponding to the range; the motion direction identifier corresponding to the i-th group of motion areas is the motion direction identifier corresponding to the preset angle range within which the direction of the pixel displacement corresponding to the i-th group of motion areas falls.
因此,通过上述方法,处理器能够输出指示物体运动的快慢和方向的多种标识。Therefore, through the above method, the processor can output various identifications indicating the speed and direction of the movement of the object.
在一种可能的设计中,若m个像素位移满足以下第一判断准则和第二判断准则中的至少一个判断准则,所述第i组运动区域对应的运动信息包括第一标识,所述第一标识用于指示所述第i组运动区域处于高速运动状态;所述第一判断准则是指m个第二相关系数中小于等于第二预设相关系数阈值的数目大于等于第一预设数目;其中,第j个第二相关系数为所述第i+1张采样图像对应的运动区域中与所述第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗与所述第i张采样图像对应的运动区域中第j个矩形窗的相关系数。所述第二判断准则是指所述m个像素位移的方向中不同方向的数目大于等于第二预设数目。In a possible design, if the m pixel displacements satisfy at least one of the following first judgment criterion and second judgment criterion, the motion information corresponding to the i-th group of motion regions includes a first identifier, and the i-th group of motion regions An identifier is used to indicate that the i-th group of motion regions is in a high-speed motion state; the first judgment criterion means that the number of m second correlation coefficients less than or equal to the second preset correlation coefficient threshold is greater than or equal to the first preset number Wherein, the j-th second correlation coefficient is the rectangular window that matches the j-th rectangular window in the motion region corresponding to the i-th sampled image and the j-th rectangular window in the motion region corresponding to the i-th sampled image and the The correlation coefficient of the jth rectangular window in the motion region corresponding to the ith sampled image. The second judgment criterion refers to that the number of different directions in the displacement directions of the m pixels is greater than or equal to a second preset number.
因此,通过上述方法能够弥补快速运动场景下SAD扫描算法发生计算错误的不足,保证物体运动信息的准确性。Therefore, the above method can make up for the deficiency of the calculation error of the SAD scanning algorithm in the fast motion scene, and ensure the accuracy of the object motion information.
在一种可能的设计中,在确定所述n-1组运动区域分别对应的运动信息之前,处理器将所述n-1组运动区域分别对应的像素位移执行低通滤波。In a possible design, before determining the motion information corresponding to the n-1 groups of motion regions, the processor performs low-pass filtering on the pixel displacements corresponding to the n-1 groups of motion regions.
因此,通过上述方法可以消除随机噪声和奇异值对计算结果造成的影响,保证输出结果的稳定性。Therefore, the influence of random noise and singular value on the calculation result can be eliminated by the above method, and the stability of the output result can be ensured.
在一种可能的设计中,在确定所述第i组运动区域对应的运动信息之后,处理器若所述i组运动区域对应的像素位移的大小与第一阈值的差值的绝对值小于等于波动阈值,调整所述第一阈值。In a possible design, after determining the motion information corresponding to the i-th group of motion regions, the processor may determine if the absolute value of the difference between the size of the pixel displacement corresponding to the i-th group of motion regions and the first threshold is less than or equal to Fluctuation threshold, adjust the first threshold.
因此,通过上述方法可以消除多个像素位移的大小位于阈值附近发生的运动速度标识频繁抖动的问题,保证输出结果的稳定性。Therefore, the above-mentioned method can eliminate the problem of frequent jittering of the motion speed markers that occurs when the magnitude of the displacement of multiple pixels is near the threshold, and ensure the stability of the output result.
第二方面,本申请提供一种调整图像质量的装置,该装置包括:In a second aspect, the present application provides an apparatus for adjusting image quality, the apparatus comprising:
采样单元,用于将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像,其中,第i张图像对应第i张采样图像,所述第i张图像为所述n张图像中的任一张图像,i和n均为正整数;The sampling unit is configured to perform sampling processing on the n images continuously obtained in the camera preview process to obtain n sampled images, wherein the ith image corresponds to the ith sampled image, and the ith image is the n For any image in the images, i and n are positive integers;
处理单元,用于根据所述n张采样图像中每相邻两个采样图像确定一组运动区域,获得n-1组运动区域,其中,第i组运动区域是根据所述第i个采样图像和第i+1个采样图像获得的,所述第i组运动区域包括所述第i个采样图像对应的运动区域和所述第i+1个采样图像对应的运动区域;A processing unit, configured to determine a group of motion regions according to every two adjacent sampled images in the n sampled images, and obtain n-1 groups of motion regions, wherein the i-th group of motion regions is based on the i-th sampled image Obtained from the i+1 th sampled image, the i-th group of motion regions includes a motion region corresponding to the i-th sampled image and a motion region corresponding to the i+1-th sampled image;
计算单元,用于根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移,其中,所述第i组运动区域对应的像素位移是指所述第i+1张采样图像对应的运动区域相对所述第i张采样图像对应的运动区域的像素位移;a calculation unit, configured to determine the pixel displacements corresponding to the n-1 groups of motion regions according to the n-1 groups of motion regions, wherein the pixel displacement corresponding to the i-th group of motion regions refers to the i-th group of motion regions The pixel displacement of the motion region corresponding to one sampled image relative to the motion region corresponding to the i-th sampled image;
分析单元,用于根据所述n-1组运动区域分别对应的像素位移确定所述n-1组运动区域分别对应的运动信息,所述n-1组运动区域分别对应的运动信息用于调整图像质量。An analysis unit, configured to determine the motion information corresponding to the n-1 groups of motion areas according to the pixel displacements corresponding to the n-1 groups of motion areas, and the motion information corresponding to the n-1 groups of motion areas is used for adjustment Image Quality.
可选的,该调整图像质量的装置,还可以实现第一方面的部分或全部的可选的实现方式。Optionally, the apparatus for adjusting image quality may also implement some or all of the optional implementation manners of the first aspect.
第三方面,本申请提供一种调整图像质量的设备,该调整图像质量的设备包括:存储器,用于存储计算机可执行程序代码;通信接口,以及处理器,处理器与存储器、通信接口耦合。其中存储器所存储的程序代码包括指令,当处理器执行所述指令时,使调整图像质量的设备执行上述第一方面的方法。In a third aspect, the present application provides a device for adjusting image quality, the device for adjusting image quality comprising: a memory for storing computer executable program codes; a communication interface, and a processor, where the processor is coupled to the memory and the communication interface. The program code stored in the memory includes instructions, and when the processor executes the instructions, the device for adjusting image quality is made to execute the method of the first aspect.
第四方面,本申请提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行上述第一方面中任意可能的实现方式中的方法。In a fourth aspect, the present application provides a computer program product, the computer program product comprising: computer program code, when the computer program code is run on a computer, the computer is made to execute any possible implementation manner in the first aspect above method in .
第五方面,本申请提供了一种计算机可读介质,所述计算机可读介质存储有程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行上述第一方面的实现方式中的方法。In a fifth aspect, the present application provides a computer-readable medium, where program codes are stored in the computer-readable medium, and when the computer program codes are executed on a computer, the computer is made to execute the implementation of the first aspect above. method.
第六方面,本申请提供了一种芯片,包括:处理模块与通信接口,所述处理模块用于执行上述第一方面中任意可能的实现方式中的方法。In a sixth aspect, the present application provides a chip, including: a processing module and a communication interface, where the processing module is configured to execute the method in any possible implementation manner of the above-mentioned first aspect.
所述芯片还包括存储模块,所述存储模块用于存储指令,所述处理模块用于执行所述存储模块存储的指令,并且对所述存储模块中存储的指令的执行使得所述处理模块执行上述第一方面中任意可能的实现方式中的方法。The chip also includes a storage module, the storage module is used for storing instructions, the processing module is used for executing the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute The method in any possible implementation manner of the above first aspect.
附图说明Description of drawings
图1为本申请中调整图像质量的方法的概述流程图;Fig. 1 is the general flow chart of the method for adjusting image quality in this application;
图2(a)和图2(b)为本申请中采用SAD扫描算法在x轴方向(水平方向)上确定在第i+1张图像中与第i张采样图像中第j个矩形窗匹配的矩形窗的示意图;Fig. 2(a) and Fig. 2(b) are determined in the x-axis direction (horizontal direction) using the SAD scanning algorithm in the application to match the j-th rectangular window in the i+1-th image with the i-th sampling image The schematic diagram of the rectangular window;
图3为本申请中处理器确定两张相邻的采样图像对应的运动信息的具体流程图之一;Fig. 3 is one of the specific flow charts of the processor in the application to determine the motion information corresponding to two adjacent sampled images;
图4为本申请中处理器确定两张相邻的采样图像对应的运动信息的具体流程图之二;Fig. 4 is the second specific flow chart of the processor in the application to determine the motion information corresponding to two adjacent sampled images;
图5为本申请中调整图像质量的装置的结构示意图;5 is a schematic structural diagram of an apparatus for adjusting image quality in the present application;
图6为本申请中调整图像质量的设备的结构示意图。FIG. 6 is a schematic structural diagram of an apparatus for adjusting image quality in the present application.
具体实施方式Detailed ways
下面结合附图,对本申请的实施例进行描述。The embodiments of the present application will be described below with reference to the accompanying drawings.
本申请提供的调整图像质量的方法可以用于为移动电子设备中的摄影相机提供运动信息。进一步地,移动电子设备可基于运动信息控制摄影相机的曝光参数,例如减少曝光参数,或者结合运动信息,采用图像后处理算法为图像进行补偿或修正处理,进而提高成像质量,提高成片率。本申请提供的调整图像质量的方法可以由移动电子设备中的处理器或芯片执行。The method for adjusting image quality provided in this application can be used to provide motion information for a photographic camera in a mobile electronic device. Further, the mobile electronic device can control the exposure parameters of the photographic camera based on the motion information, for example, reduce the exposure parameters, or use an image post-processing algorithm to compensate or correct the image in combination with the motion information, thereby improving the imaging quality and film yield. The method for adjusting image quality provided in this application may be executed by a processor or a chip in a mobile electronic device.
参阅图1所示,本申请提供一种调整图像质量的方法,该方法包括:Referring to Figure 1, the present application provides a method for adjusting image quality, the method comprising:
步骤100:处理器将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像。Step 100: The processor performs sampling processing on the n images continuously obtained in the camera preview process to obtain n sampled images.
其中,n张图像可以是小规模像素图像,第i张图像对应第i张采样图像,第i张采样图像的分辨率低于第i张图像的分辨率,第i张图像为n张图像中的任一张图像,i和n均为正整数。Among them, the n images can be small-scale pixel images, the ith image corresponds to the ith sampled image, the resolution of the ith sampled image is lower than that of the ith image, and the ith image is one of the n images. For any image of , i and n are positive integers.
例如,移动电子设备中的摄影相机可以实现在相机预览过程中每秒获得连续的30张图像。处理器根据该30张图像分别进行采样处理,即依次对30张图像中的每张图像进行采样处理,获得30张采样图像。For example, a photographic camera in a mobile electronic device can achieve 30 consecutive images per second during camera preview. The processor performs sampling processing respectively according to the 30 images, that is, sampling processing is performed on each of the 30 images in turn to obtain 30 sampled images.
为了降低处理器的运算量和功耗,降低图像分辨率是最直接的方法,例如,可以直接对n张图像分别执行下采样处理,但是直接对n张图像分别执行下采样处理获得的n张采样图像,可能会造成采样图像闪烁,引发运动误检。因此,本申请提出一种可能的采样方式,以第i张图像为例,对其进行的采样处理具体为:在第i张图像的水平方向上经预设滤波处理后执行下采样,且在第i张图像的垂直方向上执行下采样。In order to reduce the computational complexity and power consumption of the processor, reducing the image resolution is the most direct method. For example, it is possible to directly perform downsampling on n images, but directly perform downsampling on n images to obtain n images. Sampling images may cause flickering of the sampled images, resulting in false motion detection. Therefore, the present application proposes a possible sampling method. Taking the ith image as an example, the sampling processing on the ith image is specifically: performing downsampling after preset filtering processing in the horizontal direction of the ith image, and performing downsampling on the ith image in the horizontal direction. Downsampling is performed in the vertical direction of the ith image.
此外,对第i张图像进行的采样处理还可以为:在第i张图像的水平方向上经第一预设滤波处理后执行下采样,且在第i张图像的垂直方向上经第二预设滤波处理后执行下采样。其中,第一预设滤波处理和第二预设滤波处理可以相同或不同。In addition, the sampling processing performed on the ith image may also be: performing downsampling after the first preset filtering processing in the horizontal direction of the ith image, and performing downsampling in the vertical direction of the ith image through a second preset filtering process. It is assumed that downsampling is performed after filtering. The first preset filtering process and the second preset filtering process may be the same or different.
上述提到的预设滤波处理为无限脉冲响应滤波器(IIR filter),或者有限脉冲响应滤波器(FIR filter),本申请对此不作限定。The above-mentioned preset filtering process is an infinite impulse response filter (IIR filter) or a finite impulse response filter (FIR filter), which is not limited in this application.
采用上述采样方式,只要滤波处理的系数设计得当,可以使获得的n张采样图像能够有效避免采样图像闪烁问题,且处理器的运算量较低。例如,每张采样图像的总像素略低于50K。By adopting the above sampling method, as long as the filtering coefficients are properly designed, the obtained n sampled images can effectively avoid the problem of flickering of the sampled images, and the calculation amount of the processor is low. For example, the total pixels per sampled image are a little under 50K.
步骤110:处理器根据n张采样图像中每相邻两个采样图像确定一组运动区域,获得n-1组运动区域。Step 110: The processor determines a group of motion regions according to every two adjacent sampled images in the n sampled images, and obtains n-1 groups of motion regions.
其中,第i组运动区域是根据第i个采样图像和第i+1个采样图像获得的,第i组运动区域包括第i个采样图像对应的运动区域和第i+1个采样图像对应的运动区域。Among them, the i-th group of motion regions is obtained according to the i-th sampled image and the i+1-th sampled image, and the i-th group of motion regions includes the motion region corresponding to the i-th sampled image and the i+1-th sampled image. sports area.
例如,假设一共有4张采样图像,每相邻两个采样图像确定一组运动区域,即第1个采样图像和第2个采样图像确定第1组运动区域,第2个采样图像和第3个采样图像确定第2组运动区域,第3个采样图像和第4个采样图像确定第3组运动区域,共获得3组运动区域。For example, suppose there are 4 sampled images in total, and each adjacent two sampled images determine a group of motion areas, that is, the first sampled image and the second sampled image determine the first group of motion areas, the second sampled image and the third sampled image. The second sample image determines the second group of motion regions, the third sample image and the fourth sample image determine the third group of motion regions, and a total of 3 groups of motion regions are obtained.
第1组运动区域是根据第1个采样图像和第2个采样图像获得的,第1组运动区域包括第1个采样图像对应的运动区域和第2个采样图像对应的运动区域。第2组运动区域是根据第2个采样图像和第3个采样图像获得的,第3组运动区域包括第2个采样图像对应的运动区域和第3个采样图像对应的运动区域。第3组运动区域是根据第3个采样图像和第4个采样图像获得的,第3组运动区域包括第3个采样图像对应的运动区域和第4个采样图像对应的运动区域。The first group of motion regions is obtained according to the first sampled image and the second sampled image, and the first group of motion regions includes a motion region corresponding to the first sampled image and a motion region corresponding to the second sampled image. The second group of motion regions is obtained according to the second sampled image and the third sampled image, and the third group of motion regions includes a motion region corresponding to the second sampled image and a motion region corresponding to the third sampled image. The third group of motion areas is obtained according to the third sampled image and the fourth sampled image, and the third group of motion areas includes the motion area corresponding to the third sampled image and the motion area corresponding to the fourth sampled image.
应理解的是,上述第1组运动区域中包括的第2个采样图像对应的运动区域,与第2组运动区域中包括的第2个采样图像对应的运动区域不同,因为,第1组运动区域中包括的第2个采样图像对应的运动区域,是根据第1个采样图像和第2个采样图像获得的,是指第2采样图像中第2采样图像相对于第1采样图像的运动区域。而第2组运动区域中包括的第2个采样图像对应的运动区域,是根据第2个采样图像和第3个采样图像获得的,是指第2采样图像中第3采样图像相对于第2采样图像的运动区域。同理,第2组运动区域中包括的第3个采样图像对应的运动区域,与第3组运动区域中包括的第3个采样图像对应的运动区域不同。It should be understood that the motion region corresponding to the second sampled image included in the first group of motion regions is different from the motion region corresponding to the second sampled image included in the second group of motion regions, because the first group of motion regions The motion area corresponding to the second sampled image included in the area is obtained from the first sampled image and the second sampled image, and refers to the motion area of the second sampled image relative to the first sampled image in the second sampled image . The motion area corresponding to the second sampled image included in the second group of motion areas is obtained from the second sampled image and the third sampled image, which means that the third sampled image in the second sampled image is relative to the second sampled image. Motion region of the sampled image. Similarly, the motion region corresponding to the third sampled image included in the second group of motion regions is different from the motion region corresponding to the third sampled image included in the third group of motion regions.
步骤120:处理器根据n-1组运动区域,确定n-1组运动区域分别对应的像素位移。Step 120: The processor determines the pixel displacements corresponding to the n-1 groups of motion regions respectively according to the n-1 groups of motion regions.
其中,第i组运动区域对应的像素位移是指第i+1张采样图像对应的运动区域相对第i张采样图像对应的运动区域的像素位移。The pixel displacement corresponding to the i-th group of motion regions refers to the pixel displacement of the motion region corresponding to the i+1-th sampled image relative to the motion region corresponding to the i-th sampled image.
步骤130:处理器根据n-1组运动区域分别对应的像素位移确定n-1组运动区域分别对应的运动信息。Step 130: The processor determines motion information corresponding to the n-1 groups of motion regions according to the pixel displacements corresponding to the n-1 groups of motion regions respectively.
n-1组运动区域分别对应的运动信息用于调整图像质量。例如,处理器可基于n-1组运动区域分别对应的运动信息控制摄影相机的曝光参数,例如减少曝光参数,以减轻曝光时间内物体的移动拖影导致的成像模糊。又例如,处理器可以结合n-1组运动区域分别对应的运动信息,采用图像后处理算法为图像进行补偿或修正处理。因此,通过利用n-1组运动区域分别对应的运动信息能够提高图像质量,提高成片率。The motion information corresponding to each of the n-1 groups of motion regions is used to adjust the image quality. For example, the processor may control the exposure parameters of the photographic camera based on the motion information corresponding to the n-1 groups of motion regions, for example, reduce the exposure parameters to reduce image blur caused by moving smears of objects within the exposure time. For another example, the processor may use an image post-processing algorithm to perform compensation or correction processing for the image in combination with the motion information corresponding to the n-1 groups of motion regions respectively. Therefore, by using the motion information corresponding to the n-1 groups of motion regions respectively, the image quality can be improved and the film formation rate can be improved.
针对步骤110~步骤130,下面以第i张采样图像和第i+1张采样图像为例,具体说明如何确定第i组运动区域、第i组运动区域对应的像素位移、以及第i组运动区域对应的运动信息。For steps 110 to 130, the following takes the i-th sampled image and the i+1-th sampled image as examples to specifically describe how to determine the i-th group of motion regions, the pixel displacements corresponding to the i-th group of motion regions, and the i-th group of motion regions. The motion information corresponding to the region.
第一,处理器首先确定第i组运动区域。First, the processor first determines the i-th group of motion regions.
针对第i张采样图像和第i+1张采样图像,处理器执行:For the i-th sampled image and the i+1-th sampled image, the processor executes:
(1)处理器将第i张采样图像和第i+1张采样图像均分割成M×N个矩形窗,M和N均为正整数。(1) The processor divides the i-th sampled image and the i+1-th sampled image into M×N rectangular windows, where M and N are both positive integers.
应理解的是,第i张采样图像中的M×N个矩形窗中的每个矩形窗与第i张采样图像中的M×N个矩形窗中的每个矩形窗大小相等,一一对应。It should be understood that each rectangular window in the M×N rectangular windows in the i-th sampled image is equal in size to each rectangular window in the M×N rectangular windows in the i-th sampled image, one-to-one correspondence. .
(2)计算M×N个第一相关系数,其中,第k个第一相关系数为第i张采样图像中第k个矩形窗与第i+1张采样图像中第k个矩形窗的相关系数,第k个第一相关系数为M×N个第一相关系数中的任一个第一相关系数,k为正整数。(2) Calculate M×N first correlation coefficients, where the kth first correlation coefficient is the correlation between the kth rectangular window in the ith sampled image and the kth rectangular window in the i+1th sampled image coefficient, the k-th first correlation coefficient is any one of the M×N first correlation coefficients, and k is a positive integer.
这里计算第一相关系数的相关系数算法可以为投影直方图法、图像直方图法、色彩特征法等,本申请对此不作限定。The correlation coefficient algorithm for calculating the first correlation coefficient here may be a projection histogram method, an image histogram method, a color feature method, etc., which is not limited in this application.
在一种可能的设计中,为了降低处理器的运算量和功耗,处理器可采用投影直方图法计算两个矩形窗的相关系数。因此,第k个第一相关系数可以为第i张采样图像中第k个矩形窗在水平方向上的投影直方图与第i+1张采样图像中第k个矩形窗在水平方向上的投影直方图的相关系数,与第i张采样图像中第k个矩形窗在垂直方向上的投影直方图与第i+1张采样图像中第k个矩形窗在垂直方向上的投影直方图的相关系数之和。In a possible design, in order to reduce the computational complexity and power consumption of the processor, the processor may use the projection histogram method to calculate the correlation coefficient of the two rectangular windows. Therefore, the k-th first correlation coefficient can be the projection histogram of the k-th rectangular window in the i-th sampled image in the horizontal direction and the projection of the k-th rectangular window in the i+1-th sampled image in the horizontal direction The correlation coefficient of the histogram, the correlation between the projection histogram of the kth rectangular window in the i-th sampled image in the vertical direction and the projection histogram of the k-th rectangular window in the i+1th sampled image in the vertical direction sum of coefficients.
(3)若第k个第一相关系数小于等于第一预设相关系数阈值,即第i张采样图像中第k个矩形窗与第i+1张采样图像中第k个矩形窗相差较多,可以判断第k个矩形窗为运动窗,因此,处理器确定第i张采样图像对应的运动区域包括第i张采样图像中的第k个矩形窗,第i+1张采样图像对应的运动区域包括第i+1张采样图像中的第k个矩形窗。(3) If the k-th first correlation coefficient is less than or equal to the first preset correlation coefficient threshold, that is, the k-th rectangular window in the i-th sampling image and the k-th rectangular window in the i+1-th sampling image are quite different , it can be judged that the kth rectangular window is a motion window, therefore, the processor determines that the motion region corresponding to the i-th sampled image includes the k-th rectangular window in the i-th sampled image, and the motion corresponding to the i+1-th sampled image The region includes the kth rectangular window in the i+1th sampled image.
采用上述方法,处理器遍历M×N个第一相关系数,将每个第一相关系数与第一相关系数进行比较,并将其中小于等于第一预设相关系数阈值的所有第一相关系数分别对应的矩形窗均作为运动窗,进而确定第i组运动区域,其中,第i张采样图像对应的运动区域包括的矩形窗与第i组运动区域中的第i+1张采样图像对应的运动区域包括的矩形窗一一对应。Using the above method, the processor traverses M×N first correlation coefficients, compares each first correlation coefficient with the first correlation coefficient, and separates all the first correlation coefficients less than or equal to the first preset correlation coefficient threshold Corresponding rectangular windows are all used as motion windows, and then determine the i-th group of motion regions, wherein, the motion region corresponding to the i+1th sampled image in the i-th sampled image corresponding motion region includes the rectangular window and the i-th group of motion regions. The rectangular windows included in the region correspond one-to-one.
因此,通过上述方法,处理器可以确定第i+1张采样图像相对第i张采样图像存在运动物体,并确定出该运动物体所在区域。Therefore, through the above method, the processor can determine that there is a moving object in the i+1 th sampled image relative to the ith sampled image, and determine the region where the moving object is located.
第二,处理器确定第i组运动区域对应的像素位移。Second, the processor determines the pixel displacement corresponding to the i-th group of motion regions.
针对第i组运动区域,第i张采样图像对应的运动区域包括m个矩形窗,第i张采样图像对应的运动区域包括m个矩形窗,处理器执行:For the ith group of motion regions, the motion region corresponding to the ith sampled image includes m rectangular windows, and the motion region corresponding to the ith sampled image includes m rectangular windows, and the processor executes:
(1)处理器采用预设算法计算m个像素位移,其中,第j个像素位移为第i+1张采样图像对应的运动区域中与第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗相对第i张采样图像对应的运动区域中第j个矩形窗的像素位移,m和j均为正整数。(1) The processor uses a preset algorithm to calculate m pixel displacements, where the jth pixel displacement is the jth rectangle in the motion region corresponding to the ith sampled image in the motion region corresponding to the i+1th sampled image The pixel displacement of the window-matched rectangular window relative to the j-th rectangular window in the motion region corresponding to the i-th sampled image, where m and j are both positive integers.
这里的预设算法可以为SAD扫描算法,或者其他算法,本申请对此不作限定。The preset algorithm here may be the SAD scanning algorithm, or other algorithms, which are not limited in this application.
如图2(a)和图2(b)所示,为采用SAD扫描算法在x轴方向(水平方向)上确定在第i+1张图像中与第i张采样图像中第j个矩形窗匹配的矩形窗的示意图。图2(a)为第i张采样图像中第j个矩形窗在x轴方向上的投影直方图。图2(b)为第i+1张采样图像中从第j-1个矩形窗至第j+1个矩形窗分别对应的在x轴方向上的投影直方图。虚线框为扫描框,其大小与矩形框相同,图2(b)中虚线框所划定的矩形框为在x轴方向上第i+1张图像中与第i张采样图像中第j个矩形窗匹配的矩形窗。因此,根据该虚线框可以确定相对第i+1张图像,第i张采样图像中的第j个矩形窗在x轴方向上的像素位移分量。As shown in Figure 2(a) and Figure 2(b), in order to use the SAD scanning algorithm to determine in the x-axis direction (horizontal direction) the j-th rectangular window in the i+1-th image and the i-th sampling image Schematic diagram of the matched rectangular window. Fig. 2(a) is the projection histogram of the jth rectangular window in the x-axis direction in the ith sampled image. Fig. 2(b) is the projection histogram corresponding to the x-axis direction from the j-1th rectangular window to the j+1th rectangular window in the i+1th sampled image. The dotted frame is the scanning frame, and its size is the same as that of the rectangular frame. The rectangular frame delineated by the dotted frame in Figure 2(b) is the i+1 image in the x-axis direction and the j-th sampled image in the i-th image. A rectangular window that matches the rectangular window. Therefore, relative to the i+1 th image, the pixel displacement component of the j th rectangular window in the i th sampled image in the x-axis direction can be determined according to the dotted frame.
(2)处理器根据m个像素位移确定第i组运动区域对应的像素位移。(2) The processor determines the pixel displacement corresponding to the i-th group of motion regions according to the m pixel displacements.
根据上述m个像素位移可以求出在x轴方向上的像素位移分量平均值和在y轴方向上的像素位移分量平均值,进而确定第i组运动区域对应的像素位移。According to the above m pixel displacements, the average value of pixel displacement components in the x-axis direction and the average value of pixel displacement components in the y-axis direction can be obtained, and then the pixel displacement corresponding to the i-th group of motion regions can be determined.
第二,处理器确定第i组运动区域对应的运动信息。Second, the processor determines motion information corresponding to the i-th group of motion regions.
第i组运动区域对应的运动信息包括以下至少一种:第i组运动区域对应的像素位移,第i组运动区域对应的运动速度标识、第i组运动区域对应的运动方向标识。The motion information corresponding to the i-th group of motion areas includes at least one of the following: pixel displacement corresponding to the i-th group of motion areas, a motion speed identifier corresponding to the i-th group of motion areas, and a motion direction identifier corresponding to the i-th group of motion areas.
其中,第i组运动区域对应的运动速度标识是根据第i组运动区域对应的像素位移的大小落入的预设位移大小阈值范围对应的运动速度标识。The motion speed identifier corresponding to the ith group of motion regions is a motion speed identifier corresponding to a preset displacement size threshold range within which the size of the pixel displacement corresponding to the ith group of motion regions falls.
例如,1个像素~5个像素对应运动速度标识1,5个像素~8个像素对应运动速度标识2,8个像素以上对应运动速度标识3。假设第i组运动区域对应的像素位移的大小为3,则第i组运动区域对应的运动速度标识为运动速度标识1。For example, 1 pixel to 5 pixels corresponds to motion speed identification 1, 5 to 8 pixels corresponds to motion speed identification 2, and more than 8 pixels corresponds to motion speed identification 3. Assuming that the size of the pixel displacement corresponding to the ith group of motion areas is 3, the motion speed identifier corresponding to the ith group of motion areas is the motion speed identifier 1.
第i组运动区域对应的运动方向标识是根据第i组运动区域对应的像素位移的方向落入的预设角度范围对应的运动方向标识。The motion direction identifier corresponding to the ith group of motion areas is a motion direction identifier corresponding to a preset angle range within which the direction of the pixel displacement corresponding to the ith group of motion areas falls.
例如,将360度划分为12个角度区间,每30度对应一个运动方向标识,共有12个运动方向标识。假设第i组运动区域对应的像素位移的方向为45度,则第i组运动区域对应的运动速度标识为运动速度标识2。For example, 360 degrees are divided into 12 angle intervals, each 30 degrees corresponds to a movement direction mark, and there are 12 movement direction marks in total. Assuming that the direction of the pixel displacement corresponding to the ith group of motion areas is 45 degrees, the motion speed identifier corresponding to the ith group of motion areas is motion speed identifier 2.
因此,本申请能够提供准确的物体运动信息,能够确定运动速度和运动方向。Therefore, the present application can provide accurate object motion information, and can determine the motion speed and motion direction.
进一步地,为了确保上述结果的准确性,考虑到SAD扫描算法对应的扫描范围,例如,扫描范围一般为3~5个矩形窗,因此,当物体运动速度较快时,超出扫描范围时,可能导致运动信息不准确。本申请提供一种判断物体是否为高速运动的方法。Further, in order to ensure the accuracy of the above results, considering the scanning range corresponding to the SAD scanning algorithm, for example, the scanning range is generally 3 to 5 rectangular windows. Therefore, when the object moves faster and exceeds the scanning range, it may be resulting in inaccurate exercise information. The present application provides a method for judging whether an object is moving at a high speed.
具体的,处理器采用SAD扫描算法计算出m个像素位移后,若m个像素位移满足以下第一判断准则和第二判断准则中的至少一个判断准则,第i组运动区域对应的运动信息包括第一标识,第一标识用于指示第i组运动区域处于高速运动状态。Specifically, after the processor uses the SAD scanning algorithm to calculate the m pixel displacements, if the m pixel displacements satisfy at least one of the following first judgment criterion and second judgment criterion, the motion information corresponding to the i-th group of motion regions includes: The first identifier, where the first identifier is used to indicate that the i-th group of motion areas is in a high-speed motion state.
第一判断准则是指m个第二相关系数中小于等于第二预设相关系数阈值的数目大于等于第一预设数目;The first judgment criterion refers to that the number of m second correlation coefficients less than or equal to the second preset correlation coefficient threshold is greater than or equal to the first preset number;
其中,第j个第二相关系数为第i+1张采样图像对应的运动区域中与第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗与第i张采样图像对应的运动区域中第j个矩形窗的相关系数。Among them, the jth second correlation coefficient is the rectangular window that matches the jth rectangular window in the motion region corresponding to the ith sampled image in the motion region corresponding to the ith sampled image and the ith sampled image. Correlation coefficient of the jth rectangular window in the motion region.
应理解的是,第二相关系数的算法可以与第一相关系数的算法相同或不同,第二预设相关系数阈值可以与第一预设相关系数阈值相同或不同,重复之处不再赘述。It should be understood that the algorithm of the second correlation coefficient may be the same as or different from the algorithm of the first correlation coefficient, and the second preset correlation coefficient threshold may be the same as or different from the first preset correlation coefficient threshold, and the repetition will not be repeated.
第二判断准则是指m个像素位移的方向中不同方向的数目大于等于第二预设数目。The second judgment criterion refers to that the number of different directions among the m pixel displacement directions is greater than or equal to the second preset number.
例如,m=10,10个第二相关系数中小于等于第二预设相关系数阈值的数目为6个大于等于第一预设数目5,且10个像素位移的方向中不同方向的数目为7大于等于第二预设数目6,此时可以确定第i组运动区域处于高速运动状态,第i组运动区域对应的运动信息包括第一标识,此时可以不携带其他信息。For example, m=10, the number of 10 second correlation coefficients less than or equal to the second preset correlation coefficient threshold is 6 and greater than or equal to the first preset number of 5, and the number of different directions among the 10 pixel displacement directions is 7 If it is greater than or equal to the second preset number of 6, it can be determined that the i-th group of motion areas is in a high-speed motion state, and the motion information corresponding to the i-th group of motion areas includes the first identifier, and other information may not be carried at this time.
因此,通过上述判断能够弥补快速运动场景下SAD扫描算法发生计算错误的不足,保证物体运动信息的准确性。Therefore, the above judgment can make up for the deficiency of the calculation error of the SAD scanning algorithm in the fast motion scene, and ensure the accuracy of the object motion information.
此外,为了确保上述结果的稳定性,在一种可能的设计中,在确定n-1组运动区域分别对应的运动信息之前,处理器可以将n-1组运动区域分别对应的像素位移执行低通滤波,以消除随机噪声和奇异值对计算结果造成的影响。In addition, in order to ensure the stability of the above results, in a possible design, before determining the motion information corresponding to the n-1 groups of motion regions, the processor may perform low Pass filtering to eliminate the influence of random noise and singular values on the calculation results.
在另一种可能的设计中,在确定第i组运动区域分别对应的运动信息之后,若第i组运动区域对应的像素位移的大小与第一阈值的差值的绝对值小于等于波动阈值,处理器可以调整第一阈值,消除了多个像素位移的大小位于阈值附近发生的运动速度标识频繁抖动的问题。In another possible design, after determining the motion information corresponding to the ith group of motion regions, if the absolute value of the difference between the size of the pixel displacement corresponding to the ith group of motion regions and the first threshold is less than or equal to the fluctuation threshold, The processor can adjust the first threshold, which eliminates the problem of frequent jittering of the movement speed marker when the magnitude of the displacement of multiple pixels is located near the threshold.
例如,初始设置1个像素~5个像素对应运动速度标识1,5个像素~8个像素对应运动速度标识2,波动阈值为1,第1组运动区域对应的像素位移的大小为4个像素,4<5,第1组运动区域对应运动速度标识为运动速度标识1。第1组运动区域对应的像素位移的大小距离运动速度标识1的阈值上限的差值的绝对值为1,5-4=1,此时该差值的绝对值等于波动阈值1,则处理器调整运动速度标识1的阈值上限为5+1=6。第2组运动区域对应的像素位移的大小为5个像素,5<6,第2组运动区域对应运动速度标识为运动速度标识1,第2组运动区域对应的像素位移的大小距离最新的运动速度标识1的阈值上限的差值的绝对值为1,6-5=1,此时该差值的绝对值等于波动阈值1,则处理器调整运动速度标识1的阈值上限为6+1=7。第3组运动区域对应的像素位移的大小为5个像素,5<7,第3组运动区域对应运动速度标识为运动速度标识1。第3组运动区域对应的像素位移的大小距离最新的运动速度标识1的阈值上限的差值的绝对值为2,7-5=2,此时该差值的绝对值大于波动阈值1,则处理器不调整运动速度标识1的阈值上限,运动速度标识1的阈值上限维持为7。For example, the initial setting of 1 to 5 pixels corresponds to the motion speed flag 1, 5 to 8 pixels corresponds to the motion speed flag 2, the fluctuation threshold is 1, and the size of the pixel displacement corresponding to the first group of motion areas is 4 pixels , 4<5, the motion speed identifier corresponding to the first group of motion regions is motion speed identifier 1. The absolute value of the difference between the size of the pixel displacement corresponding to the first group of motion areas and the upper threshold of the motion speed flag 1 is 1, and 5-4=1. At this time, the absolute value of the difference is equal to the fluctuation threshold 1, then the processor The upper limit of the threshold for adjusting the motion speed flag 1 is 5+1=6. The size of the pixel displacement corresponding to the second group of motion areas is 5 pixels, 5<6, the motion speed corresponding to the second group of motion areas is identified as motion speed flag 1, and the size of the pixel displacement corresponding to the second group of motion areas is far from the latest motion The absolute value of the difference between the upper limit of the threshold value of the speed marker 1 is 1, and 6-5=1. At this time, the absolute value of the difference value is equal to the fluctuation threshold value 1, and the processor adjusts the upper limit of the threshold value of the motion speed marker 1 to 6+1= 7. The size of the pixel displacement corresponding to the third group of motion areas is 5 pixels, 5<7, and the motion speed identifier corresponding to the third group of motion areas is the motion speed identifier 1. The absolute value of the difference between the size of the pixel displacement corresponding to the third group of motion regions and the upper threshold of the latest motion speed indicator 1 is 2, and 7-5=2. At this time, the absolute value of the difference is greater than the fluctuation threshold 1, then The processor does not adjust the upper limit of the threshold value of the motion speed flag 1, and the upper limit of the threshold value of the motion speed flag 1 is maintained at 7.
又例如,初始设置1个像素~5个像素对应运动速度标识1,5个像素~8个像素对应运动速度标识2,波动阈值为1,第1组运动区域对应的像素位移的大小为6个像素,5<6,第1组运动区域对应运动速度标识为运动速度标识2。第1组运动区域对应的像素位移的大小距离运动速度标识1的阈值上限的差值的绝对值为1,6-5=1,此时该差值的绝对值等于波动阈值1,则处理器调整运动速度标识1的阈值上限为5-1=4。此外,第1组运动区域对应的像素位移的大小距离运动速度标识2的阈值上限的差值的绝对值为2,此时该差值的绝对值大于波动阈值1,则处理器不调整运动速度标识2的阈值上限。第2组运动区域对应的像素位移的大小为5个像素,4<5,第2组运动区域对应运动速度标识为运动速度标识2,第2组运动区域对应的像素位移的大小距离最新的运动速度标识1的阈值上限的差值的绝对值为1,5-4=1,此时该差值的绝对值等于波动阈值1,则处理器调整运动速度标识1的阈值上限为4-1=3。第3组运动区域对应的像素位移的大小为5个像素,3<5,第3组运动区域对应运动速度标识为运动速度标识2。第3组运动区域对应的像素位移的大小距离最新的运动速度标识1的阈值上限的差值的绝对值为2,5-3=2,此时该差值的绝对值大于波动阈值1,则处理器不调整运动速度标识1的阈值上限,运动速度标识1的阈值上限维持为3。For another example, the initial setting of 1 to 5 pixels corresponds to the motion speed flag 1, 5 to 8 pixels corresponds to the motion speed flag 2, the fluctuation threshold is 1, and the size of the pixel displacement corresponding to the first group of motion regions is 6 Pixels, 5<6, the first group of motion regions corresponding to the motion speed is identified as the motion speed flag 2. The absolute value of the difference between the size of the pixel displacement corresponding to the first group of motion regions and the upper threshold of the motion speed flag 1 is 1, 6-5=1, and the absolute value of the difference is equal to the fluctuation threshold 1, then the processor The upper limit of the threshold for adjusting the motion speed flag 1 is 5-1=4. In addition, the absolute value of the difference between the size of the pixel displacement corresponding to the first group of motion regions and the upper threshold of the motion speed flag 2 is 2. At this time, the absolute value of the difference is greater than the fluctuation threshold of 1, and the processor does not adjust the motion speed. Identifies the upper threshold of 2. The size of the pixel displacement corresponding to the second group of motion areas is 5 pixels, 4<5, the motion speed corresponding to the second group of motion areas is marked as motion speed mark 2, and the size of the pixel displacement corresponding to the second group of motion areas is far from the latest motion The absolute value of the difference between the upper limit of the threshold value of the speed marker 1 is 1, and 5-4=1. At this time, the absolute value of the difference is equal to the fluctuation threshold value 1, and the processor adjusts the upper limit of the threshold value of the motion speed marker 1 to 4-1= 3. The size of the pixel displacement corresponding to the third group of motion areas is 5 pixels, 3<5, and the motion speed identifier corresponding to the third group of motion areas is motion speed identifier 2. The absolute value of the difference between the size of the pixel displacement corresponding to the third group of motion areas and the upper threshold of the latest motion speed indicator 1 is 2, 5-3=2, and the absolute value of the difference is greater than the fluctuation threshold 1, then The processor does not adjust the upper limit of the threshold value of the motion speed flag 1, and the upper limit of the threshold value of the motion speed flag 1 is maintained at 3.
因此,通过动态调整阈值能够消除多个像素位移的大小位于阈值附近发生的运动速度标识频繁抖动,保证输出结果的稳定性。Therefore, by dynamically adjusting the threshold, it is possible to eliminate frequent jitters of the motion speed markers that occur when the displacement of multiple pixels is located near the threshold, thereby ensuring the stability of the output result.
参阅图3所示,为处理器确定两张相邻的采样图像对应的运动信息的具体流程图之一。Referring to FIG. 3 , it is one of the specific flowcharts for the processor to determine motion information corresponding to two adjacent sampled images.
S301:将两张相邻的采样图像,分别分割为M×N个矩形窗,针对每张采样图像中的每个矩形窗分别做x轴方向和y轴方向的投影直方图。S301 : Divide the two adjacent sampling images into M×N rectangular windows, respectively, and create projection histograms in the x-axis direction and the y-axis direction for each rectangular window in each sampled image.
S302:计算M×N个第一相关系数。S302: Calculate M×N first correlation coefficients.
其中,每个第一相关系数为这两张相邻的采样图像中相同位置的矩形窗在水平方向上的投影直方图的相关系数,与在垂直方向上的投影直方图的相关系数之和。Wherein, each first correlation coefficient is the sum of the correlation coefficient of the projected histogram of the rectangular window at the same position in the two adjacent sampling images in the horizontal direction and the correlation coefficient of the projected histogram in the vertical direction.
S303:判断当前矩形窗是否为运动窗,若当前矩形窗对应的第一相关系数小于等于第一预设相关系数阈值,执行S304,若当前矩形窗对应的第一相关系数大于第一预设相关系数阈值,执行S305。S303: Determine whether the current rectangular window is a motion window, if the first correlation coefficient corresponding to the current rectangular window is less than or equal to the first preset correlation coefficient threshold, execute S304, and if the first correlation coefficient corresponding to the current rectangular window is greater than the first preset correlation Coefficient threshold, execute S305.
S304:计算当前矩形窗对应的像素位移。S304: Calculate the pixel displacement corresponding to the current rectangular window.
S305:判断当前矩形窗是否为最后一个矩形窗,若是执行306,否则将当前矩形窗指示的矩形窗移动至下一个矩形窗,返回S303。S305: Determine whether the current rectangular window is the last rectangular window, and if so, execute 306; otherwise, move the rectangular window indicated by the current rectangular window to the next rectangular window, and return to S303.
S306:综合所有运动窗分别对应的像素位移输出这两张相邻的采样图像对应的运动速度标识和对应的运动方向标识。S306: Synthesize the pixel displacements corresponding to all the motion windows and output the motion speed identifiers and the corresponding motion direction identifiers corresponding to the two adjacent sampling images.
通过如图3所示的实施例,处理器可以实现低运算量低功耗检测出物体运动,确定两张相邻的采样图像对应的运动信息。With the embodiment shown in FIG. 3 , the processor can detect object motion with low computational complexity and low power consumption, and determine motion information corresponding to two adjacent sampled images.
参阅图4所示,为处理器确定两张相邻的采样图像对应的运动信息的具体流程图之二。Referring to FIG. 4 , it is the second specific flow chart for the processor to determine the motion information corresponding to two adjacent sampled images.
S401:将两张相邻的采样图像,分别分割为M×N个矩形窗。S401: Divide the two adjacent sampling images into M×N rectangular windows respectively.
S402:确定运动窗数目为m个,以及m个像素位移。S402: Determine the number of motion windows to be m, and the displacement of m pixels.
其中,m为正整数。where m is a positive integer.
S403:计算m个第二相关系数。S403: Calculate m second correlation coefficients.
S404:统计m个像素位移的方向中不同方向的数目。S404: Count the number of different directions in the directions of m pixel displacements.
S405:判断m个第二相关系数中小于等于第二预设相关系数阈值的数目是否大于等于第一预设数目,且m个像素位移的方向中不同方向的数目是否大于等于第二预设数目,若是,执行S406,否则执行S407。S405: Determine whether the number of m second correlation coefficients less than or equal to the second preset correlation coefficient threshold is greater than or equal to the first preset number, and whether the number of different directions in the directions of m pixel displacements is greater than or equal to the second preset number , if yes, go to S406, otherwise go to S407.
S406:输出第一标识,结束流程。S406: Output the first identifier, and end the process.
S407:综合m个像素位移输出这两张相邻的采样图像对应的运动速度标识和对应的运动方向标识。S407: Combine the m pixel displacements and output the motion speed identifiers and the corresponding motion direction identifiers corresponding to the two adjacent sampling images.
因此,通过如图4所示的实施例,能够对图3所示的实施例获得的结果进行验证,进而弥补快速运动场景下SAD扫描算法发生计算错误的不足,保证物体运动信息的准确性。Therefore, through the embodiment shown in FIG. 4 , the results obtained by the embodiment shown in FIG. 3 can be verified, thereby making up for the insufficiency of the calculation error of the SAD scanning algorithm in the fast motion scene, and ensuring the accuracy of the object motion information.
参阅图5所示,本申请提供一种调整图像质量的装置500,该装置包括:Referring to FIG. 5 , the present application provides an
采样单元501,用于将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像,其中,第i张图像对应第i张采样图像,所述第i张图像为所述n张图像中的任一张图像,i和n均为正整数;The
处理单元502,用于根据所述n张采样图像中每相邻两个采样图像确定一组运动区域,获得n-1组运动区域,其中,第i组运动区域是根据所述第i个采样图像和第i+1个采样图像获得的,所述第i组运动区域包括所述第i个采样图像对应的运动区域和所述第i+1个采样图像对应的运动区域;The
计算单元503,用于根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移,其中,所述第i组运动区域对应的像素位移是指所述第i+1张采样图像对应的运动区域相对所述第i张采样图像对应的运动区域的像素位移;The
分析单元504,用于根据所述n-1组运动区域分别对应的像素位移确定所述n-1组运动区域分别对应的运动信息,所述n-1组运动区域分别对应的运动信息用于调整图像质量。The
在一种可能的设计中,所述第i张采样图像是指在所述第i张图像的水平方向上经预设滤波处理后执行下采样,且在所述第i张图像的垂直方向上执行下采样后获得的图像。In a possible design, the i-th sampled image refers to performing downsampling after a preset filtering process in the horizontal direction of the i-th image, and in the vertical direction of the i-th image Image obtained after performing downsampling.
在一种可能的设计中,所述预设滤波处理为无限脉冲响应滤波器IIR filter,或者有限脉冲响应滤波器FIR filter。In a possible design, the preset filtering process is an infinite impulse response filter IIR filter, or a finite impulse response filter FIR filter.
在一种可能的设计中,根据所述n张采样图像中每相邻两个采样图像确定一组运动区域时,所述处理单元502,具体用于:In a possible design, when a group of motion regions is determined according to every two adjacent sampled images in the n sampled images, the
针对所述第i张采样图像和所述第i+1张采样图像,执行:For the i-th sampled image and the i+1-th sampled image, execute:
将所述第i张采样图像和所述第i+1张采样图像均分割成M×N个矩形窗,M和N均为正整数;Both the i-th sampled image and the i+1-th sampled image are divided into M×N rectangular windows, where M and N are both positive integers;
计算M×N个第一相关系数,其中,第k个第一相关系数为所述第i张采样图像中第k个矩形窗与所述第i+1张采样图像中第k个矩形窗的相关系数,所述第k个第一相关系数为所述M×N个第一相关系数中的任一个第一相关系数,k为正整数;Calculate M×N first correlation coefficients, where the k-th first correlation coefficient is the difference between the k-th rectangular window in the i-th sampled image and the k-th rectangular window in the i+1-th sampled image a correlation coefficient, the kth first correlation coefficient is any one of the M×N first correlation coefficients, and k is a positive integer;
根据所述M×N个第一相关系数中小于等于第一预设相关系数阈值的第一相关系数对应的矩形窗,确定所述第i组运动区域,其中,所述第i张采样图像对应的运动区域包括的矩形窗与所述第i组运动区域中的所述第i+1张采样图像对应的运动区域包括的矩形窗一一对应。The ith group of motion regions is determined according to the rectangular window corresponding to the first correlation coefficient less than or equal to the first preset correlation coefficient threshold among the M×N first correlation coefficients, wherein the ith sampled image corresponds to The rectangular window included in the motion region of t corresponds to the rectangular window included in the motion region corresponding to the i+1 th sampled image in the i th group of motion regions in a one-to-one correspondence.
在一种可能的设计中,所述第k个第一相关系数为所述第i张采样图像中第k个矩形窗在水平方向上的投影直方图与所述第i+1张采样图像中第k个矩形窗在水平方向上的投影直方图的相关系数,与所述第i张采样图像中第k个矩形窗在垂直方向上的投影直方图与所述第i+1张采样图像中第k个矩形窗在垂直方向上的投影直方图的相关系数之和。In a possible design, the k-th first correlation coefficient is the projection histogram of the k-th rectangular window in the i-th sampled image in the horizontal direction and the i+1-th sampled image The correlation coefficient of the projection histogram of the kth rectangular window in the horizontal direction and the projection histogram of the kth rectangular window in the vertical direction in the i-th sampling image and the i+1-th sampling image The sum of the correlation coefficients of the projected histograms of the kth rectangular window in the vertical direction.
在一种可能的设计中,根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移时,所述计算单元503,具体用于:In a possible design, when determining the pixel displacements corresponding to the n-1 groups of motion regions according to the n-1 groups of motion regions, the
针对所述第i组运动区域,所述第i张采样图像对应的运动区域包括m个矩形窗,所述第i+1张采样图像对应的运动区域包括m个矩形窗,执行:For the i-th group of motion regions, the motion region corresponding to the i-th sampled image includes m rectangular windows, and the motion region corresponding to the i+1-th sampled image includes m rectangular windows, and execute:
采用预设算法计算m个像素位移,其中,第j个像素位移为所述第i+1张采样图像对应的运动区域中与所述第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗相对所述第i张采样图像对应的运动区域中第j个矩形窗的像素位移,m和j均为正整数;A preset algorithm is used to calculate m pixel displacements, where the jth pixel displacement is the jth rectangular window in the motion region corresponding to the ith sampled image in the motion region corresponding to the i+1th sampled image The pixel displacement of the jth rectangular window in the motion region corresponding to the i-th sampled image of the matched rectangular window, where m and j are both positive integers;
根据m个像素位移确定所述第i组运动区域对应的像素位移。The pixel displacement corresponding to the i-th group of motion regions is determined according to the m pixel displacements.
在一种可能的设计中,所述第i组运动区域对应的运动信息包括以下至少一种:所述第i组运动区域对应的像素位移,所述第i组运动区域对应的运动速度标识、所述第i组运动区域对应的运动方向标识;In a possible design, the motion information corresponding to the ith group of motion areas includes at least one of the following: a pixel displacement corresponding to the ith group of motion areas, a motion speed identifier corresponding to the ith group of motion areas, The motion direction identification corresponding to the i-th group of motion areas;
其中,所述第i组运动区域对应的运动速度标识是根据所述第i组运动区域对应的像素位移的大小落入的预设位移大小阈值范围对应的运动速度标识;Wherein, the motion speed identifier corresponding to the i-th group of motion areas is a motion speed identifier corresponding to a preset displacement size threshold range that falls according to the size of the pixel displacement corresponding to the i-th group of motion areas;
所述第i组运动区域对应的运动方向标识是根据所述第i组运动区域对应的像素位移的方向落入的预设角度范围对应的运动方向标识。The motion direction identifier corresponding to the i-th group of motion areas is a motion direction identifier corresponding to a preset angle range within which the direction of the pixel displacement corresponding to the i-th group of motion areas falls.
在一种可能的设计中,若m个像素位移满足以下第一判断准则和第二判断准则中的至少一个判断准则,所述第i组运动区域对应的运动信息包括第一标识,所述第一标识用于指示所述第i组运动区域处于高速运动状态;In a possible design, if the m pixel displacements satisfy at least one of the following first judgment criterion and second judgment criterion, the motion information corresponding to the i-th group of motion regions includes a first identifier, and the i-th group of motion regions A flag is used to indicate that the i-th group of motion areas is in a high-speed motion state;
所述第一判断准则是指m个第二相关系数中小于等于第二预设相关系数阈值的数目大于等于第一预设数目;The first judgment criterion refers to that the number of m second correlation coefficients less than or equal to the second preset correlation coefficient threshold is greater than or equal to the first preset number;
其中,第j个第二相关系数为所述第i+1张采样图像对应的运动区域中与所述第i张采样图像对应的运动区域中第j个矩形窗匹配的矩形窗与所述第i张采样图像对应的运动区域中第j个矩形窗的相关系数。Wherein, the jth second correlation coefficient is the rectangular window that matches the jth rectangular window in the motion region corresponding to the i+1th sampled image and the jth rectangular window in the motion region corresponding to the ith sampled image and the The correlation coefficient of the jth rectangular window in the motion region corresponding to the i sampled images.
所述第二判断准则是指所述m个像素位移的方向中不同方向的数目大于等于第二预设数目。The second judgment criterion refers to that the number of different directions in the displacement directions of the m pixels is greater than or equal to a second preset number.
在一种可能的设计中,在确定所述n-1组运动区域分别对应的运动信息之前,所述分析单元504还用于:In a possible design, before determining the motion information corresponding to the n-1 groups of motion regions, the
将所述n-1组运动区域分别对应的像素位移执行低通滤波。Perform low-pass filtering on the pixel displacements corresponding to the n-1 groups of motion regions respectively.
在一种可能的设计中,在确定所述n-1组运动区域分别对应的运动信息之后,所述分析单元504还用于:In a possible design, after determining the motion information corresponding to the n-1 groups of motion regions, the
若所述n-1组运动区域分别对应的像素位移的大小与第一阈值的差值的绝对值小于等于波动阈值,调整所述第一阈值。If the absolute value of the difference between the size of the pixel displacement corresponding to the n-1 groups of motion regions and the first threshold value is less than or equal to the fluctuation threshold value, the first threshold value is adjusted.
应理解以上各个单元的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且这些单元可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可以部分单元以软件通过处理元件调用的形式实现,部分单元以硬件的形式实现。例如处理单元可以为单独设立的处理元件,也可以集成在某一个芯片中实现,此外,也可以以程序的形式存储于存储器中,由某一个处理元件调用并执行该单元的功能。其它单元的实现与之类似。此外这些单元全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件可以是一种集成电路,具有信号的处理能力。在实现过程中,上述方法的各步骤或以上各个单元可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。It should be understood that the division of the above units is only a division of logical functions, and in actual implementation, all or part of them may be integrated into a physical entity, or they may be physically separated. And these units can all be implemented in the form of software calling through the processing element; also can all be implemented in the form of hardware; some units can also be implemented in the form of software calling through the processing element, and some units can be implemented in the form of hardware. For example, the processing unit can be a separately established processing element, or can be integrated in a certain chip to realize, in addition, it can also be stored in the memory in the form of a program, and the function of the unit can be called and executed by a certain processing element. The implementation of other units is similar. In addition, all or part of these units can be integrated together, and can also be implemented independently. The processing element described here may be an integrated circuit with signal processing capability. In the implementation process, each step of the above-mentioned method or each of the above-mentioned units may be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software.
基于以上实施例,参阅图6,本申请实施例还提供了一种调整图像质量的设备600,该调整图像质量的设备600包括:通信接口601,处理器602,存储器603。上述连续获得的n张图像通过所述通信接口601获取,分析单元确定的运动信息可通过通信接口601输出,采样单元的功能,处理单元的功能,计算单元的功能和分析单元的功能均可通过所述处理器602实现。Based on the above embodiments, referring to FIG. 6 , an embodiment of the present application further provides a
所述存储器603,用于存储计算机程序代码。所述存储器603可能包含随机存储记忆体(Random Access Memory,RAM)等,也可能还包括非易失性存储器,例如至少一个磁盘存储器。所述处理器602可以是中央处理器(central processing unit,CPU),网络处理器(network processor,NP),硬件芯片或者其任意组合。所述处理器602执行所述存储器603所存储的计算机程序代码,实现如图1所示的方法。The
综上所述,采用本申请提供一种调整图像质量的方法,处理器将相机预览过程中连续获得的n张图像分别执行采样处理,获得n张采样图像。通过采样处理获得低分辨的采样图像,处理器根据所述n张采样图像中每相邻两个采样图像确定一组运动区域,获得n-1组运动区域,即识别出运动区域,处理器根据所述n-1组运动区域,确定所述n-1组运动区域分别对应的像素位移,根据所述n-1组运动区域分别对应的像素位移确定所述n-1组运动区域分别对应的运动信息,所述n-1组运动区域分别对应的运动信息用于调整图像质量。To sum up, using the method for adjusting image quality provided by the present application, the processor performs sampling processing on n images continuously obtained during the camera preview process, respectively, to obtain n sampled images. A low-resolution sampled image is obtained through sampling processing. The processor determines a group of motion regions according to every two adjacent sampled images in the n sampled images, and obtains n-1 groups of motion regions, that is, the motion regions are identified. For the n-1 groups of motion areas, determine the pixel displacements corresponding to the n-1 groups of motion areas respectively, and determine the corresponding pixel displacements of the n-1 groups of motion areas according to the respective pixel displacements of the n-1 groups of motion areas. Motion information, the motion information respectively corresponding to the n-1 groups of motion regions is used to adjust the image quality.
因此,通过上述方法可以实现通过采样处理降低图像分辨率,获得采样图像,并根据采样图像确定运动信息,使得到的运动信息用于调整图像质量。该方法具有低运算量低功耗的特点。Therefore, through the above method, it is possible to reduce the image resolution through sampling processing, obtain a sampled image, and determine motion information according to the sampled image, so that the obtained motion information is used to adjust the image quality. This method has the characteristics of low computational complexity and low power consumption.
本领域内的技术人员应明白,本申请实施例可提供为方法、系统、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims (18)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710960703.2A CN109672818B (en) | 2017-10-16 | 2017-10-16 | A method and device for adjusting image quality |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710960703.2A CN109672818B (en) | 2017-10-16 | 2017-10-16 | A method and device for adjusting image quality |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109672818A CN109672818A (en) | 2019-04-23 |
CN109672818B true CN109672818B (en) | 2020-12-22 |
Family
ID=66140120
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710960703.2A Active CN109672818B (en) | 2017-10-16 | 2017-10-16 | A method and device for adjusting image quality |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109672818B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2136554A2 (en) * | 2008-06-20 | 2009-12-23 | Sony Corporation | Apparatus, method, and program for processing image |
CN102111613A (en) * | 2009-12-28 | 2011-06-29 | 中国移动通信集团公司 | Image processing method and device |
CN102714697A (en) * | 2010-11-11 | 2012-10-03 | 松下电器产业株式会社 | Image processing device, image processing method, and program for image processing |
CN103299342A (en) * | 2010-12-31 | 2013-09-11 | 诺基亚公司 | Method and apparatus for providing a mechanism for gesture recognition |
CN105611116A (en) * | 2015-12-23 | 2016-05-25 | 苏州科达科技股份有限公司 | Global motion vector estimating method, monitoring video stabilizing method, and device |
CN105678757A (en) * | 2015-12-31 | 2016-06-15 | 华南理工大学 | Object displacement measurement method |
CN106331518A (en) * | 2016-09-30 | 2017-01-11 | 北京旷视科技有限公司 | Image processing method and device and electronic system |
CN107231526A (en) * | 2017-06-09 | 2017-10-03 | 联想(北京)有限公司 | Image processing method and electronic equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4178480B2 (en) * | 2006-06-14 | 2008-11-12 | ソニー株式会社 | Image processing apparatus, image processing method, imaging apparatus, and imaging method |
JP4623111B2 (en) * | 2008-03-13 | 2011-02-02 | ソニー株式会社 | Image processing apparatus, image processing method, and program |
JP2011035737A (en) * | 2009-08-03 | 2011-02-17 | Olympus Corp | Imaging apparatus, electronic instrument, image processing device, and image processing method |
CN105279769B (en) * | 2015-07-16 | 2017-06-13 | 北京理工大学 | A kind of level particle filter tracking method for combining multiple features |
KR102474837B1 (en) * | 2015-09-14 | 2022-12-07 | 주식회사 한화 | Foreground area extracting method and apparatus |
-
2017
- 2017-10-16 CN CN201710960703.2A patent/CN109672818B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2136554A2 (en) * | 2008-06-20 | 2009-12-23 | Sony Corporation | Apparatus, method, and program for processing image |
CN102111613A (en) * | 2009-12-28 | 2011-06-29 | 中国移动通信集团公司 | Image processing method and device |
CN102714697A (en) * | 2010-11-11 | 2012-10-03 | 松下电器产业株式会社 | Image processing device, image processing method, and program for image processing |
CN103299342A (en) * | 2010-12-31 | 2013-09-11 | 诺基亚公司 | Method and apparatus for providing a mechanism for gesture recognition |
CN105611116A (en) * | 2015-12-23 | 2016-05-25 | 苏州科达科技股份有限公司 | Global motion vector estimating method, monitoring video stabilizing method, and device |
CN105678757A (en) * | 2015-12-31 | 2016-06-15 | 华南理工大学 | Object displacement measurement method |
CN106331518A (en) * | 2016-09-30 | 2017-01-11 | 北京旷视科技有限公司 | Image processing method and device and electronic system |
CN107231526A (en) * | 2017-06-09 | 2017-10-03 | 联想(北京)有限公司 | Image processing method and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN109672818A (en) | 2019-04-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110660090B (en) | Subject detection method and apparatus, electronic device, computer-readable storage medium | |
EP3480784B1 (en) | Image processing method, and device | |
US9998650B2 (en) | Image processing apparatus and image pickup apparatus for adding blur in an image according to depth map | |
CN102959586B (en) | Depth estimation device and depth estimation method | |
CN109194877B (en) | Image compensation method and apparatus, computer-readable storage medium, and electronic device | |
WO2020259474A1 (en) | Focus tracking method and apparatus, terminal device, and computer-readable storage medium | |
CN107948519A (en) | Image processing method, device and equipment | |
CN110661977B (en) | Subject detection method and apparatus, electronic device, computer-readable storage medium | |
CN111246089A (en) | Jitter compensation method and apparatus, electronic device, computer-readable storage medium | |
KR20180101466A (en) | Depth information acquisition method and apparatus, and image acquisition device | |
WO2019221013A4 (en) | Video stabilization method and apparatus and non-transitory computer-readable medium | |
CN105635559B (en) | Camera control method and device for terminal | |
CN109963080B (en) | Image acquisition method, device, electronic device and computer storage medium | |
US11375097B2 (en) | Lens control method and apparatus and terminal | |
JP6497987B2 (en) | Image processing apparatus, image processing method, program, and storage medium | |
WO2019105261A1 (en) | Background blurring method and apparatus, and device | |
CN111246100B (en) | Anti-shake parameter calibration method and device and electronic equipment | |
CN110796041A (en) | Subject identification method and apparatus, electronic device, computer-readable storage medium | |
CN110493522A (en) | Anti-fluttering method and device, electronic equipment, computer readable storage medium | |
CN110248101A (en) | Focusing method and device, electronic equipment and computer readable storage medium | |
JP5968379B2 (en) | Image processing apparatus and control method thereof | |
CN110689007B (en) | Subject recognition method and device, electronic equipment and computer-readable storage medium | |
CN116347056A (en) | Image focusing method, device, computer equipment and storage medium | |
JP2019062340A (en) | Image shake correction apparatus and control method | |
CN109672818B (en) | A method and device for adjusting image quality |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |