JP5183440B2 - Gradation correction apparatus and imaging apparatus - Google Patents

Gradation correction apparatus and imaging apparatus Download PDF

Info

Publication number
JP5183440B2
JP5183440B2 JP2008300666A JP2008300666A JP5183440B2 JP 5183440 B2 JP5183440 B2 JP 5183440B2 JP 2008300666 A JP2008300666 A JP 2008300666A JP 2008300666 A JP2008300666 A JP 2008300666A JP 5183440 B2 JP5183440 B2 JP 5183440B2
Authority
JP
Japan
Prior art keywords
area
gradation
value
edge
histogram
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
Application number
JP2008300666A
Other languages
Japanese (ja)
Other versions
JP2010130150A (en
Inventor
洋一 村松
圭司 豊田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co Ltd
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 Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP2008300666A priority Critical patent/JP5183440B2/en
Publication of JP2010130150A publication Critical patent/JP2010130150A/en
Application granted granted Critical
Publication of JP5183440B2 publication Critical patent/JP5183440B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Studio Devices (AREA)

Description

本発明は、画像の階調補正を行う階調補正装置に関し、主にデジタルスチルカメラやデジタルビデオカメラ等に代表される撮像装置に用いられるものに関する。   The present invention relates to a gradation correction apparatus that performs gradation correction of an image, and particularly relates to an apparatus used in an imaging apparatus represented by a digital still camera, a digital video camera, and the like.

一般にデジタルカメラ等の撮像装置において、画面内に明るい領域と暗い領域が同時に存在する場合、2つの領域間での明暗差は得られるが、それぞれの領域内でのコントラストは小さくなる傾向がある。そのため、領域内におけるコントラストを強調する階調補正方式が提案されている。   In general, in an imaging apparatus such as a digital camera, when a bright area and a dark area exist simultaneously on the screen, a contrast between the two areas can be obtained, but the contrast in each area tends to be small. Therefore, a gradation correction method for enhancing the contrast in the region has been proposed.

広く一般に知られている有効な階調補正の方法として、ヒストグラム均等化による階調補正がある。この階調補正は、次の手順で階調補正を行う。まず、補正対象の画像のヒストグラムを作成し、ヒストグラムにおいて要素数の多い階調のコントラストを強調する階調変換カーブを求め、階調変換カーブを用いて階調補正する。   As an effective gradation correction method that is widely known, there is gradation correction by histogram equalization. This gradation correction is performed by the following procedure. First, a histogram of an image to be corrected is created, a gradation conversion curve that emphasizes the contrast of gradation with a large number of elements in the histogram is obtained, and gradation correction is performed using the gradation conversion curve.

画像に対して1つのヒストグラムではなく、複数の領域のそれぞれのヒストグラムを作成し、それぞれの領域に対応するヒストグラムに基づいて階調変換を行う方法を局所的ヒストグラム均等化による階調補正と呼ぶ。一般的には局所的ヒストグラム均等化による階調補正の方が効果的であることが知られている。   A method of creating a histogram for each of a plurality of areas instead of one histogram for an image and performing gradation conversion based on the histogram corresponding to each area is referred to as gradation correction by local histogram equalization. In general, it is known that tone correction by local histogram equalization is more effective.

しかし、ヒストグラム均等化による階調補正は、ヒストグラムの分布に基づいて階調変換を行っていることに起因する欠点がある。具体的には、画面中に同じ明るさで広い面積を占める被写体が存在したとき、ヒストグラム分布としてはその被写体の明るさに該当する階調の要素数が非常に多くなり、結果としてその被写体の階調を補正するような階調変換カーブが求まるという性質がある。このため、狭い面積の被写体に対して階調変換の効果が効きにくいという問題がある。   However, tone correction by histogram equalization has a drawback due to tone conversion based on the histogram distribution. Specifically, when a subject that occupies a wide area with the same brightness exists on the screen, the histogram distribution has a very large number of gradation elements corresponding to the brightness of the subject, and as a result, There is a property that a gradation conversion curve for correcting gradation can be obtained. For this reason, there is a problem that the effect of gradation conversion is hardly effective for a subject having a small area.

また、広い面積の被写体が元々濃淡なく均一に近いものであっても階調変換によりコントラストを強調してしまうため、本来濃淡が均一である筈の被写体に不自然に濃淡がついてしまったり、ノイズ成分だけを強調してしまったりする問題も存在する。これはヒストグラム均等化による階調補正が、被写体の面積に強く依存していることが原因である。   In addition, even if a large area of the subject is originally close to uniform with no shading, the contrast is enhanced by the tone conversion, so that the subject with the originally uniform shading is unnaturally shaded or noisy. There is also a problem that emphasizes only the ingredients. This is because tone correction by histogram equalization strongly depends on the area of the subject.

この問題に対し、特許文献1に記載された階調補正方法では、あらかじめテクスチャを解析してテクスチャが同じ部分を1つの領域として画像を領域分割し、それぞれの領域ごとにヒストグラムを求めて階調補正を行っている。また、階調補正前の段階で各領域中の濃度バラツキを判定し、濃度バラツキが十分にあると判定した領域に対してはヒストグラムの要素クリップ値を調整して階調変換の効き目を弱めるという処理を行っている。
特許第3465226号
To deal with this problem, in the gradation correction method described in Patent Document 1, the texture is analyzed in advance, the image is divided into areas with the same texture as one area, and a histogram is obtained for each area. Correction is being performed. In addition, density variation in each area is determined before gradation correction, and the effect of gradation conversion is weakened by adjusting the element clip value of the histogram for areas determined to have sufficient density variation. Processing is in progress.
Japanese Patent No. 3465226

しかしながら、上記の階調補正方法では、小面積の被写体に対する解決にはなるが、大面積の均一な被写体に対しては問題解決の手段とはならない。また、あらかじめテクスチャを解析して領域を分割することは、画像のシーンによって領域分割結果が毎回異なることになり、処理が煩雑になる。   However, the above gradation correction method solves a subject with a small area, but does not solve the problem with a uniform subject with a large area. Also, dividing the region by analyzing the texture in advance results in different region division results every time depending on the scene of the image, and the process becomes complicated.

本発明は、上記背景に鑑み、被写体の面積に依存しない階調変換カーブを求め、最適な階調変換を行う階調補正装置を提供することを目的とする。   In view of the above background, an object of the present invention is to provide a gradation correction apparatus that obtains a gradation conversion curve that does not depend on the area of a subject and performs optimal gradation conversion.

本発明の階調補正装置は、入力された画像に階調補正を行う階調補正装置であって、画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するエリア値算出部と、前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するエッジ量算出部と、前記エリア値と前記エッジ量とに基づいて、計算対象のエリアを中心とする第1の所定の範囲におけるエリア値のヒストグラムを生成するヒストグラム生成部と、計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成する階調変換カーブ生成部と、前記階調変換カーブ生成部にて生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換する階調変換部とを備えた構成を有する。   The gradation correction apparatus according to the present invention is a gradation correction apparatus that performs gradation correction on an input image, divides the image into a plurality of areas, and sets values representing pixel values in each area as area values. Based on the area value calculation unit, an edge amount calculation unit that calculates an edge amount indicating the amount of the edge component in each area, and the area value and the edge amount. A histogram generation unit that generates a histogram of area values in a first predetermined range, and a gradation conversion curve generation that generates a gradation conversion curve corresponding to the area based on the histogram corresponding to the area to be calculated And a gradation conversion unit that converts pixel values in the area to be calculated using the gradation conversion curve generated by the gradation conversion curve generation unit.

この構成により、エッジ量をも用いて求めたエリア値のヒストグラムに基づいて階調変換カーブを求めているので、階調補正前の画像の中で階調の変化が存在している領域(エッジの多い領域)を重点的に階調補正することができる。また、処理負荷の大きいヒストグラムの算出をエリアの画素値を代表するエリア値を用いて行っているので、階調補正処理に必要な記憶容量と処理負荷を大幅に削減できる。   With this configuration, the tone conversion curve is obtained based on the area value histogram obtained using the edge amount as well, so that an area where there is a change in tone (edge) in the image before tone correction. Area) with a large amount of tone). In addition, since calculation of a histogram with a large processing load is performed using area values that represent the pixel values of the area, the storage capacity and processing load required for the gradation correction processing can be greatly reduced.

本発明の階調補正装置において、前記ヒストグラム生成部は、エリアのエッジ量に基づいて前記第1の所定の範囲内の各エリア固有の値を計算し、エリア値が同じ階調に属する前記エリア固有の値を加算してヒストグラムを生成する構成を有する。   In the gradation correction apparatus of the present invention, the histogram generation unit calculates a value unique to each area within the first predetermined range based on an edge amount of the area, and the area value belongs to the same gradation. It has a configuration for generating a histogram by adding unique values.

この構成により、各エリアにおけるエッジ量の大きさをエリア値のヒストグラムに適切に反映することができる。   With this configuration, the size of the edge amount in each area can be appropriately reflected in the histogram of area values.

本発明の階調補正装置において、前記ヒストグラム生成部は、計算対象のエリアからの距離に基づいて前記第1の所定の範囲内の各エリア固有の値を計算する構成を有する。   In the gradation correction apparatus of the present invention, the histogram generation unit has a configuration for calculating a value specific to each area within the first predetermined range based on a distance from the area to be calculated.

この構成により、計算対象のエリアから第1の所定の範囲内の各エリアまでの距離をヒストグラムに反映することができる。   With this configuration, the distance from the area to be calculated to each area within the first predetermined range can be reflected in the histogram.

本発明の階調補正装置は、計算対象のエリアを中心とする第2の所定の範囲内にあるエリアのエッジ量の総和を求めるエッジ総和部を備え、前記階調変換カーブ生成部は、計算対象のエリアに対応するヒストグラムとエッジ総和とに基づいて、そのエリアに対応する階調変換カーブを生成する構成を有する。   The gradation correction apparatus according to the present invention includes an edge summation unit that obtains the sum of the edge amounts of areas within a second predetermined range centered on the area to be calculated, and the gradation conversion curve generation unit is configured to calculate A gradation conversion curve corresponding to the area is generated based on the histogram corresponding to the target area and the total edge.

この構成により、階調変換カーブをエリア値だけでなくエッジ量の総和に基づいて求めているので、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができる。なお、第2の所定の範囲は、第1の所定の範囲と同じであってもよいし、異なってもよい。   With this configuration, the gradation conversion curve is obtained based not only on the area value but also on the total amount of edges, so that the area where gradation changes exist in the image before gradation correction is focused on. Tone correction can be performed. Note that the second predetermined range may be the same as or different from the first predetermined range.

本発明の別の態様の階調補正装置は、入力された画像に階調補正を行う階調補正装置であって、画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するエリア値算出部と、前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するエッジ量算出部と、前記エリア値に基づいて、計算対象のエリアを中心とする第1の所定の範囲におけるエリア値のヒストグラムを生成するヒストグラム生成部と、計算対象のエリアを中心とする第2の所定の範囲内にあるエリアのエッジ量の総和を求めるエッジ総和部と、計算対象のエリアに対応するヒストグラムとエッジ総和とに基づいて、そのエリアに対応する階調変換カーブを生成する階調変換カーブ生成部と、前記階調変換カーブ生成部にて生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換する階調変換部とを備えた構成を有する。   A gradation correction apparatus according to another aspect of the present invention is a gradation correction apparatus that performs gradation correction on an input image, divides the image into a plurality of areas, and represents pixel values in each area. An area value calculation unit that calculates a value as an area value, an edge amount calculation unit that calculates an edge amount indicating the amount of an edge component in each of the areas, and a calculation target area based on the area value. A histogram generation unit that generates a histogram of area values in a first predetermined range, an edge total unit that calculates a sum of edge amounts of areas within a second predetermined range centered on the area to be calculated, A gradation conversion curve generation unit that generates a gradation conversion curve corresponding to the area based on the histogram and the edge total corresponding to the area to be calculated, and the gradation conversion curve generation unit The using gradation conversion curve has a configuration in which a gradation conversion unit for converting the pixel value in the calculation target area.

この構成により、階調変換カーブをエリア値だけでなくエッジ量の総和に基づいて求めているので、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができる。   With this configuration, the gradation conversion curve is obtained based not only on the area value but also on the total amount of edges, so that the area where gradation changes exist in the image before gradation correction is focused on. Tone correction can be performed.

本発明の階調補正装置において、前記階調変換カーブ生成部は、前記エッジ総和の大きさに応じて各階調の要素数の上限値および下限値を設定し、要素数が上限値を超える階調については要素数を上限値とし、要素数が下限値を下回る階調については要素数を下限値とするヒストグラムの整形を行い、各階調の要素数をその階調より下位の階調の要素数を累積した累積ヒストグラムを生成し、生成された累積ヒストグラムに基づいて階調変換カーブを求める構成を有する。   In the gradation correction apparatus of the present invention, the gradation conversion curve generation unit sets an upper limit value and a lower limit value of the number of elements of each gradation according to the size of the edge sum, and the number of elements exceeds the upper limit value. For the key, the number of elements is set as the upper limit, and for gradations where the number of elements is lower than the lower limit, the histogram is shaped with the number of elements as the lower limit. A cumulative histogram in which numbers are accumulated is generated, and a gradation conversion curve is obtained based on the generated cumulative histogram.

この構成により、ヒストグラムから階調変換カーブを生成したときに、エッジ総和の大きさに応じて各階調別に階調変換カーブの最大傾きおよび最小傾きを調整し、シーンに応じて階調補正の度合いを調整できる。   With this configuration, when the gradation conversion curve is generated from the histogram, the maximum and minimum inclinations of the gradation conversion curve are adjusted for each gradation according to the size of the total edge, and the degree of gradation correction according to the scene Can be adjusted.

本発明の階調補正装置において、前記階調変換カーブ生成部は、前記エッジ総和が大きいほど各階調の要素数の上限値を大きく、下限値を小さく設定する構成を有する。   In the gradation correction apparatus of the present invention, the gradation conversion curve generation unit has a configuration in which the upper limit value of the number of elements of each gradation is set larger and the lower limit value is set smaller as the edge sum is larger.

この構成により、エッジ総和が大きいほど階調変換カーブの最大傾きおよび最小傾きの制限を緩和して、より強力な階調補正を行うことができる。   With this configuration, the larger the sum of the edges, the more relaxed gradation correction can be performed by relaxing restrictions on the maximum inclination and minimum inclination of the gradation conversion curve.

本発明の階調補正装置において、前記エッジ総和部は、前記第2の所定の範囲内のエリアのエッジ量の総和を求める際に、計算対象のエリアからエッジ量を加算しようとするエリアまでの距離に応じた重み付けをする構成を有する。   In the gradation correction apparatus according to the present invention, the edge summation unit obtains the sum of the edge amounts of the areas within the second predetermined range from the calculation target area to the area to which the edge amount is to be added. It has the structure which weights according to distance.

この構成により、第2の所定の範囲におけるエッジ総和を算出する際に、計算対象のエリアから各エリアまでの距離に応じて、エッジ量がエッジ総和に与える影響を調整できる。   With this configuration, when calculating the total edge in the second predetermined range, the influence of the edge amount on the total edge can be adjusted according to the distance from the area to be calculated to each area.

本発明の階調補正装置において、前記エッジ量算出部は、エリアの明るさに応じて算出するエッジ量を調整する構成を有する。   In the gradation correction apparatus of the present invention, the edge amount calculation unit has a configuration for adjusting the edge amount calculated according to the brightness of the area.

この構成により、階調補正を重点的に行うべき明るさの対象について、階調を制御できる。   With this configuration, it is possible to control the gradation of a brightness target that should be subjected to gradation correction.

本発明の撮像装置は、撮像素子と、前記撮像素子によって撮像された画像を階調補正する上記した階調補正装置とを備えた構成を有する。   The image pickup apparatus of the present invention has a configuration including an image pickup element and the above-described gradation correction apparatus that performs gradation correction on an image picked up by the image pickup element.

この構成により、上記した階調補正装置と同様に、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができる。なお、本発明の階調補正装置の各種の構成を、本発明の撮像装置に適用することも可能である。   With this configuration, similar to the above-described gradation correction apparatus, it is possible to perform gradation correction mainly on an area where a change in gradation exists in an image before gradation correction. Various configurations of the gradation correction apparatus of the present invention can also be applied to the imaging apparatus of the present invention.

本発明の階調補正プログラムは、入力された画像に階調補正を行う階調補正プログラムであって、コンピュータに、画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するステップと、前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するステップと、前記エリア値と前記エッジ量とに基づいて、計算対象のエリアを中心とする所定の範囲におけるエリア値のヒストグラムを生成するステップと、計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成するステップと、生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換するステップとを実行させる。   The gradation correction program of the present invention is a gradation correction program that performs gradation correction on an input image, and divides the image into a plurality of areas, and is a value that represents the pixel value in each area. Based on the area value, the edge amount indicating the amount of the edge component in each area, and the area value and the edge amount. Generating a histogram of area values in a range, generating a gradation conversion curve corresponding to the area based on the histogram corresponding to the area to be calculated, and using the generated gradation conversion curve And a step of converting pixel values in the area to be calculated.

本発明のコンピュータ読み取り可能な記録媒体は、上記した階調補正プログラムを記録した構成を有する。   The computer-readable recording medium of the present invention has a configuration in which the above-described gradation correction program is recorded.

本発明の階調補正方法は、入力された画像に階調補正を行う階調補正方法であって、画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するステップと、前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するステップと、前記エリア値と前記エッジ量とに基づいて、計算対象のエリアを中心とする所定の範囲におけるエリア値のヒストグラムを生成するステップと、計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成するステップと、生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換するステップとを備えた構成を有する。   The gradation correction method of the present invention is a gradation correction method for performing gradation correction on an input image, and divides the image into a plurality of areas, and values representing pixel values in each area are represented by area values. In a predetermined range centered on the area to be calculated based on the area value and the edge amount based on the step of calculating the edge amount indicating the amount of the edge component in each area A step of generating an area value histogram, a step of generating a gradation conversion curve corresponding to the area based on the histogram corresponding to the area to be calculated, and a calculation target using the generated gradation conversion curve And a step of converting pixel values in the area.

これらの構成により、上記した階調補正装置と同様に、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができる。なお、本発明の階調補正装置の各種の構成を、本発明の階調補正プログラム、記録媒体および階調補正方法に適用することも可能である。   With these configurations, similar to the above-described gradation correction apparatus, it is possible to perform gradation correction focusing on an area where a change in gradation exists in an image before gradation correction. Various configurations of the gradation correction apparatus of the present invention can be applied to the gradation correction program, recording medium, and gradation correction method of the present invention.

本発明によれば、エッジ量をも用いて求めたエリア値のヒストグラムに基づいて階調変換カーブを求めているので、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができるというすぐれた効果を有する。   According to the present invention, since the gradation conversion curve is obtained based on the histogram of the area value obtained also using the edge amount, the area where the gradation change exists in the image before the gradation correction. It has an excellent effect that gradation correction can be performed with priority.

以下に、本発明の実施の形態の階調補正装置を備えた撮像装置について、図面を参照しながら説明する。   Hereinafter, an imaging apparatus including a gradation correction apparatus according to an embodiment of the present invention will be described with reference to the drawings.

図1は、実施の形態の撮像装置の構成を示す図である。撮像装置は、被写体からの光を撮像素子3に結像するためのレンズ1と、撮像素子3に入射する光量を制御する絞り部2と、結像した像を光電変換する撮像素子3と、撮像素子3から得られるアナログ信号をデジタル信号に変換するA/D変換器4と、A/D変換された映像信号に対しOB減算やホワイトバランス調整などを行う前処理回路5と、前処理後の映像信号を輝度信号と色差信号に分離するYC分離回路6と、YC分離回路6から出力された輝度信号および色差信号に階調補正を行う階調補正部100と、輝度信号を処理するY信号処理回路7と、色差信号を処理するC信号処理回路8を備える。階調補正部100は、本発明の階調補正装置に該当する。   FIG. 1 is a diagram illustrating a configuration of an imaging apparatus according to an embodiment. The imaging apparatus includes a lens 1 for imaging light from a subject on the imaging device 3, a diaphragm unit 2 that controls the amount of light incident on the imaging device 3, an imaging device 3 that photoelectrically converts the formed image, An A / D converter 4 that converts an analog signal obtained from the image sensor 3 into a digital signal, a preprocessing circuit 5 that performs OB subtraction, white balance adjustment, and the like on the A / D converted video signal, and post-processing YC separation circuit 6 that separates the video signal into a luminance signal and a color difference signal, a gradation correction unit 100 that performs gradation correction on the luminance signal and the color difference signal output from YC separation circuit 6, and Y that processes the luminance signal A signal processing circuit 7 and a C signal processing circuit 8 for processing color difference signals are provided. The gradation correction unit 100 corresponds to the gradation correction apparatus of the present invention.

階調補正部100は、前処理後の映像信号からエッジ信号を抽出するエッジ抽出回路10と、エッジ抽出回路10で抽出したエッジ信号と前処理後の映像信号をそれぞれ複数のエリアに分割するエリア分割回路11と、エリア分割回路11で分割した全てのエリアについて、映像信号からエリア値を算出するエリア値算出回路12と、エッジ信号からエッジ量を算出するエッジ量算出回路13を備えている。エリア値とは、エリアを代表する映像信号の値であり、例えば、エリアに含まれる全画素の画素値の平均値や中央値を用いることができる。エッジ量とはエリアを代表するエッジ信号の値であり、例えばエリアに含まれる全画素のエッジ信号の大きさの平均値や中央値を用いることができる。   The gradation correction unit 100 extracts an edge signal from the pre-processed video signal, and an area for dividing the edge signal extracted by the edge extraction circuit 10 and the pre-processed video signal into a plurality of areas, respectively. For each of the areas divided by the dividing circuit 11, the area dividing circuit 11, an area value calculating circuit 12 for calculating an area value from the video signal, and an edge amount calculating circuit 13 for calculating an edge amount from the edge signal are provided. The area value is a value of a video signal representing the area, and for example, an average value or a median value of the pixel values of all the pixels included in the area can be used. The edge amount is a value of an edge signal representing an area, and for example, an average value or a median value of the edge signals of all pixels included in the area can be used.

また、階調補正部100は、エリア値算出回路12で算出されたエリア値と、エッジ量算出回路13で算出されたエッジ量を1フレーム期間記憶する記憶部14とを備えている。   In addition, the gradation correction unit 100 includes a storage unit 14 that stores the area value calculated by the area value calculation circuit 12 and the edge amount calculated by the edge amount calculation circuit 13 for one frame period.

また、階調補正部100は、記憶部14が記憶するエッジ量に基づいて各エリアを中心とした局所領域におけるエッジ量の総和を算出するエッジ総和算出回路15と、エリア値とエッジ量に基づいて各エリアを中心とした局所領域におけるヒストグラムを算出する局所的ヒストグラム算出回路16と、局所的ヒストグラム算出回路16で算出された各ヒストグラムに対してエッジ総和算出回路15で算出したエッジ総和を参照してクリップ処理や平滑化などの整形処理を行うヒストグラム整形回路17と、整形後のヒストグラムからエリア毎の階調変換カーブを生成する階調変換カーブ生成回路18とを備えている。ここで、ヒストグラム整形回路17、および階調変換カーブ生成回路18は、請求項に記載した「階調変換カーブ生成部」に該当する。階調変換カーブ生成回路18にて求められる階調変換カーブは、エリア別の階調変換カーブである。すなわち、所定のエリアを中心とした局所領域におけるヒストグラムを用いて算出された階調変換カーブは、その所定のエリアに対応する階調変換カーブである。   Further, the gradation correction unit 100 is based on the edge sum calculation circuit 15 that calculates the sum of the edge amounts in the local area centered on each area based on the edge amount stored in the storage unit 14, and based on the area value and the edge amount. A local histogram calculation circuit 16 for calculating a histogram in a local region centered on each area, and an edge sum calculated by the edge sum calculation circuit 15 for each histogram calculated by the local histogram calculation circuit 16. A histogram shaping circuit 17 that performs shaping processing such as clip processing and smoothing, and a gradation conversion curve generation circuit 18 that generates a gradation conversion curve for each area from the histogram after shaping. Here, the histogram shaping circuit 17 and the gradation conversion curve generation circuit 18 correspond to the “gradation conversion curve generation unit” recited in the claims. The gradation conversion curve obtained by the gradation conversion curve generation circuit 18 is a gradation conversion curve for each area. That is, the gradation conversion curve calculated using the histogram in the local area centered on the predetermined area is a gradation conversion curve corresponding to the predetermined area.

階調補正部100は、階調変換カーブを使って前処理後の映像信号値Lを変換する階調変換回路19と、階調変換回路19で得られた複数の階調変換後の映像信号値を線形補間計算する線形補間回路20と、前処理後の映像信号値Lと階調変換後の映像信号値L’の比を計算する比率計算回路21と、計算された比率をYC分離回路7で生成された輝度信号および色信号に乗算する回路とを備えている。   The tone correction unit 100 uses a tone conversion curve to convert the pre-processed video signal value L, and a plurality of tone-converted video signals obtained by the tone conversion circuit 19. A linear interpolation circuit 20 that performs linear interpolation calculation of values, a ratio calculation circuit 21 that calculates a ratio between the pre-processed video signal value L and the gradation-converted video signal value L ′, and the calculated ratio as a YC separation circuit. And a circuit for multiplying the luminance signal and the color signal generated in step.

以上のように構成された撮像装置における階調補正の動作、すなわち、エッジ抽出回路10から比率計算回路21を経て求めた変換比率を、輝度信号および色信号に乗算するまでの動作について説明する。   An operation of gradation correction in the imaging apparatus configured as described above, that is, an operation until the luminance signal and the color signal are multiplied by the conversion ratio obtained from the edge extraction circuit 10 via the ratio calculation circuit 21 will be described.

撮像素子3による撮像によって得られた映像信号は、A/D変換部4および前処理回路5を介してYC分離回路6および階調補正部100に入力される。   A video signal obtained by imaging by the imaging device 3 is input to the YC separation circuit 6 and the gradation correction unit 100 via the A / D conversion unit 4 and the preprocessing circuit 5.

階調補正部100のエッジ抽出回路10は、入力された画像からエッジ信号を抽出する。本実施の形態においてエッジ信号抽出は、階調補正結果に大きく影響を与える。ここでは有効なエッジ信号抽出手法として2つの方法を取り上げる。   The edge extraction circuit 10 of the gradation correction unit 100 extracts an edge signal from the input image. In the present embodiment, the edge signal extraction greatly affects the gradation correction result. Here, two methods are taken up as effective edge signal extraction methods.

図2は、1つ目のエッジ信号抽出手法を説明する図である。まず、入力画像に対してエッジ抽出フィルタを適用する。なお、エッジ抽出フィルタを適用する前にローパスフィルタなどを適用し、あらかじめ画面中のノイズ成分を除去することも有効である。ここで、エッジ抽出フィルタとしては、SobelフィルタやCannyエッジフィルタなどの既知のフィルタを用いることができる。これらのフィルタの結果として、フィルタによる抽出結果が得られる。次に、この結果に対して、エッジ調整係数を乗ずることで最終的なエッジ信号抽出結果を得る。エッジ調整係数とは、入力画像の各画素の画素値に応じて、フィルタによるエッジ抽出結果に対して乗ずるゲインのことである。図2に示す例では、入力画像の画素値が小さいほどゲインは大きくなっており、結果として低画素値のエッジ信号が大きくなる。このように、エッジ調整係数は、どの階調のエッジ信号を抽出するかを調整する役割を担う。これにより、エリアの明るさに応じてエッジを抽出することが可能となり、例えば画面中の暗い領域に存在するエッジ信号だけを重点的に抽出することができる。階調補正の狙いに沿ったエッジ信号抽出が可能になる。   FIG. 2 is a diagram for explaining a first edge signal extraction method. First, an edge extraction filter is applied to the input image. It is also effective to remove a noise component in the screen in advance by applying a low-pass filter or the like before applying the edge extraction filter. Here, a known filter such as a Sobel filter or a Canny edge filter can be used as the edge extraction filter. As a result of these filters, an extraction result by the filter is obtained. Next, a final edge signal extraction result is obtained by multiplying this result by an edge adjustment coefficient. The edge adjustment coefficient is a gain by which the edge extraction result by the filter is multiplied according to the pixel value of each pixel of the input image. In the example illustrated in FIG. 2, the gain increases as the pixel value of the input image decreases, and as a result, the edge signal having a low pixel value increases. In this way, the edge adjustment coefficient plays a role of adjusting which gradation edge signal is extracted. Thereby, it becomes possible to extract an edge according to the brightness of the area, and for example, only an edge signal existing in a dark area on the screen can be extracted with priority. Edge signal extraction along the purpose of gradation correction can be performed.

図3は、2つ目のエッジ信号抽出手法について説明する図である。まず、入力画像に対してローパスフィルタを適用する。このローパスフィルタによる処理は、ノイズ成分をエッジ信号と誤判定しないための処理である。次に、画面中の各画素を注目画素として、注目画素とその周辺近傍の8画素との差分値をそれぞれ計算する。差分値は、2つの画素の差分の絶対値である。ノイズ対策のため、求まった差分値が閾値diffTHより小さいときは差分無しとする。   FIG. 3 is a diagram for explaining a second edge signal extraction method. First, a low pass filter is applied to the input image. This processing by the low-pass filter is processing for preventing a noise component from being erroneously determined as an edge signal. Next, using each pixel in the screen as a target pixel, a difference value between the target pixel and eight neighboring pixels is calculated. The difference value is an absolute value of the difference between the two pixels. As a noise countermeasure, when the obtained difference value is smaller than the threshold value diffTH, there is no difference.

次に、ここまでの処理で求まっている8つの差分値に対して、それぞれの差分値を計算した2つの画素の平均値で除算する。例えば、注目画素と左上画素A1について考えると、まず2つの画素の差分の絶対値から差分1’が求まり、さらに差分1’を注目画素と左上画素A1の平均値で除算したものが差分1となる。同様に差分1から差分8までを求める。求めた差分1から差分8の総和を差分計とし、差分計がTHmin以上、THmax未満のとき注目画素はエッジ信号であると判定する。   Next, the eight difference values obtained in the above processing are divided by the average value of the two pixels calculated for each difference value. For example, considering the target pixel and the upper left pixel A1, first, the difference 1 ′ is obtained from the absolute value of the difference between the two pixels, and the difference 1 ′ is further divided by the average value of the target pixel and the upper left pixel A1 as the difference 1. Become. Similarly, the difference 1 to the difference 8 are obtained. The sum of the obtained differences 1 to 8 is used as a difference meter, and when the difference meter is equal to or higher than THmin and lower than THmax, the target pixel is determined to be an edge signal.

以上が2つ目のエッジ信号抽出手法である。この抽出手法では画面中の暗い領域のエッジは抽出しやすく、明るい領域のエッジは抽出しにくいという特性を持つ。この特性により、主に暗部の視認性を向上する目的に用いる階調補正に適している。   The above is the second edge signal extraction method. This extraction method has characteristics that it is easy to extract edges of dark areas on the screen and it is difficult to extract edges of bright areas. This characteristic is suitable for gradation correction used mainly for the purpose of improving the visibility of dark areas.

次に、エリア分割回路11は、入力された画像およびエッジ抽出回路10によって抽出されたエッジ抽出結果を複数のエリアに分割する。入力画像およびエッジ抽出結果のエリア分割は同じとし、1エリア内には少なくとも1個の画素が属している。   Next, the area division circuit 11 divides the input image and the edge extraction result extracted by the edge extraction circuit 10 into a plurality of areas. The area division of the input image and the edge extraction result is the same, and at least one pixel belongs to one area.

図4は、エリア分割の例を示す図である。図4では、画像の大きさを水平640画素、垂直480画素としたときに、画像を水平80個、垂直60個の計4800個のエリアに分割した例を示している。このとき、1エリア中には、水平8個、垂直8個の計64個の画素が含まれる。   FIG. 4 is a diagram illustrating an example of area division. FIG. 4 shows an example in which the image is divided into a total of 4800 areas of 80 horizontal and 60 vertical when the image size is 640 pixels horizontal and 480 pixels vertical. At this time, one area includes a total of 64 pixels of 8 horizontal pixels and 8 vertical pixels.

続いて、エリア値算出回路12は、エリア分割回路11にて分割されたエリアごとに、そのエリアに属する画素値の平均値を算出し、算出した平均値をエリア値とする。以下の処理では、このエリア値を用いる。   Subsequently, for each area divided by the area dividing circuit 11, the area value calculating circuit 12 calculates an average value of the pixel values belonging to the area, and sets the calculated average value as the area value. This area value is used in the following processing.

また、エッジ量算出回路13においても同様に、エリア分割回路11にて分割されたエリアごとに、そのエリアに属するエッジ信号の大きさの平均値を算出し、算出した平均値をエッジ量とする。以下の処理では、このエッジ量を用いる。   Similarly, in the edge amount calculation circuit 13, for each area divided by the area division circuit 11, an average value of the magnitudes of the edge signals belonging to the area is calculated, and the calculated average value is used as the edge amount. . In the following processing, this edge amount is used.

これらのエリア化により、画素単位の画素値やエッジ信号を利用した計算を行わなくてもよいので、計算処理の負荷を軽減できる。また、エリア値およびエッジ量は必要に応じて階調削減を行う。本実施の形態では、エリア値を5bit長に、エッジ量を2bitに削減する。これにより、エリア値およびエッジ量を記憶部14に記憶するにあたりメモリ容量を削減することができる。   By making these areas, it is not necessary to perform calculation using pixel values or edge signals in units of pixels, so the load of calculation processing can be reduced. Further, the area value and the edge amount are subjected to gradation reduction as necessary. In this embodiment, the area value is reduced to 5 bits and the edge amount is reduced to 2 bits. Thereby, the memory capacity can be reduced when the area value and the edge amount are stored in the storage unit 14.

ここまでの処理によって、階調削減された各エリアのエリア値とエッジ量が、階調補正部100の記憶部14に記憶される。階調補正部100は、各エリアのエリア値とエッジ量を用いて、各エリアに対応する階調変換カーブを求める。階調変換カーブを求める処理は、エッジ総和算出回路15、局所的ヒストグラム算出回路16、ヒストグラム整形回路17、階調変換カーブ生成回路18によって行われる。   Through the processing so far, the area value and the edge amount of each area whose gradation has been reduced are stored in the storage unit 14 of the gradation correction unit 100. The gradation correction unit 100 obtains a gradation conversion curve corresponding to each area using the area value and edge amount of each area. The processing for obtaining the gradation conversion curve is performed by the edge total calculation circuit 15, the local histogram calculation circuit 16, the histogram shaping circuit 17, and the gradation conversion curve generation circuit 18.

エッジ総和算出回路15は、記憶部14に記憶されたエッジ量を使って、各エリアを中心とした局所領域におけるエッジ量の総和を算出する。   The edge sum total calculation circuit 15 calculates the sum of the edge amounts in the local region centered on each area, using the edge amounts stored in the storage unit 14.

図5は、エッジ総和の算出について説明するための図である。エッジ総和算出回路15は、注目エリアを中心とした所定範囲にあるエリアを対象に、注目エリアからの距離に応じて重み付けを行った上で、所定範囲内にあるエリアのエッジ量の総和を求める。   FIG. 5 is a diagram for explaining the calculation of the edge sum. The edge sum total calculation circuit 15 calculates the sum of the edge amounts of the areas in the predetermined range after weighting according to the distance from the target area for the area in the predetermined range centered on the target area. .

図5に示す例では、注目エリアECを中心に水平距離D1、垂直距離D1の範囲E1内にある各エリアについては、エッジ量をK1倍する。同様に、注目エリアECを中心に水平距離D2、垂直距離D2の範囲にあり、かつ範囲E1に含まれない範囲E2内にある各エリアについては、エッジ量をK2倍する。注目エリアECを中心に水平距離D3、垂直距離D3の範囲にあり、かつ範囲E1およびE2に含まれない範囲E3内にある各エリアについては、エッジ量をK3倍する。注目エリアECを中心に水平距離D4、垂直距離D4の範囲にあり、かつ範囲E1からE3に含まれない範囲E4内にある各エリアについては、エッジ量をK4倍する。そして、これらの重み係数をかけたエッジ量の合計値をエッジ総和とする。   In the example shown in FIG. 5, the edge amount is multiplied by K1 for each area within the range E1 of the horizontal distance D1 and the vertical distance D1 centering on the attention area EC. Similarly, the edge amount is multiplied by K2 for each area in the range E2 that is within the horizontal distance D2 and the vertical distance D2 around the attention area EC and is not included in the range E1. The edge amount is multiplied by K3 for each area in the range E3 that is within the horizontal distance D3 and the vertical distance D3 around the attention area EC and is not included in the ranges E1 and E2. The edge amount is multiplied by K4 for each area in the range E4 that is in the range of the horizontal distance D4 and the vertical distance D4 around the attention area EC and is not included in the ranges E1 to E3. Then, the total value of the edge amounts multiplied by these weighting factors is defined as the total edge.

なお、注目エリアECを中心として範囲E4以内に含まれない画面上のエリアは、この注目エリアで算出するエッジ総和には関与しない。ここで、重み係数K1〜K4は、重み係数K1が一番大きく重み係数K4に向かって順次係数を小さくし、距離D1〜D4は、距離D1が一番小さく、距離D4に向かった順次距離を大きくする。これにより、注目エリアECから距離的に遠くなるほど注目エリアECにおけるエッジ総和に与える影響を小さくすることができる。重み係数K1〜K4と水平距離および垂直距離D1〜D4は、経験上K1=4、K2=3、K3=2、K4=1、D1=12、D2=25、D3=40、D4=60程度の値とすることが望ましい。   Note that an area on the screen that is not included within the range E4 with the attention area EC as the center is not involved in the edge sum calculated in this attention area. Here, the weighting factors K1 to K4 are the largest in the weighting factor K1 and are sequentially decreased toward the weighting factor K4, and the distances D1 to D4 are the distances in which the distance D1 is the smallest and traveled toward the distance D4. Enlarge. As a result, as the distance from the attention area EC increases, the influence on the total edge in the attention area EC can be reduced. The weighting factors K1 to K4 and the horizontal and vertical distances D1 to D4 are based on experience, K1 = 4, K2 = 3, K3 = 2, K4 = 1, D1 = 12, D2 = 25, D3 = 40, and D4 = 60. It is desirable to set the value of.

ここで、本実施の形態では、階調変換を行う際に、階調変換の対象となる画素を含むエリアと当該エリアに隣接する3つのエリアの合計4つのエリアの階調変換カーブを用いて階調補正を行う。階調補正部100は、エッジ総和算出回路15から階調変換回路19まで、4つの注目エリアについて、独立にそれぞれのエッジ総和や局所的ヒストグラムを算出し、それに基づいて階調変換カーブを生成して階調変換結果を得る。   Here, in the present embodiment, when gradation conversion is performed, a gradation conversion curve of a total of four areas including an area including a pixel to be subjected to gradation conversion and three areas adjacent to the area is used. Perform gradation correction. The tone correction unit 100 independently calculates the edge sum and local histogram for each of the four areas of interest from the edge sum calculation circuit 15 to the tone conversion circuit 19, and generates a tone conversion curve based on the sum. To obtain the gradation conversion result.

図6は、4つの注目エリアについて説明する図である。4つの注目エリアは、図6に示すように現在処理している注目画素Kから、重心位置への距離が近いエリア(i,j)、エリア(i+1,j)、エリア(i,j+1)、エリア(i+1,j+1)を選択する。エッジ総和算出回路15から階調変換回路19まで並列に処理され、線形補間回路20において4つの階調変換後の映像信号値を用いて線形補間計算を行い、1つの階調変換後の映像信号値L’を得る。   FIG. 6 is a diagram illustrating four attention areas. As shown in FIG. 6, the four areas of interest are an area (i, j), an area (i + 1, j), an area (i, j + 1), an area (i, j), a distance from the pixel of interest K currently being processed to the center of gravity position. Area (i + 1, j + 1) is selected. The edge summation calculation circuit 15 to the gradation conversion circuit 19 are processed in parallel, and the linear interpolation circuit 20 performs linear interpolation calculation using four gradation-converted video signal values. One gradation-converted video signal The value L ′ is obtained.

4つのエリアに注目した処理は、並列に実行されるが処理内容としては同様であるので、エッジ総和算出回路15から階調変換回路19の説明では1つのエリアの処理について注目して説明する。   The processing focused on the four areas is executed in parallel, but the processing contents are the same. Therefore, in the description of the edge total calculation circuit 15 to the gradation conversion circuit 19, the processing of one area will be focused on and described.

局所的ヒストグラム算出回路16は、記憶部14に記憶されたエリア値とエッジ量を使って、各エリアを中心とした局所領域におけるヒストグラムを算出する。   The local histogram calculation circuit 16 calculates a histogram in a local region centered on each area using the area value and edge amount stored in the storage unit 14.

図7は、局所的ヒストグラムの算出について説明するための図である。局所的ヒストグラム算出回路16は、注目エリアを中心にした所定範囲内にあるエリアを対象に、注目エリアから各エリアへの距離と各エリアのエッジ量に応じて、各エリアの固有の値を求め、エリア固有の値を階調ごとに加算してヒストグラムを算出する。なお、エリア固有の値は、そのエリアのエリア値が属する階調の要素数としてカウントする際に、1個としてカウントするのではなく、重みWを乗じて「W個」としてカウントする際のWに対応する値である。   FIG. 7 is a diagram for explaining calculation of a local histogram. The local histogram calculation circuit 16 obtains a unique value of each area according to the distance from the area of interest to each area and the edge amount of each area for an area within a predetermined range centered on the area of interest. Then, a histogram is calculated by adding area-specific values for each gradation. It should be noted that the area-specific value is not counted as one when counting as the number of gradation elements to which the area value of the area belongs, but is multiplied by the weight W and counted as “W”. Is a value corresponding to.

図7に示す例では、注目エリアECを中心に水平距離D1、垂直距離D1の範囲E1内にある各エリアについては、エリア固有の値W1を次式により求める。

Figure 0005183440
In the example shown in FIG. 7, for each area within the range E1 of the horizontal distance D1 and the vertical distance D1 with the attention area EC as the center, an area-specific value W1 is obtained by the following equation.
Figure 0005183440

範囲E1内に適用される距離重み係数origW1をベースに、各エリアのエッジ量に応じて係数origW1をエッジ量で調整した重みである。係数G1は、エッジ量を調整する係数である。係数origW1および係数G1は、範囲E1内で同じ値が適用されるが、エッジ量は各エリアによって異なるので範囲E1の中であっても、エリア固有の値W1は異なる。   Based on the distance weight coefficient origW1 applied in the range E1, the weight is obtained by adjusting the coefficient origW1 by the edge amount according to the edge amount of each area. The coefficient G1 is a coefficient for adjusting the edge amount. The same value is applied to the coefficient origW1 and the coefficient G1 within the range E1, but since the edge amount varies depending on each area, the area-specific value W1 is different even within the range E1.

同様に、注目エリアECを中心に水平距離D2、垂直距離D2の範囲にあり、かつ範囲E1に含まれない範囲E2内にある各エリアについては、エリア固有の値W2を次式により求める。

Figure 0005183440
Similarly, for each area in the range E2 that is in the range of the horizontal distance D2 and the vertical distance D2 around the attention area EC and is not included in the range E1, an area-specific value W2 is obtained by the following equation.
Figure 0005183440

注目エリアECを中心に水平距離D3、垂直距離D3の範囲にあり、かつ範囲E1およびE2に含まれない範囲E3内にある各エリアについては、エリア固有の値W3を次式により求める。

Figure 0005183440
For each area in the range E3 that is in the range of the horizontal distance D3 and the vertical distance D3 around the area of interest EC and not included in the ranges E1 and E2, an area-specific value W3 is obtained by the following equation.
Figure 0005183440

注目エリアECを中心に水平距離D4、垂直距離D4の範囲にあり、かつ範囲E1からE3に含まれない範囲E4内にある各エリアについては、エリア固有の値W4を次式により求める。

Figure 0005183440
For each area within the range E4 that is in the range of the horizontal distance D4 and the vertical distance D4 around the attention area EC and is not included in the ranges E1 to E3, an area-specific value W4 is obtained by the following equation.
Figure 0005183440

注目エリアECを中心として範囲E4以内に含まれない画面上のエリアは、この注目エリアで算出する局所的ヒストグラムには関与しない。ここで、距離重み係数origW1〜origW4は、距離重み係数origW1が一番大きく距離重み係数origW4に向かって順次係数を小さくし、距離D1〜D4は、距離D1が一番小さく、距離D4に向かった順次距離を大きくするのが適当である。これにより、注目エリアECから距離的に遠くなるほど注目エリアECにおける局所的ヒストグラムに与える影響を小さくすることができる。また、エッジ量調整係数G1〜G4は、距離重み係数との乗算となるため距離重み係数との兼ね合いで適宜設定する。それぞれの係数は、経験上origW1=14、origW2=6、origW3=2、origW4=1、G1=0.29、G2=0.5、G3=1、G4=1程度の値を取ることが望ましい。距離D1〜D4は、エッジ総和算出回路15と同じとする。また、エッジ量は2bitに削減されているため0〜3の値を取る。 The area on the screen that is not included within the range E4 with the attention area EC as the center is not involved in the local histogram calculated in this attention area. Here, the distance weight coefficients origW1 to origW4 have the largest distance weight coefficient origW1 and the smaller the coefficients sequentially toward the distance weight coefficient origW4, and the distances D1 to D4 have the smallest distance D1 and go to the distance D4. It is appropriate to increase the distance sequentially. Thereby, the influence on the local histogram in the attention area EC can be reduced as the distance from the attention area EC increases. Further, the edge amount adjustment coefficients G1 to G4 are multiplied by the distance weighting coefficient, and thus are appropriately set in consideration of the distance weighting coefficient. Each coefficient has a value of about orig W1 = 14, orig W2 = 6, orig W3 = 2, orig W4 = 1, G1 = 0.29, G2 = 0.5, G3 = 1, G4 = 1. Is desirable. The distances D1 to D4 are the same as those in the edge total calculation circuit 15. Since the edge amount is reduced to 2 bits, it takes a value of 0 to 3.

図8は、注目エリアが画像の端部付近にある場合を示している。図8のように、注目エリアが画像の端部付近にある場合には、当該エリアを中心とする所定範囲(エリア参照範囲)が画像の外にはみ出してしまう場合がある。この場合、画面外にはみ出した範囲に関しては、値が存在しないものとして扱ってもよいし、端部処理として別処理を行ってもよい。例えば、画面の一番外枠のエリアが画面外に無限に広がっていると考えて局所的ヒストグラムの範囲をケアする方法や、画面の一番外枠のエリアを対称に画面の外側は内側を折り返していると考えて局所的ヒストグラムの範囲をケアする方法が考えられる。   FIG. 8 shows a case where the attention area is near the edge of the image. As shown in FIG. 8, when the area of interest is near the edge of the image, a predetermined range (area reference range) centered on the area may protrude from the image. In this case, the range outside the screen may be treated as having no value, or another process may be performed as the edge process. For example, a method of caring for the area of the local histogram considering that the area of the outermost frame of the screen extends infinitely outside the screen, or the outer side of the screen is folded inside with the outermost frame area of the screen symmetrical A method of caring for the range of the local histogram can be considered.

次に、ヒストグラム整形回路17は、局所的ヒストグラム算出回路16にて算出された局所的ヒストグラムに対して処理を行う。ヒストグラム整形回路17は、(1)要素数の上下階調への分配処理、(2)要素数のMAXクリップ、(3)要素数のMINクリップの3つの処理を行う。   Next, the histogram shaping circuit 17 performs processing on the local histogram calculated by the local histogram calculation circuit 16. The histogram shaping circuit 17 performs three processes: (1) a process of distributing the number of elements to upper and lower gradations, (2) a MAX clip of the number of elements, and (3) a MIN clip of the number of elements.

図9は、ヒストグラムの要素数を上下階調へ分配する処理を説明するための図である。分配処理では、ヒストグラム全32階調において、各階調の要素数を上下の階調に分配することにより、ヒストグラムの平滑化を行う。本実施の形態では、エリアに含まれる8×8画素の画素値を一つのエリア値によって処理しているために、実際の画像に含まれていた様々な値の画素値が丸められてしまっている。分配処理は、エリア値を用いることによって、丸められた分を元に戻すという考えに基づく処理である。   FIG. 9 is a diagram for explaining a process of distributing the number of elements of the histogram to the upper and lower gradations. In the distribution process, the histogram is smoothed by distributing the number of elements of each gradation to the upper and lower gradations in all 32 gradations of the histogram. In the present embodiment, since the pixel values of 8 × 8 pixels included in the area are processed by one area value, the pixel values of various values included in the actual image are rounded. Yes. The distribution process is a process based on the idea that the rounded portion is restored by using the area value.

要素数の分配処理は、注目階調の要素数に対し、注目階調から見て上下1階調離れた階調へは重み係数V1を乗じた値を加算し、上下2階調離れた階調へは重み係数V2を乗じた値を加算し、上下3階調離れた階調へは重み係数V3を乗じた値を加算するというように、注目階調との階調差に応じて重み係数を設定し、注目階調の要素数を上下階調へ分配する。   In the distribution process of the number of elements, a value obtained by multiplying the number of elements of the target gradation by a weighting factor V1 is added to the gradation that is one gradation above and below the target gradation, and the gradation that is two gradations above and below is added. A value multiplied by the weighting factor V2 is added to the key, and a value multiplied by the weighting factor V3 is added to the tone separated by three tones above and below, so that the weight is determined according to the tone difference from the target tone. A coefficient is set, and the number of elements of the target gradation is distributed to the upper and lower gradations.

図9(a)は、分配処理前のヒストグラムの例を示す図である。図9(b)は、図9(a)に示すヒストグラムに対して、V1=0.75、V2=0.50、V3=0.25という重み係数を設定し、かつ、存在しない階調への分配分を破棄する処理を行った結果を示す図である。なお、重み係数V1、V2、V3は経験上V1≧V2≧V3とするのが望ましい。   FIG. 9A shows an example of a histogram before distribution processing. In FIG. 9B, a weighting factor of V1 = 0.75, V2 = 0.50, V3 = 0.25 is set for the histogram shown in FIG. It is a figure which shows the result of having performed the process which discards the distribution part of. The weight coefficients V1, V2, and V3 are preferably V1 ≧ V2 ≧ V3 from experience.

図9(c)〜図9(e)は、図9(a)に示すヒストグラムから、分配処理により図9(b)にヒストグラムを求める途中経過を示す図である。図9(c)は、図9(a)に示すヒストグラムの階調0における値100を上下の階調に分配する例を示す図である。図9(c)に示すように階調1に対しては、100×V1(0.75)=75という値が加算され、階調2に対しては、100×V2(0.5)=50という値が加算され、階調3に対しては、100×V3(0.25)=25という値が加算される。なお、階調0は最も低い階調であるので、階調0より低い階調は存在しない。この場合、階調外への分配分は消失する。   FIG. 9C to FIG. 9E are diagrams showing the progress in the middle of obtaining the histogram in FIG. 9B by the distribution process from the histogram shown in FIG. 9A. FIG. 9C is a diagram showing an example in which the value 100 at the gradation 0 of the histogram shown in FIG. 9A is distributed to the upper and lower gradations. As shown in FIG. 9C, a value of 100 × V1 (0.75) = 75 is added to the gradation 1, and 100 × V2 (0.5) = 75 for the gradation 2. A value of 50 is added, and for gradation 3, a value of 100 × V3 (0.25) = 25 is added. Note that since gradation 0 is the lowest gradation, there is no gradation lower than gradation 0. In this case, the distribution outside the gradation is lost.

図9(d)は、図9(c)と同様に、図9(a)に示すヒストグラムの階調1における値200を上下の階層に分配する例を示し、図9(e)は、階調2における値150を上下の階層に分配する例を示す。図9(c)、図9(d)、図9(e)に示す分配値の総和をとることによって、図9(b)に示す結果が得られる。図9(b)に見られるように、分配処理によって、ヒストグラムは平滑化される。
次に、ヒストグラム整形回路17が行う要素数のクリップについて説明する。
FIG. 9 (d) shows an example in which the value 200 at gradation 1 of the histogram shown in FIG. 9 (a) is distributed to the upper and lower layers, as in FIG. 9 (c). The example which distributes the value 150 in the key 2 to an upper and lower hierarchy is shown. The sum shown in FIG. 9C, FIG. 9D, and FIG. 9E is taken to obtain the result shown in FIG. 9B. As seen in FIG. 9B, the histogram is smoothed by the distribution process.
Next, the clip of the number of elements performed by the histogram shaping circuit 17 will be described.

図10(a)および図10(b)は、要素数のクリップを説明するための図である。図10(a)はクリップ処理前のヒストグラムを示し、図10(b)はクリップ処理後のヒストグラムを示す。ヒストグラム整形回路17は、各階調について独立に、要素数のMAXクリップ値およびMINクリップ値を設定し、要素数のクリップ処理を行う。すなわち、ヒストグラム整形回路17は、各階調についてMAXクリップ値を超える要素数はMAXクリップ値まで減算し、MINクリップ値に満たない要素数はMINクリップ値まで加算する。   FIG. 10A and FIG. 10B are diagrams for explaining the clip of the number of elements. FIG. 10A shows a histogram before clip processing, and FIG. 10B shows a histogram after clip processing. The histogram shaping circuit 17 sets the MAX clip value and the MIN clip value for the number of elements independently for each gradation, and performs the clip process for the number of elements. That is, the histogram shaping circuit 17 subtracts the number of elements exceeding the MAX clip value for each gradation to the MAX clip value, and adds the number of elements less than the MIN clip value to the MIN clip value.

次に、MAXクリップ値およびMINクリップ値について説明する。MAXクリップ値およびMINクリップ値の設定は、階調補正結果に大きく関係する。基本的には、MAXクリップ値を大きくするほど、または、MIN値クリップを小さくするほど階調補正の度合いは大きくなりコントラスト改善も大きくなる。クリップ値は、各階調で独立して設定する。   Next, the MAX clip value and the MIN clip value will be described. The setting of the MAX clip value and the MIN clip value is largely related to the gradation correction result. Basically, the larger the MAX clip value or the smaller the MIN value clip, the greater the degree of gradation correction and the greater the contrast improvement. Clip values are set independently for each gradation.

MAXクリップ値およびMINクリップ値は、あらかじめ設定した値を基準にエッジ総和算出回路15で求めた注目エリアのエッジ総和によって調整する。   The MAX clip value and the MIN clip value are adjusted by the edge sum of the area of interest obtained by the edge sum calculation circuit 15 with reference to a preset value.

図11(a)および図11(b)は、エッジ総和の大きさとMAXクリップ値およびMINクリップ値の調整について説明する図である。図11(a)は、MAXクリップ値の調整を説明する図であり、エッジ総和が大きいときはMAXクリップ値を基準値よりも大きくし、エッジ総和が小さいときは基準値よりも小さくする。   FIG. 11A and FIG. 11B are diagrams for explaining the adjustment of the size of the edge sum, the MAX clip value, and the MIN clip value. FIG. 11A is a diagram for explaining the adjustment of the MAX clip value. When the edge sum is large, the MAX clip value is made larger than the reference value, and when the edge sum is small, the MAX clip value is made smaller than the reference value.

図11(b)は、MINクリップ値の調整を説明する図であり、エッジ総和が大きいときはMINクリップ値を基準値よりも小さくし、エッジ総和が大きいときは基準値よりも大きくする。この調整の仕方は次の考えに基づいている。エッジ総和が小さいエリアについては、被写体が、均一に近く階調を拡大する必要性が低い。従って、階調補正の度合いが小さくなるようにMAXクリップ値を小さく、MINクリップ値を大きくする。逆に、エッジ総和が大きいエリアは階調を拡大する必要性が高いエリアであるので、より階調補正の度合いが大きくなるようにMAXクリップ値を基準よりも大きく、MINクリップ値を基準よりも小さくする。   FIG. 11B is a diagram for explaining adjustment of the MIN clip value. When the edge sum is large, the MIN clip value is made smaller than the reference value, and when the edge sum is large, it is made larger than the reference value. This adjustment method is based on the following idea. In areas where the sum of edges is small, it is less necessary for the subject to be nearly uniform and to expand the gradation. Accordingly, the MAX clip value is decreased and the MIN clip value is increased so that the degree of gradation correction is reduced. On the contrary, since the area where the sum of edges is large is an area where it is highly necessary to expand the gradation, the MAX clip value is larger than the reference and the MIN clip value is larger than the reference so that the degree of gradation correction becomes larger. Make it smaller.

次に、階調変換カーブ生成回路18は、ヒストグラム整形回路17にて整形されたヒストグラムから、階調変換カーブを生成する。   Next, the gradation conversion curve generation circuit 18 generates a gradation conversion curve from the histogram shaped by the histogram shaping circuit 17.

図12(a)〜図12(c)は、階調変換カーブの生成について説明するための図である。図12(a)は、ヒストグラム整形回路17にて整形されたヒストグラムを示す図である。階調変換カーブ生成回路18は、図12(a)に示すヒストグラムを下位階調から累積して、図12(b)に示す累積ヒストグラムを作成する。次に、階調変換カーブ生成回路18は、累積ヒストグラムの最上位階調の要素数が映像信号値の階調数になるように正規化して、図12(c)に示す階調変換カーブを生成する。   FIG. 12A to FIG. 12C are diagrams for explaining the generation of the gradation conversion curve. FIG. 12A shows a histogram shaped by the histogram shaping circuit 17. The gradation conversion curve generation circuit 18 accumulates the histogram shown in FIG. 12A from the lower gradations, and creates the accumulated histogram shown in FIG. Next, the gradation conversion curve generation circuit 18 normalizes the number of elements of the highest gradation of the cumulative histogram so that it becomes the number of gradations of the video signal value, and converts the gradation conversion curve shown in FIG. Generate.

図12(a)〜図12(c)に示す例では、映像信号値の階調数を256階調として正規化を行い、正規化された累積ヒストグラムから階調変換カーブを生成している。階調変換カーブは0を原点とし、原点以外を等間隔の32点の制御点で結んだ折れ線カーブとなる。   In the example shown in FIGS. 12A to 12C, normalization is performed by setting the number of gradations of the video signal value to 256 gradations, and a gradation conversion curve is generated from the normalized cumulative histogram. The gradation conversion curve is a broken line curve having 0 as the origin and connecting other than the origin by 32 equally spaced control points.

ここまでの処理により、各エリアに対応する階調変換カーブが生成される。この階調変換カーブを用いて、エリア内の画素を階調変換することにより、階調補正することができる。本実施の形態では、エリア別の階調変換カーブを用いた階調補正によって、エリア境界線が生じる問題点を解決するために、以下に説明するような処理を行う。   Through the processing so far, a gradation conversion curve corresponding to each area is generated. Using this gradation conversion curve, gradation correction can be performed by gradation conversion of pixels in the area. In the present embodiment, processing as described below is performed in order to solve the problem that an area boundary line is generated by gradation correction using a gradation conversion curve for each area.

階調変換回路19は、生成された階調変換カーブを用いて前処理後の映像信号値Lの階調変換を行う。
図13は、階調変換の例を示す図である。階調変換カーブに基づく変換では、前処理後の映像信号値Lに対応する値を、階調変換カーブから読み出して階調変換後の出力値とする。階調変換カーブは32点の制御点からなる折れ線カーブであるので、制御点間については補間計算を行って出力値を算出する。
The gradation conversion circuit 19 performs gradation conversion of the preprocessed video signal value L using the generated gradation conversion curve.
FIG. 13 is a diagram illustrating an example of gradation conversion. In conversion based on the gradation conversion curve, a value corresponding to the pre-processed video signal value L is read from the gradation conversion curve and used as an output value after gradation conversion. Since the gradation conversion curve is a broken line curve composed of 32 control points, an interpolation calculation is performed between the control points to calculate an output value.

階調変換回路19は、注目画素を含む4つのエリア(図6参照)の階調変換カーブを用いて注目画素の階調変換を行う。これによって階調変換回路19は、一の画素に対して4つの階調変換結果を得ることになる。   The gradation conversion circuit 19 performs gradation conversion of the target pixel using the gradation conversion curves of four areas (see FIG. 6) including the target pixel. As a result, the gradation conversion circuit 19 obtains four gradation conversion results for one pixel.

線形補間回路20は、階調変換回路19にて求められた4つの階調変換結果に線形補間処理を行い、画素に対する階調補正結果を求める。   The linear interpolation circuit 20 performs linear interpolation processing on the four gradation conversion results obtained by the gradation conversion circuit 19 to obtain gradation correction results for the pixels.

図14は、線形補間回路20による処理について説明するための図である。線形補間回路は、図14に示すように、注目画素Kと注目エリアであるエリア(i,j)、エリア(i+1,j)、エリア(i,j+1)、エリア(i+1,j+1)のそれぞれの重心位置との距離を用いて補間演算を行う。ここで、エリアの水平および垂直のサイズをR、注目エリア(i,j)と注目画素Kとの水平距離をp、垂直距離をqとし、エリア(i,j)、エリア(i+1,j)、エリア(i,j+1)、エリア(i+1,j+1)の階調変換結果を順にLA、LB、LC、LDとしたとき、線形補間後の信号値L’は次式で求められる。

Figure 0005183440
FIG. 14 is a diagram for explaining processing by the linear interpolation circuit 20. As shown in FIG. 14, the linear interpolation circuit includes each of the pixel of interest K and the areas of interest (i, j), area (i + 1, j), area (i, j + 1), and area (i + 1, j + 1). Interpolation is performed using the distance from the center of gravity. Here, the horizontal and vertical sizes of the area are R, the horizontal distance between the area of interest (i, j) and the pixel of interest K is p, the vertical distance is q, and the area (i, j) and area (i + 1, j) When the gradation conversion results of area (i, j + 1) and area (i + 1, j + 1) are sequentially LA, LB, LC, and LD, the signal value L ′ after linear interpolation is obtained by the following equation.
Figure 0005183440

次に、比率計算回路21は、前処理回路5から出力された映像信号値Lと、線形補間回路20で求められた階調変換後の映像信号値L’に基づいて、(階調変換後の映像信号値L’)/(前処理後の映像信号値L)を計算して変換比率を求める。階調補正部100は、比率計算回路21で求めた変換比率を、YC分離回路7で生成した輝度信号(Y信号)および色差信号(C信号)に乗算する。
以上、階調補正部100の動作について説明した。
Next, based on the video signal value L output from the preprocessing circuit 5 and the video signal value L ′ after gradation conversion obtained by the linear interpolation circuit 20, the ratio calculation circuit 21 (after gradation conversion). Video signal value L ′) / (preprocessed video signal value L) to calculate the conversion ratio. The gradation correction unit 100 multiplies the luminance signal (Y signal) and color difference signal (C signal) generated by the YC separation circuit 7 by the conversion ratio obtained by the ratio calculation circuit 21.
The operation of the gradation correction unit 100 has been described above.

本実施の形態の撮像装置は、エリア値だけでなくエッジ量をも用いて階調変換カーブを求めているので、階調補正前の画像の中で階調として変化が存在している領域の階調を重点的に階調補正することができる。   Since the imaging apparatus according to the present embodiment obtains the gradation conversion curve using not only the area value but also the edge amount, an area in which a change in gradation exists in an image before gradation correction. Gradation correction can be performed with emphasis on gradation.

本実施の形態の撮像装置は、処理負荷の大きいヒストグラムの算出をエリア単位で行っているので、処理に必要な記憶容量と処理負荷を大幅に削減した局所的ヒストグラム均等化による階調補正を実現できる。   Since the imaging apparatus of this embodiment calculates a histogram with a large processing load for each area, it realizes gradation correction by local histogram equalization that greatly reduces the storage capacity and processing load required for processing. it can.

本実施の形態の撮像装置は、エリアに対応した階調変換カーブを求める際に、当該エリアを含む所定範囲内のエリア値とエッジ量からヒストグラムを算出しているので、エリア内の画素値とエッジ信号から算出したヒストグラムを用いて階調変換カーブを求める場合に比べ、広い範囲のデータを利用して階調変換カーブを求めることができる。   The imaging apparatus according to the present embodiment calculates a histogram from an area value and an edge amount within a predetermined range including the area when obtaining a gradation conversion curve corresponding to the area. Compared to the case where the gradation conversion curve is obtained using the histogram calculated from the edge signal, the gradation conversion curve can be obtained using a wider range of data.

本実施の形態の撮像装置は、エリアに対応した階調変換カーブを求める際に、局所的ヒストグラムの算出にあたり該当エリアを含む所定範囲内のエリア値やエッジ量に対し該当エリアからの距離に基づいて段階的に重みを調整しているのでエリアによって急激なヒストグラムの変動が生じない。従って、階調変換カーブもエリアによって滑らかに変化しており階調補正後に違和感のない結果が得られる。   When obtaining the gradation conversion curve corresponding to the area, the imaging apparatus according to the present embodiment is based on the distance from the area with respect to the area value and edge amount within a predetermined range including the area when calculating the local histogram. Since the weights are adjusted step by step, there is no sudden histogram fluctuation depending on the area. Therefore, the gradation conversion curve also changes smoothly depending on the area, and a result with no sense of incongruity is obtained after gradation correction.

本実施の形態の撮像装置では、ヒストグラム整形回路17によってヒストグラムの分配処理を行っているので、エリア内の複数の画素をエリア値によって処理することに起因する階調潰れを低減することができる。   In the imaging apparatus according to the present embodiment, the histogram shaping circuit 17 performs the histogram distribution process, so that it is possible to reduce gradation collapse caused by processing a plurality of pixels in the area with the area value.

本実施の形態の撮像装置では、各エリアに対応した階調変換カーブを用いて求められた階調変換結果を線形補間することにより、画素の線形補正結果を求めているので、隣接するエリアの階調変換カーブを加味した階調補正値が得られる。これにより、階調補正後の画像にエリア境界線が生じにくくすることができる。   In the imaging device of the present embodiment, the linear correction result of the pixel is obtained by linearly interpolating the gradation conversion result obtained using the gradation conversion curve corresponding to each area. A gradation correction value in consideration of the gradation conversion curve is obtained. Thereby, it is possible to make it difficult for an area boundary line to occur in the image after gradation correction.

以上、本発明の階調補正装置について、階調補正装置を含む撮像装置を実施の形態を挙げて詳細に説明したが、本発明は上記した実施の形態に限定されるものではない。   As described above, the image correction apparatus including the gradation correction apparatus has been described in detail with respect to the gradation correction apparatus of the present invention, but the present invention is not limited to the above-described embodiment.

上記した実施の形態では、階調補正装置を回路によって構成する例について説明したが、上記した階調補正部100の各回路の機能を実現するプログラムも本発明の範囲に含まれる。   In the above-described embodiment, an example in which the gradation correction apparatus is configured by a circuit has been described. However, a program that realizes the function of each circuit of the gradation correction unit 100 described above is also included in the scope of the present invention.

上記した実施の形態では、前処理回路5が行う処理としてOB減算とホワイトバランス調整を挙げたが、この2つの処理を行なわなくてもよいし、この2つ以外の処理を前処理回路で行ってもよい。例えば、シェーディング補正やガンマ補正などが前処理に含まれてもよい。   In the above-described embodiment, the OB subtraction and the white balance adjustment are described as the processing performed by the preprocessing circuit 5. However, these two processings may not be performed, and processing other than these two processing is performed by the preprocessing circuit. May be. For example, shading correction or gamma correction may be included in the preprocessing.

また、上記した実施の形態では、エッジ抽出回路10として2つの手法を説明したがエッジ抽出の方法としてはこれに限られるものではない。エッジ抽出のためのフィルタは画素値の微分成分が抽出できれば何を使ってもよく、上記で説明した2つの手段を組み合わせて使うことも有効である。   In the embodiment described above, two methods have been described as the edge extraction circuit 10, but the edge extraction method is not limited to this. Any filter can be used for the edge extraction as long as the differential component of the pixel value can be extracted, and it is also effective to use a combination of the two means described above.

また、上記した実施の形態では、画面の大きさを水平640画素、垂直480画素とし、画面分割において水平80個、垂直60個の計4800個のエリアに分割する例について説明したが、画面の大きさおよびエリア分割数は上記の例に限られない。また、エリア値としてエリア中の画素値の平均値を用いるとしたが、平均値の算出方法は特に限定するものではない。例えば、エリア内の全画素の平均値を求めてもよいし、エリア内のいくつかの画素をサンプリングしてその画素の平均値を求めてもよい。経験上、なるべく多くの画素の平均値を求めるほうが結果は安定する傾向にある。また、画素値として用いる値も特に限定するものではない。例えば、各画素における輝度値を算出してその値を使用してもよい。   In the above-described embodiment, an example in which the screen size is 640 pixels horizontal and 480 pixels vertical and the screen is divided into a total of 4800 areas of 80 horizontal and 60 vertical is described. The size and the number of area divisions are not limited to the above example. Further, although the average value of the pixel values in the area is used as the area value, the method for calculating the average value is not particularly limited. For example, an average value of all the pixels in the area may be obtained, or some pixels in the area may be sampled to obtain an average value of the pixels. From experience, the result tends to be more stable when the average value of as many pixels as possible is obtained. Further, the value used as the pixel value is not particularly limited. For example, the luminance value in each pixel may be calculated and used.

また、上記した実施の形態では、エリア値を5bit、エッジ量を2bit、ヒストグラムを32階調、階調変換カーブを32点折れ線カーブなどとしたが、いずれもこれに限られない。例えば、ヒストグラムの階調を16階調にして階調変換カーブを16点折れ線カーブで求めることは記憶容量や回路規模の削減に対して有効である。逆に、ヒストグラムを64階調、階調変換カーブを64点の折れ線カーブとすればより精度の高い階調変換が可能になる。   In the above-described embodiment, the area value is 5 bits, the edge amount is 2 bits, the histogram is 32 gradations, and the gradation conversion curve is a 32-point broken line curve. However, the present invention is not limited to this. For example, it is effective to reduce the storage capacity and the circuit scale to set the gradation of the histogram to 16 gradations and obtain the gradation conversion curve with a 16-point broken line curve. On the contrary, if the histogram is 64 gradations and the gradation conversion curve is a 64-point line curve, more accurate gradation conversion is possible.

エッジ量に関してもbit数を増加すればさらに高精度なヒストグラムの重み付けが可能になる。また、階調変換カーブは等間隔の折れ線カーブとしているが、等間隔でなくてもよい。例えば、下位側の階調数を増やし、上位側の階調数をまばらに取ることで、下位側だけ折れ線カーブの精度を向上させることも可能である。またヒストグラムの階調についても同様である。   As for the edge amount, if the number of bits is increased, the histogram can be weighted with higher accuracy. Further, although the gradation conversion curve is a polygonal line curve with equal intervals, it may not be equal intervals. For example, by increasing the number of gradations on the lower side and taking the number of gradations on the upper side sparsely, it is possible to improve the accuracy of the broken line curve only on the lower side. The same applies to the gradation of the histogram.

また、上記した実施の形態では、局所的ヒストグラム算出時に参照する範囲を正方形としているが、参照範囲の形は正方形に限らない。例えば、菱形や円形にすることも可能である。   In the above-described embodiment, the range referred to when calculating the local histogram is a square, but the shape of the reference range is not limited to a square. For example, a rhombus or a circle can be used.

また、上記した実施の形態では、局所的ヒストグラム算出時に4つの参照範囲で段階的に重みを切り替えているが、段階数は4つである必要はない。   In the above-described embodiment, weights are switched stepwise in the four reference ranges when calculating the local histogram, but the number of steps is not necessarily four.

また、上記した実施の形態では、局所的ヒストグラム算出時とエッジ総和算出時の参照範囲を同じにしているが必ずしも同じである必要はない。   Further, in the above-described embodiment, the reference ranges at the time of calculating the local histogram and the edge total are the same, but they are not necessarily the same.

また、上記した実施の形態では、ヒストグラムの分配処理において最下位階調または最上位階調を超える存在しない階調への分配要素は破棄したが、必ずしも破棄する必要はない。例えば、最下位階調を超える存在しない階調への分配要素は最下位階調に加算し、最上位階調を超える存在しない階調への分配要素は最上位階調に加算するのも有効な方法である。また、上下3階調ずつに要素数を分配する例を説明したが、階調数はこれに限るものではない。   In the above-described embodiment, the distribution element to the lowest gradation or the nonexistent gradation exceeding the highest gradation is discarded in the histogram distribution process, but it is not always necessary to discard it. For example, it is also effective to add a distribution element to a nonexistent gradation exceeding the lowest gradation to the lowest gradation and add a distribution element to a nonexistence gradation exceeding the highest gradation to the highest gradation. It is a simple method. In addition, although the example in which the number of elements is distributed for each upper and lower three gradations has been described, the number of gradations is not limited to this.

以上説明したように、本発明は、階調補正前の画像の中で階調の変化が存在している領域を重点的に階調補正することができるというすぐれた効果を有し、デジタルスチルカメラやデジタルビデオカメラ等に代表される撮像装置に用いる階調補正装置等に有用である。   As described above, the present invention has an excellent effect that gradation correction can be focused on an area where a change in gradation exists in an image before gradation correction. This is useful for a gradation correction device used in an imaging device represented by a camera, a digital video camera, or the like.

実施の形態における階調補正装置の概略構成図Schematic configuration diagram of a gradation correction apparatus in an embodiment 実施の形態における第1のエッジ抽出手法を説明する図The figure explaining the 1st edge extraction method in embodiment 実施の形態における第2のエッジ抽出手法を説明する図The figure explaining the 2nd edge extraction method in embodiment 実施の形態におけるエリア分割を説明する図The figure explaining the area division | segmentation in embodiment 実施の形態におけるエッジ総和算出を説明する図The figure explaining edge sum total calculation in an embodiment 実施の形態における4つのエリア選択を説明する図The figure explaining four area selection in an embodiment 実施の形態における局所的ヒストグラム算出を説明する図The figure explaining local histogram calculation in an embodiment 実施の形態における局所的ヒストグラム算出での参照範囲が画面外に及んだ状態を説明する図The figure explaining the state where the reference range in the local histogram calculation in the embodiment extends outside the screen (a)分配処理前のヒストグラムの例を示す図、(b)分配処理後のヒストグラムの例を示す図、(c)階調0の分配処理の例を示す図、(d)階調1の分配処理の例を示す図、(e)階調2の分配処理の例を示す図(A) A diagram showing an example of a histogram before distribution processing, (b) a diagram showing an example of a histogram after distribution processing, (c) a diagram showing an example of distribution processing of gradation 0, and (d) a gradation 1 The figure which shows the example of a distribution process, The figure which shows the example of the distribution process of (e) gradation 2 (a)クリップ処理前のヒストグラムの例を示す図、(b)クリップ処理後のヒストグラムの例を示す図(A) The figure which shows the example of the histogram before a clip process, (b) The figure which shows the example of the histogram after a clip process (a)MAXクリップ値の調整について説明する図、(b)MINクリップ値の調整について説明する図(A) A figure explaining adjustment of a MAX clip value, (b) A figure explaining adjustment of a MIN clip value (a)ヒストグラムの例を示す図、(b)累積比ヒストグラムの例を示す図、(c)階調変換カーブの例を示す図(A) A diagram illustrating an example of a histogram, (b) a diagram illustrating an example of a cumulative ratio histogram, and (c) a diagram illustrating an example of a gradation conversion curve. 実施の形態における階調変換の例を説明する図FIG. 6 is a diagram illustrating an example of gradation conversion in an embodiment 実施の形態における4つの階調変換結果の線形補間処理を説明する図The figure explaining the linear interpolation process of the four gradation conversion results in embodiment

符号の説明Explanation of symbols

1 レンズ
2 絞り部
3 撮像素子
4 A/D変換器
5 前処理回路
6 YC分離回路
7 Y信号処理回路
8 C信号処理回路
10 エッジ抽出回路
11 エリア分割回路
12 エリア値算出回路
13 エッジ量算出回路
14 記憶部
15 エッジ総和算出回路
16 局所的ヒストグラム算出回路
17 ヒストグラム整形回路
18 階調変換カーブ生成回路
19 階調変換回路
20 線形補間回路
21 比率計算回路
100 実施の形態の階調補正部
DESCRIPTION OF SYMBOLS 1 Lens 2 Aperture part 3 Image pick-up element 4 A / D converter 5 Preprocessing circuit 6 YC separation circuit 7 Y signal processing circuit 8 C signal processing circuit 10 Edge extraction circuit 11 Area division circuit 12 Area value calculation circuit 13 Edge amount calculation circuit DESCRIPTION OF SYMBOLS 14 Memory | storage part 15 Edge sum total calculation circuit 16 Local histogram calculation circuit 17 Histogram shaping circuit 18 Tone conversion curve generation circuit 19 Tone conversion circuit 20 Linear interpolation circuit 21 Ratio calculation circuit 100 Tone correction part of embodiment

Claims (10)

入力された画像に階調補正を行う階調補正装置であって、
画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するエリア値算出部と、
前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するエッジ量算出部と、
前記エリア値と前記エッジ量と計算対象のエリアからの距離に基づいて、計算対象のエリアを中心とする第1の所定の範囲における各エリア固有の値を計算し、エリア値が同じ階調に属する前記エリア固有の値を加算した、エリア値のヒストグラムを生成するヒストグラム生成部と、
計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成する階調変換カーブ生成部と、
前記階調変換カーブ生成部にて生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換する階調変換部と、
を備えた階調補正装置。
A gradation correction apparatus that performs gradation correction on an input image,
An area value calculation unit that divides an image into a plurality of areas and calculates a value that represents a pixel value in each area as an area value;
An edge amount calculation unit for calculating an edge amount indicating an amount of an edge component in each of the areas;
Based on the area value, the edge amount, and the distance from the area to be calculated, a value specific to each area in the first predetermined range centered on the area to be calculated is calculated, and the area value has the same gradation. A histogram generation unit that generates a histogram of area values by adding the area-specific values to which they belong ;
A gradation conversion curve generation unit that generates a gradation conversion curve corresponding to the area based on a histogram corresponding to the area to be calculated;
A gradation conversion unit that converts pixel values in an area to be calculated using the gradation conversion curve generated by the gradation conversion curve generation unit;
A gradation correction apparatus comprising:
計算対象のエリアを中心とする第2の所定の範囲内にあるエリアのエッジ量の総和を求めるエッジ総和部を備え、
前記階調変換カーブ生成部は、計算対象のエリアに対応するヒストグラムとエッジ総和とに基づいて、そのエリアに対応する階調変換カーブを生成する請求項に記載の階調補正装置。
An edge summation unit for obtaining the sum of the edge amounts of areas within a second predetermined range centered on the area to be calculated;
The gradation correction apparatus according to claim 1 , wherein the gradation conversion curve generation unit generates a gradation conversion curve corresponding to an area based on a histogram and an edge total corresponding to the area to be calculated.
前記階調変換カーブ生成部は、前記エッジ総和の大きさに応じて各階調の要素数の上限値および下限値を設定し、要素数が上限値を超える階調については要素数を上限値とし、要素数が下限値を下回る階調については要素数を下限値とするヒストグラムの整形を行い、各階調の要素数をその階調より下位の階調の要素数を累積した累積ヒストグラムを生成し、生成された累積ヒストグラムに基づいて階調変換カーブを求める請求項に記載の階調補正装置。 The gradation conversion curve generation unit sets an upper limit value and a lower limit value for the number of elements of each gradation in accordance with the size of the total edge, and for a gradation whose number of elements exceeds the upper limit value, the number of elements is set as the upper limit value. For gradations where the number of elements falls below the lower limit, the histogram is shaped with the number of elements as the lower limit, and a cumulative histogram is generated by accumulating the number of elements for each gradation and the number of elements for the gradations lower than that gradation. The gradation correction apparatus according to claim 2 , wherein a gradation conversion curve is obtained based on the generated cumulative histogram. 前記階調変換カーブ生成部は、前記エッジ総和が大きいほど各階調の要素数の上限値を大きく、下限値を小さく設定する請求項に記載の階調補正装置。 The gradation correction apparatus according to claim 3 , wherein the gradation conversion curve generation unit sets the upper limit value of the number of elements of each gradation to be larger and the lower limit value to be smaller as the edge sum is larger. 前記エッジ総和部は、前記第2の所定の範囲内のエリアのエッジ量の総和を求める際に、計算対象のエリアからエッジ量を加算しようとするエリアまでの距離に応じた重み付けをする請求項1〜4のいずれかに記載の階調補正装置。 The edge summation unit performs weighting according to a distance from an area to be calculated to an area to which an edge amount is to be added when obtaining a sum of edge amounts of areas within the second predetermined range. The gradation correction apparatus according to any one of 1 to 4 . 前記エッジ量算出部は、エリアの明るさに応じて算出するエッジ量を調整する請求項1〜5のいずれかに記載の階調補正装置。 The gradation correction apparatus according to claim 1 , wherein the edge amount calculation unit adjusts an edge amount calculated according to brightness of an area. 撮像素子と、
前記撮像素子によって撮像された画像を階調補正する請求項1〜6のいずれかに記載の階調補正装置と、
を備えた撮像装置。
An image sensor;
A gradation correction device according to any one of claims 1 to 6, the image captured to gradation correction by the image pickup device,
An imaging apparatus comprising:
入力された画像に階調補正を行う階調補正プログラムであって、コンピュータに、
画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するステップと、
前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するステップと、
前記エリア値と前記エッジ量と計算対象のエリアからの距離に基づいて、計算対象のエリアを中心とする所定の範囲における各エリア固有の値を計算し、エリア値が同じ階調に属する前記エリア固有の値を加算した、エリア値のヒストグラムを生成するステップと、
計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成するステップと、
生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換するステップと、
を実行させる階調補正プログラム。
A gradation correction program that performs gradation correction on an input image,
Dividing an image into a plurality of areas and calculating a value representative of a pixel value in each area as an area value;
Calculating an edge amount indicating an amount of an edge component in each of the areas;
Based on the area value, the edge amount, and the distance from the calculation target area, a value specific to each area in a predetermined range centered on the calculation target area is calculated, and the area value belongs to the same gradation Generating a histogram of area values , adding unique values ;
Generating a gradation conversion curve corresponding to the area based on a histogram corresponding to the area to be calculated;
Converting the pixel value in the area to be calculated using the generated gradation conversion curve;
Gradation correction program that executes
請求項8に記載された階調補正プログラムを記録したコンピュータ読み取り可能な記録媒体。   A computer-readable recording medium on which the gradation correction program according to claim 8 is recorded. 入力された画像に階調補正を行う階調補正方法であって、
画像を複数のエリアに分割し、それぞれのエリア内の画素値を代表する値をエリア値として算出するステップと、
前記それぞれのエリア内のエッジ成分の量を示すエッジ量を算出するステップと、
前記エリア値と前記エッジ量と計算対象のエリアからの距離に基づいて、計算対象のエリアを中心とする所定の範囲における各エリア固有の値を計算し、エリア値が同じ階調に属する前記エリア固有の値を加算した、エリア値のヒストグラムを生成するステップと、
計算対象のエリアに対応するヒストグラムに基づいて、そのエリアに対応する階調変換カーブを生成するステップと、
生成された階調変換カーブを用いて、計算対象のエリア内の画素値を変換するステップと、
を備えた階調補正方法。
A gradation correction method for performing gradation correction on an input image,
Dividing an image into a plurality of areas and calculating a value representative of a pixel value in each area as an area value;
Calculating an edge amount indicating an amount of an edge component in each of the areas;
Based on the area value, the edge amount, and the distance from the calculation target area, a value specific to each area in a predetermined range centered on the calculation target area is calculated, and the area value belongs to the same gradation Generating a histogram of area values , adding unique values ;
Generating a gradation conversion curve corresponding to the area based on a histogram corresponding to the area to be calculated;
Converting the pixel value in the area to be calculated using the generated gradation conversion curve;
A gradation correction method comprising:
JP2008300666A 2008-11-26 2008-11-26 Gradation correction apparatus and imaging apparatus Active JP5183440B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008300666A JP5183440B2 (en) 2008-11-26 2008-11-26 Gradation correction apparatus and imaging apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008300666A JP5183440B2 (en) 2008-11-26 2008-11-26 Gradation correction apparatus and imaging apparatus

Publications (2)

Publication Number Publication Date
JP2010130150A JP2010130150A (en) 2010-06-10
JP5183440B2 true JP5183440B2 (en) 2013-04-17

Family

ID=42330246

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008300666A Active JP5183440B2 (en) 2008-11-26 2008-11-26 Gradation correction apparatus and imaging apparatus

Country Status (1)

Country Link
JP (1) JP5183440B2 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100735236B1 (en) * 2006-02-08 2007-07-03 삼성전자주식회사 Apparatus and method for analysing histogram of image and luminance adjustment apparatus using the same
JP5701010B2 (en) * 2010-10-22 2015-04-15 キヤノン株式会社 Image processing apparatus and control method thereof
JP5202749B1 (en) * 2012-09-03 2013-06-05 正浩 小林 Image processing method
JP6116272B2 (en) 2013-02-08 2017-04-19 キヤノン株式会社 Image processing apparatus, image processing method, program, and storage medium
JP6193721B2 (en) 2013-10-23 2017-09-06 キヤノン株式会社 Image processing apparatus, image processing method, program, and storage medium
JP6701687B2 (en) * 2015-11-20 2020-05-27 セイコーエプソン株式会社 Image processing apparatus, image processing method, and image processing program
CN107169938B (en) * 2017-05-24 2019-05-31 深圳市华星光电半导体显示技术有限公司 Brightness control system
KR102375369B1 (en) * 2020-11-26 2022-03-18 엘지전자 주식회사 Apparatus and method for tone mapping

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3573143B2 (en) * 2002-07-17 2004-10-06 セイコーエプソン株式会社 Image processing apparatus, image processing method, medium recording image processing control program
JP2008092052A (en) * 2006-09-29 2008-04-17 Matsushita Electric Ind Co Ltd Gradation correcting device and imaging apparatus

Also Published As

Publication number Publication date
JP2010130150A (en) 2010-06-10

Similar Documents

Publication Publication Date Title
JP5183440B2 (en) Gradation correction apparatus and imaging apparatus
US8494303B2 (en) Image processing apparatus and image processing method for adaptively processing an image using an enhanced image and pixel values of an original image
US8269862B2 (en) Image processing apparatus and image processing method
JP4526445B2 (en) Imaging device
US8248492B2 (en) Edge preserving and tone correcting image processing apparatus and method
JP2008092052A (en) Gradation correcting device and imaging apparatus
US8115833B2 (en) Image-acquisition apparatus
US7920183B2 (en) Image processing device and digital camera
JP6097588B2 (en) Image processing apparatus and image processing method
US8831346B2 (en) Image processing apparatus and method, and program
JP7343090B2 (en) Image processing system and method
JP4021261B2 (en) Image processing device
JP6824817B2 (en) Image processing device and image processing method
JP2007082181A (en) Imaging apparatus and image processing method
JP5648849B2 (en) Image processing apparatus and image processing method
JP5468930B2 (en) Image processing apparatus and image processing program
KR101650050B1 (en) Image processing apparatus, method, and program
JP4013699B2 (en) Image processing apparatus and image processing method
JP4664938B2 (en) Image processing apparatus, image processing method, and program
JP2001045298A (en) Method for processing picture, recording medium recording picture processing program and picture processor
JP4539674B2 (en) Image processing apparatus, image processing method, and processor used for image processing
JP2010252002A (en) Gradation correcting device, and imaging apparatus
JP2010277607A (en) Apparatus and method for processing image
JP6935842B2 (en) Image adjusters, methods, and programs
JP6366432B2 (en) Image processing apparatus, control method therefor, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110404

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120530

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120605

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120724

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130108

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130115

R150 Certificate of patent or registration of utility model

Ref document number: 5183440

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3