TW202217741A - Image processing method - Google Patents

Image processing method Download PDF

Info

Publication number
TW202217741A
TW202217741A TW109137956A TW109137956A TW202217741A TW 202217741 A TW202217741 A TW 202217741A TW 109137956 A TW109137956 A TW 109137956A TW 109137956 A TW109137956 A TW 109137956A TW 202217741 A TW202217741 A TW 202217741A
Authority
TW
Taiwan
Prior art keywords
image
mask
pixels
threshold
processing method
Prior art date
Application number
TW109137956A
Other languages
Chinese (zh)
Other versions
TWI783288B (en
Inventor
王立杰
Original Assignee
大陸商業成科技(成都)有限公司
大陸商業成光電(深圳)有限公司
英特盛科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商業成科技(成都)有限公司, 大陸商業成光電(深圳)有限公司, 英特盛科技股份有限公司 filed Critical 大陸商業成科技(成都)有限公司
Publication of TW202217741A publication Critical patent/TW202217741A/en
Application granted granted Critical
Publication of TWI783288B publication Critical patent/TWI783288B/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/646Circuits for processing colour signals for image enhancement, e.g. vertical detail restoration, cross-colour elimination, contour correction, chrominance trapping filters

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Sewing Machines And Sewing (AREA)
  • Ultra Sonic Daignosis Equipment (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

An image processing method is provided, comprising inputting an original image which is taken in a dark environment and includes a plurality of pixels arranged in a data array. Then, a histogram analysis is employed to traverse the plurality of pixels of the original image for determining a threshold value. At least one mask corresponding to the threshold value is generated, and the mask is applied to the original image to form a pre-processing image. Then, traverse the pixels of the pre-processing image and decide at least one extreme value thereof. Accordingly, adjust brightness of the pre-processing image based on the extreme value, and generate an output image after removing the mask. The output image can be further processed with a level smoothing procedure or a saturation testing step so as to make the image color much more natural and with even well-distributed brightness.

Description

影像處理方法Image processing method

本發明係有關於一種影像處理的演算法,特別是一種針對影像中具有亮點或亮區,或是在低光源環境下所攝得之影像進行前級處理的影像處理方法。The present invention relates to an image processing algorithm, in particular to an image processing method for pre-processing an image with bright spots or bright areas in an image, or an image captured under a low light source environment.

按,影像處理係指一種針對圖像進行分析、加工、和處理,使其可滿足視覺、心理或其他應用層面的技術,一般來說,由於目前大多數的圖像皆是透過以數位的方式進行儲存,因此,影像處理技術可視為是數位訊號處理在圖像領域上的一種運用,更可進一步地與電腦科學、人工智慧等領域也構成密切的關係。Press, image processing refers to a technology for analyzing, processing, and processing images to meet visual, psychological or other application levels. Generally speaking, since most of the current images are processed in digital ways Therefore, image processing technology can be regarded as an application of digital signal processing in the field of images, and it can further form a close relationship with computer science, artificial intelligence and other fields.

一般而言,影像處理技術例如可包含改善影像中的對比,增強影像;或是重新分佈影像內的色彩,以充分運用可用的色彩;或是針對陰影處進行移除、加入、或強調等操作,尤其是針對在低光源環境下拍攝所得的影像,一般可針對影像畫素中的中間值及高亮度做調整,以達成較好的效果。In general, image processing techniques may include, for example, improving the contrast in the image, enhancing the image; or redistributing the colors in the image to make full use of the available colors; or removing, adding, or emphasizing shadows. , especially for images shot under low light sources, generally adjust the median and high brightness of the image pixels to achieve better results.

舉例來說,在低光源或亮度不足的拍攝環境下,使用者極有可能會有拍攝到的照片過暗而無法辨識主體的問題,而為了解決此問題,現有技藝通常必須通過影像處理的方式,調整該影像的亮度,使其可正確辨識影像內容。大抵而言,一般針對在低光源或拍攝環境亮度不足的條件下,若要調整該影像的影像亮度,由於影像係為一資料陣列,現有的處理方式便是透過遍歷整個影像(對應該影像之資料陣列)中的像素,透過逐一尋訪像素,找出該資料陣列中的極大值與極小值,最後再依照該些極值去調整影像的亮度。For example, in a shooting environment with low light source or insufficient brightness, the user may have the problem that the captured photo is too dark to recognize the subject. In order to solve this problem, the prior art usually requires image processing. to adjust the brightness of the image so that it can correctly identify the image content. Generally speaking, if you want to adjust the image brightness of the image under the condition of low light source or insufficient brightness of the shooting environment, since the image is a data array, the existing processing method is to traverse the entire image (corresponding to the The pixels in the data array) are searched one by one to find the maximum and minimum values in the data array, and finally adjust the brightness of the image according to these extreme values.

請參照第1A圖所示,其係為一在低光源或亮度不足的拍攝環境下所攝得之影像,承上所述,傳統的影像處理方式是直接分析該影像的亮度,並將其最大值提高至255(8位元影像),以及將其最小值降低至0,使該張影像不會整體偏暗或偏亮,第2A圖係為該影像進行亮度調整後的結果。一般而言,由於影像係可視為一資料陣列,假設該資料陣列可預期的資料範圍為0x0~0xF,在影像進行處理時,透過掃描該整個資料陣列,並將其掃描資料經由一直方圖的統計(其橫軸為亮度值,以數位表示為0~F,縱軸為個數),便可以得到該影像的亮度分布數據,舉例來說,第1A圖為進行影像處理前的圖像,第2A圖為進行影像處理後的圖像,通過個別分析該第1A圖與該第2A圖影像以擷取到其直方圖,會分別如第1B圖及第2B圖所示,通過此分析可得到影像處理前、及處理後各自的影像亮度分布。可以看出,第1B圖的資料分布多是集中於較小數值,導致所呈現的影像在視覺上偏暗;而通過影像處理後,第2B圖的資料分布雖相較於第1B圖來得稍為均勻一些,但其亮度值仍特別集中在較小數值一側,顯示出的影像仍然偏暗。Please refer to Figure 1A, which is an image captured in a shooting environment with low light source or insufficient brightness. As mentioned above, the traditional image processing method is to directly analyze the brightness of the image, and maximize the brightness of the image. Increase the value to 255 (8-bit image) and lower the minimum value to 0, so that the image is not darker or brighter overall. Picture 2A is the result of adjusting the brightness of the image. Generally speaking, since an image can be regarded as a data array, it is assumed that the expected data range of the data array is 0x0-0xF. When the image is processed, the entire data array is scanned and the scanned data is passed through the histogram. Statistics (the horizontal axis is the brightness value, expressed in digits as 0-F, and the vertical axis is the number), the brightness distribution data of the image can be obtained. For example, Figure 1A is the image before image processing. Figure 2A is an image after image processing. The histograms of the images of Figure 1A and Figure 2A are individually analyzed to capture their histograms, as shown in Figure 1B and Figure 2B respectively. The image brightness distributions before and after image processing are obtained. It can be seen that the data distribution in Figure 1B is mostly concentrated in smaller values, resulting in a visually darker image. After image processing, the data distribution in Figure 2B is slightly smaller than that in Figure 1B. It is more uniform, but its brightness value is still concentrated on the side of the smaller value, and the displayed image is still dark.

除此之外,值得注意的是,這樣的演算法仍然有其缺失存在,也就是若影像中出現有一個以上的亮點時,如:鏡片、鏡框、玻璃、金屬、反光片之反光等,都極有可能會影響到前述影像處理的結果,請配合參閱第3A圖與第4A圖所示,其係分別為一具有亮點之影像進行影像亮度調整前、以及影像亮度調整後之圖像,如圖所示,從區域S1中可以發現有金屬反光的痕跡。第3B圖與第4B圖係分別對應第3A圖與第4A圖為其影像分析所擷取到之直方圖數據,由該等直方圖可以得知,在影像中具有亮點時,即便在通過傳統的影像處理並調整其亮度後,其影像的亮度分布情況仍然並非均勻的,而有集中在亮度數值較低一側的問題,因此使得該影像,如第4A圖所陳,亦仍然具有影像過暗且辨識度不佳的缺失存在。In addition, it is worth noting that such an algorithm still has its shortcomings, that is, if there is more than one bright spot in the image, such as: lens, frame, glass, metal, reflector, etc. It is very likely to affect the results of the aforementioned image processing. Please refer to Figure 3A and Figure 4A, which are respectively an image with bright spots before image brightness adjustment and an image after image brightness adjustment, such as As shown in the figure, traces of metal reflection can be found in the area S1. Figures 3B and 4B correspond to the histogram data captured by the image analysis of Figures 3A and 4A, respectively. It can be known from these histograms that when there are bright spots in the image, even if the traditional After processing and adjusting the brightness of the image, the brightness distribution of the image is still not uniform, and there is a problem that it is concentrated on the lower side of the brightness value, so that the image, as shown in Figure 4A, still has image distortion. Dark and poorly identifiable absences exist.

有鑒於此,本申請人係有感於上述缺失之可改善,且依據多年來從事此方面之相關經驗,悉心觀察且研究之,並配合學理之運用,而提出一種設計新穎且有效改善上述缺失之本發明,其係揭露一種影像處理方法,其係可針對在低光源或亮度不足的拍攝環境下所攝得之影像進行影像處理,使其亮度分度均勻並可具備極佳的辨識度,以下,本申請人係針對本發明具體之架構及實施方式茲提供詳細說明如下。In view of this, the applicant feels that the above deficiencies can be improved, and based on years of relevant experience in this area, careful observation and research, and the application of academic theory, and propose a novel design and effective improvement of the above deficiencies The present invention discloses an image processing method, which can perform image processing on images captured in a low light source or a shooting environment with insufficient brightness, so that the brightness can be evenly graded and have excellent recognition. Hereinafter, the applicant provides a detailed description of the specific structure and implementation of the present invention as follows.

為解決習知技術存在的問題,本發明之一目的係在於提供一種影像處理方法,其係針對現行影像處理的演算法作一改良,相較於現有技藝,即使影像中具有亮區或亮點,當應用本發明所公開的影像處理方法後,其係可得到較佳辨識率的影像,並使其影像的亮度分布維持均勻,提供極佳的視覺效果。In order to solve the problems existing in the prior art, an object of the present invention is to provide an image processing method, which is an improvement to the current image processing algorithm. Compared with the prior art, even if there are bright areas or bright spots in the image, When the image processing method disclosed in the present invention is applied, an image with a better resolution rate can be obtained, and the brightness distribution of the image can be maintained uniform, thereby providing an excellent visual effect.

本發明之又一目的係在於提供一種適於低光源環境所攝得之影像的前級處理演算法,此種前級處理演算法的主要目的係在於:改善原始的影像品質,進而使該影像可以更適於後續的處理程序。Another object of the present invention is to provide a pre-processing algorithm suitable for images captured in a low light source environment. Can be more suitable for subsequent processing procedures.

本發明之再一目的係在於提供一種影像處理方法,利用此種影像處理方法,更可進一步地結合予一色階平滑程序或飽和檢測步驟,以使輸出影像的色彩愈趨自然,提供本發明另一較優化之發明功效。Another object of the present invention is to provide an image processing method, which can be further combined with a level smoothing procedure or a saturation detection step, so as to make the color of the output image more natural, providing another aspect of the present invention. 1. A more optimized invention effect.

鑒於以上,本發明所揭露之一種影像處理方法,其係包括以下步驟:首先,輸入一原始影像,其中,該原始影像係為一在低光源環境下所攝得之影像,包含一資料陣列的複數個像素;之後,遍歷所述原始影像中所有的像素,以設定出至少一閾值;之後,再依據所設定之該至少一閾值產生與其相應的至少一遮罩,並將所產生的遮罩覆掩於原始影像上,以產生一待處理影像;之後,遍歷該待處理影像中的資料像素,並自該些資料像素中決定出至少一極值;之後,根據該至少一極值調整待處理影像的亮度後,將遮罩移除,以產生一輸出影像。In view of the above, an image processing method disclosed in the present invention includes the following steps: first, inputting an original image, wherein the original image is an image captured under a low light source environment, and includes a data array of a plurality of pixels; then, traverse all the pixels in the original image to set at least one threshold; then, generate at least one mask corresponding to the set at least one threshold, and use the generated mask overlaying the original image to generate a to-be-processed image; then traversing the data pixels in the to-be-processed image, and determining at least one extreme value from the data pixels; then adjusting the to-be-processed image according to the at least one extreme value After processing the brightness of the image, the mask is removed to generate an output image.

根據本發明之實施例,其中,在遍歷該原始影像之該些像素的步驟中,更包含通過使用一直方圖統計並分析該些像素的亮度分布,以決定該至少一閾值。According to an embodiment of the present invention, in the step of traversing the pixels of the original image, the method further includes using a histogram to count and analyze the luminance distribution of the pixels to determine the at least one threshold.

在本發明的一實施例中,根據本發明所揭露的影像處理方法,其中,當該閾值係為一亮區閾值時,所對應產生的該至少一遮罩係為一亮區遮罩,以利用該亮區遮罩,將所述的原始影像中像素數值高於該亮區閾值者遮沒。在此情況下,所述的待處理影像中所決定的極值係為該些資料像素中的一極大值。In an embodiment of the present invention, according to the image processing method disclosed in the present invention, when the threshold is a bright area threshold, the correspondingly generated at least one mask is a bright area mask, so as to Using the bright area mask, the pixel values in the original image that are higher than the bright area threshold are covered. In this case, the extremum determined in the image to be processed is a maximal value in the data pixels.

在本發明的另一實施例中,根據本發明所揭露的影像處理方法,其中,當該閾值係為一暗區閾值時,所對應產生的該至少一遮罩係為一暗區遮罩,以利用該暗區遮罩,將所述的原始影像中像素數值低於該暗區閾值者遮沒。在此情況下,所述的待處理影像中所決定的極值係為該些資料像素中的一極小值。In another embodiment of the present invention, according to the image processing method disclosed in the present invention, when the threshold is a dark area threshold, the correspondingly generated at least one mask is a dark area mask, By using the dark area mask, the pixel values in the original image that are lower than the dark area threshold are covered. In this case, the extremum determined in the image to be processed is a minimum value among the data pixels.

甚者,在本發明的又一實施例中,根據本發明所揭露的影像處理方法,其中,當該至少一閾值包括一亮區閾值與一暗區閾值時,則所對應產生的該至少一遮罩係包含一亮區遮罩與一暗區遮罩。於此,本發明便可以同時利用該亮區遮罩,將所述的原始影像中像素數值高於該亮區閾值者遮沒,亦利用該暗區遮罩,將所述的原始影像中像素數值低於該暗區閾值者遮沒。在此情況下,所述的待處理影像中所決定的極值係包括該些資料像素中的一極大值與一極小值。Furthermore, in another embodiment of the present invention, according to the image processing method disclosed in the present invention, when the at least one threshold includes a bright area threshold and a dark area threshold, the at least one correspondingly generated The mask system includes a bright area mask and a dark area mask. Therefore, the present invention can simultaneously use the bright area mask to mask out the pixels whose value is higher than the bright area threshold in the original image, and also use the dark area mask to mask the pixels in the original image. Those whose values are lower than the threshold of the dark area are obscured. In this case, the extremum determined in the image to be processed includes a maximum value and a minimum value in the data pixels.

總括以上,本發明係藉由形成一亮區遮罩、形成一暗區遮罩、抑或是可同時形成暗區遮罩與亮區遮罩,通過這些遮罩的形成,來針對原始影像進行過濾與覆掩,使本發明所揭露之演算法僅針對沒有被遮罩遮沒的部分進行處理,並在處理完畢後移除遮罩,以於後續步驟中產生所得之輸出影像。To sum up the above, the present invention filters the original image by forming a bright area mask, forming a dark area mask, or simultaneously forming a dark area mask and a bright area mask. With masking, the algorithm disclosed in the present invention processes only the portion not covered by the mask, and removes the mask after processing to generate the resulting output image in the subsequent steps.

其中,所述的亮度調整方案,係通過一正規化公式進行調整,根據本發明之實施例,則所述的正規化公式包括

Figure 02_image001
,其中,P係為該待處理影像之資料,每一該資料的數值係介於0~R之間,P max與P min係分別為該些資料中之一最大值與一最小值,P norm係為通過該正規化公式調整後之影像。 Wherein, the brightness adjustment scheme is adjusted through a normalization formula. According to the embodiment of the present invention, the normalization formula includes:
Figure 02_image001
, where P is the data of the image to be processed, the numerical value of each data is between 0 and R, P max and P min are a maximum value and a minimum value of the data, P norm is the image adjusted by the normalization formula.

除此之外,本發明所公開之影像處理方法,更可在產生輸出影像之前,通過一色階平滑程序,使該輸出影像中原先被遮罩所覆掩的資料像素接近於鄰近像素。大抵而言,此一色階平滑程序的目的係旨在,使輸出影像的色彩可愈趨自然,進而避免色彩資料不平滑的問題,在視覺上提供更佳的呈現效果。Besides, in the image processing method disclosed in the present invention, before generating the output image, a level smoothing procedure can be used to make the data pixels originally covered by the mask in the output image close to the adjacent pixels. Generally speaking, the purpose of this level smoothing procedure is to make the color of the output image more natural, thereby avoiding the problem of uneven color data, and providing a better visual effect.

更進一步而言,在影像處理該色階平滑的程序中,更可選擇性地包括有一飽和檢測步驟,根據該飽和檢測步驟,其係將輸出影像中超過一飽和值的資料像素,直接設定為該飽和值,其目的在於防止資料像素產生溢位。Furthermore, in the image processing procedure for smoothing the level, a saturation detection step can be optionally included, and according to the saturation detection step, data pixels exceeding a saturation value in the output image are directly set as The purpose of this saturation value is to prevent data pixels from overflowing.

緣此,藉由此演算法的改良,本發明所揭露之影像處理方法,自然可針對在低光源、亮度不足環境下所拍攝得到的影像,抑或是影像中具有亮點或亮區者,進行有效且完善的前級處理,不僅可供觀賞者正確地辨識影像內容,更可控制影像亮度的均勻分布,改善現有技術所存在之諸多缺失。Therefore, through the improvement of the algorithm, the image processing method disclosed in the present invention can naturally be effective for images captured under low light source and insufficient brightness environment, or those with bright spots or bright areas in the images. And the perfect pre-processing can not only allow viewers to correctly identify the image content, but also control the uniform distribution of image brightness, improving many deficiencies in the prior art.

底下藉由具體實施例配合所附的圖式詳加說明,當更容易瞭解本發明之目的、技術內容、特點及其所達成之功效。The following detailed description will be given in conjunction with the accompanying drawings through specific embodiments, so as to more easily understand the purpose, technical content, characteristics and effects of the present invention.

以上有關於本發明的內容說明,與以下的實施方式係用以示範與解釋本發明的精神與原理,並且提供本發明的專利申請範圍更進一步的解釋。有關本發明的特徵、實作與功效,茲配合圖式作較佳實施例詳細說明如下。The above description about the content of the present invention and the following embodiments are used to demonstrate and explain the spirit and principle of the present invention, and provide further explanation of the scope of the patent application of the present invention. With regard to the features, implementations and effects of the present invention, preferred embodiments are described in detail as follows in conjunction with the drawings.

為了改良先前技術所提,由於傳統的影像處理演算法無法針對在低光源環境下所攝得的圖像進行有效的影像處理;本發明遂針對此等缺失提出一種較佳的改良設計,其係為一種影像處理方法。其中,為了能更佳地理解本發明所述之技術內容,首先請配合參閱第5圖所示,其係為根據本發明一實施例所述之影像處理方法的步驟流程圖,包括下列步驟S501、S503、S505、S507、S509及S511。In order to improve the prior art, since traditional image processing algorithms cannot perform effective image processing on images captured in a low light source environment, the present invention proposes a better improved design for these shortcomings, which is is an image processing method. Among them, in order to better understand the technical content of the present invention, please refer to FIG. 5, which is a flow chart of the steps of the image processing method according to an embodiment of the present invention, including the following steps S501 , S503, S505, S507, S509 and S511.

步驟S501:輸入一原始影像,原始影像係為一資料陣列並包含複數個像素。Step S501: Input an original image, which is a data array and includes a plurality of pixels.

步驟S503:遍歷該原始影像之像素,以設定至少一閾值。Step S503: Traverse the pixels of the original image to set at least one threshold.

步驟S505:依據該至少一閾值產生相對應的遮罩,並將該遮罩覆掩於原始影像上,產生一待處理影像。Step S505: Generate a corresponding mask according to the at least one threshold, and cover the mask on the original image to generate a to-be-processed image.

步驟S507:遍歷該待處理影像中的資料像素,並決定至少一極值。Step S507: Traverse the data pixels in the image to be processed, and determine at least one extreme value.

步驟S509:根據該至少一極值調整待處理影像的亮度後,移除遮罩。Step S509: After adjusting the brightness of the image to be processed according to the at least one extreme value, remove the mask.

步驟S511:產生一輸出影像。Step S511: Generate an output image.

以下,本發明將逐一根據該些步驟配合相應之實施例,據此提供詳細之技術說明如後。Hereinafter, the present invention will cooperate with corresponding embodiments according to these steps one by one, and provide detailed technical descriptions accordingly as follows.

請參照第6A圖所示,其係為根據本發明實施例之一原始影像10之示意圖。其中,該原始影像10係為一資料陣列(M行xN列),該原始影像10包含複數個像素,在此實施例中,M=4, N=4,原始影像10包含16個像素。本發明係先於步驟S501中輸入該原始影像10。之後,根據步驟S503,遍歷該原始影像10中的所有像素,以設定至少一閾值。在此步驟S503中,本發明係通過使用一直方圖統計並分析該些像素的亮度分布,以決定出所需設定的閾值為何,一般來說,閾值的設定會在此一「遍歷像素」步驟時決定,由於該步驟係藉由進行影像像素的直方圖分析,並且,基於該統計所得的直方圖,其橫軸係為影像像素的亮度值,縱軸為個數,因此可以經統計分析後得到影像亮度的分布圖,並自其中擷取出最亮像素與最暗像素,最後再依照相機特性,自動設定適當的閾值。Please refer to FIG. 6A , which is a schematic diagram of an original image 10 according to an embodiment of the present invention. The original image 10 is a data array (M rows×N columns), and the original image 10 includes a plurality of pixels. In this embodiment, M=4, N=4, and the original image 10 includes 16 pixels. In the present invention, the original image 10 is input prior to step S501. Afterwards, according to step S503, all pixels in the original image 10 are traversed to set at least one threshold. In this step S503, the present invention uses a histogram to count and analyze the luminance distribution of the pixels to determine the threshold to be set. Generally speaking, the threshold is set in the step of “traversing the pixels”. It is determined at the time of this step because the histogram analysis of the image pixels is performed in this step, and the histogram obtained based on the statistics, the horizontal axis is the brightness value of the image pixels, and the vertical axis is the number, so after statistical analysis Obtain the distribution map of image brightness, and extract the brightest pixel and the darkest pixel from it, and finally set the appropriate threshold automatically according to the characteristics of the camera.

根據本發明之一實施例,假設本發明掃描並遍歷原始影像10後設定要處理:像素亮度值小於”8”的資料,此時該閾值係設定為”8”, 之後,如步驟S505所示,依據該閾值”8” 產生對應的遮罩,根據本發明之實施例,其中,遮罩的用途係在於排除特定資料,使演算法僅處理其他資料。藉由遮罩影像的過濾,演算法可以僅處理沒有被遮罩遮沒的影像像素值。According to an embodiment of the present invention, it is assumed that the present invention scans and traverses the original image 10 and sets the data to be processed: the pixel brightness value is less than "8", at this time, the threshold is set to "8", and then, as shown in step S505 , and generate a corresponding mask according to the threshold "8". According to an embodiment of the present invention, the purpose of the mask is to exclude specific data, so that the algorithm only processes other data. By filtering the mask image, the algorithm can only process image pixel values that are not masked by the mask.

舉例來說,當輸入的原始影像10,其資料陣列大小為 MxN,因此所形成的遮罩陣列也會是MxN,根據本發明所公開之遮罩,其MxN陣列係以二值布林數形式呈現之,僅包含0(true)或F(false)兩種狀態,且陣列之內容值係先預設全為F。當本實施例欲針對像素亮度值小於”8”的資料進行處理時,此時該閾值”8” 係定義為一亮區閾值,並根據該亮區閾值”8”產生一亮區遮罩,以將亮度值”8”以上的像素遮沒,而僅處理亮度值”8”以下的像素。具體而言,本演算法係逐一檢測原始影像10中的所有像素,並將該像素之數值高於該亮區閾值”8”者設定為0,該像素之數值未超過該亮區閾值”8”者設定為F,形成如本發明圖式第6B圖所示之亮區遮罩12。For example, when the input original image 10 has a data array size of MxN, the resulting mask array is also MxN. According to the mask disclosed in the present invention, the MxN array is in the form of binary Boolean numbers. It only includes two states of 0 (true) or F (false), and the content value of the array is preset to be all F. When the present embodiment intends to process data whose pixel brightness value is less than "8", the threshold "8" is defined as a bright area threshold, and a bright area mask is generated according to the bright area threshold "8", In this way, pixels with a brightness value of "8" or higher are masked, and only pixels with a brightness value of "8" or less are processed. Specifically, the algorithm detects all the pixels in the original image 10 one by one, and sets the value of the pixel higher than the bright area threshold "8" as 0, and the value of the pixel does not exceed the bright area threshold "8" ” is set as F to form a bright area mask 12 as shown in FIG. 6B of the present invention.

詳細而言,根據本發明之實施例,則所述產生亮區遮罩12的步驟主要係依據下列公式(1),其中,x:第幾個行,x<M;y:第幾個列,y<N;P(x, y):原始影像10中第x行第y列的被檢測資料;Threshold Bright:亮區閾值; P maskBright(x, y) :亮區遮罩12中第x行第y列的亮區遮罩資料。

Figure 02_image003
(1) In detail, according to the embodiment of the present invention, the step of generating the bright area mask 12 is mainly based on the following formula (1), where x: which row, x<M; y: which column , y<N; P(x, y): the detected data in the xth row and the yth column in the original image 10; Threshold Bright : the threshold of the bright area; P maskBright (x, y): the xth in the bright area mask 12 Bright area mask data for row y column.
Figure 02_image003
(1)

緣此,在形成該亮區遮罩12之後,再將該亮區遮罩12覆掩於原始影像10上以產生一待處理影像。根據本發明之實施例,其係通過將原始影像10與亮區遮罩12進行邏輯交集的運算,以得到新的待處理陣列,也便是第6C圖所示的待處理影像14。接著,如步驟S507所示,本發明續針對待處理影像14進行其中像素的遍歷及查訪,以決定出其中的一極值。在本實施例中,由於主要是經由產生的亮區遮罩12,將所述的原始影像10中像素亮度值高於該亮區閾值者遮沒,使演算法可針對像素亮度值小於亮區閾值者進行處理,因此在步驟S507中所決定的極值則係為待處理影像14中資料像素的一極大值:”7”。Therefore, after the bright area mask 12 is formed, the bright area mask 12 is then covered on the original image 10 to generate a to-be-processed image. According to an embodiment of the present invention, a new array to be processed, that is, the to-be-processed image 14 shown in FIG. 6C , is obtained by logically intersecting the original image 10 and the bright area mask 12 . Next, as shown in step S507, the present invention continues to traverse and search the pixels in the image 14 to be processed to determine an extreme value therein. In the present embodiment, because the generated bright area mask 12 is mainly used to mask the pixels whose luminance value is higher than the bright area threshold in the original image 10, the algorithm can target the pixel luminance value smaller than the bright area threshold. The threshold value is processed, so the extreme value determined in step S507 is a maximum value of the data pixels in the image 14 to be processed: "7".

隨後,本發明接續執行步驟S509,以根據此極值去調整待處理影像14的亮度。其中,該待處理影像14的亮度係可以通過一正規化公式進行調整,該正規化公式如下式(2)所陳,其中,P係為該待處理影像14之資料,每一筆資料的數值係介於0~R之間,P max與P min係分別為該些資料中之一最大值與一最小值,P norm係為通過該正規化公式調整後之影像。

Figure 02_image001
(2) Then, the present invention proceeds to step S509 to adjust the brightness of the image to be processed 14 according to the extreme value. The brightness of the image to be processed 14 can be adjusted by a normalization formula, and the normalization formula is shown in the following formula (2), where P is the data of the image to be processed 14, and the numerical value of each data is Between 0 and R, P max and P min are respectively a maximum value and a minimum value in the data, and P norm is an image adjusted by the normalization formula.
Figure 02_image001
(2)

亦或是,在本實施例中,通過在步驟S507所決定的極大值為”7”之後,本發明亦可選擇藉由平移調整亮度至一目標值”15”,來達到調整影像亮度的目的。承前例來說,由遍歷及尋訪待處理影像14後,演算法係設定”7”為其中之一極大值,而為了調整到目標值”15”需要再加”8”,因此透過平移調整,將待處理影像14中的資料像素各平移調整加上8,得到如第6D圖所示之調整影像16。之後,再將亮區遮罩12移除,以得到一個新的資料陣列,也便是第6E圖產生的處理後影像20。Or, in this embodiment, after the maximum value determined in step S507 is "7", the present invention can also choose to adjust the brightness to a target value of "15" by translation to achieve the purpose of adjusting the image brightness . Taking the previous example, after traversing and searching the image 14 to be processed, the algorithm sets "7" as one of the maximum values, and in order to adjust to the target value "15", "8" needs to be added. Therefore, through translation adjustment, The adjustment image 16 as shown in FIG. 6D is obtained by adding 8 to each translation adjustment of the data pixels in the image to be processed 14 . After that, the bright area mask 12 is removed to obtain a new data array, that is, the processed image 20 generated in Fig. 6E.

綜上所述,以上本發明藉由產生之遮罩為亮區遮罩12之實施例,其演算法執行的步驟在影像處理的意義上,係為:增加特定區域(即原始影像10中的暗區,也就是未被亮區遮罩12所遮沒處)的影像亮度。根據本發明所揭露的處理方法,亦可應用於產生一暗區遮罩,以利用暗區遮罩的生成來降低特定區域的影像亮度。若同樣以第6A圖之原始影像10為例,根據本發明之另一實施例,當本演算法欲針對像素亮度值大於”2”的資料進行處理時,此時步驟S503中的閾值係設定為”2”,並將其閾值”2”定義為一暗區閾值,之後,根據該暗區閾值”2”產生一暗區遮罩,大抵而言,暗區遮罩係將原始影像10中像素亮度值低於該暗區閾值者遮沒,使演算法可針對像素亮度值高於暗區閾值者進行處理,也便是將亮度值”2”以下的像素遮沒,而僅處理亮度值”2”以上的像素。具體而言,產生暗區遮罩的原理基本上係如同本發明前述產生亮區遮罩12者相似,該暗區遮罩亦會包含以二值布林數形式呈現的MxN陣列,其內容值皆預設為F。之後,依據下列公式(3)產生一暗區遮罩P maskDark(x, y),其中,x:第幾個行,x<M;y:第幾個列,y<N;P(x, y):原始影像10中第x行第y列的被檢測資料;Threshold Dark:暗區閾值; P maskDark(x, y) :暗區遮罩中第x行第y列的暗區遮罩資料。

Figure 02_image005
(3) To sum up, the above embodiments of the present invention in which the mask generated is the bright area mask 12 , the steps executed by the algorithm in the sense of image processing are: adding a specific area (ie, the original image 10 ) The brightness of the image in the dark area, that is, the area not covered by the bright area mask 12). The processing method disclosed in the present invention can also be applied to generate a dark area mask, so as to reduce the image brightness of a specific area by using the generation of the dark area mask. Taking the original image 10 in Fig. 6A as an example, according to another embodiment of the present invention, when the algorithm intends to process data whose pixel luminance value is greater than "2", the threshold value in step S503 is set at this time. is "2", and its threshold "2" is defined as a dark area threshold, and then a dark area mask is generated according to the dark area threshold "2". Pixel brightness values lower than the threshold of the dark area are hidden, so that the algorithm can process the pixels whose brightness value is higher than the threshold value of the dark area, that is, the pixels with the brightness value below "2" are masked, and only the brightness value is processed. Pixels above "2". Specifically, the principle of generating the dark area mask is basically similar to that of generating the bright area mask 12 in the present invention. All default to F. Afterwards, a dark area mask P maskDark (x, y) is generated according to the following formula (3), where x: which row, x<M; y: which column, y<N; P(x, y): the detected data in the xth row and the yth column of the original image 10; Threshold Dark : the threshold value of the dark area; P maskDark (x, y): the dark area mask data in the xth row and the yth column in the dark area mask .
Figure 02_image005
(3)

之後,同樣地利用暗區遮罩覆掩於原始影像上產生待處理影像,再接著進行步驟S507~S509。與前一實施例不同的是,在使用暗區遮罩時,其中待處理影像經遍歷後所決定的極值會是一極小值,在此實施例中即為”1”。最後,根據該極值”1”調整待處理影像的亮度,並在移除暗區遮罩後,產生處理後影像。Afterwards, the dark area mask is similarly used to cover the original image to generate a to-be-processed image, and then steps S507 to S509 are performed. Different from the previous embodiment, when the dark area mask is used, the extreme value determined after traversing the image to be processed will be a minimum value, which is “1” in this embodiment. Finally, the brightness of the image to be processed is adjusted according to the extreme value "1", and the processed image is generated after removing the dark area mask.

更進一步而言,根據本發明之再一實施例,本發明所揭露之影像處理方法亦可同時形成有所述的亮區遮罩與暗區遮罩,在此再一實施例中,步驟S503中所設定的閾值則同時包含有所述的亮區閾值與暗區閾值,以進一步地根據該亮區閾值產生亮區遮罩,以及根據該暗區閾值產生暗區遮罩。值得一提的是,亮區遮罩與暗區遮罩的產生並無先後順序的差異,且亮區遮罩與暗區遮罩在產生的過程中並不會互相影響,亦不會重疊,其原理在於:亮區遮罩的激勵像素來自於「像素值 > 亮區閾值」,而暗區遮罩的激勵像素則是來自於「像素值 < 暗區閾值」。舉例來說,若一像素值高於亮區閾值時,亮區遮罩相對應的 P maskBright(x, y)就會設定為0,同樣地,若一像素值係低於暗區閾值時,則暗區遮罩相對應的P maskDark(x, y)就會設定為0,至於針對一像素值是介於亮區閾值與暗區閾值之間時,則不會改變其預設資料(F),大抵而言,亮區遮罩係用以遮沒影像中像素值高於該亮區閾值者,而暗區遮罩係用以遮沒影像中像素值低於該暗區閾值者,其詳細的操作原理係如以下公式(4)所陳:

Figure 02_image007
(4) Furthermore, according to still another embodiment of the present invention, the image processing method disclosed in the present invention can also form the above-mentioned bright area mask and dark area mask at the same time. In this still another embodiment, step S503 The thresholds set in , include the bright area threshold and the dark area threshold at the same time, so as to further generate a bright area mask according to the bright area threshold, and generate a dark area mask according to the dark area threshold. It is worth mentioning that there is no difference in the order of generation of the bright area mask and the dark area mask, and the bright area mask and the dark area mask will not affect each other or overlap during the generation process. The principle is that the excitation pixels of the bright area mask come from "pixel value > bright area threshold", while the excitation pixels of the dark area mask are from "pixel value < dark area threshold". For example, if a pixel value is higher than the bright area threshold, P maskBright (x, y) corresponding to the bright area mask will be set to 0. Similarly, if a pixel value is lower than the dark area threshold, Then the P maskDark (x, y) corresponding to the dark area mask will be set to 0. As for a pixel value between the bright area threshold and the dark area threshold, the default data (F ), generally speaking, the bright area mask is used to hide the pixel values in the image that are higher than the bright area threshold, and the dark area mask is used to hide the pixel values in the image that are lower than the dark area threshold. The detailed operation principle is shown in the following formula (4):
Figure 02_image007
(4)

x:第幾個行;y:第幾個列;M:最大的行數值;N:最大的列數值;P(x, y):第x行第y列的被檢測資料;Threshold Bright:亮區閾值;Threshold Dark:暗區閾值;P maskBright(x, y) :亮區遮罩中第x行第y列的資料;P maskDark(x, y) :暗區遮罩中第x行第y列的資料。 x: the number of rows; y: the number of columns; M: the largest row value; N: the largest column value; P(x, y): the detected data of the xth row and the yth column; Threshold Bright : bright Threshold Dark : Dark area threshold; P maskBright (x, y): Data in the xth row, y column in the bright area mask; P maskDark (x, y): In the dark area mask, the xth row, yth column information.

之後,根據亮區遮罩與暗區遮罩覆掩於原始影像,以產生待處理影像。並接著在步驟S507中決定出極值,在此情況下,則該極值必須包含一極大值與一極小值,之後,在步驟S509中根據像素的極大、極小值套用公式(2)進行影像亮度的正規化,之後再移除亮區遮罩與暗區遮罩產生處理後影像。Then, the original image is covered according to the bright area mask and the dark area mask to generate a to-be-processed image. Then, the extreme value is determined in step S507. In this case, the extreme value must include a maximum value and a minimum value. After that, in step S509, formula (2) is applied according to the maximum and minimum values of the pixels to image Normalize the brightness, and then remove the bright area mask and the dark area mask to produce the processed image.

在此須說明的是,鑒於上述本發明所揭之諸多實施例,顯見根據本發明所教示之技術方案,本領域具通常知識者當可在其實際實施層面上自行變化其設計,而皆屬於本發明之發明範圍。本發明在前述段落中所列舉出之數個示性例,其目的是為了善加解釋本發明主要之技術特徵,而使本領域人員可理解並據以實施之,唯本發明當不以該些示性例為限。It should be noted here that, in view of the various embodiments disclosed in the present invention, it is apparent that according to the technical solutions taught in the present invention, those skilled in the art can change the design on their own at the actual implementation level, and all belong to The invention scope of the present invention. Several exemplary examples of the present invention are listed in the foregoing paragraphs for the purpose of better explaining the main technical features of the present invention, so that those skilled in the art can understand and implement them accordingly, but the present invention should not be based on this These illustrative examples are limited.

另一方面而言,詳細來看,根據本發明自步驟S509移除遮罩後所得到的處理後影像20中,由於沒有處理色階平滑,因此影像會有不自然的現象發生,如圖式第7A圖的區域R1所示,原本應該要逐漸增亮的部分卻呈現亮一塊、暗一塊的不自然亮度。有鑑於此,本發明所揭露之影像處理方法更可包含一色階平滑程序,如第7B圖之流程圖所示,該色階平滑程序即對應步驟S510,以在步驟S511產生最終的一輸出影像之前執行。根據本發明之實施例,此色階平滑程序主要係針對該處理後影像20中原先被遮罩所覆掩的資料像素進行調整,其操作色階平滑後的結果會如第7C圖所示,可以明顯看出:此色階平滑程序係使輸出影像22中原先被遮罩所覆掩的資料像素可接近於鄰近像素,在視覺上,輸出影像22中區域R1的像素亮度可以變得較為平滑,且皆與鄰近像素接近。On the other hand, in detail, in the processed image 20 obtained after removing the mask from step S509 according to the present invention, since there is no smoothing of the gradation, unnatural phenomena may occur in the image, as shown in the figure As shown in the area R1 of Fig. 7A, the part that should be gradually brightened has an unnatural brightness of bright and dark parts. In view of this, the image processing method disclosed in the present invention may further include a level smoothing procedure, as shown in the flowchart of FIG. 7B , the level smoothing procedure corresponds to step S510 to generate a final output image at step S511 performed before. According to an embodiment of the present invention, the level-smoothing procedure mainly adjusts the data pixels in the processed image 20 that were originally covered by the mask, and the result of the operation after level-smoothing is shown in FIG. 7C , It can be clearly seen that this level smoothing procedure makes the data pixels covered by the mask in the output image 22 close to the adjacent pixels, and visually, the pixel brightness of the region R1 in the output image 22 can become smoother , and all are close to adjacent pixels.

除此之外,根據本發明所公開之色階平滑程序中,其亦可包括有一飽和檢測步驟,所述的飽和檢測可視為「色階平滑」其中的一個邏輯項目,此飽和檢測步驟本身是為了防止資料溢位現象的發生。舉例來說,如八位元暫存器的最大無號數可表示為255,但是128+128在八位元暫存器將得到 0,因為資料產生溢位。有鑑於此,本發明所揭露之影像處理方法,其係可進一步通過此飽和檢測步驟,直接將輸出影像22中超過一飽和值的資料像素設定為該飽和值,以防止資料像素產生溢位的問題。承本發明前述所公開的實施例而言,則該飽和值係可預設為15,以將輸出影像22之資料陣列中的值大於 15者,直接設定為15,以防止像素溢位造成後續數位訊號處理的謬誤。Besides, according to the level smoothing program disclosed in the present invention, it may also include a saturation detection step, and the saturation detection can be regarded as a logical item of "level smoothing". The saturation detection step itself is In order to prevent the occurrence of data overflow. For example, the maximum unsigned number in the octet register can be represented as 255, but 128+128 will get 0 in the octet register because the data overflows. In view of this, the image processing method disclosed in the present invention can further pass the saturation detection step to directly set the data pixels exceeding a saturation value in the output image 22 to the saturation value, so as to prevent the data pixels from overflowing. question. According to the embodiments disclosed in the present invention, the saturation value can be preset to 15, so that the value in the data array of the output image 22 greater than 15 is directly set to 15 to prevent pixel overflow from causing subsequent The fallacy of digital signal processing.

緣此,基於本發明所公開的影像處理方法及其演算法的改良,請配合參閱第8A圖所示,其係為應用本發明所揭露之影像處理方法所得到之影像結果示意圖,其原始影像係為第3A圖具有亮點之圖像。通過本發明影像處理方法所使用的遮罩則如第8B圖所示,參閱該些圖式,可以看出區域P1與區域P2係各自為原始影像中具有一金屬反光與紙張過曝的區塊,通過第8B圖遮罩的遮沒後,最後經影像處理成像及亮度調整為第8A圖之影像,可以顯見的是,即便原始影像中有反光區或反光點也不至於影響最終輸出影像的品質。第8C圖係為第8A圖之圖像通過影像分析所擷取到之直方圖,通過該直方圖分析,亦可以明顯看出通過本發明之影像處理方法,可使影像的亮度達到均勻分布,亦呈現常態分布,進一步證實本發明之發明功效。Therefore, based on the improvement of the image processing method and its algorithm disclosed in the present invention, please refer to Figure 8A, which is a schematic diagram of the image result obtained by applying the image processing method disclosed in the present invention, the original image It is an image with bright spots in Figure 3A. The mask used by the image processing method of the present invention is shown in FIG. 8B. Referring to these figures, it can be seen that the area P1 and the area P2 are areas in the original image with a metal reflection and paper overexposed respectively. , after being covered by the mask in Figure 8B, the image in Figure 8A is finally imaged after image processing and brightness adjusted. It can be seen that even if there are reflective areas or reflective spots in the original image, it will not affect the final output image. quality. Fig. 8C is a histogram obtained by image analysis of the image in Fig. 8A. Through the analysis of the histogram, it can be clearly seen that the image processing method of the present invention can achieve a uniform distribution of the brightness of the image. It also presents a normal distribution, which further confirms the inventive efficacy of the present invention.

鑒於以上所述,可明顯觀之,相較於習知技術,本發明所揭露之影像處理方法實屬創新,並可有效解決先前技術中傳統的影像處理演算法無法針對在低光源環境下所攝得的圖像進行影像處理的問題。根據本發明所教示之影像處理方法,其係可應用於在一低光源環境下所攝得之原始影像,並經由本發明所揭露的演算法,可有效地調整影像亮度,控制亮度的均勻分布,並使影像內容維持色彩平滑,使觀賞者可輕易分辨影像內容,實現本發明較優化之發明功效。In view of the above, it is obvious that, compared with the prior art, the image processing method disclosed in the present invention is really innovative, and can effectively solve the problem that the traditional image processing algorithm in the prior art cannot be used in a low light source environment. The problem of image processing of captured images. According to the image processing method taught in the present invention, it can be applied to the original image captured in a low light source environment, and through the algorithm disclosed in the present invention, the brightness of the image can be adjusted effectively and the uniform distribution of the brightness can be controlled , and keep the color of the image content smooth, so that the viewer can easily distinguish the image content, and realize the optimized effect of the present invention.

綜上所述,根據本發明所揭露之技術方案,確實具有極佳之產業利用性及競爭力。顯見本發明所揭露之技術特徵、方法手段與達成之功效係顯著地不同於現行方案,實非為熟悉該項技術者能輕易完成者,故應具備有專利要件。To sum up, according to the technical solution disclosed in the present invention, it does have excellent industrial availability and competitiveness. It is obvious that the technical features, methods and means disclosed in the present invention and the achieved effects are significantly different from the existing solutions, which are not easily accomplished by those who are familiar with the technology, so it should have patent requirements.

10:原始影像 12:亮區遮罩 14:待處理影像 16:調整影像 20:處理後影像 22:輸出影像 S1:區域 R1:區域 P1:區域 P2:區域 S501, S503, S505, S507, S509, S510, S511:步驟 10: Original image 12: Bright area mask 14: Image to be processed 16: Adjust the image 20: The processed image 22: Output image S1: Area R1: Region P1: area P2: Area S501, S503, S505, S507, S509, S510, S511: Steps

第1A圖係為先前技術一進行影像處理前之圖像。 第1B圖係為第1A圖之圖像通過影像分析所擷取到之直方數據圖。 第2A圖係為先前技術一進行影像處理後之圖像。 第2B圖係為第2A圖之圖像通過影像分析所擷取到之直方數據圖。 第3A圖係為先前技術一具有亮點之影像進行影像處理前之圖像。 第3B圖係為第3A圖之圖像通過影像分析所擷取到之直方數據圖。 第4A圖係為先前技術一具有亮點之影像進行影像處理後之圖像。 第4B圖係為第4A圖之圖像通過影像分析所擷取到之直方數據圖。 第5圖係為根據本發明實施例所揭露之影像處理方法的步驟流程示意圖。 第6A圖係為根據本發明一實施例之原始影像的示意圖。 第6B圖係為根據本發明一實施例之亮區遮罩的示意圖。 第6C圖係為根據本發明一實施例之待處理影像的示意圖。 第6D圖係為根據本發明一實施例之調整影像的示意圖。 第6E圖係為根據本發明一實施例之處理後影像的示意圖。 第7A圖係為根據本發明一實施例在進行色階平滑程序前的影像示意圖。 第7B圖係為根據本發明實施例之影像處理方法更包括色階平滑程序的步驟流程示意圖。 第7C圖係為根據本發明一實施例在進行色階平滑程序後的影像示意圖。 第8A圖係為應用本發明所揭露之影像處理方法所得到之影像結果示意圖。 第8B圖係為根據第8A圖所使用之遮罩的示意圖。 第8C圖係為第8A圖之圖像通過影像分析所擷取到之直方圖。 FIG. 1A is an image before image processing is performed in the prior art. Figure 1B is a histogram of the image in Figure 1A captured by image analysis. FIG. 2A is an image after image processing in the prior art. Figure 2B is a histogram of the image in Figure 2A captured by image analysis. FIG. 3A is an image of an image with bright spots in the prior art before image processing. Figure 3B is a histogram of the image in Figure 3A captured by image analysis. FIG. 4A is an image of an image with bright spots in the prior art after image processing. Figure 4B is a histogram of the image in Figure 4A captured by image analysis. FIG. 5 is a schematic flow chart of steps of an image processing method disclosed according to an embodiment of the present invention. FIG. 6A is a schematic diagram of an original image according to an embodiment of the present invention. FIG. 6B is a schematic diagram of a bright area mask according to an embodiment of the present invention. FIG. 6C is a schematic diagram of an image to be processed according to an embodiment of the present invention. FIG. 6D is a schematic diagram of adjusting an image according to an embodiment of the present invention. FIG. 6E is a schematic diagram of a processed image according to an embodiment of the present invention. FIG. 7A is a schematic diagram of an image before performing a level smoothing process according to an embodiment of the present invention. FIG. 7B is a schematic flow chart of the steps of the image processing method according to the embodiment of the present invention, which further includes a level smoothing procedure. FIG. 7C is a schematic diagram of an image after the level smoothing process is performed according to an embodiment of the present invention. FIG. 8A is a schematic diagram of an image result obtained by applying the image processing method disclosed in the present invention. Figure 8B is a schematic diagram of a mask used according to Figure 8A. Fig. 8C is a histogram obtained by image analysis of the image of Fig. 8A.

S501,S503,S505,S507,S509,S510,S511:步驟 S501, S503, S505, S507, S509, S510, S511: Steps

Claims (11)

一種影像處理方法,適於在一低光源環境下所攝得之一原始影像,該影像處理方法包括: 輸入該原始影像,其中,該原始影像係為一資料陣列,並包含複數個像素; 遍歷該原始影像之該些像素,以設定至少一閾值; 依據該至少一閾值產生至少一遮罩,並將該至少一遮罩覆掩於該原始影像上以產生一待處理影像; 遍歷該待處理影像中的資料像素,並決定至少一極值; 根據該至少一極值調整該待處理影像的亮度後,移除該至少一遮罩;以及 產生一輸出影像。 An image processing method suitable for an original image captured in a low light source environment, the image processing method comprising: inputting the original image, wherein the original image is a data array and includes a plurality of pixels; traversing the pixels of the original image to set at least one threshold; generating at least one mask according to the at least one threshold, and covering the at least one mask on the original image to generate a to-be-processed image; Traverse the data pixels in the image to be processed, and determine at least one extreme value; After adjusting the brightness of the image to be processed according to the at least one extreme value, remove the at least one mask; and An output image is generated. 如請求項1所述之影像處理方法,其中,在遍歷該原始影像之該些像素的步驟中,更包含通過使用一直方圖統計並分析該些像素的亮度分布,以決定該至少一閾值。The image processing method according to claim 1, wherein in the step of traversing the pixels of the original image, the step of traversing the pixels of the original image further comprises using a histogram to count and analyze the brightness distribution of the pixels to determine the at least one threshold. 如請求項1所述之影像處理方法,其中,當該至少一閾值係為一亮區閾值時,所對應產生的該至少一遮罩係為一亮區遮罩,該亮區遮罩係用以遮沒該原始影像之該些像素中數值高於該亮區閾值者。The image processing method according to claim 1, wherein when the at least one threshold is a bright area threshold, the at least one mask generated correspondingly is a bright area mask, and the bright area mask is In order to cover those pixels in the original image whose values are higher than the threshold of the bright area. 如請求項3所述之影像處理方法,其中,該待處理影像中所決定的該至少一極值係為該些資料像素中的一極大值。The image processing method of claim 3, wherein the at least one extreme value determined in the image to be processed is a maximum value in the data pixels. 如請求項1所述之影像處理方法,其中,當該至少一閾值係為一暗區閾值時,所對應產生的該至少一遮罩係為一暗區遮罩,該暗區遮罩係用以遮沒該原始影像之該些像素中數值低於該暗區閾值者。The image processing method according to claim 1, wherein when the at least one threshold is a dark area threshold, the correspondingly generated at least one mask is a dark area mask, and the dark area mask is In order to cover those pixels in the original image whose values are lower than the threshold of the dark area. 如請求項5所述之影像處理方法,其中,該待處理影像中所決定的該至少一極值係為該些資料像素中的一極小值。The image processing method of claim 5, wherein the at least one extreme value determined in the image to be processed is a minimum value in the data pixels. 如請求項1所述之影像處理方法,其中,當該至少一閾值包含一亮區閾值與一暗區閾值時,所對應產生的該至少一遮罩包含一亮區遮罩與一暗區遮罩,該亮區遮罩係用以遮沒該原始影像之該些像素中數值高於該亮區閾值者,且該暗區遮罩係用以遮沒該原始影像之該些像素中數值低於該暗區閾值者。The image processing method of claim 1, wherein when the at least one threshold includes a bright area threshold and a dark area threshold, the correspondingly generated at least one mask includes a bright area mask and a dark area mask a mask, the bright area mask is used to mask the pixels of the original image whose values are higher than the threshold of the bright area, and the dark area mask is used to mask the pixels of the original image whose values are lower than the threshold at the threshold of the dark zone. 如請求項7所述之影像處理方法,其中,該待處理影像中所決定的該至少一極值係包含該些資料像素中的一極大值與一極小值。The image processing method of claim 7, wherein the at least one extreme value determined in the image to be processed includes a maximum value and a minimum value in the data pixels. 如請求項1所述之影像處理方法,其中,該待處理影像的亮度係通過一正規化公式進行調整,該正規化公式包括
Figure 03_image001
,其中P係為該待處理影像之資料,每一該資料的數值係介於0~R之間,P max與P min係分別為該些資料中之一最大值與一最小值,P norm係為通過該正規化公式調整後之影像。
The image processing method of claim 1, wherein the brightness of the image to be processed is adjusted by a normalization formula, and the normalization formula includes
Figure 03_image001
, where P is the data of the image to be processed, the numerical value of each data is between 0 and R, P max and P min are a maximum value and a minimum value of the data, P norm is the image adjusted by the normalization formula.
如請求項1所述之影像處理方法,其中,在產生該輸出影像前更包括一色階平滑程序,該色階平滑程序係使該輸出影像中原先被該至少一遮罩所覆掩的資料像素接近於鄰近像素。The image processing method as claimed in claim 1, further comprising a level smoothing process before generating the output image, the level smoothing process making data pixels in the output image originally covered by the at least one mask close to neighboring pixels. 如請求項10所述之影像處理方法,其中該色階平滑程序中更包含一飽和檢測步驟,其係將該輸出影像中超過一飽和值的資料像素設定為該飽和值,以防止一該資料像素產生溢位。The image processing method of claim 10, wherein the level smoothing procedure further includes a saturation detection step, which sets data pixels exceeding a saturation value in the output image to the saturation value, so as to prevent a data pixel Pixel overflows.
TW109137956A 2020-10-28 2020-10-30 Image processing method TWI783288B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011171222.1A CN112272293A (en) 2020-10-28 2020-10-28 Image processing method
CN202011171222.1 2020-10-28

Publications (2)

Publication Number Publication Date
TW202217741A true TW202217741A (en) 2022-05-01
TWI783288B TWI783288B (en) 2022-11-11

Family

ID=74345261

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109137956A TWI783288B (en) 2020-10-28 2020-10-30 Image processing method

Country Status (2)

Country Link
CN (1) CN112272293A (en)
TW (1) TWI783288B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114002225B (en) * 2021-10-19 2023-05-12 业成科技(成都)有限公司 Optical detection system and method

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW469733B (en) * 2000-01-07 2001-12-21 Dynacolor Inc Method of dynamically modulating image brightness and image catching device using the method
TWI351212B (en) * 2006-12-28 2011-10-21 Altek Corp Brightness adjusting method
TW200950536A (en) * 2008-05-19 2009-12-01 Wintek Corp Method of displaying images
TWI462575B (en) * 2008-08-06 2014-11-21 Marketech Int Corp Image processing apparatus and image processing method
CN102196233B (en) * 2010-03-18 2013-06-05 腾讯科技(深圳)有限公司 Method and device for improving video image quality
CN102222323A (en) * 2011-06-13 2011-10-19 北京理工大学 Histogram statistic extension and gradient filtering-based method for enhancing infrared image details
TW201822709A (en) * 2016-12-30 2018-07-01 曦威科技股份有限公司 Real-time heart rate detection method and real-time heart rate detection system therefor
CN108924525B (en) * 2018-06-06 2021-07-06 平安科技(深圳)有限公司 Image brightness adjusting method and device, computer equipment and storage medium
JP7173763B2 (en) * 2018-06-20 2022-11-16 株式会社日本マイクロニクス Image generation device and image generation method
CN110838091B (en) * 2019-10-25 2022-06-17 北京中电慧视科技有限公司 Fully self-adaptive infrared image contrast enhancement method and system

Also Published As

Publication number Publication date
CN112272293A (en) 2021-01-26
TWI783288B (en) 2022-11-11

Similar Documents

Publication Publication Date Title
CN111028189B (en) Image processing method, device, storage medium and electronic equipment
WO2019223069A1 (en) Histogram-based iris image enhancement method, apparatus and device, and storage medium
JP3862140B2 (en) Method and apparatus for segmenting a pixelated image, recording medium, program, and image capture device
RU2400815C2 (en) Method of enhancing digital image quality
CN101350933B (en) Method for regulating lighteness of filmed display screen based on image inductor
CN108846807B (en) Light effect processing method and device, terminal and computer-readable storage medium
TWI629904B (en) Image brightness non-uniformity correction method and image brightness correction device therefor
US9256928B2 (en) Image processing apparatus, image processing method, and storage medium capable of determining a region corresponding to local light from an image
JP5818552B2 (en) Image processing apparatus, image processing method, and program
JP2007097178A (en) Method for removing &#34;red-eyes&#34; by face detection
WO2019056549A1 (en) Image enhancement method, and image processing device
CN109146811A (en) A kind of Adaptive contrast enhancement method of color image
US20170154437A1 (en) Image processing apparatus for performing smoothing on human face area
TWI698124B (en) Image adjustment method and associated image processing circuit
US8885971B2 (en) Image processing apparatus, image processing method, and storage medium
TWI783288B (en) Image processing method
JP4851505B2 (en) Image processing apparatus and image processing method
CN108550124B (en) Illumination compensation and image enhancement method based on bionic spiral
CN110136085B (en) Image noise reduction method and device
WO2013025204A1 (en) Method for detecting existence of dust spots in digital images based on locally adaptive thresholding
JP7208823B2 (en) Video correction device and its program
CN105184747B (en) The method for improving of low-light (level) picture contrast
JP2002117400A (en) Image correction method and device, and recording medium readable by computer and having image correction program recorded thereon
JP2007312099A (en) Image-taking device
CN112887513A (en) Image noise reduction method and camera