JP2014109978A - Image processing device and image processing method - Google Patents

Image processing device and image processing method Download PDF

Info

Publication number
JP2014109978A
JP2014109978A JP2012265138A JP2012265138A JP2014109978A JP 2014109978 A JP2014109978 A JP 2014109978A JP 2012265138 A JP2012265138 A JP 2012265138A JP 2012265138 A JP2012265138 A JP 2012265138A JP 2014109978 A JP2014109978 A JP 2014109978A
Authority
JP
Japan
Prior art keywords
histogram
data
region
block
primary difference
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.)
Granted
Application number
JP2012265138A
Other languages
Japanese (ja)
Other versions
JP6098971B2 (en
Inventor
Yu Hasegawa
祐 長谷川
Akihiro Furuta
暁広 古田
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
Original Assignee
Panasonic Corp
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 filed Critical Panasonic Corp
Priority to JP2012265138A priority Critical patent/JP6098971B2/en
Publication of JP2014109978A publication Critical patent/JP2014109978A/en
Application granted granted Critical
Publication of JP6098971B2 publication Critical patent/JP6098971B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

PROBLEM TO BE SOLVED: To increase the speed of histogram generation processing for generating a histogram data of a filter region set adjacent to a position of interest on an image.SOLUTION: A local histogram generation section that sequentially generates histogram data at each position on an image while shifting the position of interest one by one includes: a histogram storage 46 that stores histogram data at each position on the image; primary difference acquisition sections 51, 53 and 56 each of which acquires as a target primary difference data of a primary difference region where a filtering region at a position of interest and a filtering region preceding by one position are not overlapped with each other; and integration sections 52, 54 and 57 each of which integrates the primary difference data acquired by the primary difference acquisition section and the histogram data at a position preceding by one stored in the histogram storage to thereby acquire a histogram data at the position of interest.

Description

本発明は、階調ごとの度数を示すヒストグラムデータを生成して、このヒストグラムデータに基づいて画像の補正を行う画像処理装置および画像処理方法に関するものである。   The present invention relates to an image processing apparatus and an image processing method for generating histogram data indicating the frequency for each gradation and correcting an image based on the histogram data.

撮像装置で撮像された画像内に明るい領域と暗い領域とが混在する、例えば日射による明るい屋外が写った領域と暗い屋内が写った領域とが含まれていると、明るい領域と暗い領域との間では十分な明暗差が得られるものの、それぞれの領域内ではコントラストが低下して、被写体が不鮮明となるという問題があった。   A bright area and a dark area are mixed in the image captured by the imaging device.For example, a bright outdoor area and a dark indoor area due to solar radiation are included. Although a sufficient difference in brightness can be obtained between the two, there is a problem that the contrast is lowered in each region and the subject becomes unclear.

このような問題に対して、画像上のある注目点を中心とした局所領域内に存在する画素の階調分布を示すヒストグラムデータを生成し、そのヒストグラムデータにおいて度数が高い階調のコントラストを強調する階調変換カーブを求め、その階調変換カーブを用いて階調補正する、いわゆる局所的ヒストグラム均等化法による階調補正の技術が知られている。これにより、明るい領域および暗い領域のそれぞれの領域内でコントラストが強調されて、鮮明な画像を得ることができる。   To solve this problem, generate histogram data that shows the tone distribution of pixels that exist within a local area centered on a point of interest on the image, and emphasize the high-frequency tone contrast in the histogram data. There is known a tone correction technique based on a so-called local histogram equalization method, in which a tone conversion curve is obtained and tone correction is performed using the tone conversion curve. Thereby, the contrast is enhanced in each of the bright region and the dark region, and a clear image can be obtained.

ところが、この局所的ヒストグラム均等化法による階調補正を画像の全体に対して画素単位で行うには、莫大な演算量を必要とするため、現実的でない。そこで、画像を複数のブロックに分割し、各ブロックを中心にした局所領域に含まれる各ブロックの代表値を集計して、各ブロックのヒストグラムデータを生成し、このヒストグラムデータに基づいて階調変換カーブを求めて階調補正する技術が知られている(特許文献1参照)。これにより、演算量を削減することができる。   However, it is not practical to perform gradation correction by this local histogram equalization method on a pixel basis for the entire image because a huge amount of calculation is required. Therefore, the image is divided into a plurality of blocks, the representative values of each block included in the local area centered on each block are aggregated, histogram data of each block is generated, and gradation conversion is performed based on this histogram data. A technique for correcting a gradation by obtaining a curve is known (see Patent Document 1). Thereby, the amount of calculation can be reduced.

特開2008−92052号公報JP 2008-92052 A

しかしながら、前記のブロック単位でヒストグラムデータを生成する従来の技術では、フィルタ領域に含まれる全てのブロックの代表値を集計してヒストグラムデータを生成する処理を全てのブロックで繰り返す必要があるため、演算量を十分に削減することができず、階調補正処理の高速化を十分に図ることができないという問題があった。また、ブロックの大きさを大きくすれば、演算量を削減することができるが、この場合、ブロックの境界での不連続性が顕著になり、画質が低下する問題が生じるため、ヒストグラム生成処理自体の高速化を図ることが望まれる。   However, in the conventional technique for generating the histogram data in units of the blocks, it is necessary to repeat the process of generating the histogram data by adding up the representative values of all the blocks included in the filter area. There is a problem that the amount cannot be reduced sufficiently, and the gradation correction processing cannot be sufficiently speeded up. In addition, if the size of the block is increased, the amount of calculation can be reduced. However, in this case, the discontinuity at the boundary of the block becomes remarkable and the image quality is deteriorated. It is desirable to increase the speed.

本発明は、このような従来技術の問題点を解消するべく案出されたものであり、その主な目的は、ヒストグラム生成処理の高速化を図ることができるように構成された画像処理装置および画像処理方法を提供することにある。   The present invention has been devised to solve such problems of the prior art, and the main object of the present invention is an image processing apparatus configured to increase the speed of histogram generation processing, and It is to provide an image processing method.

本発明の画像処理装置は、入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理装置であって、前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成する局所的ヒストグラム生成部を備え、この局所的ヒストグラム生成部は、前記画像上の各位置での前記ヒストグラムデータを格納するヒストグラム格納部と、注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得する1次差分取得部と、前記1次差分取得部で取得した前記1次差分データ、および前記ヒストグラム格納部に格納された1つ前の位置での前記ヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得する統合部と、を有する構成とする。   An image processing apparatus according to the present invention generates histogram data for a filter region set around a position of interest on an input image, and corrects the image based on the histogram data A local histogram generator for sequentially generating the histogram data at each position while shifting the target position one by one on the image, and the local histogram generator at each position on the image The primary difference data is acquired for a primary difference area in which the histogram storage unit for storing the histogram data and the filter area at the position of interest and the filter area at the previous position do not overlap with each other. A primary difference acquisition unit, the primary difference data acquired by the primary difference acquisition unit, and one stored in the histogram storage unit The integrated histogram data at the position of a structure having, an integrated unit for acquiring histogram data at the target position.

また、本発明の画像処理方法は、入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理方法であって、前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成するステップを有し、前記ヒストグラムデータを生成するステップは、注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得するステップと、前記1次差分データおよび1つ前の位置でのヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得するステップと、を有する構成とする。   Further, the image processing method of the present invention generates an image of histogram data for a filter region set around a position of interest on the input image, and corrects the image based on the histogram data. A method of processing, comprising: sequentially generating the histogram data at each position while shifting the position of interest on the image one by one, wherein the step of generating the histogram data includes the filter region at the position of interest. Obtaining primary difference data for a primary difference area that does not overlap with the filter area at the previous position, and the primary difference data and histogram data at the previous position. And acquiring histogram data at the target position.

本発明によれば、ヒストグラムデータを取得するために、フィルタ領域に含まれる全ての位置での特徴値(例えば輝度)を集計する必要がないため、演算負担を軽減することができ、これによりヒストグラム生成処理の高速化を図ることができる。   According to the present invention, it is not necessary to add up the feature values (for example, luminance) at all positions included in the filter region in order to obtain the histogram data, so that the calculation burden can be reduced. The generation process can be speeded up.

本実施形態に係る撮像装置を示す概略構成図Schematic configuration diagram showing an imaging apparatus according to the present embodiment 階調補正部7で行われる階調補正処理の状況を実際の画像の例を用いて説明する説明図Explanatory drawing explaining the condition of the gradation correction process performed in the gradation correction | amendment part 7 using the example of an actual image 階調補正部7で行われる処理の手順を示すフロー図Flow chart showing a procedure of processing performed in the gradation correction unit 7 ブロック分割部10で行われるブロック分割処理を説明する説明図Explanatory drawing explaining the block division process performed in the block division part 10 局所的ヒストグラム生成部14で行われる局所的ヒストグラム生成処理を説明する説明図Explanatory drawing explaining the local histogram generation process performed in the local histogram generation part 14 階調変換カーブ生成部16で行われる階調変換カーブ生成処理を説明する説明図Explanatory drawing explaining the gradation conversion curve generation process performed in the gradation conversion curve generation part 16 階調変換部17で行われる階調変換処理および線形補間部18で行われる線形補間処理を説明する説明図Explanatory drawing explaining the gradation conversion process performed in the gradation conversion part 17, and the linear interpolation process performed in the linear interpolation part 18 局所的ヒストグラム生成部14の概略構成を示すブロック図The block diagram which shows schematic structure of the local histogram generation part 14 重み付け領域および重み係数を説明する説明図Explanatory drawing explaining a weighting area | region and a weighting coefficient 重みつきヒストグラムを生成する要領を説明する説明図Explanatory drawing explaining the point which produces | generates a weighted histogram 局所的ヒストグラム生成部14で行われる局所的ヒストグラム生成処理の手順を示すフロー図Flow chart showing a procedure of local histogram generation processing performed in the local histogram generation unit 14 重みなしヒストグラム生成部31の概略構成を示すブロック図The block diagram which shows schematic structure of the weightless histogram generation part 31 重みなしヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline of histogram generation processing without weight 重みなしヒストグラム生成処理の手順を示すフロー図Flow chart showing the procedure of unweighted histogram generation processing 第1領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 1st area | region histogram production | generation process. 第1領域ヒストグラム生成処理の手順を示すフロー図Flow chart showing the procedure of first region histogram generation processing 第2領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 2nd area | region histogram production | generation process. 第2領域ヒストグラム生成処理の手順を示すフロー図Flow chart showing procedure of second region histogram generation processing 第3領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 3rd area | region histogram production | generation process 第3領域ヒストグラム生成処理の手順を示すフロー図Flow chart showing the procedure of third region histogram generation processing 第4領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 4th area | region histogram production | generation process. 第4領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 4th area | region histogram production | generation process. 第4領域ヒストグラム生成処理の概要を説明する説明図Explanatory drawing explaining the outline | summary of a 4th area | region histogram production | generation process. 第4領域ヒストグラム生成処理を詳しく説明する説明図Explanatory drawing explaining the 4th field histogram generation processing in detail 第4領域ヒストグラム生成処理の手順を示すフロー図Flow chart showing procedure of fourth region histogram generation processing

前記課題を解決するためになされた第1の発明は、入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理装置であって、前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成する局所的ヒストグラム生成部を備え、この局所的ヒストグラム生成部は、前記画像上の各位置での前記ヒストグラムデータを格納するヒストグラム格納部と、注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得する1次差分取得部と、前記1次差分取得部で取得した前記1次差分データ、および前記ヒストグラム格納部に格納された1つ前の位置での前記ヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得する統合部と、を有する構成とする。   According to a first aspect of the present invention, there is provided a first invention for generating histogram data for a filter region set around an attention position on an input image, and generating the image based on the histogram data. An image processing apparatus that includes a local histogram generation unit that sequentially generates the histogram data at each position while shifting the target position one by one on the image, and the local histogram generation unit includes: Targeting a histogram storage unit that stores the histogram data at each position on the image, and a primary difference area in which the filter area at the target position and the filter area at the previous position do not overlap. A primary difference acquisition unit that acquires the primary difference data, the primary difference data acquired by the primary difference acquisition unit, and the histogram By integrating the histogram data at the previous locations stored in the accommodated section, a structure having, an integrated unit for acquiring histogram data at the target position.

これによると、ヒストグラムデータを取得するために、フィルタ領域に含まれる全ての位置での特徴値(例えば輝度)を集計する必要がないため、演算負担を軽減することができ、これによりヒストグラム生成処理の高速化を図ることができる。   According to this, since it is not necessary to add up the feature values (for example, luminance) at all positions included in the filter area in order to obtain the histogram data, it is possible to reduce the calculation burden, and thereby the histogram generation process Can be speeded up.

ここで、ヒストグラムデータとは、フィルタ領域内の各位置での特徴値を集計して得られる特徴値ごとの度数を示すものであり、1次差分データとは、1次差分領域内の各位置での特徴値を集計して得られる特徴値ごとの度数を示すものである。   Here, the histogram data indicates the frequency for each feature value obtained by aggregating the feature values at each position in the filter area, and the primary difference data means each position in the primary difference area. This indicates the frequency for each feature value obtained by aggregating the feature values.

また、1次差分領域には、1つ前の位置でのフィルタ領域において注目位置でのフィルタ領域から外れる減少分と、注目位置でのフィルタ領域に新たに加わる増加分とがあり、1次差分データとヒストグラムデータとを統合する際には、減少分の1次差分データはヒストグラムデータから差し引かれ、増加分の1次差分データはヒストグラムデータに加えられる。   The primary difference area includes a decrease amount deviating from the filter area at the target position in the filter area at the previous position, and an increase amount newly added to the filter area at the target position. When integrating data and histogram data, the reduced primary difference data is subtracted from the histogram data, and the increased primary difference data is added to the histogram data.

また、第2の発明は、前記局所的ヒストグラム生成部は、注目位置を第1の方向にずらしながら各位置での前記ヒストグラムデータを順次生成する1ライン分の処理を、第1の方向と直交する第2の方向に1ラインずつずらしながら繰り返すものであり、前記1次差分取得部で取得した前記1次差分データを格納する1次差分格納部と、注目位置での前記1次差分データと第2の方向に1つ前の位置での前記1次差分データとが重なり合わない2次差分領域を対象にした2次差分データを取得する2次差分取得部と、をさらに有し、前記1次差分取得部は、前記2次差分取得部で取得した前記2次差分データ、および前記1次差分格納部に格納された第2の方向に1つ前の位置での前記1次差分データを統合して、注目位置での前記1次差分データを取得する構成とする。   In the second invention, the local histogram generation unit performs processing for one line for sequentially generating the histogram data at each position while shifting the position of interest in the first direction, orthogonal to the first direction. The primary difference storage unit stores the primary difference data acquired by the primary difference acquisition unit, and the primary difference data at the position of interest. A secondary difference acquisition unit that acquires secondary difference data for a secondary difference area that is not overlapped with the primary difference data at the position immediately before in the second direction; The primary difference acquisition unit includes the secondary difference data acquired by the secondary difference acquisition unit, and the primary difference data at a position immediately before in the second direction stored in the primary difference storage unit. To integrate the first order difference at the position of interest A structure in which to get over data.

これによると、ヒストグラムデータを取得するために、フィルタ領域に含まれる全ての位置の特徴値を集計する必要がなく、さらに、1次差分データを取得するために、1次差分領域に含まれる全ての位置の特徴値を集計する必要もないため、演算負担をより一層軽減することができ、これによりヒストグラム生成処理のより一層の高速化を図ることができる。   According to this, in order to acquire the histogram data, it is not necessary to add up the feature values of all the positions included in the filter area, and in addition, all the elements included in the primary difference area to acquire the primary difference data. Since it is not necessary to add up the feature values at the positions of the positions, it is possible to further reduce the calculation burden, thereby further speeding up the histogram generation process.

ここで、2次差分データとは、2次差分領域内の各位置での特徴値を集計して得られる特徴値ごとの度数を示すものである。   Here, the secondary difference data indicates the frequency for each feature value obtained by aggregating the feature values at each position in the secondary difference area.

また、2次差分領域には、第2の方向に1つ前の位置での1次差分領域において注目位置での1次差分領域から外れる減少分と、注目位置での1次差分領域に新たに加わる増加分とがあり、2次差分データと1次差分データとを統合する際には、減少分の2次差分データは1次差分データから差し引かれ、増加分の2次差分データは1次差分データに加えられる。   In the secondary difference area, the decrease in the primary difference area at the position immediately before in the second direction deviates from the primary difference area at the target position, and the primary difference area at the target position is newly added. When the secondary difference data and the primary difference data are integrated, the reduced secondary difference data is subtracted from the primary difference data, and the increased secondary difference data is 1 Added to the next difference data.

また、第3の発明は、前記局所的ヒストグラム生成部は、前記画像の隅に位置する開始位置を対象にした第1領域ヒストグラム生成部と、前記開始位置から第1の方向に延びた1つのラインにおいて前記開始位置を除く領域を対象にした第2領域ヒストグラム生成部と、前記開始位置から第2の方向に延びた1つのラインにおいて前記開始位置を除く領域を対象にした第3領域ヒストグラム生成部と、前記第1領域ヒストグラム生成部、前記第2領域ヒストグラム生成部および前記第3領域ヒストグラム生成部の対象領域を除く領域を対象にした第4領域ヒストグラム生成部と、を有し、前記第1領域ヒストグラム生成部は、前記開始位置における前記フィルタ領域内の各位置での特徴値を集計して前記ヒストグラムデータを取得し、前記第2領域ヒストグラム生成部は、前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第1の方向に1つずれた位置から、注目位置を第1の方向にずらしながら前記ヒストグラムデータを順次生成し、前記第3領域ヒストグラム生成部は、前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第2の方向に1つずれた位置から、注目位置を第2の方向にずらしながら前記ヒストグラムデータを順次生成し、前記第4領域ヒストグラム生成部は、前記2次差分取得部と前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第1の方向および第2の方向に1つずつずれた位置から、注目位置を第1の方向にずらしながら各位置での前記ヒストグラムデータを順次生成する1ライン分の処理を、第2の方向に1ラインずつずらしながら繰り返す構成とする。   According to a third aspect of the present invention, the local histogram generation unit includes a first region histogram generation unit for a start position located at a corner of the image, and a first region histogram extending in the first direction from the start position. A second region histogram generator for a region excluding the start position in the line, and a third region histogram generation for a region excluding the start position in one line extending from the start position in the second direction. And a fourth region histogram generation unit for a region excluding a target region of the first region histogram generation unit, the second region histogram generation unit, and the third region histogram generation unit, The one-region histogram generating unit obtains the histogram data by collecting feature values at each position in the filter region at the start position, The region histogram generation unit includes the primary difference acquisition unit and the integration unit, and shifts the target position in the first direction from a position shifted by one in the first direction with respect to the start position. Histogram data is sequentially generated, and the third region histogram generation unit includes the primary difference acquisition unit and the integration unit, and takes attention from a position shifted by one in the second direction with respect to the start position. The histogram data is sequentially generated while shifting the position in the second direction, and the fourth region histogram generation unit includes the secondary difference acquisition unit, the primary difference acquisition unit, and the integration unit, and the start A process for one line for sequentially generating the histogram data at each position while shifting the position of interest in the first direction from a position shifted one by one in the first direction and the second direction with respect to the position, 1 in the second direction A configuration that is repeated while shifting by Inn.

これによると、画像内の全ての位置でのヒストグラムデータを効率よく生成することができる。   This makes it possible to efficiently generate histogram data at all positions in the image.

また、第4の発明は、前記画像に対して階調補正を行うものであり、前記画像補正部は、前記ヒストグラムデータに基づいて階調変換カーブを生成する階調変換カーブ生成部と、前記階調変換カーブを用いて各画素に対して階調変換を行う階調変換部と、を有する構成とする。   According to a fourth aspect of the present invention, gradation correction is performed on the image, and the image correction unit includes a gradation conversion curve generation unit that generates a gradation conversion curve based on the histogram data; And a gradation conversion unit that performs gradation conversion on each pixel using a gradation conversion curve.

これによると、画像内に明るい領域と暗い領域とが混在する場合に、それぞれの領域内でコントラストを強調して、鮮明な画像を得ることができる。   According to this, when a bright region and a dark region are mixed in the image, it is possible to obtain a clear image by enhancing the contrast in each region.

また、第5の発明は、前記画像を複数のブロックに分割するブロック分割部と、前記ブロック内の各画素の値からブロックごとの代表値を求めるブロック代表値取得部と、をさらに備え、前記局所的ヒストグラム生成部は、前記ブロックごとのヒストグラムデータを生成する構成とする。   The fifth invention further comprises a block dividing unit that divides the image into a plurality of blocks, and a block representative value obtaining unit that obtains a representative value for each block from the values of the pixels in the block, The local histogram generator is configured to generate histogram data for each block.

これによると、ヒストグラム生成処理がブロック単位で行われるため、演算量を削減して、処理の高速化を図ることができる。   According to this, since the histogram generation processing is performed in units of blocks, it is possible to reduce the amount of calculation and increase the processing speed.

また、第6の発明は、前記局所的ヒストグラム生成部は、注目位置からの距離に応じた重み付けを行った重みつきヒストグラムデータを生成するものであり、異なる重み係数が設定された大きさの異なる複数の前記フィルタ領域を対象にして重みなしヒストグラムデータを生成する重みなしヒストグラム生成部と、複数の前記フィルタ領域ごとの前記重みなしヒストグラムデータを、それぞれに前記重み係数を乗じた上で統合して、重みつきヒストグラムデータを生成する重みつきヒストグラム生成部と、を有する構成とする。   According to a sixth aspect of the present invention, the local histogram generator generates weighted histogram data weighted according to the distance from the target position, and has different sizes with different weighting factors set. An unweighted histogram generator for generating unweighted histogram data for a plurality of filter regions, and the unweighted histogram data for each of the plurality of filter regions are integrated by multiplying each by the weight coefficient. And a weighted histogram generator for generating weighted histogram data.

これによると、注目位置からの距離に応じて各位置の特徴値がヒストグラムデータに与える影響を調整することができる。   According to this, it is possible to adjust the influence of the feature value of each position on the histogram data according to the distance from the target position.

また、第7の発明は、入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理方法であって、前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成するステップを有し、前記ヒストグラムデータを生成するステップは、注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得するステップと、前記1次差分データおよび1つ前の位置でのヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得するステップと、を有する構成とする。   According to a seventh aspect of the present invention, there is provided an image processing method for generating histogram data for a filter region set around a target position on an input image and correcting the image based on the histogram data. A step of sequentially generating the histogram data at each position while shifting the target position one by one on the image, and the step of generating the histogram data includes the filter region at the target position and the filter region The step of acquiring primary difference data for a primary difference area that does not overlap the filter area at the previous position, and the primary difference data and the histogram data at the previous position are integrated. And acquiring histogram data at the target position.

これによると、前記の第1の発明と同様に、ヒストグラム生成処理の高速化を図ることができる。   According to this, similarly to the first invention, it is possible to speed up the histogram generation processing.

以下、本発明の実施の形態を、図面を参照しながら説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

図1は、本実施形態に係る撮像装置を示す概略構成図である。この撮像装置は、レンズ1と、絞り部2と、撮像素子3と、A/D変換器4と、前処理部5と、YC分離部6と、階調補正部(画像処理装置)7と、Y信号処理部8と、C信号処理部9と、を備えている。   FIG. 1 is a schematic configuration diagram illustrating an imaging apparatus according to the present embodiment. This imaging device includes a lens 1, a diaphragm unit 2, an imaging device 3, an A / D converter 4, a preprocessing unit 5, a YC separation unit 6, and a gradation correction unit (image processing device) 7. , Y signal processing unit 8 and C signal processing unit 9.

レンズ1は、被写体からの光を撮像素子3に結像するものである。絞り部2は、撮像素子3に入射する光量を制御するものである。撮像素子3は、結像した像を光電変換するものである。A/D変換器4は、撮像素子3から得られるアナログ信号をデジタル信号に変換するものである。前処理部5は、A/D変換された画像信号に対しOB減算やホワイトバランス調整などの処理を行うものである。YC分離部6は、前処理後の画像信号を輝度信号と色差信号に分離するものである。階調補正部7は、YC分離部6から出力された輝度信号および色差信号に階調補正を行うものである。Y信号処理部8は、輝度信号に対して所要の信号処理を行うものである。C信号処理部9は、色差信号に対して所要の信号処理を行うものである。   The lens 1 focuses light from the subject on the image sensor 3. The diaphragm unit 2 controls the amount of light incident on the image sensor 3. The image sensor 3 performs photoelectric conversion on the formed image. The A / D converter 4 converts an analog signal obtained from the image sensor 3 into a digital signal. The pre-processing unit 5 performs processing such as OB subtraction and white balance adjustment on the A / D converted image signal. The YC separation unit 6 separates the preprocessed image signal into a luminance signal and a color difference signal. The gradation correction unit 7 performs gradation correction on the luminance signal and the color difference signal output from the YC separation unit 6. The Y signal processing unit 8 performs necessary signal processing on the luminance signal. The C signal processing unit 9 performs necessary signal processing on the color difference signal.

なお、本実施形態では、撮像装置が階調補正部7を備えた構成としたが、階調補正部を、撮像装置とは別の画像処理装置で構成し、適宜な記憶媒体あるいは通信媒体を介して、撮像装置から画像処理装置に撮像データを送るようにしてもよい。この場合、画像処理装置は、PCなどの情報処理装置に階調補正アプリケーションを導入することで実現することも可能である。   In the present embodiment, the imaging apparatus includes the gradation correction unit 7. However, the gradation correction unit is configured by an image processing apparatus different from the imaging apparatus, and an appropriate storage medium or communication medium is provided. The imaging data may be sent from the imaging device to the image processing device. In this case, the image processing apparatus can also be realized by introducing a gradation correction application into an information processing apparatus such as a PC.

次に、階調補正部7で行われる階調補正処理について説明する。図2は、図1に示した階調補正部7で行われる階調補正処理の状況を実際の画像の例を用いて説明する説明図である。   Next, the tone correction process performed by the tone correction unit 7 will be described. FIG. 2 is an explanatory diagram for explaining the state of gradation correction processing performed by the gradation correction unit 7 shown in FIG. 1 using an example of an actual image.

この画像では、明るい領域と暗い領域とが混在する、すなわち日射による明るい屋外が写った領域と暗い屋内が写った領域とが含まれているが、図2(A)に示すように、階調補正前の入力画像では、明るい領域と暗い領域との間では十分な明暗差が得られるものの、それぞれの領域内ではコントラストが低下して、被写体が不鮮明となっている。このような入力画像に対して階調補正部7で階調補正処理を行うと、図2(B)に示すように、明るい領域および暗い領域のそれぞれの領域内でコントラストが強調されて、鮮明な画像を得ることができる。   In this image, a bright area and a dark area are mixed, that is, an area where a bright outdoor area is reflected by solar radiation and an area where a dark indoor area is captured are included. As shown in FIG. In the input image before correction, a sufficient contrast between the bright area and the dark area is obtained, but the contrast is lowered in each area, and the subject is unclear. When gradation correction processing is performed on such an input image by the gradation correction unit 7, as shown in FIG. 2B, the contrast is enhanced in each of the bright area and the dark area, so that the image is clear. Can be obtained.

図1に示したように、階調補正部7は、ブロック分割部10と、ブロック代表値算出部11と、階調数削減部12と、ブロック代表値格納部13と、局所的ヒストグラム生成部14と、ヒストグラム整形部15と、階調変換カーブ生成部16と、階調変換部17と、線形補間部18と、比率計算部19と、乗算器21,22と、を備えている。この階調補正部7には、前処理部5から出力される画像データが入力される。   As shown in FIG. 1, the gradation correction unit 7 includes a block dividing unit 10, a block representative value calculating unit 11, a gradation number reducing unit 12, a block representative value storing unit 13, and a local histogram generating unit. 14, a histogram shaping unit 15, a gradation conversion curve generation unit 16, a gradation conversion unit 17, a linear interpolation unit 18, a ratio calculation unit 19, and multipliers 21 and 22. The gradation correction unit 7 receives image data output from the preprocessing unit 5.

以下に、階調補正部7の各部で行われる処理について説明するが、まず、階調補正部7の各部で行われる処理の手順を説明する。図3は、階調補正部7で行われる処理の手順を示すフロー図である。   Hereinafter, processing performed in each unit of the gradation correction unit 7 will be described. First, a procedure of processing performed in each unit of the gradation correction unit 7 will be described. FIG. 3 is a flowchart showing a procedure of processing performed by the gradation correction unit 7.

階調補正部7では、まず、入力された画像を複数のブロックに分割する処理がブロック分割部10にて行われ(ST101)、ついで、ブロック内の各画素の値から各ブロックの代表値を算出する処理がブロック代表値算出部11にて行われ(ST102)、ついで、各ブロックの代表値の階調数を削減する処理が階調数削減部12にて行われ(ST103)、階調数削減済みの各ブロックの代表値がブロック代表値格納部13に格納される。   In the gradation correction unit 7, first, a process of dividing the input image into a plurality of blocks is performed in the block dividing unit 10 (ST101), and then the representative value of each block is determined from the value of each pixel in the block. The calculation process is performed by the block representative value calculation unit 11 (ST102), and then the process of reducing the number of gradations of the representative value of each block is performed by the gradation number reduction unit 12 (ST103). The representative value of each block whose number has been reduced is stored in the block representative value storage unit 13.

ついで、注目ブロックを中心にしたフィルタ領域に含まれるブロックの代表値を階調ごとに集計して、階調ごとの度数を示す局所的ヒストグラムデータを生成する処理が局所的ヒストグラム生成部14にて行われ(ST104)、ついで、ヒストグラムデータを整形する処理がヒストグラム整形部15にて行われる(ST105)。   Next, the local histogram generator 14 performs processing for generating the local histogram data indicating the frequency for each gradation by counting the representative values of the blocks included in the filter region centered on the target block for each gradation. Then, the process of shaping the histogram data is performed by the histogram shaping unit 15 (ST105).

ついで、整形済みのヒストグラムデータに基づいて各ブロックの階調変換カーブを生成する処理が階調変換カーブ生成部16にて行われ(ST106)、ついで、注目画素の周囲の複数のブロックの階調変換カーブに基づいて注目画素に関する複数の階調変換結果を求める処理が階調変換部17にて行われ(ST107)、ついで、その複数の階調変換結果を線形補間して各画素の階調を求める処理が線形補間部18にて行われる(ST108)。   Next, a process for generating a gradation conversion curve for each block based on the shaped histogram data is performed by the gradation conversion curve generation unit 16 (ST106), and then the gradations of a plurality of blocks around the pixel of interest are processed. A process for obtaining a plurality of gradation conversion results for the pixel of interest based on the conversion curve is performed in the gradation conversion unit 17 (ST107), and then the plurality of gradation conversion results are linearly interpolated to perform gradation of each pixel. Is obtained by the linear interpolation unit 18 (ST108).

ついで、各画素について、線形補間部18で取得した階調変換後の階調と、前処理部5からの入力時の階調との比率を計算する処理が比率計算部19にて行われ(ST109)、ついで、比率計算部19で得られた比率をYC分離部6で生成された輝度信号および色差信号にそれぞれ乗算する階調補正処理が乗算器21,22にて行われる(ST110)。   Next, for each pixel, processing for calculating the ratio between the gradation after gradation conversion acquired by the linear interpolation unit 18 and the gradation at the time of input from the preprocessing unit 5 is performed by the ratio calculation unit 19 ( (ST109) Then, gradation correction processing for multiplying the luminance signal and the color difference signal generated by the YC separation unit 6 by the ratio obtained by the ratio calculation unit 19 is performed by the multipliers 21 and 22 (ST110).

次に、階調補正部7の各部で行われる処理について詳しく説明する。   Next, processing performed in each unit of the gradation correction unit 7 will be described in detail.

図4は、図1に示したブロック分割部10で行われるブロック分割処理を説明する説明図である。ブロック分割部10では、入力された画像を複数の矩形のブロックに分割する処理が行われる。図4に示す例では、横640画素、縦480画素となる画像が、縦横ともに8画素の正方形のブロックに分割され、ブロック数は画像全体で80×60=4800となる。   FIG. 4 is an explanatory diagram for explaining a block division process performed by the block division unit 10 shown in FIG. The block dividing unit 10 performs processing for dividing the input image into a plurality of rectangular blocks. In the example shown in FIG. 4, an image having 640 pixels in width and 480 pixels in height is divided into square blocks of 8 pixels in both length and width, and the total number of blocks is 80 × 60 = 4800.

なお、本実施形態では、図示するX方向を横方向、Y方向を縦方向として説明する。また、ブロックの位置については、X方向を列iの並び方向、Y方向を行jの並び方向として、i列j行目に位置するブロックを(i,j)として説明する。   In the present embodiment, the illustrated X direction will be described as a horizontal direction and the Y direction as a vertical direction. In addition, regarding the position of the block, the X direction is the arrangement direction of the column i, the Y direction is the arrangement direction of the row j, and the block located in the i column and the jth row is described as (i, j).

図1に示したブロック代表値算出部11では、ブロック分割部10で設定された各ブロック内の各画素の値から各ブロックの代表値を算出する処理が行われる。ここで算出する代表値は、例えばブロック内の各画素の輝度の平均値や中央値である。   In the block representative value calculation unit 11 illustrated in FIG. 1, a process of calculating the representative value of each block from the value of each pixel in each block set by the block dividing unit 10 is performed. The representative value calculated here is, for example, the average value or the median value of the luminance of each pixel in the block.

図1に示した階調数削減部12では、ブロック代表値算出部11で算出された各ブロックの代表値の階調数を誤差拡散法などを用いて削減する処理(ディザリング)が行われる。この階調数削減処理は、ヒストグラムデータの生成に適した階調数に削減するものであり、ブロックの代表値が例えば256階調(8ビット)から16階調(4ビット)に変換される。   The gradation number reduction unit 12 shown in FIG. 1 performs processing (dithering) to reduce the number of gradations of the representative value of each block calculated by the block representative value calculation unit 11 using an error diffusion method or the like. . This gradation number reduction process is to reduce the number of gradations suitable for generating histogram data, and the representative value of the block is converted from, for example, 256 gradations (8 bits) to 16 gradations (4 bits). .

図1に示したブロック代表値格納部13には、階調数削減部12で取得した階調数削減済みの各ブロックの代表値が格納される。このブロック代表値格納部13には、1フレーム分のブロックの代表値が格納される。   The block representative value storage unit 13 illustrated in FIG. 1 stores the representative value of each block having the reduced number of gradations acquired by the gradation number reducing unit 12. The block representative value storage unit 13 stores a representative value of a block for one frame.

図5は、図1に示した局所的ヒストグラム生成部14で行われる局所的ヒストグラム生成処理を説明する説明図である。局所的ヒストグラム生成部14では、ブロック代表値格納部13から各ブロックの代表値を取得して、ブロックごとに局所的ヒストグラムデータを生成する処理が行われる。   FIG. 5 is an explanatory diagram for explaining a local histogram generation process performed by the local histogram generator 14 shown in FIG. The local histogram generation unit 14 performs processing to acquire the representative value of each block from the block representative value storage unit 13 and generate local histogram data for each block.

この局所的ヒストグラム生成処理では、図5(A)に示すように、注目ブロックを中心にして所定の大きさ(例えば15×15)のフィルタ領域が設定され、このフィルタ領域内のブロックの代表値を階調ごとに集計して、図5(B)に示すように、階調ごとの度数(ブロック数)を示す局所的ヒストグラムデータを生成する。   In this local histogram generation process, as shown in FIG. 5A, a filter area of a predetermined size (for example, 15 × 15) is set around the block of interest, and the representative value of the block in this filter area Are collected for each gradation, and as shown in FIG. 5B, local histogram data indicating the frequency (number of blocks) for each gradation is generated.

図1に示したヒストグラム整形部15では、局所的ヒストグラム生成部14で取得した各ブロックの局所的ヒストグラムデータに対して、所要の階調の度数を上下の階調に分配する分配処理などのヒストグラム整形処理が行われる。   In the histogram shaping unit 15 shown in FIG. 1, a histogram such as a distribution process that distributes the frequency of the required gradation to the upper and lower gradations for the local histogram data of each block acquired by the local histogram generation unit 14. A shaping process is performed.

図6は、図1に示した階調変換カーブ生成部16で行われる階調変換カーブ生成処理を説明する説明図である。階調変換カーブ生成部16では、ヒストグラム整形部15で取得した整形済みの各ブロックのヒストグラムデータに基づいて、各ブロックの階調変換カーブ(トーンカーブ)を生成する処理が行われる。   FIG. 6 is an explanatory diagram for explaining the gradation conversion curve generation processing performed by the gradation conversion curve generation unit 16 shown in FIG. The gradation conversion curve generation unit 16 performs a process of generating a gradation conversion curve (tone curve) of each block based on the histogram data of each shaped block acquired by the histogram shaping unit 15.

この階調変換カーブ生成処理では、図5(B)に示したヒストグラムデータにおける階調ごとの度数(ブロック数)を、図6(A)に示すように、下位の階調から順に累積して累積ヒストグラムを生成する。そして、累積ヒストグラム上で各階調の度数で規定される矩形の対角線を結ぶことで、図6(B)に示すように、折れ線状の階調変換カーブが得られる。このとき、累積ヒストグラムにおける最上位の階調の度数が階調数になるように正規化する処理が行われる。   In this gradation conversion curve generation processing, the frequency (number of blocks) for each gradation in the histogram data shown in FIG. 5B is accumulated in order from the lower gradation as shown in FIG. 6A. Generate a cumulative histogram. Then, by connecting rectangular diagonal lines defined by the frequency of each gradation on the cumulative histogram, a polygonal gradation conversion curve is obtained as shown in FIG. 6B. At this time, normalization processing is performed so that the frequency of the highest gradation in the cumulative histogram becomes the number of gradations.

図7は、図1に示した階調変換部17で行われる階調変換処理および線形補間部18で行われる線形補間処理を説明する説明図である。階調変換部17では、階調変換カーブ生成部16で取得した各ブロックの階調変換カーブのうち、注目画素の近傍の複数のブロックの階調変換カーブに基づいて各画素の階調を変換する処理が行われる。   FIG. 7 is an explanatory diagram for explaining the gradation conversion process performed by the gradation conversion unit 17 and the linear interpolation process performed by the linear interpolation unit 18 shown in FIG. The gradation conversion unit 17 converts the gradation of each pixel based on the gradation conversion curves of a plurality of blocks in the vicinity of the target pixel among the gradation conversion curves of each block acquired by the gradation conversion curve generation unit 16. Processing is performed.

特に本実施形態では、4つのブロック、すなわち注目画素を含むブロック(i,j)と、これに縦横斜め方向に隣接するブロック(i−1,j)、ブロック(i,j−1)、およびブロック(i−1,j−1)の階調変換カーブに基づいて注目画素の階調変換を行う。これにより、注目画素に関する4つの階調変換結果、すなわち階調L(i,j)、階調L(i−1,j)、階調L(i,j−1)、および階調L(i−1,j−1)が得られる。   In particular, in the present embodiment, four blocks, that is, a block (i, j) including the target pixel, a block (i-1, j) adjacent to the block (i-1, j), a block (i, j-1), and Based on the gradation conversion curve of the block (i-1, j-1), gradation conversion of the target pixel is performed. As a result, four gradation conversion results relating to the pixel of interest, that is, gradation L (i, j), gradation L (i-1, j), gradation L (i, j-1), and gradation L ( i-1, j-1) is obtained.

図1に示した線形補間部18では、階調変換部17で得られた複数の階調変換結果を線形補間して画素ごとに1つの階調を求める処理が行われる。この線形補間処理は、注目画素から各ブロックの重心までの距離に基づいて行われる。すなわち、距離による加重平均(重み付き平均)で注目画素の階調を求める。   In the linear interpolation unit 18 illustrated in FIG. 1, a process for obtaining one gradation for each pixel by linearly interpolating a plurality of gradation conversion results obtained by the gradation conversion unit 17 is performed. This linear interpolation processing is performed based on the distance from the target pixel to the center of gravity of each block. That is, the tone of the pixel of interest is obtained by a weighted average (weighted average) based on distance.

なお、注目画素の近傍の各ブロックの階調変換カーブに対して、注目画素から各ブロックの重心までの距離に応じた重み付けを行って、注目画素に関する階調変換カーブを生成して、この階調変換カーブに基づいて注目画素の階調変換を行うようにしてもよい。   Note that the gradation conversion curve of each block near the target pixel is weighted according to the distance from the target pixel to the center of gravity of each block to generate a gradation conversion curve related to the target pixel. The tone conversion of the pixel of interest may be performed based on the tone conversion curve.

次に、図1に示した局所的ヒストグラム生成部14で行われる局所的ヒストグラム生成処理について詳しく説明する。図8は、局所的ヒストグラム生成部14の概略構成を示すブロック図である。   Next, the local histogram generation process performed by the local histogram generation unit 14 shown in FIG. 1 will be described in detail. FIG. 8 is a block diagram illustrating a schematic configuration of the local histogram generation unit 14.

局所的ヒストグラム生成部14は、重みなしヒストグラム生成部31と、重み係数設定部32と、重みつきヒストグラム生成部33と、を備えている。   The local histogram generation unit 14 includes a weightless histogram generation unit 31, a weight coefficient setting unit 32, and a weighted histogram generation unit 33.

重みなしヒストグラム生成部31では、ブロック代表値格納部13から階調数削減済みのブロック代表値を取得して、ブロックごとの重みなしヒストグラムデータを生成する処理が行われる。重み係数設定部32では、重み係数を設定する処理が行われる。重みつきヒストグラム生成部33では、重みなしヒストグラム生成部31で取得した重みなしヒストグラムデータと、重み係数設定部32で設定された重み係数に基づいて、重みつきヒストグラムデータを生成する処理が行われる。   The unweighted histogram generation unit 31 performs processing for acquiring the block representative value with the reduced number of gradations from the block representative value storage unit 13 and generating unweighted histogram data for each block. The weighting factor setting unit 32 performs processing for setting a weighting factor. The weighted histogram generation unit 33 performs processing for generating weighted histogram data based on the weightless histogram data acquired by the weightless histogram generation unit 31 and the weighting factor set by the weighting factor setting unit 32.

次に、重みつきヒストグラム生成部33で行われる重みつきヒストグラム生成処理について説明する。図9は、重み付け領域および重み係数を説明する説明図である。図10は、重みつきヒストグラムを生成する要領を説明する説明図である。   Next, a weighted histogram generation process performed by the weighted histogram generation unit 33 will be described. FIG. 9 is an explanatory diagram for explaining the weighting region and the weighting coefficient. FIG. 10 is an explanatory diagram for explaining a procedure for generating a weighted histogram.

重みつきヒストグラム生成処理では、図9に示すように、フィルタ領域が注目ブロックを中心にして複数の重み付け領域に分割され、各重み付け領域には異なる重み係数が設定されている。本実施形態では、注目ブロックを中心にして第1〜第3の3つの重み付け領域が設定される。第1〜第3の各重み付け領域の大きさは、例えばD1=15、D2=9、D3=3とする。第1〜第3の各重み付け領域にはそれぞれ重み係数W1〜W3が設定され、この重み係数W1〜W3は、最も外側の第1の重み付け領域から内側の第2,第3領域の順に大きくなる、例えばW1=3、W2=5、W3=6となるように設定される。   In the weighted histogram generation process, as shown in FIG. 9, the filter area is divided into a plurality of weighted areas centering on the block of interest, and different weighting factors are set for each weighted area. In the present embodiment, the first to third weighting regions are set around the block of interest. The sizes of the first to third weighted areas are, for example, D1 = 15, D2 = 9, and D3 = 3. Weighting factors W1 to W3 are set in the first to third weighting regions, respectively, and the weighting factors W1 to W3 increase in order from the outermost first weighting region to the inner second and third regions. For example, W1 = 3, W2 = 5, and W3 = 6 are set.

ここで、従来は、フィルタ領域に含まれるブロックの代表値を階調ごとに集計する際に、ブロックが属する重み付け領域に設定された重み係数を度数(ブロック数)に乗じて集計するようにしていた。   Here, conventionally, when the representative values of the blocks included in the filter area are aggregated for each gradation, the weighting factor set in the weighting area to which the block belongs is multiplied by the frequency (number of blocks) and aggregated. It was.

これに対して、本実施形態では、図10に示すように、全ての重み付け領域を統合した第1のフィルタ領域と、この第1のフィルタ領域から外側の重み付け領域を順に除外した第2,第3のフィルタ領域をそれぞれ設定し、これらの第1〜第3のフィルタ領域を対象にした重みなしヒストグラムデータH1、H2、H3をそれぞれ生成する。   In contrast, in the present embodiment, as shown in FIG. 10, a first filter region in which all weighting regions are integrated, and second and second filter regions in which the outer weighting regions are excluded in order from the first filter region. 3 filter regions are set, and unweighted histogram data H1, H2, and H3 are generated for the first to third filter regions, respectively.

具体的には、図10(A)に示すように、第1〜第3の重み付け領域を統合した第1のフィルタ領域を対象にした重みなしヒストグラムデータH1(i,j)を生成する。また、図10(B)に示すように、第2,第3の重み付け領域を統合した第2のフィルタ領域を対象にした重みなしヒストグラムデータH2(i,j)を生成する。また、図10(C)に示すように、第3の重み付け領域のみによる第3のフィルタ領域を対象にした重みなしヒストグラムデータH3(i,j)を生成する。   Specifically, as shown in FIG. 10A, unweighted histogram data H1 (i, j) for the first filter region obtained by integrating the first to third weighting regions is generated. Further, as shown in FIG. 10B, unweighted histogram data H2 (i, j) is generated for the second filter region obtained by integrating the second and third weighting regions. Further, as shown in FIG. 10C, unweighted histogram data H3 (i, j) for the third filter region based only on the third weighting region is generated.

そして、得られた第1〜第3の重みなしヒストグラムデータH1(i,j)、H2(i,j)、H3(i,j)を統合して重みつきヒストグラムデータを生成するが、このとき、第1〜第3のフィルタ領域では重み付け領域が互いに重複しているため、第1〜第3の重み係数W1〜W3に代えて、重み付け領域の重複を考慮した第1〜第3の修正重み係数W1’,W2’,W3’を第1〜第3の重みなしヒストグラムデータH1(i,j),H2(i,j),H3(i,j)にそれぞれ乗じる。   Then, the obtained first to third unweighted histogram data H1 (i, j), H2 (i, j) and H3 (i, j) are integrated to generate weighted histogram data. In the first to third filter regions, since the weighting regions overlap each other, instead of the first to third weighting factors W1 to W3, the first to third correction weights considering the overlapping of the weighting regions. The coefficients W1 ′, W2 ′, and W3 ′ are respectively multiplied by the first to third unweighted histogram data H1 (i, j), H2 (i, j), and H3 (i, j).

すなわち、第1のヒストグラムデータH1(i,j)に乗じる第1の修正重み係数W1’は、第1の重み係数W1(=3)のままであるが、第2のヒストグラムデータH2(i,j)に乗じる第2の修正重み係数W2’は、第2の重み係数W2(=5)から重複分の3を引いた値(=2)となり、第3のヒストグラムデータH3(i,j)に乗じる第3の修正重み係数W3’は、第3の重み係数W3(=6)から重複分の5を引いた値(=1)となる。   That is, the first correction weighting coefficient W1 ′ multiplied by the first histogram data H1 (i, j) remains the first weighting coefficient W1 (= 3), but the second histogram data H2 (i, j, The second modified weighting factor W2 ′ multiplied by j) is a value (= 2) obtained by subtracting the overlap 3 from the second weighting factor W2 (= 5), and the third histogram data H3 (i, j) The third modified weighting factor W3 ′ multiplied by is a value (= 1) obtained by subtracting the overlapping 5 from the third weighting factor W3 (= 6).

なお、本実施形態で、2つのヒストグラムデータを統合するとは、各ヒストグラムデータにおける度数を階調ごとに加算することをいう。また、ヒストグラムデータに係数を乗じるとは、ヒストグラムデータにおける階調ごとの度数に係数を乗じることをいう。   In the present embodiment, integrating two histogram data means adding the frequency in each histogram data for each gradation. Also, multiplying histogram data by a coefficient means multiplying the frequency for each gradation in the histogram data by a coefficient.

以上のような局所的ヒストグラム生成処理の全体的な手順について説明する。図11は、局所的ヒストグラム生成部14で行われる局所的ヒストグラム生成処理の手順を示すフロー図である。   The overall procedure of the local histogram generation process as described above will be described. FIG. 11 is a flowchart showing a procedure of local histogram generation processing performed by the local histogram generation unit 14.

局所的ヒストグラム生成処理では、まず、重みなしヒストグラム生成部31において重みなしヒストグラム生成処理がフィルタ領域の大きさを変えて重み係数の数だけ複数回(ここでは3回)繰り返される(ST201〜ST203)。そして、重み係数設定部32において重み係数を設定する処理が行われて(ST204)、その重み係数に基づいて重みつきヒストグラムデータを生成する処理が重みつきヒストグラム生成部33において行われる(ST205)。   In the local histogram generation processing, first, the weightless histogram generation processing is repeated a plurality of times (here, three times) by the number of weighting factors by changing the size of the filter region in the weightless histogram generation unit 31 (ST201 to ST203). . Then, processing for setting a weighting factor is performed in the weighting factor setting unit 32 (ST204), and processing for generating weighted histogram data based on the weighting factor is performed in the weighted histogram generating unit 33 (ST205).

次に、図8に示した重みなしヒストグラム生成部31で行われる重みなしヒストグラム生成処理について詳しく説明する。図12は、重みなしヒストグラム生成部31の概略構成を示すブロック図である。図13は、重みなしヒストグラム生成処理の概要を説明する説明図である。図14は、重みなしヒストグラム生成処理の手順を示すフロー図である。   Next, the unweighted histogram generation process performed by the unweighted histogram generation unit 31 shown in FIG. 8 will be described in detail. FIG. 12 is a block diagram illustrating a schematic configuration of the unweighted histogram generation unit 31. FIG. 13 is an explanatory diagram for explaining an overview of the unweighted histogram generation process. FIG. 14 is a flowchart showing the procedure of the unweighted histogram generation process.

なお、以下の説明では、1つのフィルタ領域に関する重みなしヒストグラム生成処理について説明するが、この処理は、前記のようにフィルタ領域の大きさを変えて繰り返し行われる。   In the following description, the unweighted histogram generation process related to one filter area will be described, but this process is repeatedly performed while changing the size of the filter area as described above.

図12に示すように、重みなしヒストグラム生成部31は、第1領域ヒストグラム生成部41と、第2領域ヒストグラム生成部42と、第3領域ヒストグラム生成部43と、第4領域ヒストグラム生成部44と、横方向1次差分格納部45と、ヒストグラム格納部46と、を備えている。   As shown in FIG. 12, the unweighted histogram generation unit 31 includes a first region histogram generation unit 41, a second region histogram generation unit 42, a third region histogram generation unit 43, and a fourth region histogram generation unit 44. The horizontal direction primary difference storage unit 45 and the histogram storage unit 46 are provided.

図13に示すように、第1領域ヒストグラム生成部41では、画像の左上隅に位置する開始位置となる開始ブロック(0,0)のみを対象にした第1領域ヒストグラム生成処理が行われる。   As shown in FIG. 13, the first region histogram generation unit 41 performs a first region histogram generation process for only the start block (0, 0) that is the start position located in the upper left corner of the image.

第2領域ヒストグラム生成部42では、開始ブロックから横方向(第1の方向)に延びた1つのライン(開始行)において開始ブロックを除く領域のブロック、すなわちブロック(1,0)〜(I,0)を対象にした第2領域ヒストグラム生成処理が行われる。この第2領域ヒストグラム生成処理では、横方向に1つずつずらしながら順に各ブロックのヒストグラムを取得する処理が行われる。   In the second region histogram generation unit 42, blocks in the region excluding the start block in one line (start row) extending in the horizontal direction (first direction) from the start block, that is, blocks (1, 0) to (I, A second region histogram generation process targeting 0) is performed. In the second region histogram generation process, a process of acquiring the histogram of each block in order while shifting one by one in the horizontal direction is performed.

第3領域ヒストグラム生成部43では、開始ブロックから縦方向(第2の方向)に延びた1つのライン(開始列)において開始ブロックを除く領域のブロック、すなわちブロック(0,1)〜(0,J)を対象にした第3領域ヒストグラム生成処理が行われる。この第3領域ヒストグラム生成処理では、縦方向に1つずつずらしながら順に各ブロックのヒストグラムを取得する処理が行われる。   In the third region histogram generation unit 43, blocks in the region excluding the start block in one line (start column) extending in the vertical direction (second direction) from the start block, that is, blocks (0, 1) to (0, A third region histogram generation process for J) is performed. In the third region histogram generation process, a process of acquiring the histogram of each block in order while shifting one by one in the vertical direction is performed.

第4領域ヒストグラム生成部44では、開始行および開始列を除くブロック、すなわち(1,1)〜(I,J)を対象にした第4領域ヒストグラム生成処理が行われる。この第4領域ヒストグラム生成処理では、横方向に1つずつずらしながら順に各ブロックのヒストグラムを取得する1ライン分の処理が上から順に各ライン(行)で繰り返し行われる。   The fourth region histogram generation unit 44 performs a fourth region histogram generation process for blocks other than the start row and start column, that is, (1, 1) to (I, J). In the fourth region histogram generation processing, processing for one line for sequentially obtaining the histogram of each block while shifting one by one in the horizontal direction is repeatedly performed on each line (row) in order from the top.

この第1領域ヒストグラム生成部41、第2領域ヒストグラム生成部42、第3領域ヒストグラム生成部43、および第4領域ヒストグラム生成部44でそれぞれ行われるヒストグラム生成処理は、図14に示すように、順に行われる(ST301〜ST304)。ただし、第2領域ヒストグラム生成処理と第3領域ヒストグラム生成処理とは逆の順番で行うようにしてもよい。   The histogram generation processing performed in each of the first region histogram generation unit 41, the second region histogram generation unit 42, the third region histogram generation unit 43, and the fourth region histogram generation unit 44 is sequentially performed as shown in FIG. Performed (ST301 to ST304). However, the second region histogram generation process and the third region histogram generation process may be performed in the reverse order.

なお、図12に示した横方向1次差分格納部45では、ブロックごとに横方向1次差分値Dxを格納するメモリ領域Mdが確保されている。横方向1次差分値Dxは、後述するように、縦方向に1つ後の1ライン分の処理にしか用いられないため、横方向1次差分格納部45には1ライン分のメモリ領域Mdを確保すればよい。また、ヒストグラム格納部46では、ブロックごとにヒストグラムデータHを格納するメモリ領域Mhが確保されている。   In the horizontal direction primary difference storage unit 45 shown in FIG. 12, a memory area Md for storing the horizontal direction primary difference value Dx is secured for each block. As will be described later, the horizontal direction primary difference value Dx is used only for processing for the next line in the vertical direction, and therefore the horizontal direction primary difference storage unit 45 has a memory area Md for one line. Should be secured. The histogram storage unit 46 reserves a memory area Mh for storing the histogram data H for each block.

次に、図12に示した第1領域ヒストグラム生成部41で行われる第1領域ヒストグラム生成処理について説明する。図15は、第1領域ヒストグラム生成処理の概要を説明する説明図である。図16は、第1領域ヒストグラム生成処理の手順を示すフロー図である。   Next, a first region histogram generation process performed by the first region histogram generation unit 41 illustrated in FIG. 12 will be described. FIG. 15 is an explanatory diagram for explaining an overview of the first region histogram generation process. FIG. 16 is a flowchart showing the procedure of the first region histogram generation process.

第1領域ヒストグラム生成処理では、左上隅の開始ブロック(0,0)のヒストグラムデータを取得する。この第1領域ヒストグラム生成処理では、開始ブロック(0,0)のフィルタ領域に含まれる全てのブロックの代表値をブロック代表値格納部13から取得して、そのブロックの代表値を階調ごとに集計して開始ブロックのヒストグラムデータH(0,0)を取得する(図16のST401)。この開始ブロックのヒストグラムデータH(0,0)は、ヒストグラム格納部46の該当するメモリ領域Mh(0,0)に格納される(図16のST402)。   In the first region histogram generation process, histogram data of the start block (0, 0) at the upper left corner is acquired. In this first region histogram generation processing, representative values of all blocks included in the filter region of the start block (0, 0) are acquired from the block representative value storage unit 13, and the representative values of the blocks are obtained for each gradation. The histogram data H (0, 0) of the start block is obtained by aggregation (ST401 in FIG. 16). The histogram data H (0, 0) of the start block is stored in the corresponding memory area Mh (0, 0) of the histogram storage unit 46 (ST402 in FIG. 16).

次に、図12に示した第2領域ヒストグラム生成部42で行われる第2領域ヒストグラム生成処理について説明する。図17は、第2領域ヒストグラム生成処理の概要を説明する説明図である。   Next, the second region histogram generation process performed by the second region histogram generation unit 42 shown in FIG. 12 will be described. FIG. 17 is an explanatory diagram for explaining the outline of the second region histogram generation processing.

図13に示したように、第2領域ヒストグラム生成処理では、開始ブロックを除く開始行のブロック、すなわちブロック(1,0)〜(I,0)を対象にしてブロックごとのヒストグラムを取得する。この第2領域ヒストグラム生成処理では、横方向に1つずつずらしながら順にブロックごとのヒストグラムを取得する処理が行われる。   As shown in FIG. 13, in the second region histogram generation process, a block-by-block histogram is acquired for blocks in the start row excluding the start block, that is, blocks (1, 0) to (I, 0). In the second region histogram generation processing, processing for acquiring a histogram for each block in order while shifting one by one in the horizontal direction is performed.

ここで、図17に示すように、注目ブロック(i,0)のフィルタ領域と横方向に1つ前のブロック(i−1,0)のフィルタ領域とを比較すると、各フィルタ領域の大半は重なるが、横方向に1つ前のブロック(i−1,0)のフィルタ領域における最も左側の1列が注目ブロック(i,0)のフィルタ領域から外れ、また、注目ブロック(i,0)のフィルタ領域に最も右側の1列が新たに加わる。   Here, as shown in FIG. 17, when comparing the filter area of the target block (i, 0) with the filter area of the previous block (i-1, 0) in the horizontal direction, most of each filter area is Although overlapped, the leftmost column in the filter area of the previous block (i-1, 0) in the horizontal direction is out of the filter area of the target block (i, 0), and the target block (i, 0) The rightmost column is newly added to the filter area.

そこで、横方向に1つ前のブロック(i−1,0)のフィルタ領域において注目ブロック(i,0)のフィルタ領域から外れる最も左側の1列を、減少分の横方向1次差分領域とし、また、注目ブロック(i,0)のフィルタ領域に新たに加わる最も右側の1列を、増加分の横方向1次差分領域として、この減少分および増加分の横方向1次差分領域に含まれるブロックの代表値を階調ごとに集計して横方向1次差分データDx(i,0)を求め、この横方向1次差分データDx(i,0)を、横方向に1つ前のブロックのヒストグラムデータH(i−1,0)と統合することで、注目ブロックのヒストグラムデータH(i,0)を求めることができる。   Therefore, in the filter area of the previous block (i-1, 0) in the horizontal direction, the leftmost one column that is out of the filter area of the target block (i, 0) is set as the horizontal primary difference area for the decrease. In addition, the rightmost one column newly added to the filter area of the block of interest (i, 0) is included in the reduced horizontal direction primary difference area as the increased horizontal direction primary difference area. The horizontal direction primary difference data Dx (i, 0) is obtained by summing up the representative values of the blocks to be classified for each gradation, and the horizontal direction primary difference data Dx (i, 0) By integrating with the histogram data H (i-1, 0) of the block, the histogram data H (i, 0) of the block of interest can be obtained.

なお、本実施形態で、1次差分データとは、ヒストグラムデータと同様に、階調ごとの度数を示すものであり、1次差分データとヒストグラムデータとを統合するとは、各データにおける度数を階調ごとに加減算することをいい、増加分の1次差分データでは加算が行われ、減少分の1次差分データでは減算が行われる。   In the present embodiment, the primary difference data indicates the frequency for each gradation as in the case of the histogram data, and the integration of the primary difference data and the histogram data means that the frequency in each data is a scale. Addition / subtraction is performed for each key, and addition is performed for the increased primary difference data, and subtraction is performed for the decreased primary difference data.

ここで、横方向1次差分領域は、注目ブロックの位置によって異なる。すなわち、図17(A)に示すように、注目ブロックが左寄りの位置では、増加分のみが存在し、減少分は存在しない。また、図17(B)に示すように、注目ブロックが横方向の中間の位置では、減少分および増加分の両方が存在する。また、図17(C)に示すように、注目ブロックが右寄りの位置では、減少分のみが存在し、増加分は存在しない。   Here, the horizontal primary difference area differs depending on the position of the block of interest. That is, as shown in FIG. 17A, when the block of interest is on the left side, only an increase exists and no decrease exists. Further, as shown in FIG. 17B, both the decrease and the increase exist at the intermediate position in the horizontal direction of the target block. Further, as shown in FIG. 17C, when the target block is located on the right side, only the decrease amount exists and the increase amount does not exist.

次に、第2領域ヒストグラム生成部42の構成について説明する。第2領域ヒストグラム生成部42は、図12に示したように、横方向1次差分取得部51と、統合部52と、を備えている。   Next, the configuration of the second region histogram generation unit 42 will be described. As shown in FIG. 12, the second region histogram generation unit 42 includes a horizontal primary difference acquisition unit 51 and an integration unit 52.

横方向1次差分取得部51では、前記のように、注目ブロック(i,0)のフィルタ領域と横方向に1つ前のブロック(i−1,0)のフィルタ領域とが重なり合わない減少分および増加分の横方向1次差分領域に含まれるブロックの代表値をブロック代表値格納部13から取得して、横方向1次差分データDx(i,0)を取得する。   In the horizontal direction primary difference acquisition unit 51, as described above, the filter area of the block of interest (i, 0) and the filter area of the previous block (i-1, 0) in the horizontal direction do not overlap. The representative value of the block included in the horizontal direction primary difference area for the minute and the increase is acquired from the block representative value storage unit 13 and the horizontal direction primary difference data Dx (i, 0) is acquired.

統合部52では、横方向1次差分取得部51で取得した横方向1次差分データDx(i,0)と、ヒストグラム格納部46から取得した横方向に1つ前のブロックのヒストグラムデータH(i−1,0)とを統合して、注目ブロックのヒストグラムデータH(i,0)を生成する。   In the integration unit 52, the horizontal direction primary difference data Dx (i, 0) acquired by the horizontal direction primary difference acquisition unit 51 and the histogram data H () of the block immediately preceding in the horizontal direction acquired from the histogram storage unit 46 ( i-1, 0) is integrated to generate histogram data H (i, 0) of the block of interest.

次に、第2領域ヒストグラム生成処理の手順について説明する。図18は、第2領域ヒストグラム生成処理の手順を示すフロー図である。   Next, the procedure of the second region histogram generation process will be described. FIG. 18 is a flowchart showing the procedure of the second region histogram generation process.

第2領域ヒストグラム生成処理では、まず、列iを初期化する(ST501)。これにより、ブロックごとのヒストグラム生成処理がブロック(1,0)から開始される。   In the second region histogram generation process, first, the column i is initialized (ST501). Thereby, the histogram generation processing for each block is started from the block (1, 0).

ブロックごとのヒストグラム生成処理では、まず、横方向1次差分取得部51にて、横方向1次差分データDx(i,0)を取得して(ST502)、その横方向1次差分データDx(i,0)を横方向1次差分格納部45の該当するメモリ領域Md(i,0)に格納する(ST503)。ついで、横方向に1つ前のブロックのヒストグラムデータH(i−1,0)に、横方向1次差分データDx(i,0)を統合して、注目ブロックのヒストグラムデータH(i,0)を取得して(ST504)、その注目ブロックのヒストグラムデータH(i,0)をヒストグラム格納部46の該当するメモリ領域Mh(i,0)に格納する(ST505)。   In the histogram generation process for each block, first, the horizontal primary difference acquisition unit 51 acquires horizontal primary difference data Dx (i, 0) (ST502), and the horizontal primary difference data Dx ( i, 0) is stored in the corresponding memory area Md (i, 0) of the horizontal primary difference storage unit 45 (ST503). Next, the horizontal primary difference data Dx (i, 0) is integrated into the histogram data H (i-1,0) of the previous block in the horizontal direction, and the histogram data H (i, 0) of the block of interest. ) Is acquired (ST504), and the histogram data H (i, 0) of the block of interest is stored in the corresponding memory area Mh (i, 0) of the histogram storage unit 46 (ST505).

このようにして、1つのブロックのヒストグラム生成処理が終了すると、列iを1増分した上で(ST506)、列iが最大値Iを超えている、すなわち対象となるブロックの処理が全て終了したか否かの判定が行われ(ST507)、対象となるブロックの処理が全て終了していなければ(ST507でNo)、次のブロックの処理に進み、対象となるブロックの処理が全て終了するまで繰り返される。   In this way, when the histogram generation processing of one block is completed, the column i is incremented by 1 (ST506), and the column i exceeds the maximum value I, that is, all processing of the target block is completed. Is determined (ST507), and if all of the processing of the target block is not completed (No in ST507), the process proceeds to the processing of the next block until all of the processing of the target block is completed. Repeated.

以上のように、第2領域ヒストグラム生成処理では、注目ブロックのフィルタ領域と横方向に1つ前のブロックのフィルタ領域とが重なり合わない横方向1次差分領域に含まれるブロックの代表値を集計した横方向1次差分データを求め、この横方向1次差分データと横方向に1つ前のブロックのヒストグラムデータとを統合して、注目ブロックのヒストグラムデータを生成する。これにより、フィルタ領域に含まれる全てのブロックの代表値を集計する必要がないため、演算負担を軽減することができる。   As described above, in the second region histogram generation process, the representative values of the blocks included in the horizontal primary difference region in which the filter region of the target block and the filter region of the previous block in the horizontal direction do not overlap are totaled. The obtained horizontal direction primary difference data is obtained, and the horizontal direction primary difference data and the histogram data of the previous block in the horizontal direction are integrated to generate the histogram data of the block of interest. As a result, it is not necessary to aggregate the representative values of all the blocks included in the filter area, so that the calculation burden can be reduced.

次に、図12に示した第3領域ヒストグラム生成部43で行われる第3領域ヒストグラム生成処理について説明する。図19は、第3領域ヒストグラム生成処理の概要を説明する説明図である。   Next, a third region histogram generation process performed by the third region histogram generation unit 43 illustrated in FIG. 12 will be described. FIG. 19 is an explanatory diagram for explaining the outline of the third region histogram generation processing.

図13に示したように、第3領域ヒストグラム生成処理では、開始ブロックを除く開始列のブロック、すなわちブロック(0,1)〜(0,J)を対象にして各ブロックのヒストグラムデータを取得する。この第3領域ヒストグラム生成処理では、縦方向に順に各ブロックのヒストグラムデータを取得する処理が行われる。   As shown in FIG. 13, in the third region histogram generation process, histogram data of each block is acquired for the blocks in the start column excluding the start block, that is, the blocks (0, 1) to (0, J). . In the third region histogram generation processing, processing for acquiring histogram data of each block in order in the vertical direction is performed.

ここで、図19に示すように、注目ブロック(0,j)のフィルタ領域と縦方向に1つ前のブロック(0,j−1)のフィルタ領域とを比較すると、各フィルタ領域の大半は重なるが、縦方向に1つ前のブロック(0,j−1)のフィルタ領域における最も上側の1行が注目ブロック(0,j)のフィルタ領域から外れ、また、注目ブロック(0,j)のフィルタ領域に最も下側の1行が新たに加わる。   Here, as shown in FIG. 19, when comparing the filter area of the target block (0, j) with the filter area of the previous block (0, j-1) in the vertical direction, most of the filter areas are Although overlapping, the uppermost row in the filter area of the immediately preceding block (0, j-1) in the vertical direction is out of the filter area of the target block (0, j), and the target block (0, j) The lowermost row is newly added to the filter area.

そこで、縦方向に1つ前のブロック(0,j−1)のフィルタ領域において注目ブロック(0,j)のフィルタ領域から外れる最も上側の1行を、減少分の縦方向1次差分領域とし、また、注目ブロック(0,j)のフィルタ領域に新たに加わる最も下側の1行を、増加分の縦方向1次差分領域として、この減少分および増加分の縦方向1次差分領域に含まれるブロックの代表値を階調ごとに集計して縦方向1次差分データDy(0,j)を求め、この縦方向1次差分データDy(0,j)を、縦方向に1つ前のブロックのヒストグラムデータH(0,j−1)と統合することで、注目ブロックのヒストグラムデータH(0,j)を求めることができる。   Therefore, in the filter area of the previous block (0, j-1) in the vertical direction, the uppermost one line that is out of the filter area of the target block (0, j) is defined as the vertical difference area in the vertical direction. In addition, the lowermost row newly added to the filter area of the target block (0, j) is set as the vertical direction primary difference area for the increase, and the vertical direction primary difference area for the decrease and the increase The representative values of the included blocks are aggregated for each gradation to obtain the vertical direction primary difference data Dy (0, j), and this vertical direction primary difference data Dy (0, j) is one before in the vertical direction. The histogram data H (0, j) of the block of interest can be obtained by integrating with the histogram data H (0, j-1) of the block.

ここで、縦方向1次差分領域は、注目ブロックの位置によって異なる。すなわち、図19(A)に示すように、注目ブロックが上寄りの位置では、増加分のみが存在し、減少分は存在しない。また、図19(B)に示すように、注目ブロックが縦方向の中間の位置では、減少分および増加分の両方が存在する。また、図19(C)に示すように、注目ブロックが下寄りの位置では、減少分のみが存在し、増加分は存在しない。   Here, the vertical direction primary difference area differs depending on the position of the target block. That is, as shown in FIG. 19 (A), at the position where the target block is on the upper side, there is only an increase and no decrease. Further, as shown in FIG. 19B, both the decrease amount and the increase amount exist at the position where the target block is in the middle in the vertical direction. Further, as shown in FIG. 19C, at the position where the block of interest is at the lower side, there is only a decrease and no increase.

次に、第3領域ヒストグラム生成部43の構成について説明する。第3領域ヒストグラム生成部43は、図12に示したように、縦方向1次差分取得部53と、統合部54と、を備えている。   Next, the configuration of the third region histogram generation unit 43 will be described. As illustrated in FIG. 12, the third region histogram generation unit 43 includes a vertical direction primary difference acquisition unit 53 and an integration unit 54.

縦方向1次差分取得部53では、前記のように、注目ブロック(0,j)のフィルタ領域と縦方向に1つ前のブロック(0,j−1)のフィルタ領域とが重なり合わない減少分および増加分の縦方向1次差分領域に含まれるブロックの代表値をブロック代表値格納部13から取得して、縦方向1次差分データDy(0,j)を取得する。   In the vertical direction primary difference acquisition unit 53, as described above, the filter region of the target block (0, j) and the filter region of the previous block (0, j-1) in the vertical direction do not overlap. The representative values of the blocks included in the vertical direction primary difference area for the minute and the increase are acquired from the block representative value storage unit 13 to acquire the vertical direction primary difference data Dy (0, j).

統合部54では、縦方向1次差分取得部53で取得した縦方向1次差分データDy(0,j)と、ヒストグラム格納部46から取得した縦方向に1つ前のブロックのヒストグラムデータH(0,j−1)とを統合して、注目ブロックのヒストグラムデータH(0,j)を生成する。   In the integration unit 54, the vertical direction primary difference data Dy (0, j) acquired by the vertical direction primary difference acquisition unit 53 and the histogram data H () of the previous block in the vertical direction acquired from the histogram storage unit 46 ( 0, j-1) is integrated to generate histogram data H (0, j) of the block of interest.

次に、第3領域ヒストグラム生成処理の手順について説明する。図20は、第3領域ヒストグラム生成処理の手順を示すフロー図である。   Next, the procedure of the third region histogram generation process will be described. FIG. 20 is a flowchart showing the procedure of the third region histogram generation process.

第3領域ヒストグラム生成処理では、まず、行jを初期化する(ST601)。これにより、ブロックごとのヒストグラム生成処理がブロック(0,1)から開始される。   In the third region histogram generation process, first, row j is initialized (ST601). Thereby, the histogram generation processing for each block is started from the block (0, 1).

ブロックごとのヒストグラム生成処理では、まず、縦方向1次差分取得部53にて、縦方向1次差分データDy(0,j)を取得する(ST602)。ついで、その縦方向1次差分データDy(0,j)を縦方向に1つ前のブロックのヒストグラムデータH(0,j−1)に統合して、注目ブロックのヒストグラムデータH(0,j)を取得して(ST603)、その注目ブロックのヒストグラムデータH(0,j)をヒストグラム格納部46の該当するメモリ領域Mh(0,j)に格納する(ST604)。   In the histogram generation process for each block, first, the vertical primary difference acquisition unit 53 acquires vertical primary difference data Dy (0, j) (ST602). Next, the vertical difference data Dy (0, j) in the vertical direction is integrated with the histogram data H (0, j-1) of the previous block in the vertical direction, so that the histogram data H (0, j of the block of interest). ) Is acquired (ST603), and the histogram data H (0, j) of the target block is stored in the corresponding memory area Mh (0, j) of the histogram storage unit 46 (ST604).

このようにして、1つのブロックのヒストグラム生成処理が終了すると、行jを1増分した上で(ST605)、行jが最大値Jを超えている、すなわち対象となるブロックの処理が全て終了したか否かの判定が行われ(ST606)、対象となるブロックの処理が全て終了していなければ(ST606でNo)、次のブロックの処理に進み、対象となるブロックが全て終了するまで繰り返される。   When the histogram generation processing for one block is completed in this way, the row j is incremented by 1 (ST605), and then the row j exceeds the maximum value J, that is, all the processing of the target block is completed. Is determined (ST606), and if all the processing of the target block is not completed (No in ST606), the process proceeds to the next block, and is repeated until all the target blocks are completed. .

以上のように、第3領域ヒストグラム生成処理では、注目ブロックのフィルタ領域と縦方向に1つ前のブロックのフィルタ領域とが重なり合わない縦方向1次差分領域に含まれるブロックの代表値を集計した縦方向1次差分データを求め、この縦方向1次差分データと縦方向に1つ前のブロックのヒストグラムデータとを統合して、注目ブロックのヒストグラムデータを生成する。これにより、フィルタ領域に含まれる全てのブロックの代表値を集計する必要がないため、演算負担を軽減することができる。   As described above, in the third region histogram generation process, the representative values of the blocks included in the vertical direction primary difference region in which the filter region of the target block and the filter region of the previous block in the vertical direction do not overlap are totaled. The vertical direction primary difference data is obtained, and the vertical direction primary difference data and the histogram data of the previous block in the vertical direction are integrated to generate the histogram data of the block of interest. As a result, it is not necessary to aggregate the representative values of all the blocks included in the filter area, so that the calculation burden can be reduced.

次に、図12に示した第4領域ヒストグラム生成部44で行われる第4領域ヒストグラム生成処理について説明する。図21,図22,図23は、第4領域ヒストグラム生成処理の概要を説明する説明図である。図24は、第4領域ヒストグラム生成処理を詳しく説明する説明図である。   Next, a fourth region histogram generation process performed by the fourth region histogram generation unit 44 illustrated in FIG. 12 will be described. 21, FIG. 22, and FIG. 23 are explanatory diagrams for explaining the outline of the fourth region histogram generation processing. FIG. 24 is an explanatory diagram for explaining the fourth region histogram generation processing in detail.

図13に示したように、第4領域ヒストグラム生成処理では、開始行および開始列を除くブロック、すなわち(1,1)〜(I,J)を対象にして各ブロックのヒストグラムデータを取得する。この第4領域ヒストグラム生成処理では、横方向に順に各ブロックのヒストグラムデータを取得する1ライン分の処理が上から順に各ライン(行)で繰り返し行われる。   As shown in FIG. 13, in the fourth region histogram generation process, histogram data of each block is acquired for blocks other than the start row and start column, that is, (1, 1) to (I, J). In the fourth region histogram generation processing, processing for one line for acquiring histogram data of each block in order in the horizontal direction is repeatedly performed on each line (row) in order from the top.

この第4領域ヒストグラム生成処理では、図21,図22,図23に示すように、注目ブロックの位置に応じて9つのパターンがあるが、まず、図22(B)に示す代表的なパターンについて図24を参照して説明する。   In this fourth area histogram generation process, as shown in FIGS. 21, 22, and 23, there are nine patterns according to the position of the block of interest. First, the representative pattern shown in FIG. This will be described with reference to FIG.

まず、図24(A)に示すように、注目ブロック(i,j)のフィルタ領域と横方向に1つ前のブロック(i−1,j)のフィルタ領域とが重なり合わない横方向1次差分領域の横方向1次差分データDx(i,j)を求めれば、この横方向1次差分データDx(i,j)を、横方向に1つ前のブロックのヒストグラムデータH(i−1,j)と統合することで、注目ブロックのヒストグラムデータH(i,j)を求めることができる。これは、第2領域ヒストグラム生成処理と同様である。   First, as shown in FIG. 24 (A), the filter region of the target block (i, j) and the filter region of the immediately preceding block (i-1, j) do not overlap with each other in the horizontal direction. If the horizontal direction primary difference data Dx (i, j) of the difference area is obtained, the horizontal direction primary difference data Dx (i, j) is converted into the histogram data H (i−1) of the immediately previous block in the horizontal direction. , J), the histogram data H (i, j) of the block of interest can be obtained. This is the same as the second region histogram generation process.

一方、この第4領域ヒストグラム生成処理では、第2領域ヒストグラム生成処理で取得した開始行のブロックの横方向1次差分データ(i,0)や、第4領域ヒストグラム生成処理で取得した縦方向に1つ前のブロックの横方向1次差分データ(i,j−1)を用いることで、注目ブロックの横方向1次差分データDx(i,j)を少ない演算量で求めることができる。   On the other hand, in the fourth area histogram generation process, the horizontal direction primary difference data (i, 0) of the block of the start row acquired in the second area histogram generation process or the vertical direction acquired in the fourth area histogram generation process. By using the horizontal primary difference data (i, j-1) of the previous block, the horizontal primary differential data Dx (i, j) of the block of interest can be obtained with a small amount of calculation.

すなわち、図24(B−1),(B−2)に示すように、注目ブロック(i,j)の横方向1次差分領域と縦方向に1つ前のブロック(i,j−1)の横方向1次差分領域とを比較すると、各横方向1次差分領域の大半は重なるが、縦方向に1つ前のブロック(i,j−1)の横方向1次差分領域における最も上側の2つのブロックが注目ブロック(i,j)の横方向1次差分領域から外れ、また、注目ブロック(i,j)の横方向1次差分領域における最も下側の2つのブロックが新たに加わる。   That is, as shown in FIGS. 24B-1 and 24B-2, the horizontal primary difference area of the block of interest (i, j) and the previous block (i, j-1) in the vertical direction. When compared with the horizontal direction primary difference area, most of the horizontal direction primary difference areas overlap, but the uppermost in the horizontal direction primary difference area of the previous block (i, j-1) in the vertical direction. Are out of the horizontal primary difference area of the target block (i, j), and the two lowest blocks in the horizontal primary difference area of the target block (i, j) are newly added. .

そこで、縦方向に1つ前のブロック(i,j−1)の横方向1次差分領域において注目ブロック(i,j)の横方向1次差分領域から外れる最も上側の2つのブロックを、減少分の横方向2次差分ブロック(2次差分領域)とし、また、注目ブロック(i,j)の横方向1次差分領域に新たに加わる最も下側の2つのブロックを、増加分の横方向2次差分ブロック(2次差分領域)として、この減少分および増加分の横方向2次差分ブロックの代表値による横方向2次差分データD2x(i,j)を求め、この横方向2次差分データD2x(i,j)を、縦方向に1つ前のブロックの横方向1次差分データDx(i,j−1)と統合することで、注目ブロックの横方向1次差分データDx(i,j)を求めることができる。   Therefore, the uppermost two blocks that deviate from the horizontal primary difference area of the block of interest (i, j) in the horizontal primary differential area of the previous block (i, j-1) in the vertical direction are reduced. Minute horizontal direction secondary difference block (secondary difference region), and the lowest two blocks newly added to the horizontal direction primary difference region of the target block (i, j) As the secondary difference block (secondary difference area), horizontal secondary difference data D2x (i, j) based on the representative value of the horizontal secondary difference block for the decrease and increase is obtained, and the horizontal secondary difference is obtained. By integrating the data D2x (i, j) with the horizontal primary difference data Dx (i, j-1) of the previous block in the vertical direction, the horizontal primary difference data Dx (i of the block of interest , J).

このようにして注目ブロックの横方向1次差分データDx(i,j)が求められると、この横方向1次差分データDx(i,j)を、横方向に1つ前のブロック(i−1,j)のヒストグラムデータH(i−1,j)と統合することで、注目ブロック(i,j)のヒストグラムデータH(i,j)を求めることができる。   When the horizontal direction primary difference data Dx (i, j) of the block of interest is thus obtained, the horizontal direction primary difference data Dx (i, j) is converted to the block (i− 1, j) histogram data H (i, j) of the block of interest (i, j) can be obtained by integrating with the histogram data H (i-1, j).

なお、本実施形態で、2次差分データとは、ヒストグラムデータと同様に、階調ごとの度数を示すものであり、2次差分データと1次差分データとを統合するとは、各データにおける度数を階調ごとに加減算することをいい、増加分の2次差分データでは加算が行われ、減少分の2次差分データでは減算が行われる。   In the present embodiment, the secondary difference data indicates the frequency for each gradation as in the histogram data, and the integration of the secondary difference data and the primary difference data means the frequency in each data. Is added / subtracted for each gradation, and addition is performed for the secondary difference data for the increase, and subtraction is performed for the secondary difference data for the decrease.

ここで、横方向2次差分ブロックは、図24(C)に示すように、注目ブロック(i,j)のフィルタ領域の4隅の外側または内側に存在するが、右下に位置する横方向2次差分ブロックは、増加分の横方向1次差分領域に新たに加わるため、増加分の横方向2次差分ブロックとなり、右上に位置する横方向2次差分ブロックは、増加分の横方向1次差分領域から外れるため、減少分の横方向2次差分ブロックとなり、左下に位置する横方向2次差分ブロックは、減少分の横方向1次差分領域に新たに加わるため、減少分の横方向2次差分ブロックとなり、左上に位置する横方向2次差分ブロックは、減少分の横方向1次差分領域から外れるため、増加分の横方向2次差分ブロックとなる。   Here, as shown in FIG. 24C, the horizontal second-order differential block exists outside or inside the four corners of the filter area of the block of interest (i, j), but is located in the lower right direction. Since the secondary difference block is newly added to the incremented lateral primary difference area, it becomes an incremented lateral secondary difference block, and the lateral secondary difference block located at the upper right is the incremented lateral direction 1. Since it is out of the next difference area, it becomes a reduced horizontal secondary difference block, and the horizontal second difference block located at the lower left is newly added to the reduced horizontal primary difference area, so the reduced horizontal direction The secondary difference block, which is the secondary difference block and located in the upper left, deviates from the reduced horizontal primary difference area, and thus becomes the increased secondary differential block.

また、横方向2次差分ブロックは、図21,図22,図23に示したように、注目ブロックの位置によって異なる。すなわち、図21(A)に示すように、注目ブロックが上寄りかつ左寄りの位置では、右下にのみ1つ存在し、図21(B)に示すように、注目ブロックが上寄りかつ横方向の中間の位置では、下側の左右に2つ存在し、図21(C)に示すように、注目ブロックが上寄りかつ右寄りの位置では、左下にのみ1つ存在する。   Further, the horizontal secondary difference block differs depending on the position of the target block, as shown in FIGS. That is, as shown in FIG. 21 (A), at the position where the target block is on the upper side and the left side, there is only one on the lower right side, and as shown in FIG. 21 (B), the target block is on the upper side and in the horizontal direction. In the middle position, there are two on the left and right sides of the lower side, and as shown in FIG. 21C, there is only one on the lower left side when the target block is on the upper side and on the right side.

図22(A)に示すように、注目ブロックが縦方向の中間かつ左寄りの位置では、右側の上下に2つ存在し、図22(B)に示すように、注目ブロックが縦方向の中間かつ横方向の中間の位置では、左右上下に4つ存在し、図22(C)に示すように、注目ブロックが縦方向の中間かつ右寄りの位置では、左側の上下に2つ存在する。   As shown in FIG. 22 (A), when the block of interest is in the middle and leftward position in the vertical direction, there are two blocks on the right and up, and as shown in FIG. 22 (B), the block of interest is in the middle of the vertical direction. At the middle position in the horizontal direction, there are four on the left and right and up and down, and as shown in FIG. 22C, there are two blocks of interest on the left and top at the middle and right side in the vertical direction.

図23(A)に示すように、注目ブロックが下寄りかつ左寄りの位置では、右上にのみ1つ存在し、図23(B)に示すように、注目ブロックが下寄りかつ横方向の中間の位置では、上側の左右に2つ存在し、図23(C)に示すように、注目ブロックが下寄りかつ右寄りの位置では、左上にのみ1つ存在する。   As shown in FIG. 23 (A), when the target block is at the lower and left positions, there is only one at the upper right. As shown in FIG. 23 (B), the target block is at the lower side and in the middle in the horizontal direction. In the position, there are two on the left and right on the upper side, and as shown in FIG. 23C, there is only one on the upper left in the position where the target block is at the lower side and the right side.

次に、第4領域ヒストグラム生成部44の構成について説明する。第4領域ヒストグラム生成部44は、図12に示したように、横方向2次差分取得部55と、横方向1次差分取得部56と、統合部57と、を備えている。   Next, the configuration of the fourth region histogram generation unit 44 will be described. As shown in FIG. 12, the fourth region histogram generation unit 44 includes a horizontal direction secondary difference acquisition unit 55, a horizontal direction primary difference acquisition unit 56, and an integration unit 57.

横方向2次差分取得部55では、横方向2次差分ブロックの代表値をブロック代表値格納部13から取得して、注目ブロックの横方向2次差分データD2x(i,j)を生成する。   The horizontal direction secondary difference acquisition unit 55 acquires the representative value of the horizontal direction secondary difference block from the block representative value storage unit 13, and generates the horizontal direction secondary difference data D2x (i, j) of the block of interest.

横方向1次差分取得部56では、縦方向に1つ前のブロックの横方向1次差分データDx(i,j−1)を横方向1次差分格納部45から取得して、この横方向1次差分データDx(i,j−1)と、横方向2次差分取得部55で取得した横方向2次差分データD2x(i,j)とを統合して、注目ブロックの横方向1次差分データDx(i,j)を生成する。   The horizontal direction primary difference acquisition unit 56 acquires the horizontal direction primary difference data Dx (i, j-1) of the immediately preceding block in the vertical direction from the horizontal direction primary difference storage unit 45, and this horizontal direction The primary difference data Dx (i, j-1) and the horizontal secondary difference data D2x (i, j) acquired by the horizontal secondary difference acquisition unit 55 are integrated, and the horizontal primary of the target block is integrated. Difference data Dx (i, j) is generated.

統合部57では、横方向1次差分取得部56で取得した注目ブロックの横方向1次差分データDx(i,j)と、ヒストグラム格納部46から取得した横方向に1つ前のブロックのヒストグラムデータH(i−1,j)とを統合して、注目ブロックのヒストグラムデータH(i,j)を生成する。   In the integration unit 57, the horizontal primary difference data Dx (i, j) of the block of interest acquired by the horizontal primary difference acquisition unit 56 and the histogram of the block immediately preceding in the horizontal direction acquired from the histogram storage unit 46 are obtained. The data H (i-1, j) is integrated to generate histogram data H (i, j) of the block of interest.

次に、第4領域ヒストグラム生成処理の手順について説明する。図25は、第4領域ヒストグラム生成処理の手順を示すフロー図である。   Next, the procedure of the fourth region histogram generation process will be described. FIG. 25 is a flowchart showing the procedure of the fourth region histogram generation process.

第4領域ヒストグラム生成処理では、まず、列iおよび行jを初期化する(ST701)。これにより、ブロックごとのヒストグラム生成処理がブロック(1,1)から開始される。   In the fourth region histogram generation process, first, column i and row j are initialized (ST701). Thereby, the histogram generation processing for each block is started from the block (1, 1).

ブロックごとのヒストグラム生成処理では、まず、横方向2次差分取得部55にて、横方向2次差分データD2x(i,j)を取得する(ST702)。ついで、横方向1次差分取得部56にて、1つ前のブロックの横方向1次差分データDx(i,j−1)に横方向2次差分データD2x(i,j)を統合して、横方向1次差分データDx(i,j)を取得し(ST703)、この横方向1次差分データDx(i,j)を横方向1次差分格納部45の該当するメモリ領域Md(i,j)に格納する(ST704)。   In the histogram generation processing for each block, first, the horizontal secondary difference acquisition unit 55 acquires the horizontal secondary difference data D2x (i, j) (ST702). Next, the horizontal primary difference data D2x (i, j) is integrated into the horizontal primary difference data Dx (i, j-1) of the previous block by the horizontal primary difference acquisition unit 56. The horizontal primary difference data Dx (i, j) is acquired (ST703), and the horizontal primary difference data Dx (i, j) is stored in the corresponding memory area Md (i , J) (ST704).

そして、横方向に1つ前のブロックのヒストグラムデータH(i−1,j)に横方向1次差分Dx(i,j)を統合して、注目ブロックのヒストグラムデータH(i,j)を取得して(ST705)、この注目ブロックのヒストグラムデータH(i,j)をヒストグラム格納部46の該当するメモリ領域Mh(i,j)に格納する(ST706)。   Then, the horizontal primary difference Dx (i, j) is integrated with the histogram data H (i-1, j) of the previous block in the horizontal direction, and the histogram data H (i, j) of the block of interest is obtained. Obtained (ST705), the histogram data H (i, j) of this block of interest is stored in the corresponding memory area Mh (i, j) of the histogram storage unit 46 (ST706).

このようにして、1つのブロックのヒストグラム生成処理が終了すると、列iを1増分した上で(ST707)、列iが最大値Iを超えている、すなわち1行の処理が終了したか否かの判定が行われ(ST708)、1行の処理が終了していなければ(ST708でNo)、次のブロックの処理に進み、1行分のブロックの処理が終了するまで繰り返される。そして、1行分のブロックの処理が終了すると(ST708でYes)、行jを1増分した上で(ST709)、行jが最大値Jを超えている、すなわち全ての行の処理が終了したか否かの判定が行われ(ST710)、全ての行の処理が終了していなければ(ST710でNo)、次の行の処理に進み、全ての行の処理が終了するまで繰り返される。   When the histogram generation processing for one block is completed in this way, the column i is incremented by 1 (ST707), and the column i exceeds the maximum value I, that is, whether or not the processing for one row is completed. (ST708) If the process for one row is not completed (No in ST708), the process proceeds to the next block, and is repeated until the process for the block for one line is completed. When the block processing for one row is completed (Yes in ST708), the row j is incremented by 1 (ST709), and the row j exceeds the maximum value J, that is, the processing for all the rows is completed. Is determined (ST 710), and if all the lines have not been processed (NO in ST 710), the process proceeds to the next line, and is repeated until all the lines have been processed.

以上のように、第4領域ヒストグラム生成処理では、注目ブロックの横方向1次差分領域と縦方向に1つ前のブロックの横方向1次差分領域とが重なり合わない横方向2次差分ブロックの代表値から横方向2次差分データを求め、この横方向2次差分データと縦方向に1つ前のブロックの横方向1次差分データとを統合することで、注目ブロックの横方向1次差分データを取得し、ついで、取得した注目ブロックの横方向1次差分データと横方向に1つ前のブロックのヒストグラムデータとを統合して、注目ブロックのヒストグラムデータを生成する。これにより、フィルタ領域に含まれる全てのブロックの代表値を集計する必要がなく、さらに、注目ブロックの横方向1次差分データも少ない演算量で求めることができるため、演算負担を軽減することができる。   As described above, in the fourth region histogram generation process, the horizontal direction primary difference region of the block of interest and the horizontal direction primary difference region of the previous block in the vertical direction are not overlapped. By obtaining horizontal secondary difference data from the representative value and integrating the horizontal secondary difference data and the horizontal primary difference data of the previous block in the vertical direction, the horizontal primary difference of the block of interest is integrated. Data is acquired, and then the acquired horizontal primary difference data of the block of interest and the histogram data of the previous block in the horizontal direction are integrated to generate histogram data of the block of interest. As a result, it is not necessary to aggregate the representative values of all the blocks included in the filter area, and furthermore, the horizontal primary difference data of the block of interest can be obtained with a small amount of calculation, thereby reducing the calculation burden. it can.

なお、図17に示したように、第2領域ヒストグラム生成処理では、横方向1次差分領域の出現パターンが3つあり、図19に示したように、第3領域ヒストグラム生成処理では、縦方向1次差分領域の出現パターンが3つあり、図21〜図23に示したように、第4領域ヒストグラム生成処理では、横方向1次差分領域および横方向2次差分ブロックの出現パターンが9つあるが、これらの出現パターンは、画像全体に対するフィルタ領域の大きさに応じて異なる。   As shown in FIG. 17, in the second area histogram generation process, there are three appearance patterns of the horizontal direction primary difference area. As shown in FIG. 19, in the third area histogram generation process, the vertical direction There are three appearance patterns of the primary difference area. As shown in FIGS. 21 to 23, in the fourth area histogram generation process, nine appearance patterns of the horizontal direction primary difference area and the horizontal direction secondary difference block are generated. However, these appearance patterns differ depending on the size of the filter area for the entire image.

例えば、フィルタ領域の縦方向のブロック数が、画像全体の縦方向のブロック数より多い場合には、図19(B)に示したように、第3領域ヒストグラム生成処理で、増加分および減少分の縦方向1次差分領域の両方が同時に存在するパターンは発生せず、また、図22に示したように、第4領域ヒストグラム生成処理で、縦方向に並ぶ位置に増加分および減少分の横方向2次差分ブロックの両方が同時に存在するパターンは発生しない。   For example, if the number of blocks in the vertical direction of the filter area is larger than the number of vertical blocks in the entire image, as shown in FIG. In the fourth region histogram generation process, as shown in FIG. 22, there is no pattern in which both of the first-order difference areas in the vertical direction are present at the same time. A pattern in which both directional secondary difference blocks exist simultaneously does not occur.

以上、本発明を特定の実施形態に基づいて説明したが、これらの実施形態はあくまでも例示であって、本発明はこれらの実施形態によって限定されるものではなく、本発明の趣旨を逸脱しない範囲で適宜変更可能である。   As mentioned above, although this invention was demonstrated based on specific embodiment, these embodiment is an illustration to the last, This invention is not limited by these embodiment, The range which does not deviate from the meaning of this invention It can be changed as appropriate.

すなわち、本実施形態では、コントラストを強調する目的でヒストグラムデータに基づいて階調補正を行うものとしたが、本発明はこれに限定されるものではなく、ヒストグラムデータに基づいて画像の補正を行う画像処理に広く適用することができる。   That is, in this embodiment, tone correction is performed based on histogram data for the purpose of enhancing contrast. However, the present invention is not limited to this, and image correction is performed based on histogram data. It can be widely applied to image processing.

また、本実施形態では、画像を複数のブロックに分割してブロックごとのヒストグラムデータを生成するものとしたが、本発明はこれに限定されるものではなく、画素ごとのヒストグラムデータを生成する構成にも適用することができる。   In the present embodiment, the image is divided into a plurality of blocks and the histogram data for each block is generated. However, the present invention is not limited to this, and a configuration for generating histogram data for each pixel. It can also be applied to.

また、本実施形態では、第4領域ヒストグラム生成部44において、横方向(第1の方向)に順に各ブロックのヒストグラムデータを取得する1ライン分の処理を上から順に各ライン(行)で繰り返し行い、2次差分取得部では、縦方向(第2の方向)の2次差分データを取得するものとしたが、これと縦横を逆にする、すなわち、第1の方向を縦方向とし、第2の方向を横方向とした構成も可能である。   In the present embodiment, the fourth region histogram generation unit 44 repeats processing for one line for acquiring histogram data of each block in order in the horizontal direction (first direction) for each line (row) in order from the top. The secondary difference acquisition unit acquires the secondary difference data in the vertical direction (second direction). However, the vertical and horizontal directions are reversed, that is, the first direction is the vertical direction, A configuration in which the direction 2 is the horizontal direction is also possible.

本発明にかかる画像処理装置および画像処理方法は、階調ごとの度数を示すヒストグラムデータを生成する処理の高速化を図ることができる効果を有し、ヒストグラムデータに基づいて画像の補正を行う画像処理装置および画像処理方法などとして有用である。   The image processing apparatus and the image processing method according to the present invention have an effect of speeding up the process of generating histogram data indicating the frequency for each gradation, and an image for correcting an image based on the histogram data It is useful as a processing device and an image processing method.

7 階調補正部(画像処理装置)
10 ブロック分割部
11 ブロック代表値算出部
13 ブロック代表値格納部
14 局所的ヒストグラム生成部
16 階調変換カーブ生成部
17 階調変換部
31 重みなしヒストグラム生成部
32 重み係数設定部
33 重みつきヒストグラム生成部
41 第1領域ヒストグラム生成部
42 第2領域ヒストグラム生成部
43 第3領域ヒストグラム生成部
44 第4領域ヒストグラム生成部
45 横方向1次差分格納部
46 ヒストグラム格納部
51 横方向1次差分取得部
52 統合部
53 縦方向1次差分取得部
54 統合部
55 横方向2次差分取得部
56 横方向1次差分取得部
57 統合部
7 Tone correction unit (image processing device)
10 block division unit 11 block representative value calculation unit 13 block representative value storage unit 14 local histogram generation unit 16 gradation conversion curve generation unit 17 gradation conversion unit 31 weightless histogram generation unit 32 weight coefficient setting unit 33 weighted histogram generation Unit 41 first region histogram generation unit 42 second region histogram generation unit 43 third region histogram generation unit 44 fourth region histogram generation unit 45 horizontal direction primary difference storage unit 46 histogram storage unit 51 horizontal direction primary difference acquisition unit 52 Integration unit 53 Vertical primary difference acquisition unit 54 Integration unit 55 Horizontal secondary difference acquisition unit 56 Horizontal primary difference acquisition unit 57 Integration unit

Claims (7)

入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理装置であって、
前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成する局所的ヒストグラム生成部を備え、
この局所的ヒストグラム生成部は、
前記画像上の各位置での前記ヒストグラムデータを格納するヒストグラム格納部と、
注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得する1次差分取得部と、
前記1次差分取得部で取得した前記1次差分データ、および前記ヒストグラム格納部に格納された1つ前の位置での前記ヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得する統合部と、を有することを特徴とする画像処理装置。
An image processing apparatus that generates histogram data for a filter region set around a target position on an input image and corrects the image based on the histogram data,
A local histogram generator that sequentially generates the histogram data at each position while shifting the target position one by one on the image;
This local histogram generator is
A histogram storage for storing the histogram data at each position on the image;
A primary difference acquisition unit that acquires primary difference data for a primary difference area in which the filter area at a position of interest and the filter area at a position immediately before the target area do not overlap;
An integration unit that integrates the primary difference data acquired by the primary difference acquisition unit and the histogram data at the previous position stored in the histogram storage unit, and acquires histogram data at the target position. And an image processing apparatus.
前記局所的ヒストグラム生成部は、注目位置を第1の方向にずらしながら各位置での前記ヒストグラムデータを順次生成する1ライン分の処理を、第1の方向と直交する第2の方向に1ラインずつずらしながら繰り返すものであり、
前記1次差分取得部で取得した前記1次差分データを格納する1次差分格納部と、
注目位置での前記1次差分データと第2の方向に1つ前の位置での前記1次差分データとが重なり合わない2次差分領域を対象にした2次差分データを取得する2次差分取得部と、をさらに有し、
前記1次差分取得部は、前記2次差分取得部で取得した前記2次差分データ、および前記1次差分格納部に格納された第2の方向に1つ前の位置での前記1次差分データを統合して、注目位置での前記1次差分データを取得することを特徴とする請求項1に記載の画像処理装置。
The local histogram generation unit performs processing for one line for sequentially generating the histogram data at each position while shifting the position of interest in the first direction, with one line in a second direction orthogonal to the first direction. It repeats while shifting one by one,
A primary difference storage unit for storing the primary difference data acquired by the primary difference acquisition unit;
Secondary difference data for acquiring secondary difference data for a secondary difference area in which the primary difference data at the position of interest and the primary difference data at the position immediately before in the second direction do not overlap. An acquisition unit,
The primary difference acquisition unit includes the secondary difference data acquired by the secondary difference acquisition unit and the primary difference at a position immediately before in the second direction stored in the primary difference storage unit. The image processing apparatus according to claim 1, wherein the primary difference data at the position of interest is acquired by integrating data.
前記局所的ヒストグラム生成部は、
前記画像の隅に位置する開始位置を対象にした第1領域ヒストグラム生成部と、
前記開始位置から第1の方向に延びた1つのラインにおいて前記開始位置を除く領域を対象にした第2領域ヒストグラム生成部と、
前記開始位置から第2の方向に延びた1つのラインにおいて前記開始位置を除く領域を対象にした第3領域ヒストグラム生成部と、
前記第1領域ヒストグラム生成部、前記第2領域ヒストグラム生成部および前記第3領域ヒストグラム生成部の対象領域を除く領域を対象にした第4領域ヒストグラム生成部と、を有し、
前記第1領域ヒストグラム生成部は、前記開始位置における前記フィルタ領域内の各位置での特徴値を集計して前記ヒストグラムデータを取得し、
前記第2領域ヒストグラム生成部は、前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第1の方向に1つずれた位置から、注目位置を第1の方向にずらしながら前記ヒストグラムデータを順次生成し、
前記第3領域ヒストグラム生成部は、前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第2の方向に1つずれた位置から、注目位置を第2の方向にずらしながら前記ヒストグラムデータを順次生成し、
前記第4領域ヒストグラム生成部は、前記2次差分取得部と前記1次差分取得部と前記統合部とを有し、前記開始位置に対して第1の方向および第2の方向に1つずつずれた位置から、注目位置を第1の方向にずらしながら各位置での前記ヒストグラムデータを順次生成する1ライン分の処理を、第2の方向に1ラインずつずらしながら繰り返すことを特徴とする請求項2に記載の画像処理装置。
The local histogram generator is
A first region histogram generator for a start position located at a corner of the image;
A second region histogram generator for a region excluding the start position in one line extending in the first direction from the start position;
A third region histogram generator for a region excluding the start position in one line extending in the second direction from the start position;
A fourth region histogram generation unit for a region excluding a target region of the first region histogram generation unit, the second region histogram generation unit, and the third region histogram generation unit;
The first region histogram generation unit obtains the histogram data by summing feature values at each position in the filter region at the start position,
The second region histogram generation unit includes the primary difference acquisition unit and the integration unit, and shifts the target position in the first direction from a position shifted by one in the first direction with respect to the start position. Generate the histogram data sequentially while shifting,
The third region histogram generation unit includes the primary difference acquisition unit and the integration unit, and moves a target position in a second direction from a position shifted by one in a second direction with respect to the start position. Generate the histogram data sequentially while shifting,
The fourth region histogram generation unit includes the secondary difference acquisition unit, the primary difference acquisition unit, and the integration unit, one each in a first direction and a second direction with respect to the start position. The processing for one line for sequentially generating the histogram data at each position while shifting the target position in the first direction from the shifted position is repeated while shifting one line in the second direction. Item 3. The image processing apparatus according to Item 2.
前記画像に対して階調補正を行うものであり、
前記画像補正部は、
前記ヒストグラムデータに基づいて階調変換カーブを生成する階調変換カーブ生成部と、
前記階調変換カーブを用いて各画素に対して階調変換を行う階調変換部と、を有することを特徴とする請求項1から請求項3のいずれかに記載の画像処理装置。
Gradation correction is performed on the image,
The image correction unit
A gradation conversion curve generation unit that generates a gradation conversion curve based on the histogram data;
The image processing apparatus according to claim 1, further comprising: a gradation conversion unit that performs gradation conversion on each pixel using the gradation conversion curve.
前記画像を複数のブロックに分割するブロック分割部と、
前記ブロック内の各画素の値からブロックごとの代表値を求めるブロック代表値取得部と、をさらに備え、
前記局所的ヒストグラム生成部は、前記ブロックごとのヒストグラムデータを生成することを特徴とする請求項1から請求項4のいずれかに記載の画像処理装置。
A block dividing unit for dividing the image into a plurality of blocks;
A block representative value obtaining unit for obtaining a representative value for each block from the value of each pixel in the block;
The image processing apparatus according to claim 1, wherein the local histogram generation unit generates histogram data for each block.
前記局所的ヒストグラム生成部は、注目位置からの距離に応じた重み付けを行った重みつきヒストグラムデータを生成するものであり、
異なる重み係数が設定された大きさの異なる複数の前記フィルタ領域を対象にして重みなしヒストグラムデータを生成する重みなしヒストグラム生成部と、
複数の前記フィルタ領域ごとの前記重みなしヒストグラムデータを、それぞれに前記重み係数を乗じた上で統合して、重みつきヒストグラムデータを生成する重みつきヒストグラム生成部と、を有することを特徴とする請求項1から請求項5のいずれかに記載の画像処理装置。
The local histogram generator generates weighted histogram data that is weighted according to the distance from the position of interest,
A weightless histogram generator for generating weightless histogram data for a plurality of the filter regions having different sizes set with different weighting factors;
A weighted histogram generating unit configured to generate weighted histogram data by integrating the weightless histogram data for each of the plurality of filter regions by multiplying the weighted coefficient data by each of the weighted histogram data. The image processing apparatus according to claim 1.
入力された画像上で注目位置の周囲に設定されたフィルタ領域を対象にしたヒストグラムデータを生成して、そのヒストグラムデータに基づいて前記画像の補正を行う画像処理方法であって、
前記画像上で注目位置を1つずつずらしながら各位置での前記ヒストグラムデータを順次生成するステップを有し、
前記ヒストグラムデータを生成するステップは、
注目位置での前記フィルタ領域とその1つ前の位置での前記フィルタ領域とが重なり合わない1次差分領域を対象にした1次差分データを取得するステップと、
前記1次差分データおよび1つ前の位置でのヒストグラムデータを統合して、注目位置でのヒストグラムデータを取得するステップと、を有することを特徴とする画像処理方法。
An image processing method for generating histogram data for a filter region set around a target position on an input image and correcting the image based on the histogram data,
Sequentially generating the histogram data at each position while shifting the position of interest on the image one by one,
The step of generating the histogram data includes:
Obtaining primary difference data targeted for a primary difference area in which the filter area at the position of interest and the filter area at the previous position do not overlap; and
Integrating the primary difference data and the histogram data at the previous position to obtain histogram data at the position of interest, and an image processing method.
JP2012265138A 2012-12-04 2012-12-04 Image processing apparatus and image processing method Active JP6098971B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012265138A JP6098971B2 (en) 2012-12-04 2012-12-04 Image processing apparatus and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012265138A JP6098971B2 (en) 2012-12-04 2012-12-04 Image processing apparatus and image processing method

Publications (2)

Publication Number Publication Date
JP2014109978A true JP2014109978A (en) 2014-06-12
JP6098971B2 JP6098971B2 (en) 2017-03-22

Family

ID=51030557

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012265138A Active JP6098971B2 (en) 2012-12-04 2012-12-04 Image processing apparatus and image processing method

Country Status (1)

Country Link
JP (1) JP6098971B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021177423A (en) * 2016-12-01 2021-11-11 株式会社サイバーコア Image processing apparatus

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7423145B2 (en) * 2019-12-27 2024-01-29 株式会社ディスコ Laser processing equipment and method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008092052A (en) * 2006-09-29 2008-04-17 Matsushita Electric Ind Co Ltd Gradation correcting device and imaging apparatus

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008092052A (en) * 2006-09-29 2008-04-17 Matsushita Electric Ind Co Ltd Gradation correcting device and imaging apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
下山荘介,外3名: ""局所領域サイズに依存しない高速局所コントラスト補正手法の検討"", 映像情報メディア学会技術報告, vol. 33, no. 56, JPN6016041642, 10 December 2009 (2009-12-10), pages 5 - 8, ISSN: 0003429148 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021177423A (en) * 2016-12-01 2021-11-11 株式会社サイバーコア Image processing apparatus
JP7262032B2 (en) 2016-12-01 2023-04-21 株式会社サイバーコア Image processing device

Also Published As

Publication number Publication date
JP6098971B2 (en) 2017-03-22

Similar Documents

Publication Publication Date Title
US20070279618A1 (en) Imaging Apparatus And Image Improving Method
CN103563361B (en) Device and method for image processing and imaging device
KR101373987B1 (en) Image processing device, image processing method, and image processing program
JP2005286482A (en) Distortion correcting apparatus and imaging apparatus provided with distortion correcting apparatus
US20100265352A1 (en) Image processing apparatus, control method therefor, and storage medium
JP2011188391A (en) Image processing apparatus, method and program
CN105659583A (en) Image processing device, image processing method, electronic apparatus, and program
JP5513978B2 (en) Imaging apparatus, integrated circuit, and image processing method
US9113085B2 (en) Apparatus for controlling exposure amount of an imaging device
US8982248B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
KR20180035863A (en) Image contrast enhancement method
JP2008092052A (en) Gradation correcting device and imaging apparatus
JP5183440B2 (en) Gradation correction apparatus and imaging apparatus
CN105719274A (en) Edge Detection System And Methods
CN103888706A (en) Image processing apparatus, image pickup apparatus, and image processing method
JP6098971B2 (en) Image processing apparatus and image processing method
CN102893305B (en) Image processing equipment and image acquisition equipment
CN101815158B (en) Compensation method for improving color shadow in digital images
TWI401973B (en) A Method to Improve the Color Shadow in Digital Image
JP5121675B2 (en) Image processing apparatus, video display apparatus, imaging apparatus, and image processing method
JP2010288093A (en) Image processing apparatus, solid-state imaging apparatus, and electronic information apparatus
CN101534375A (en) Method for correcting chromatic aberration
JP4994158B2 (en) Image correction device
CN107979715A (en) Camera device
WO2015083502A1 (en) Image processing device, method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20151124

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A711

Effective date: 20151224

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20161024

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20161101

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20161226

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: 20170131

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170210

R151 Written notification of patent or utility model registration

Ref document number: 6098971

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151