WO2014115372A1 - 撮像装置及び撮像装置の制御方法 - Google Patents

撮像装置及び撮像装置の制御方法 Download PDF

Info

Publication number
WO2014115372A1
WO2014115372A1 PCT/JP2013/075868 JP2013075868W WO2014115372A1 WO 2014115372 A1 WO2014115372 A1 WO 2014115372A1 JP 2013075868 W JP2013075868 W JP 2013075868W WO 2014115372 A1 WO2014115372 A1 WO 2014115372A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
contrast value
control unit
input image
block
Prior art date
Application number
PCT/JP2013/075868
Other languages
English (en)
French (fr)
Inventor
浩一郎 吉野
Original Assignee
オリンパス株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by オリンパス株式会社 filed Critical オリンパス株式会社
Priority to EP13872928.0A priority Critical patent/EP2950127A4/en
Priority to CN201380071531.3A priority patent/CN104956246A/zh
Publication of WO2014115372A1 publication Critical patent/WO2014115372A1/ja
Priority to US14/810,836 priority patent/US20150334289A1/en

Links

Images

Classifications

    • GPHYSICS
    • G02OPTICS
    • G02BOPTICAL ELEMENTS, SYSTEMS OR APPARATUS
    • G02B7/00Mountings, adjusting means, or light-tight connections, for optical elements
    • G02B7/28Systems for automatic generation of focusing signals
    • G02B7/36Systems for automatic generation of focusing signals using image sharpness techniques, e.g. image processing techniques for generating autofocus signals
    • G02B7/38Systems for automatic generation of focusing signals using image sharpness techniques, e.g. image processing techniques for generating autofocus signals measured at different points on the optical axis, e.g. focussing on two or more planes and comparing image data
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B1/00Instruments for performing medical examinations of the interior of cavities or tubes of the body by visual or photographical inspection, e.g. endoscopes; Illuminating arrangements therefor
    • A61B1/00002Operational features of endoscopes
    • A61B1/00004Operational features of endoscopes characterised by electronic signal processing
    • A61B1/00009Operational features of endoscopes characterised by electronic signal processing of image signals during a use of endoscope
    • A61B1/000095Operational features of endoscopes characterised by electronic signal processing of image signals during a use of endoscope for image enhancement
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B1/00Instruments for performing medical examinations of the interior of cavities or tubes of the body by visual or photographical inspection, e.g. endoscopes; Illuminating arrangements therefor
    • A61B1/00163Optical arrangements
    • A61B1/00188Optical arrangements with focusing or zooming features
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B1/00Instruments for performing medical examinations of the interior of cavities or tubes of the body by visual or photographical inspection, e.g. endoscopes; Illuminating arrangements therefor
    • A61B1/04Instruments for performing medical examinations of the interior of cavities or tubes of the body by visual or photographical inspection, e.g. endoscopes; Illuminating arrangements therefor combined with photographic or television appliances
    • A61B1/045Control thereof
    • GPHYSICS
    • G02OPTICS
    • G02BOPTICAL ELEMENTS, SYSTEMS OR APPARATUS
    • G02B23/00Telescopes, e.g. binoculars; Periscopes; Instruments for viewing the inside of hollow bodies; Viewfinders; Optical aiming or sighting devices
    • G02B23/24Instruments or systems for viewing the inside of hollow bodies, e.g. fibrescopes
    • G02B23/2407Optical details
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method
    • GPHYSICS
    • G03PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
    • G03BAPPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
    • G03B13/00Viewfinders; Focusing aids for cameras; Means for focusing for cameras; Autofocus systems for cameras
    • G03B13/32Means for focusing
    • G03B13/34Power focusing
    • G03B13/36Autofocus systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/50Constructional details
    • H04N23/555Constructional details for picking-up images in sites, inaccessible due to their dimensions or hazardous conditions, e.g. endoscopes or borescopes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/843Demosaicing, e.g. interpolating colour pixel values
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N25/00Circuitry of solid-state image sensors [SSIS]; Control thereof
    • H04N25/10Circuitry of solid-state image sensors [SSIS]; Control thereof for transforming different wavelengths into image signals
    • H04N25/11Arrangement of colour filter arrays [CFA]; Filter mosaics
    • H04N25/13Arrangement of colour filter arrays [CFA]; Filter mosaics characterised by the spectral characteristics of the filter elements
    • H04N25/134Arrangement of colour filter arrays [CFA]; Filter mosaics characterised by the spectral characteristics of the filter elements based on three different wavelength filter elements

Definitions

  • the present invention relates to an imaging apparatus and a method for controlling the imaging apparatus.
  • ⁇ ⁇ Endoscope systems require as wide a depth of field as possible so as not to interfere with user diagnosis and treatment.
  • endoscope systems that perform autofocus hereinafter referred to as AF
  • AF autofocus
  • the depth of field of an endoscope system has become narrower as an imaging device with a higher pixel is used.
  • contrast-type AF is performed in an endoscope
  • a bright spot due to the reflection of illumination light exists in the image
  • the edge of the bright spot has a large effect on the contrast value.
  • it is difficult to detect the position in focus
  • Patent Document 1 and Patent Document 2 it should be excluded when the position of the bright spot in the image fluctuates due to a slight movement of the living body that is the subject or when the user moves the screen.
  • the position of the subject in the image changes during AF, it is difficult to perform AF correctly.
  • an imaging apparatus and an imaging apparatus control method that perform appropriate focus control even when the position of an object to be excluded in the image changes during AF.
  • One aspect of the present invention is an optical system that includes a focus lens that adjusts the position of a focused object, an image sensor that acquires an image of a subject image formed by the optical system, and a lens position control that controls the focus lens position.
  • a focus control unit that performs autofocus control the focus control unit represents a block setting unit that sets a plurality of blocks in an input image, and a contrast value of each block of the set plurality of blocks
  • a contrast value calculating unit for calculating block contrast value information, a contrast value storing unit for storing the block contrast value information of the reference image, and a feature value calculating unit for calculating the feature values of each block of the set plurality of blocks;
  • the effective of the focus control among the plurality of blocks based on the feature amount
  • An effective block determination unit that determines lock and acquires a determination result as effective block information, an effective block information storage unit that stores the effective block information of the reference image, the effective block information of the reference image, and the input
  • An autofocus area setting unit for setting an auto
  • an autofocus area is set using both the effective block information of the input image and the effective block information of the reference image, and the contrast value of each image is determined based on the set autofocus area. Therefore, for both the input image and the reference image, the contrast value can be calculated under the same conditions while excluding blocks that are not properly valid (for example, blocks including bright spots, etc.), so appropriate AF control is performed. Etc. becomes possible.
  • an input image is acquired, a plurality of blocks are set in the input image, block contrast value information representing the contrast value of each block of the set plurality of blocks is calculated, and the set plurality A feature amount of each block of the block is calculated, and based on the calculated feature amount, an effective block that is effective in focus control is determined among the plurality of blocks, and effective block information of the input image is determined.
  • the block contrast value information of the reference image captured at a timing before the input image at a focus lens position different from the input object position from the input image from the contrast value storage unit, and Read the effective block information of the image from the effective block information storage unit, the reference image and the The set of blocks determined as the effective blocks in both the force images is set as an autofocus area, and the image contrast value of the reference image is obtained from the block contrast value information of the autofocus area and the reference image.
  • the image contrast value of the input image is obtained from the autofocus area and the block contrast value information of the input image, and the image contrast value of the reference image and the image contrast value of the input image are compared.
  • the control method of the image pickup apparatus that performs the focus control.
  • FIG. 1 is a system configuration example of an imaging apparatus according to the present embodiment.
  • FIG. 2 is a configuration example of the focus control unit.
  • FIG. 3 shows another configuration example of the focus control unit.
  • FIG. 4 is a flowchart for explaining processing of the first embodiment.
  • FIG. 5 is a flowchart for explaining processing according to a modification of the first embodiment.
  • FIG. 6 is a flowchart for explaining processing in which the third embodiment is applied to single AF.
  • FIG. 7 is a flowchart for explaining processing of the second embodiment.
  • FIG. 8 is a flowchart for explaining processing in which the third embodiment is applied to full-time AF.
  • FIG. 9 is a diagram for explaining peak detection processing according to the first embodiment.
  • FIG. 10 is a diagram for explaining peak detection processing according to a modification of the first embodiment.
  • FIG. 11 is a diagram illustrating an example of driving the focus lens according to the second embodiment.
  • 12A and 12B are explanatory diagrams of block setting processing.
  • FIG. 13 is a diagram for explaining the relationship between blocks and coordinate values.
  • FIGS. 14A to 14C are diagrams illustrating an example of effective block information and an example of setting an AF area.
  • the image processing apparatus includes an optical system including a focus lens 240 that adjusts a focused object position, and an image of a subject image formed by the optical system.
  • the image pickup device 260 to be acquired, a lens position control unit 340 that controls the focus lens position, and a focus control unit 330 that performs autofocus control are included.
  • the focus control unit 330 calculates a block setting unit 331 that sets a plurality of blocks in the input image, and block contrast value information that represents the contrast value of each block of the set plurality of blocks.
  • the contrast value calculation unit 332 Based on the feature value, the contrast value calculation unit 332, the contrast value storage unit 333 that stores the block contrast value information of the reference image, the feature value calculation unit 334 that calculates the feature value of each block of the set plurality of blocks, An effective block determination unit 335 that determines an effective block that is effective in focus control from among the plurality of blocks and acquires the determination result as effective block information, and an effective block information storage unit that stores effective block information of the reference image 336, effective block information of the reference image, and effective block information of the input image.
  • An autofocus area setting unit 337 for setting an autofocus area from information, and determining an image contrast value of the reference image from block contrast value information of the autofocus area and the reference image, and block contrast values of the autofocus area and the input image A contrast value determination unit 338 that determines an image contrast value of the input image from the information.
  • the autofocus area setting unit 337 performs autofocus on a set of blocks determined as valid blocks in both the reference image and the input image. Set as area.
  • the in-focus object position represents the position of the object when the system composed of the optical system, the image plane (the surface of the image sensor 260 in a narrow sense), and the object (subject) is in focus.
  • the block contrast value information is information representing a set of block contrast values of a block including the target image.
  • the feature amount is used for determining an effective block. For example, as described later, the maximum value or average value of luminance, the average value of CrCb, or the like may be used.
  • the effective block information is information indicating whether or not a plurality of blocks set in the target image are effective blocks. For example, information as shown in FIGS. 14A and 14B. It may be.
  • Patent Document 1 and Patent Document 2 a method of excluding bright spots and click areas in a target image is known in the calculation of contrast values for AF.
  • the conventional method does not assume a case where the position or size of an image such as a bright spot changes during AF.
  • the exclusion region set first in the AF process when used as it is, if the position or size of the bright spot or the like subsequently changes, the bright spot or the like can be appropriately removed from the changed image. This makes it difficult to accurately calculate the contrast value. Further, even if a bright spot or the like of each image is excluded by setting an exclusion area for each image, the exclusion area (and thus the area used for calculating the contrast value) differs for each image in a series of AF operations. Therefore, the contrast value calculated from each image has different calculation conditions, and even if the contrast value is compared, the peak detection of the contrast value cannot be performed accurately.
  • the conventional method assumes single AF that determines the focus lens position (the focus lens position when the system is in focus) once, and is a full time continuous search for the focus lens position. There is also a problem that AF is not assumed.
  • the present applicant when performing an AF process on an input image, not only includes effective block information which is a determination result of an effective block (an effective block excluding a block including a bright spot) for the input image. Then, a method for setting an autofocus area (hereinafter referred to as an AF area and the autofocus area setting unit 337 as an AF area setting unit 337) using effective block information about the reference image is proposed. Specifically, as shown in FIGS. 14A to 14C, a set of blocks determined to be valid in both the input image and the reference image may be used as the AF area. In this way, since the contrast value of the input image and the reference image can be obtained under the same conditions, the comparison process between the input image and the reference image can be appropriately performed.
  • the contrast value of each image (also referred to as an image contrast value as necessary to distinguish it from the block contrast value) can be obtained from the sum of the block contrast values of the blocks included in the AF area.
  • the image contrast value of a certain image is not always the same because the AF area may change if the images to be compared are different. That is, it should be noted that even in the method of the present embodiment, the absolute value of the image contrast value is not meaningful and represents the relative relationship in the comparison process between the reference image and the input image. .
  • the first to third embodiments will be described.
  • a method for performing single AF and a modification thereof will be described
  • a method for performing full-time AF will be described.
  • a method using the motion amount of the input image will be described. Note that the method using the amount of motion may be combined with single AF or may be combined with full-time AF, so both the combination with the first embodiment and the combination with the second embodiment will be described. .
  • the endoscope system according to the present embodiment includes a light source unit 100, an imaging unit 200, a processing unit 300, a display unit 400, and an external I / F unit 500.
  • the light source unit 100 includes a white light source 110 that generates white light and a condenser lens 120 that condenses the white light on the light guide fiber 210.
  • the imaging unit 200 is formed to be elongate and bendable, for example, to enable insertion into a body cavity.
  • the imaging unit 200 includes a light guide fiber 210 for guiding the light collected by the light source unit 100, and an illumination lens 220 for diffusing the light guided to the tip by the light guide fiber 210 and irradiating the observation target.
  • An objective lens system 230 that forms an image of reflected light returning from the observation target, a focus lens 240 that is included in the objective lens system 230 and adjusts the position of the focused object, a lens driving unit 250 that drives the focus lens 240, an objective
  • An image sensor 260 is provided that photoelectrically converts the reflected light imaged by the lens system 230 to generate an image.
  • the lens driving unit 250 is, for example, a voice coil motor (hereinafter referred to as VCM).
  • the image sensor 260 is an image sensor having, for example, a Bayer array color filter.
  • the processing unit 300 includes an A / D conversion unit 310, a preprocessing unit 320, a focus control unit 330, a lens position control unit 340, an image processing unit 350, and a control unit 360.
  • the A / D conversion unit 310 converts analog signals sequentially output from the image sensor 260 into digital image signals, and sequentially outputs them to the preprocessing unit 320.
  • the pre-processing unit 320 performs image processing such as white balance, interpolation processing (demosaicing processing), YCbCr conversion processing on the image signal output from the A / D conversion unit 310, and the focus control unit 330 and the image processing unit Sequentially output to 350.
  • the lens position control unit 340 is connected to the lens driving unit 250 and the focus control unit 330, and controls the focus lens 240 according to information output from the focus control unit 330. Details of the focus control unit 330 will be described later.
  • the image processing unit 350 performs image processing such as color conversion, gradation conversion, edge enhancement, noise reduction, and the like on the image signal output from the preprocessing unit 320, and sequentially outputs the image signal to the display unit 400.
  • the display unit 400 is a liquid crystal monitor, for example, and displays an image signal output from the image processing unit 350.
  • the control unit 360 is connected to and controls the external I / F unit 500, the focus control unit 330, the image processing unit 350, the image sensor 260, and the like.
  • the external I / F unit 500 is an interface for performing input from the user to the endoscope apparatus. For example, an AF button for starting / ending AF and an adjustment button for adjusting image processing parameters And so on.
  • the focus control unit 330 includes a block setting unit 331, a contrast value calculation unit 332, a contrast value storage unit 333, a feature amount calculation unit 334, an effective block determination unit 335, an effective block information storage unit 336, and an AF area setting.
  • the block setting unit 331 sets a plurality of evaluation blocks as shown in FIG. 12A for the current image output from the preprocessing unit 320.
  • the set evaluation block is represented as b (bx, by) as shown in FIG. 13, and (bx, by) is a coordinate defining the upper left evaluation block as a reference position (0,0).
  • the contrast value calculation unit 332 calculates the contrast value blockContrastValNow (bx, by) of the evaluation block for all the evaluation blocks set by the block setting unit 331, and sends the contrast value determination unit 338 and the contrast value storage unit 333 to the contrast value determination unit 332. Output.
  • high-pass filter processing may be performed on the Y signals of all the pixels included in each evaluation block, and the sum of the output values may be used as the contrast value of that block.
  • the contrast value storage unit 333 stores blockContrastValNow (bx, by) of all evaluation blocks calculated by the contrast value calculation unit 332 according to the control signal output from the AF control unit 339, and the contrast of each evaluation block of the reference image
  • the value blockContrastValRef (bx, by) is output to the contrast value determination unit 338. Details of the contrast value storage unit 333 and the reference image will be described later.
  • the feature amount calculation unit 334 calculates feature amounts for all the evaluation blocks set by the block setting unit 331 and outputs the feature amounts to the effective block determination unit 335.
  • the feature amount for example, the maximum value blockMaxY (bx, by), the average value blockAveY (bx, by) of the Y signal of all the pixels included in each evaluation block, and the average value blockAveCb (bx, by) of the Cb and Cr signals, respectively. , by), blockAveCr (bx, by) and the like are calculated and output to the effective block determination unit 335.
  • the effective block determination unit 335 determines whether each evaluation block is an effective block using the feature amount of each evaluation block output from the feature amount calculation unit 334.
  • the effective block determination unit 335 determines whether or not blockMaxY (bx, by) of each evaluation block is greater than or equal to a predetermined threshold value. If it is greater than or equal to the threshold value, a bright spot is included in the evaluation block. Therefore, it is determined that the block is not an effective block, and the effective block determination flag effectiveBlockFlagNow (bx, by) of the corresponding evaluation block is set to 0.
  • the effective block determination unit 335 determines whether or not blockAveY (bx, by) of each evaluation block is equal to or less than a predetermined threshold value. Since it is located, it is determined that it is not an effective block, and effectiveBlockFlagNow (bx, by) of the corresponding evaluation block is set to 0. If blockAveY (bx, by) is greater than or equal to a predetermined threshold, the evaluation block is located in a bright area of the image, so it is determined as an effective block and the effectiveBlockFlagNow (bx, by) of the evaluation block is set to 1.
  • the effective block determination unit 335 determines whether or not both blockAveCb (bx, by) and blockAveCr (bx, by) of each evaluation block are equal to or less than a predetermined threshold. Determines that the evaluation block is not an effective block because it is located in the region of the image, and sets effectiveBlockFlagNow (bx, by) of the corresponding evaluation block to 0. This is because the cash is mainly black or silver, and the Cb and Cr signals are both close to 0 in the area corresponding to the cash.
  • blockAveCb (bx, by) and / or blockAveCr (bx, by) is greater than or equal to a predetermined threshold, the evaluation block is not located in the area of the canvas, so it is determined as a valid block Set effectiveBlockFlagNow (bx, by) of the evaluation block to 1.
  • the effective block determination unit 335 determines one or any combination of the determination processes described above, and outputs effectiveBlockFlagNow (bx, by) for all evaluation blocks to the AF area setting unit 337 and the effective block information storage unit 336. To do.
  • the effectiveBlockFlagNow (bx, by) is finally set to 1 for the evaluation block determined to be an effective block for all the determination processes. do it.
  • effectiveBlockFlagNow (bx, by) may be set to 0 for at least one evaluation block determined as an invalid block.
  • the feature amount calculation unit 334 calculates an arbitrary feature amount not described above as necessary, and the effective block determination unit 335 performs arbitrary determination processing according to the calculated feature amount, and each evaluation block is an effective block. It may be determined whether or not.
  • the effective block information storage unit 336 stores effectiveBlockFlagNow (bx, by) of all the evaluation blocks output from the effective block determination unit 335 in accordance with the control signal output from the AF control unit 339, and the effective determination flag of the reference image The result is output to the AF area setting unit 337 as effectiveBlockFlagRef (bx, by). Details of the effective block information storage unit 336 and the reference image will be described later.
  • the AF area setting unit 337 outputs the effective block determination flag effectiveBlockFlagNow (bx, by) of the current image output from the effective block determination unit 335 and the effective block determination flag effectiveBlockFlagRef (bx) of the reference image output from the effective block information storage unit 336. , by), an AF area is set and output to the contrast value determination unit 338. Specifically, for example, the logical product is calculated for each evaluation block with respect to effectiveBlockFlagNow (bx, by) as shown in FIG. 14 (A) and effectiveBlockFlagRef (bx, by) as shown in FIG. 14 (B). The result is output to the contrast value determination unit 338 as an AF area flag afAreaFlag (bx, by) as shown in FIG. By performing such processing, the AF area setting unit 337 can set a set of evaluation blocks determined as effective blocks in both the current image and the reference image as an AF area.
  • the contrast value determination unit 338 calculates the current value from the afAreaFlag (bx, by) output from the AF area setting unit 337 and the contrast value blockContrastValNow (bx, by) of each evaluation block of the current image output from the contrast value calculation unit 332. An image contrast value contrastValNow is determined and output to the AF control unit 339. Further, the contrast value determination unit 338 calculates the contrast value blockContrastValRef (bx, by) of each evaluation block of the reference image output from the afAreaFlag (bx, by) output from the AF area setting unit 337 and the contrast value storage unit 333. The contrast value contrastValRef of the reference image is determined and output to the AF control unit 339.
  • the contrast value determination unit 338 calculates the sum of blockContrastValNow (bx, by) corresponding to the evaluation block whose afAreaFlag (bx, by) is 1, and sets this as contrastValNow. Furthermore, the contrast value determination unit 338 calculates the sum of blockContrastValRef (bx, by) corresponding to the evaluation block whose afAreaFlag (bx, by) is 1, and sets this as contrastValRef. By performing such processing, the contrast value determination unit 338 uses only the evaluation block determined as the effective block in both the current image and the reference image, and uses the contrast value (image contrast value) corresponding to each image. ) Can be determined.
  • the AF control unit 339 performs AF control using the contrast value contrastValNow of the current image output from the contrast value determination unit 338 and the contrast value contrastValRef of the reference image according to the AF start / end signal output from the control unit 360.
  • the AF control unit 339 controls the position of the focus lens 240 by outputting the lens position (requested lens position) required for the focus lens 240 to the lens position control unit 340.
  • the AF control unit 339 acquires the focus lens position from the lens position control unit 340. Further, the AF control unit 339 acquires a control signal (for example, a timing signal for ending acquisition of an image) of the image sensor 260 from the control unit 360.
  • the AF control unit 339 When the AF start signal is output from the control unit 360, the AF control unit 339 outputs, for example, any one end (lens position A) of the movable range of the focus lens 240 to the lens position control unit 340 as a required lens position. (S101).
  • the AF control unit 339 changes the required lens position to the other end (lens position B) of the movable range of the lens, starts the scanning operation of the focus lens 240, and focuses.
  • the lens position is detected (peak detection) (S102).
  • the AF control unit 339 determines whether the current image is the first image after the start of scanning (S103). If it is the first image, the effective block determination unit 335 to the effective block information storage unit 336 The control signal is output so that the effectiveBlockFlagNow (bx, by) output in the above is stored as effectiveBlockFlagRef (bx, by). Further, the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as blockContrastValRef (bx, by).
  • the AF control unit 339 acquires the focus lens position lensPosNow at the time of current image acquisition from the lens position control unit 340, and stores this as the focus lens position lensPosRef at the time of reference image acquisition (S104). Thereafter, the AF control unit 339 continues peak detection.
  • the AF control unit 339 acquires the contrast value contrastValNow of the current image (S105). At this time, the stored effectiveBlockFlagRef (bx, by) is read and processing for setting the AF area is performed.
  • the AF control unit 339 acquires and compares contrastValNow and contrastValRef output from the contrast value determination unit 338 (S106).
  • contrastValNow is larger than contrastValRef (Yes in S106)
  • the AF control unit 339 causes the effectiveBlockFlagNow (bx, by) output from the effective block determination unit 335 to the effective block information storage unit 336 to be a new effectiveBlockFlagRef (bx, EffectiveBlockFlagRef (bx, by) is updated by outputting a control signal so that it is stored as “by”.
  • the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as a new blockContrastValRef (bx, by). Then blockContrastValRef (bx, by) is updated. Further, the AF control unit 339 acquires lensPosNow from the lens position control unit 340 and saves it as a new lensPosRef, thereby updating the lensPosRef (S107). Thereafter, the AF control unit 339 continues peak detection.
  • the AF control unit 339 compares contrastValNow with contrastValRef * K (S108).
  • K is an arbitrary coefficient between 0 and 1.
  • the AF control unit 339 does not update effectiveBlockFlagRef (bx, by), blockContrastValNow (bx, by), and lensPosRef, and continues peak detection.
  • contrastValNow becomes equal to or less than contrastValRef * K (including its value) (in the case of No in S108) (in the case of No in S108)
  • the AF control unit 339 determines lensPosRef as the peak position and ends peak detection (S109).
  • FIG. 9 is a schematic diagram showing a general relationship between the focus lens position and the contrast value of an image.
  • contrastValNow and contrastValRef which are contrast values corresponding to the respective images
  • contrastValNow and contrastValRef are calculated using only the evaluation blocks determined as valid blocks in both the current image and the reference image.
  • the absolute values of contrastValNow and contrastValRef change because the position and number of effective blocks change depending on the presence or absence of bright spots and clicks in the reference image and the current image and the difference in the positions.
  • the magnitude relationship between contrastValRef and contrastValNow is determined in the same manner as in FIG. 9 depending on the focus lens position at the time of acquiring the reference image and the focus lens position at the time of acquiring the current image.
  • contrastValNow1 acquired at this time is larger than contrastValRef1.
  • lensPosRef is sequentially updated to the focus lens position lensPosNow at the time of current image acquisition.
  • contrastValNow2 acquired at this time is smaller than contrastValRef2.
  • the focus lens position is stored in lensPosRef. Since the difference between the focus lens position and the focus lens position at the time of current image acquisition becomes large and contrastValNow2 becomes less than or equal to contrastValRef2 * K (including that value), the AF control unit 339 ends the peak detection. lensPosRef stores the in-focus lens position.
  • the AF control unit 339 sets the above-described coefficient K appropriately so that a contrast value is obtained at a focus lens position other than the focus lens position due to a slight movement of the living body that is the subject or the influence of noise. Even when the decrease occurs, it is possible to prevent erroneous detection of the peak and to detect the focus lens position with high accuracy.
  • the AF control unit 339 After the peak detection is finished, the AF control unit 339 outputs lensPosRef as the required lens position to the lens position control unit 340, and when the focus lens 240 reaches lensPosRef, the single AF is finished because the focusing operation is completed.
  • the endoscope system according to the present embodiment can be used when the position of the bright spot in the image fluctuates due to a slight movement of the living body that is the subject, It is possible to correctly perform single AF even when the position of the subject to be excluded changes during AF, such as when it is moved.
  • the AF control unit 339 in this modification first determines whether the current image is the first image after the start of scanning (S203). If it is the first image, the effective block determination unit 335 determines effective block information. A control signal is output so that effectiveBlockFlagNow (bx, by) output to the storage unit 336 is stored as effectiveBlockFlagRef (bx, by).
  • the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as blockContrastValRef (bx, by). Also, the AF control unit 339 acquires lensPosNow from the lens position control unit 340 and stores it as lensPosRef (S204). Thereafter, the AF control unit 339 continues peak detection.
  • the AF control unit 339 determines whether the current image is the second image after the start of scanning (S205). If the current image is the second image, first, the effectiveBlockFlagRef ( bx, by) is output so as to copy the effective block determination flag effectiveBlockFlagOld (bx, by) of the image immediately before the reference image. Further, the AF control unit 339 copies the blockContrastValRef (bx, by) stored in the contrast value storage unit 333 to the contrast value blockContrastValOld (bx, by) of each evaluation block of the image immediately before the reference image. Output a control signal.
  • the AF control unit 339 copies lensPosRef to the focus lens position lensPosOld of the image immediately before the reference image.
  • the AF control unit 339 outputs a control signal so that effectiveBlockFlagNow (bx, by) output from the effective block determination unit 335 to the effective block information storage unit 336 is stored as effectiveBlockFlagRef (bx, by).
  • the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as blockContrastValRef (bx, by).
  • the AF control unit 339 acquires lensPosNow from the lens position control unit 340 and stores it as lensPosRef (S206). Thereafter, the AF control unit 339 continues peak detection.
  • the AF control unit 339 acquires and compares contrastValNow and contrastValRef output from the contrast value determination unit 338 ( S207, S208).
  • the AF control unit 339 When contrastValNow is larger than contrastValRef (Yes in S208), the AF control unit 339 first copies effectiveBlockFlagRef (bx, by) stored in the effective block information storage unit 336 to effectiveBlockFlagOld (bx, by). Output a control signal and update effectiveBlockFlagOld (bx, by). Further, the AF control unit 339 outputs a control signal so as to copy blockContrastValRef (bx, by) stored in the contrast value storage unit 333 to blockContrastValOld (bx, by), and updates blockContrastValOld (bx, by). .
  • the AF control unit 339 updates lensPosOld by copying lensPosRefs to lensPosOld.
  • the AF control unit 339 outputs a control signal so that effectiveBlockFlagNow (bx, by) output from the effective block determination unit 335 to the effective block information storage unit 336 is stored as effectiveBlockFlagRef (bx, by).
  • the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as blockContrastValRef (bx, by).
  • the AF control unit 339 acquires lensPosNow from the lens position control unit 340 and stores it as lensPosRef (S209). Thereafter, the AF control unit 339 continues peak detection.
  • contrastValNow when contrastValNow is smaller than contrastValRef (No in S208), the AF control unit 339 compares contrastValNow with contrastValRef * K (S210).
  • K is an arbitrary coefficient between 0 and 1.
  • the AF control unit 339 continues peak detection without updating effectiveBlockFlagRef (bx, by), blockContrastValNow (bx, by), and lensPosRef.
  • contrastValNow becomes equal to or less than contrastValRef * K (including that value) (No in S210)
  • the AF control unit 339 determines that the in-focus lens position has been detected and ends peak detection.
  • the AF area setting unit 337 in this modification example is effectiveBlockFlagNow (bx, by) output from the effective block determination unit 335, effectiveBlockFlagRef (bx, by) and effectiveBlockFlagOld (bx, by) output from the effective block information storage unit 336.
  • EffectiveBlockFlagNow (bx, by) output from the effective block determination unit 335
  • effectiveBlockFlagRef (bx, by)
  • effectiveBlockFlagOld (bx, by)
  • the logical product is first calculated for each evaluation block for effectiveBlockFlagNow (bx, by) and effectiveBlockFlagRef (bx, by), and then each evaluation block is calculated for the result and effectiveBlockFlagOld (bx, by).
  • the result of calculating the logical product for each is output to the contrast value determination unit 338 as afAreaFlag (bx, by).
  • the AF area setting unit 337 causes the current image, the reference image (appropriately referred to as the first reference image), and the image immediately before the reference image (appropriately, the second reference image and A set of evaluation blocks determined as valid blocks in all of (denoted) can be set as an AF area.
  • the contrast value determination unit 338 in this modification determines contrastValNow from afAreaFlag (bx, by) output from the AF area setting unit 337 and blockContrastValNow (bx, by) output from the contrast value calculation unit 332, and AF The data is output to the control unit 339. Further, the contrast value determination unit 338 calculates contrastValRef and blockContrastValRef (bx, by) and blockContrastValOld (bx, by) output from the afAreaFlag (bx, by) output from the AF area setting unit 337 and the contrast value storage unit 333. The contrastValOld is determined and output to the AF control unit 339.
  • the contrast value determination unit 338 calculates the sum of blockContrastValNow (bx, by) corresponding to the evaluation block whose afAreaFlag (bx, by) is 1, and sets this as contrastValNow. Furthermore, the contrast value determination unit 338 calculates the sum of blockContrastValRef (bx, by) and blockContrastValOld (bx, by) corresponding to the evaluation block whose afAreaFlag (bx, by) is 1, and sets these as contrastValRef and contrastValOld. . By performing such processing, the contrast value determination unit 338 uses only the evaluation block determined to be an effective block in all of the current image, the reference image, and the image immediately before the reference image, and supports each image. The contrast value to be determined can be determined.
  • the AF control unit 339 uses three known lens positions, lensPosNow, lensPosRef, lensPosOld, and corresponding contrast values contrastValNow, contrastValRef, and contrastValOld, as shown in FIG. A quadratic function passing through the three points is calculated. Thereafter, the focus lens position lensPosPeak having the maximum contrast value with respect to the calculated quadratic function is determined as the required lens position, and is output to the lens position control unit 340 (S211). When the focus lens 240 reaches lensPosPeak, the focusing operation is completed (S212), and the single AF is terminated.
  • the endoscope system in the present modification can detect the focus lens position with high accuracy even when the scan pitch of the focus lens 240 is increased, and can realize high-speed single AF. .
  • the imaging apparatus may include a distance measuring unit that calculates the distance to the subject using the focus lens position after AF processing. Since the focus object position corresponding to the focus lens position is uniquely determined from optical characteristics, if the focus lens position is determined to be a given position, the focus object position at that time is determined. Can be requested.
  • the focus lens position after the AF processing is normally completed is a focus lens position where it is expected to be focused on the subject to be imaged, and the subject at that time is the focused object. It can be estimated that the position is equivalent to the position.
  • the distance measurement unit stores, for example, table data representing the relationship between the focus lens position and the focus object position in the memory, and uses the table data from the focus lens position after the AF process to perform the focus object position. May be calculated and used as the distance to the subject.
  • the method of the present embodiment performs AF appropriately, it is possible to calculate distance information representing the distance to the subject using the AF result (particularly the focus lens position). It is arbitrary what kind of processing the acquired distance information is used for, for example, the structure of the subject is estimated from the distance information, and emphasis processing is performed to improve the visibility for a specific uneven structure, If the distance information is equal to or less than a predetermined threshold value, it may be possible to perform an alert, etc., because there is a possibility of contact with a living body that is a subject.
  • the imaging apparatus photoelectrically converts the optical system including the focus lens 240 that adjusts the position of the focused object and the subject image formed by the optical system to obtain an image.
  • the image pickup device 260 to be generated, a lens position control unit 340 that controls the focus lens position, and a focus control unit 330 that performs autofocus control are included.
  • the focus control unit 330 calculates a block setting unit 331 that sets a plurality of blocks in the input image, and block contrast value information that represents the contrast value of each block of the set plurality of blocks.
  • the contrast value calculation unit 332 Based on the feature value, the contrast value calculation unit 332, the contrast value storage unit 333 that stores the block contrast value information of the reference image, the feature value calculation unit 334 that calculates the feature value of each block of the set plurality of blocks, An effective block determination unit 335 that determines an effective block that is effective in focus control from among the plurality of blocks and acquires the determination result as effective block information, and an effective block information storage unit that stores effective block information of the reference image 336, effective block information of the reference image, and effective block information of the input image.
  • the AF area setting unit 337 for setting the AF area from the information, and determining the image contrast value of the reference image from the block contrast value information of the AF area and the reference image, and input from the block contrast value information of the AF area and the input image
  • the AF area setting section 337 sets a set of blocks determined as valid blocks in both the reference image and the input image as an AF area.
  • the focus control unit 330 may perform a reference image update process for setting the input image as a new reference image.
  • the focus control unit 330 may determine that a peak has been detected when the image contrast value of the input image is smaller than the threshold value calculated from the image contrast value of the reference image.
  • the reference image in the present embodiment is an image that is considered to be closest to the peak position among images that have been processed so far.
  • the case where the image contrast value of the input image is larger than the image contrast value of the reference image corresponds to state 1 in FIG. 9. In this case, the input image is considered to be closer to the peak position, so the reference image is updated. To do.
  • the case where the image contrast value of the input image is smaller than the image contrast value of the reference image corresponds to the state 2 in FIG. 9, and the peak position is a position corresponding to the reference image held at that time. Can think.
  • the determination that the peak has been detected is preferably made on the condition that the image contrast value of the input image has decreased to a certain extent with respect to the image contrast value of the reference image.
  • the determination shown in S108 of FIG. 4 is performed using a constant K that satisfies 0 ⁇ K ⁇ 1.
  • the lens position control unit 340 instructs the lens position control unit 340 to move the focus lens 240 to the focus lens position corresponding to the reference image at the determination timing. You may transmit to.
  • the focus lens 240 has a moving width (scan pitch) to some extent (for example, given lens position and It is desirable to make it small (so that there is no problem even if there is a peak between the next lens position).
  • the focus control unit 330 moves the focus lens position from the first position to the second position with a given movement width in the focus control, and is generated when the focus lens position is the first position.
  • the generated image may be used as a reference image, and images generated every time the focus lens position is moved within a given movement width from the position next to the first position to the second position may be sequentially used as the input image.
  • the first position is assumed to be one end of the movable range of the focus lens 240
  • the second position is assumed to be the other end of the movable range of the focus lens 240, but is not limited thereto. Absent.
  • the focus control unit 330 sets two reference images, a first reference image and a second reference image acquired at a timing before the first reference image, and an AF area setting unit 337.
  • a set of blocks determined as valid blocks in all of the first reference image, the second reference image, and the input image may be set as the AF area.
  • the image contrast values calculated by the respective processes are compared in the comparison between the two images.
  • the comparison between the contrast value of the image A calculated in the first comparison process and the contrast value of the image C calculated in the second comparison process may not make sense (first If the AF area is the same in the comparison process and the second comparison process, there is a possibility that the comparison is significant, but this is a limited case). Therefore, if the comparison process is performed on three or more images (including values thereof), the effective block information of all the images may be used.
  • the focus control unit 330 sets the first reference image as a new second reference image and sets the input image as the second reference image.
  • a reference image update process that is set as a new first reference image may be performed.
  • the focus control unit 330 may determine that a peak has been detected when the image contrast value of the input image is smaller than the threshold value calculated from the image contrast value of the first reference image.
  • the focus control unit 330 performs an interpolation process based on the image contrast values of the first reference image, the second reference image, and the input image at the determination timing.
  • the maximum value may be obtained, and an instruction to move the focus lens 240 to the focus lens position corresponding to the maximum value may be transmitted to the lens position control unit 340.
  • the focus control unit 330 moves the focus lens position from the first position to the second position with a given movement width in the focus control, and is generated when the focus lens position is the first position.
  • the obtained image is set as a second reference image, and the image generated when the focus lens position is the next position after the first position is set as the first reference image. From the position two times after the first position, Images generated every time the focus lens position is moved within a given movement width up to the second position may be sequentially used as input images.
  • the effective block determination unit 335 also includes a first determination process for determining whether or not the block includes a bright spot, a second determination process for determining whether or not the block is a dark area, and a biological object in the block. It may be determined whether or not the block is an effective block by performing at least one determination process of the third determination process for determining whether or not a treatment tool is included.
  • the block is an effective block based on the bright spot, the dark area, and the treatment instrument (cantilever, etc.).
  • the maximum value of luminance can be used in the first determination process
  • the average value of luminance can be used in the second determination process
  • the average value of CrCb can be used in the third determination process.
  • other values may be used as the feature amount of each determination process.
  • a determination process other than the first to third determination processes may be further used for determining whether or not the block is an effective block.
  • the imaging apparatus may include a distance measuring unit that obtains distance information to the subject based on the focus lens position detected by the focus control unit 330.
  • a system including a lens (focus lens 240 and the like), an image plane (in a narrow sense, but not limited to the surface of the image sensor 260), and a subject is in focus.
  • the basic characteristics of the focus lens 240 and the image sensor 260 in the focused state can be acquired in advance as design matters. That is, the position of the object point in the focused state (focused object position) is obtained by referring to the table data or the like if the position of the focus lens 240 or the like (focused lens position) in the focused state is determined. This is nothing but information representing the distance to the imaged subject.
  • Second Embodiment An imaging apparatus (endoscope system) according to a second embodiment of the present invention will be described.
  • the AF control unit 339 in this embodiment performs full time AF.
  • the configuration of the endoscope system according to this embodiment is the same as that of the first embodiment except for the AF control unit 339.
  • the AF control unit 339 sets the counter wobCnt to 0 and the full time AF start flag startFlag to 1 at the timing when the acquisition of the current image ends. Further, the AF control unit 339 acquires lensPosNow from the lens position control unit 340 (S401). Next, since wobCnt is 0 and startFlag is 1 (both Yes in S403 and S404), the AF control unit 339 sets startFlag to 0 and wobCnt to 1 (S405). Thereafter, startFlag remains 0.
  • wobLvl is the wobbling width of the focus lens 240 as shown in FIG.
  • the AF control unit 339 outputs from the effective block determination unit 335 to the effective block information storage unit 336 at the timing when the acquisition of the current image is completed.
  • a control signal is output so that effectiveBlockFlagNow (bx, by) is stored as effectiveBlockFlagRef (bx, by).
  • the AF control unit 339 outputs a control signal so that blockContrastValNow (bx, by) output from the contrast value calculation unit 332 to the contrast value storage unit 333 is stored as blockContrastValRef (bx, by) (S407).
  • the current image here is an image wobbled in the direction in which the focus lens position increases as shown in FIG.
  • the AF control unit 339 acquires contrastValNow and contrastValRef output from the contrast value determination unit 338 at the timing when acquisition of the current image ends (S410). ).
  • processing such as obtaining an AF area from the newly acquired effectiveBlockFlagNow (bx, by) and the effectiveBlockRef (bx, by) stored in S407 is performed.
  • the current image here is an image wobbled in the direction in which the focus lens position decreases as shown in FIG.
  • the AF control unit 339 compares the contrastValNow and the contrastValRef acquired above at the timing when the acquisition of the current image ends (S412). . If contrastValRef is greater than contrastValNow (Yes in S412), it is considered that the focus lens position is in the direction in which the focus lens position increases. It is calculated as + wobLvl + shiftLvl and output to the lens position control unit 340 (S413). As a result, as shown in FIG. 11, the center position of the wobbling moves in the direction in which the focus lens position increases.
  • the AF control unit 339 can finally reach the focus lens position by gradually bringing the focus lens position closer to the focus lens position. Further, when the subject is out of focus due to movement of the subject or the like, the focus state can be achieved again by continuously performing the above operation.
  • the imaging apparatus By performing such control, the imaging apparatus according to the present embodiment causes the position of the bright spot in the image to fluctuate due to a slight movement of the living body that is the subject, or the user has moved Even when the position of the subject to be excluded in the image changes during AF, the full-time AF can be performed correctly.
  • the focus control unit 330 of the imaging apparatus uses, as a reference image, an image acquired at the timing when the focus lens 240 moves in the first direction with respect to a given center position, with respect to the center position.
  • an image acquired when the focus lens 240 moves in a second direction different from the first direction is set as an input image.
  • the focus control unit 330 performs a center position update process for updating the center position based on the comparison process of the image contrast value of the reference image and the image contrast value of the input image.
  • the center position here is the focus lens position when the counter value (wobCnt) is 0.
  • a wobbling operation in which the focus lens position is swung back and forth by a given movement width (wobLvl) with the center position as a reference.
  • two images the image when the focus lens 240 is swung to one side and the image when the focus lens 240 is swung to the other, are compared, and when a series of operations ends (wobCnt is 0, 1, 2), the reference image and the input image are newly acquired in the next series of operations and are not affected by the reference image and the input image in the previous operation ( It is not hindered to keep information such as past reference images just by not using them for processing).
  • the focus control unit 330 performs a process of moving the center position in the first direction by a given shift level as the center position update process.
  • a process of moving the center position in the second direction by the shift level may be performed as the center position update process.
  • the focus control unit 330 in this embodiment includes a block setting unit 331, a contrast value calculation unit 332, a contrast value storage unit 333, a feature amount calculation unit 334, an effective block determination unit 335, and an effective block information storage unit 336.
  • the configuration of the value determining unit 338 is the same as that in the first embodiment.
  • the reduced image generation unit 33a generates reduced images for all evaluation blocks set by the block setting unit 331, and outputs the reduced images to the memory 33b and the motion detection unit 33c.
  • the reduced image generation unit 33a uses M that is a divisor of N.
  • the pixel value of smallB (bx, by) which is a reduced image of b (bx, by) is calculated by averaging all the pixel values of the Y signal included in the M * M pixels.
  • the memory 33b stores the reduced image output from the reduced image generation unit 33a and outputs the reduced image to the motion detection unit 33c.
  • the motion detection unit 33c uses the reduced amount of the current image output from the reduced image generation unit 33a and the reduced image of the image immediately before the current image output from the memory 33b, based on the motion amount blockSAD (bx, by) and output to the AF control unit 339. Specifically, when the reduced image of each evaluation block of the current image is smallB1 (bx, by) and the reduced image of each evaluation block of the image immediately before the current image is smallB2 (bx, by), motion detection is performed.
  • the unit 33c calculates a difference between pixels corresponding to smallB1 (bx, by) and smallB2 (bx, by), and calculates a sum of differences for all pixels included in the reduced image of each evaluation block as blockSAD (bx, by). To do.
  • blockSAD (bx, by) is calculated from the reduced image of each evaluation block. This is based on the value of blockSAD (bx, by) depending on the degree of focus of the current image and the previous image of the current image. This is to prevent the fluctuation of the value. When this influence is small, blockSAD (bx, by) may be calculated from the pixel value itself of each evaluation block by the same method as described above without creating a reduced image.
  • the AF control unit 339 When the AF start signal is output from the control unit 360, the AF control unit 339 outputs, for example, any one end (lens position A) of the movable range of the focus lens 240 to the lens position control unit 340 as a required lens position. .
  • the AF control unit 339 changes the required lens position to the other end (lens position B) of the movable range of the lens, starts the scanning operation of the focus lens 240, and focuses. Lens position detection (peak detection) is performed.
  • the AF control unit 339 causes blockSAD (bx, by) output from the motion detection unit 33c and the AF area setting unit 337.
  • the motion amount flameSAD of the current image is calculated from afAreaFlag (bx, by) output from (S305). Specifically, the AF control unit 339 calculates the average value of blockSAD (bx, by) corresponding to the evaluation block whose afAreaFlag (bx, by) is 1, and sets this as flameSAD.
  • the AF control unit 339 compares the calculated flameSAD with a predetermined threshold (motion amount threshold) (S306).
  • a predetermined threshold motion amount threshold
  • the AF control unit 339 determines that the current image moves with respect to the previous image, and the peak is not performed as shown in FIG. Continue detection. This is to prevent the determination that the in-focus lens position has been detected even though the in-focus lens position has not been reached by reducing contrastValNow due to motion blur when the motion of the current image is large.
  • the AF control unit 339 performs the same operation as in the first embodiment (S307 to S311 correspond to S105 to S109 in FIG. 4) and continues peak detection. To do.
  • the AF control unit 339 After the peak detection is finished, the AF control unit 339 outputs lensPosRef as the required lens position to the lens position control unit 340, and when the focus lens 240 reaches lensPosRef, the single AF is finished because the focusing operation is completed.
  • the endoscope system By performing such control, the endoscope system according to the present embodiment performs stable single AF without detecting an incorrect in-focus lens position even when a living body that is a subject moves greatly during AF. It becomes possible.
  • the peak detection is continued without performing the subsequent operation, but the focus lens position at that time may be changed or may be left as it is.
  • peak detection is continued by changing the focus lens position, focus control can be performed at high speed because the focus lens position at the time when an image with a large amount of motion is acquired can move to the next process without performing the process related to focus control again. Is possible. Even in this case, when the amount of movement of the focus lens 240 once is small, even if the processing at one place is skipped, the influence on the accuracy of the focusing lens position finally obtained is not large.
  • the process is performed so that flameSAD is larger than the threshold value.
  • the focus lens position may be updated.
  • the focus lens Processing may be performed again at the same focus lens position without updating the position.
  • processing using the motion amount may be combined not only with the single AF but also with the full-time AF described above in the second embodiment.
  • the operation when the AF control unit 339 performs full-time AF will be described with reference to the flowchart shown in FIG.
  • the AF control unit 339 sets the counter wobCnt to 0 and the full-time AF start flag startFlag to 1 at the timing when the current image acquisition is completed. Thereafter, the same operation as in the second embodiment is performed. Next, when wobCnt is 1, the AF control unit 339 performs the same operation as in the second embodiment.
  • the AF control unit 339 acquires the contrastValNow and the contrastValRef output from the contrast value determination unit 338 at the timing when the acquisition of the current image is completed. Thereafter, the AF control unit 339 calculates and stores flameSAD from the current image and the previous image by the same method as described above.
  • the current image and the current previous image are images in which the focus lens position is decreased and increased by wobLvl from the wobbling center position. That is, the above processing (S501 to S511) is the same as that of the second embodiment (S401 to S411 in FIG. 7) except that flameSAD is calculated in S510.
  • the imaging apparatus By performing such control, the imaging apparatus according to the present embodiment performs stable full-time AF without moving the focus lens position in the wrong direction even when the living body that is the subject moves greatly during wobbling. It becomes possible.
  • the imaging apparatus includes the motion detection unit 33 c that obtains the motion amount between the input image and the image acquired one timing before the input image, and the focus control unit If the amount of motion is greater than a given motion amount threshold, 330 skips processing for the input image.
  • the amount of motion can be obtained by various methods.
  • the degree of difference (SAD or SSD, etc.) between the input image and the image one timing earlier may be used.
  • blockSAD (bx, by) which is the degree of difference for each block set in the input image, is obtained using the input image and the image one timing earlier, and the effective block information among all the blocks is obtained.
  • the sum of blockSAD (bx, by) of blocks included in the AF area set by using the motion amount of the input image may be used.
  • the focus control unit 330 may use a newly acquired image at the focus lens position corresponding to the input image as a new input image. Further, when the amount of movement is larger than the movement amount threshold, the focus control unit 330 instructs the lens position control unit 340 to change the focus lens position, and the image acquired after the change of the focus lens position An input image may be used.
  • the input image may be acquired again at the same focus lens position while maintaining the focus lens position, or the focus lens position is updated and the input image acquired at the updated focus lens position is updated. May be processed.
  • the imaging apparatus includes a motion detection unit 33 c that obtains a motion amount between an input image and an image acquired one timing before the input image, and the focus control unit 330 includes a motion amount. Is larger than a given motion amount threshold, the processing for the input image may be skipped, and an image generated after the focus lens position is moved within a given movement width may be used as a new input image.
  • the processing for the input image is skipped and the focus lens position is updated, and the updated focus lens position.
  • the image acquired in step 1 can be used as a new input image.
  • the movement width of the focus lens 240 is small in order to improve the accuracy of AF control. Therefore, even if the processing at one focus lens position is skipped, the influence is small, and in this way, the processing is not re-executed, so that the AF speed can be increased.
  • the imaging apparatus includes a motion detection unit 33 c that obtains a motion amount between an input image and an image acquired one timing before the input image, and the focus control unit 330 includes a motion amount. Is larger than a given motion amount threshold, the process for the input image is skipped, the movement of the focus lens position within the given movement width is skipped, and the image generated at the focus lens position corresponding to the input image May be a new input image.
  • the single AF shown in FIG. 10 when the single AF shown in FIG. 10 is performed and the amount of motion of the input image is large, not only the processing for the input image but also the update processing of the focus lens position is skipped, and the same focus lens position
  • the image acquired in step 1 can be used as a new input image.
  • the peak position is obtained by interpolation processing, it is assumed that the movement width of the focus lens 240 is large. Therefore, since the influence of skipping the process at one focus lens position is greater than in the case of FIG. 9 and the like, it is preferable to redo the acquisition of the input image at the same position.
  • the imaging apparatus includes a motion detection unit 33 c that obtains a motion amount between an input image and an image acquired one timing before the input image, and the focus control unit 330 includes a motion amount. If is larger than a given motion amount threshold value, the center position update process may be skipped.
  • the center position update process can be skipped.
  • Full-time AF compares two images and moves the focus lens position in a better direction. If the contrast value is not calculated properly and a significant comparison cannot be made, the focus lens position is It is preferable that the image acquisition is performed again at the current position, instead of changing.

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Surgery (AREA)
  • Optics & Photonics (AREA)
  • Biomedical Technology (AREA)
  • Veterinary Medicine (AREA)
  • Biophysics (AREA)
  • Pathology (AREA)
  • Radiology & Medical Imaging (AREA)
  • Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Medical Informatics (AREA)
  • Molecular Biology (AREA)
  • Animal Behavior & Ethology (AREA)
  • General Health & Medical Sciences (AREA)
  • Public Health (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Astronomy & Astrophysics (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)
  • Focusing (AREA)
  • Endoscopes (AREA)

Abstract

撮像装置は、光学系と撮像素子(260)とレンズ位置制御部(340)とフォーカス制御部(330)を含み、フォーカス制御部(330)はブロック設定部(331)と、ブロックコントラスト値情報を算出するコントラスト値算出部(332)と、基準画像のブロックコントラスト値情報を保存するコントラスト値保存部(333)と、特徴量算出部(334)と、有効ブロック情報を取得する有効ブロック判定部(335)と、基準画像の有効ブロック情報を保存する有効ブロック情報保存部(336)と、基準画像と入力画像の有効ブロック情報からAF領域を設定するAF領域設定部(337)と、AF領域から画像コントラスト値を決定するコントラスト値決定部(338)を含む。

Description

撮像装置及び撮像装置の制御方法
 本発明は、撮像装置及び撮像装置の制御方法に関する。
 内視鏡システムにおいてはユーザーの診断・処置に支障をきたさないため、できるだけ広い被写界深度が求められる。しかし近年では、内視鏡システムにおいても高画素の撮像素子が使用されるに従ってその被写界深度が狭くなってきていることから、オートフォーカス(以下AF)を行う内視鏡システムが提案されている。内視鏡においてコントラスト方式のAFを行う場合、画像中に照明光の反射に起因する輝点が存在すると、輝点のエッジがコントラスト値に大きな影響を与えるため、ユーザーが観察したい被写体である生体にピントが合う位置をうまく検出できないという課題がある。またユーザーが処置を行っている際にAFを行う場合、画像中にカンシ等の処置具が存在すると、ユーザーが意図していない被写体(カンシ等)にピントが合ってしまうといった課題がある。
 また、これらの課題は内視鏡システムに限定されるものではなく、コントラスト値を用いたAFを行う撮像装置においても同様に問題となるものである。このような課題を解決するために例えば、特許文献1及び特許文献2のように、AF領域に複数のブロックを設定し、輝点やカンシが含まれるブロックを検出し、これらのブロックをAF領域から除外してAF制御を行うといった手法が提案されている。
特開2004-294788号公報 特開2011-139760号公報
 前述の特許文献1及び特許文献2では、被写体となる生体がわずかに動いたこと等に起因して画像中の輝点の位置が変動した場合やユーザーがカンシを動かした場合など、除外すべき被写体の画像中の位置がAF中に変化した場合は正しくAFを行うことが困難であった。
 本発明の幾つかの態様によれば、除外すべき被写体の画像中の位置がAF中に変化した場合でも、適切なフォーカス制御を行う撮像装置及び撮像装置の制御方法を提供することができる。
 本発明の一態様は、合焦物***置を調整するフォーカスレンズを含む光学系と、前記光学系で結像された被写体像の画像を取得する撮像素子と、フォーカスレンズ位置を制御するレンズ位置制御部と、オートフォーカス制御を行うフォーカス制御部と、を含み、前記フォーカス制御部は、入力画像に複数のブロックを設定するブロック設定部と、設定した複数の前記ブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出するコントラスト値算出部と、基準画像の前記ブロックコントラスト値情報を保存するコントラスト値保存部と、設定した複数の前記ブロックの各ブロックの特徴量を算出する特徴量算出部と、前記特徴量に基づいて、複数の前記ブロックのうち、前記フォーカス制御において有効である有効ブロックを判定し、判定結果を有効ブロック情報として取得する有効ブロック判定部と、前記基準画像の前記有効ブロック情報を保存する有効ブロック情報保存部と、前記基準画像の前記有効ブロック情報と、前記入力画像の前記有効ブロック情報からオートフォーカス領域を設定するオートフォーカス領域設定部と、前記オートフォーカス領域と前記基準画像の前記ブロックコントラスト値情報から、前記基準画像の画像コントラスト値を決定するとともに、前記オートフォーカス領域と前記入力画像の前記ブロックコントラスト値情報から、前記入力画像の前記画像コントラスト値を決定するコントラスト値決定部とを含み、前記オートフォーカス領域設定部は、前記基準画像と前記入力画像の両方で前記有効ブロックと判定された前記ブロックの集合を、前記オートフォーカス領域として設定する撮像装置に関係する。
 本発明の一態様では、入力画像の有効ブロック情報と基準画像の有効ブロック情報の両方を用いてオートフォーカス領域を設定し、設定したオートフォーカス領域に基づいて各画像のコントラスト値を決定する。よって、入力画像と基準画像の両方について、適切に有効でないブロック(例えば輝点等を含むブロック)を除外しつつ、同じ条件でコントラスト値を算出することができるため、適切なAF制御を行うこと等が可能になる。
 本発明の他の態様は、入力画像を取得し、前記入力画像に複数のブロックを設定し、設定した複数の前記ブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出し、設定した複数の前記ブロックの各ブロックの特徴量を算出し、算出した前記特徴量に基づいて、複数の前記ブロックのうち、フォーカス制御において有効である有効ブロックを判定して、前記入力画像の有効ブロック情報を取得し、前記入力画像とは合焦物***置の異なるフォーカスレンズ位置において、前記入力画像よりも前のタイミングで撮像された基準画像の前記ブロックコントラスト値情報をコントラスト値保存部から読み出すとともに、前記基準画像の前記有効ブロック情報を有効ブロック情報保存部から読み出し、前記基準画像と前記入力画像の両方で前記有効ブロックと判定された前記ブロックの集合を、オートフォーカス領域として設定し、前記オートフォーカス領域と前記基準画像の前記ブロックコントラスト値情報から、前記基準画像の画像コントラスト値を求めるとともに、前記オートフォーカス領域と前記入力画像の前記ブロックコントラスト値情報から、前記入力画像の前記画像コントラスト値を求め、前記基準画像の前記画像コントラスト値と、前記入力画像の前記画像コントラスト値の比較処理に基づいて、前記フォーカス制御を行う撮像装置の制御方法に関係する。
図1は、本実施形態の撮像装置のシステム構成例。 図2は、フォーカス制御部の構成例。 図3は、フォーカス制御部の他の構成例。 図4は、第1の実施形態の処理を説明するフローチャート。 図5は、第1の実施形態の変形例の処理を説明するフローチャート。 図6は、第3の実施形態をシングルAFに適用した処理を説明するフローチャート。 図7は、第2の実施形態の処理を説明するフローチャート。 図8は、第3の実施形態をフルタイムAFに適用した処理を説明するフローチャート。 図9は、第1の実施形態のピーク検出処理を説明する図。 図10は、第1の実施形態の変形例のピーク検出処理を説明する図。 図11は、第2の実施形態のフォーカスレンズの駆動例を説明する図。 図12(A)、図12(B)はブロック設定処理の説明図。 図13は、ブロックと座標値との関係を説明する図。 図14(A)~図14(C)は有効ブロック情報の例と、AF領域の設定例を説明する図。
 以下、本実施形態について説明する。なお、以下に説明する本実施形態は、請求の範囲に記載された本発明の内容を不当に限定するものではない。また本実施形態で説明される構成の全てが、本発明の必須構成要件であるとは限らない。
 1.本実施形態の手法
 本実施形態の画像処理装置は、図1に示したように、合焦物***置を調整するフォーカスレンズ240を含む光学系と、光学系で結像された被写体像の画像を取得する撮像素子260と、フォーカスレンズ位置を制御するレンズ位置制御部340と、オートフォーカス制御を行うフォーカス制御部330と、を含む。そしてフォーカス制御部330は、図2に示したように、入力画像に複数のブロックを設定するブロック設定部331と、設定した複数のブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出するコントラスト値算出部332と、基準画像のブロックコントラスト値情報を保存するコントラスト値保存部333と、設定した複数のブロックの各ブロックの特徴量を算出する特徴量算出部334と、特徴量に基づいて、複数の前記ブロックのうち、フォーカス制御において有効である有効ブロックを判定し、判定結果を有効ブロック情報として取得する有効ブロック判定部335と、基準画像の有効ブロック情報を保存する有効ブロック情報保存部336と、基準画像の有効ブロック情報と、入力画像の有効ブロック情報からオートフォーカス領域を設定するオートフォーカス領域設定部337と、オートフォーカス領域と基準画像のブロックコントラスト値情報から、基準画像の画像コントラスト値を決定するとともに、オートフォーカス領域と入力画像のブロックコントラスト値情報から、入力画像の画像コントラスト値を決定するコントラスト値決定部338とを含み、オートフォーカス領域設定部337は、基準画像と入力画像の両方で有効ブロックと判定されたブロックの集合を、オートフォーカス領域として設定する。
 ここで合焦物***置とは、光学系、像面(狭義には撮像素子260の面)、物体(被写体)からなる系が合焦状態にある場合の、物体の位置を表すものである。また、ブロックコントラスト値情報とは、対象としている画像の含まれるブロックのブロックコントラスト値の集合を表す情報である。また、特徴量とは有効ブロックの判定に用いるものであり、例えば後述するように、輝度の最大値や平均値、CrCbの平均値等を用いればよい。また、有効ブロック情報とは、対象としている画像に設定された複数のブロックが有効ブロックであるか否かを表す情報であり、例えば図14(A)や図14(B)に示すような情報であってもよい。
 特許文献1及び特許文献2のように、AFのためのコントラスト値の算出において、対象としている画像中の輝点やカンシの領域を除外する手法が知られている。しかし従来手法では、AF中に輝点等の画像上での位置や大きさが変化する場合等は想定されていない。
 そのため、AF処理において最初に設定した除外領域をそのまま用い続けた場合には、その後輝点等の位置や大きさが変化すると、その変化後の画像では当該輝点等を適切に除去することができずコントラスト値の正確な算出が困難となる。また、画像毎に除外領域を設定することで各画像の輝点等を除外したとしても、一連のAF動作の中で、画像毎に除外領域(ひいてはコントラスト値の算出に用いられる領域)が異なるものになるため、各画像から算出されるコントラスト値は、その算出条件が異なるものとなり、当該コントラスト値を比較したとしても、コントラスト値のピーク検出は正確に行うことができない。
 特に、撮像装置として生体用の内視鏡装置を用いた場合には、撮像部側から照射光を照射する必要があること、及び被写体である生体表面は濡れていることから、画像上での輝点の位置や大きさは変動しやすく、上述の問題を無視することができない。
 また、従来手法では合焦レンズ位置(系が合焦状態にある場合のフォーカスレンズ位置)を1回決定するシングルAFを想定しており、連続的に合焦レンズ位置の探索を継続するフルタイムAFを想定していないという問題もある。
 そこで本出願人は、入力画像に対してAF処理を行う場合に、当該入力画像についての有効ブロック(輝点等を含むブロックを除いた有効なブロック)の判定結果である有効ブロック情報だけでなく、基準画像についての有効ブロック情報を用いてオートフォーカス領域(以下、AF領域と表記し、オートフォーカス領域設定部337をAF領域設定部337と表記する)を設定する手法を提案する。具体的には、図14(A)~図14(C)に示したように、入力画像と基準画像の両方で有効と判定されたブロックの集合をAF領域とすればよい。このようにすれば、入力画像と基準画像のコントラスト値は、同一の条件で求めることができるため、入力画像と基準画像の比較処理を適切に行うことができる。
 この場合、各画像のコントラスト値(ブロックコントラスト値と区別するために、必要に応じて画像コントラスト値とも表記する)は、AF領域に含まれるブロックのブロックコントラスト値の総和等から求めることができる。
 なお、ある1つの画像の画像コントラスト値は、比較対象とする画像が異なればAF領域が変化する可能性がある以上、常に同一であるとは限らない。つまり、本実施形態の手法においても、画像コントラスト値はその絶対値に意味があるものではなく、基準画像と入力画像の比較処理においてその相対関係を表すものである点には留意すべきである。
 以下、第1~第3の実施形態について説明する。第1の実施形態ではシングルAFを行う手法、及びその変形例について説明し、第2の実施形態ではフルタイムAFを行う手法について説明する。また、第3の実施形態では入力画像の動き量を用いた手法について説明する。なお、動き量を用いた手法はシングルAFと組み合わせてもよいし、フルタイムAFと組み合わせてもよいため、第1の実施形態との組み合わせと第2の実施形態との組み合わせの両方を説明する。
 2.第1の実施形態
 本実施形態ではフォーカス制御としてシングルAFを行う場合について説明する。具体的には、まずシステム構成例を説明した後、オートフォーカス制御を行うフォーカス制御部の詳細について説明する。その後、フローチャート等を用いて処理の詳細を説明した上で、変形例についても説明する。
 2.1 システム構成例
 本発明の第1の実施形態に係る撮像装置(ここでは具体例として内視鏡システムを用いるがこれには限定されない)について、図1を用いて説明する。本実施形態に係る内視鏡システムは、光源部100と、撮像部200と、処理部300と、表示部400と、外部I/F部500を備えている。
 光源部100は、白色光を発生する白色光源110と白色光をライトガイドファイバ210に集光するための集光レンズ120を備えている。
 撮像部200は、例えば体腔への挿入を可能にするため細長くかつ湾曲可能に形成されている。撮像部200には、光源部100で集光された光を導くためのライトガイドファイバ210と、該ライトガイドファイバ210により先端まで導かれてきた光を拡散させて観察対象に照射する照明レンズ220と、観察対象から戻る反射光を結像する対物レンズ系230と、対物レンズ系230に含まれ合焦物***置を調整するフォーカスレンズ240と、フォーカスレンズ240を駆動するレンズ駆動部250と、対物レンズ系230で結像された反射光を光電変換して画像を生成する撮像素子260を備えている。レンズ駆動部250は例えばボイスコイルモーター(以下、VCM)である。また、撮像素子260は例えばベイヤ配列の色フィルタを持つ撮像素子である。
 処理部300はA/D変換部310と、前処理部320と、フォーカス制御部330と、レンズ位置制御部340と、画像処理部350と、制御部360を備えている。A/D変換部310は、撮像素子260から順次出力されるアナログ信号をデジタルの画像信号に変換して、前処理部320に順次出力する。前処理部320はA/D変換部310から出力された画像信号に対して、ホワイトバランス、補間処理(デモザイキング処理)、YCbCr変換処理等の画像処理を施し、フォーカス制御部330と画像処理部350に順次出力する。
 レンズ位置制御部340は、レンズ駆動部250とフォーカス制御部330とに接続されており、フォーカス制御部330から出力される情報に従ってフォーカスレンズ240を制御する。フォーカス制御部330の詳細については後述する。
 画像処理部350は、前処理部320から出力された画像信号に対して色変換、階調変換、エッジ強調、ノイズリダクション等の画像処理を施し、表示部400に画像信号を順次出力する。表示部400は例えば液晶モニタであり、画像処理部350から出力される画像信号を表示する。
 制御部360は外部I/F部500やフォーカス制御部330、画像処理部350、撮像素子260などと相互に接続されており、これらを制御する。外部I/F部500は、内視鏡装置に対するユーザーからの入力等を行うためのインターフェースであり、例えばAFの開始/終了を行うためのAFボタンや画像処理のパラメータを調整するための調整ボタンなどを含んで構成されている。
 2.2 フォーカス制御部の詳細
 次にフォーカス制御部330の詳細について、図2を用いて説明する。以降は、前処理部320からフォーカス制御部330に順次出力される画像を現在画像(入力画像)と呼ぶ。
 フォーカス制御部330はブロック設定部331と、コントラスト値算出部332と、コントラスト値保存部333と、特徴量算出部334と、有効ブロック判定部335と、有効ブロック情報保存部336と、AF領域設定部337と、コントラスト値決定部338と、AF制御部339を備えている。
 ブロック設定部331は、前処理部320から出力される現在画像に対して、図12(A)に示すような複数の評価ブロックを設定する。設定した評価ブロックは図13に示すようにb(bx,by)として表し、(bx,by)は左上の評価ブロックを基準位置(0,0)として定義した座標である。
 コントラスト値算出部332は、ブロック設定部331で設定された全ての評価ブロックに対して、評価ブロックのコントラスト値blockContrastValNow(bx,by)を算出し、コントラスト値決定部338とコントラスト値保存部333に出力する。ここでは例えば、各評価ブロックに含まれるすべての画素のY信号に対してハイパスフィルタ処理を行い、その出力値の総和をそのブロックのコントラスト値とすればよい。
 コントラスト値保存部333は、AF制御部339から出力される制御信号に従って、コントラスト値算出部332で算出した全ての評価ブロックのblockContrastValNow(bx,by)を保存し、基準画像の各評価ブロックのコントラスト値blockContrastValRef(bx,by)としてコントラスト値決定部338に出力する。コントラスト値保存部333及び基準画像の詳細については後述する。
 特徴量算出部334は、ブロック設定部331で設定されたすべての評価ブロックに対して特徴量を算出し、有効ブロック判定部335に出力する。ここでは特徴量として、例えば各評価ブロックに含まれるすべての画素のY信号の最大値blockMaxY(bx,by)や平均値blockAveY(bx,by)、Cb,Cr信号のそれぞれの平均値blockAveCb(bx,by),blockAveCr(bx,by)等を算出し、有効ブロック判定部335に出力する。
 有効ブロック判定部335は、特徴量算出部334から出力された各評価ブロックの特徴量を用いて、各評価ブロックが有効ブロックであるか否かの判定を行う。ここで有効ブロック判定部335は例えば、各評価ブロックのblockMaxY(bx,by)が所定の閾値以上であるか否かの判定を行い、閾値以上である場合は評価ブロック内に輝点が含まれるため有効ブロックではないと判定し、対応する評価ブロックの有効ブロック判定フラグeffectiveBlockFlagNow(bx,by)を0とする。またblockMaxY(bx,by)が所定の閾値以下である場合は、評価ブロック内に輝点が含まれないため有効ブロックと判定して対応する評価ブロックのeffectiveBlockFlagNow(bx,by)を1とする。
 また有効ブロック判定部335は例えば、各評価ブロックのblockAveY(bx,by)が所定の閾値以下であるか否かの判定を行い、閾値以下である場合は評価ブロックが画像の非常に暗い領域に位置するため有効ブロックではないと判定し、対応する評価ブロックのeffectiveBlockFlagNow(bx,by)を0とする。またblockAveY(bx,by)が所定の閾値以上である場合は、評価ブロックが画像の明るい領域に位置するため、有効ブロックと判定して評価ブロックのeffectiveBlockFlagNow(bx,by)を1とする。
 さらに有効ブロック判定部335は例えば、各評価ブロックのblockAveCb(bx,by)、blockAveCr(bx,by)が共に所定の閾値以下であるか否かの判定を行い、共に所定の閾値以下である場合は評価ブロックが画像のカンシの領域に位置するため有効ブロックではないと判定し、対応する評価ブロックのeffectiveBlockFlagNow(bx,by)を0とする。これは、カンシは主に黒や銀色であるため、カンシに対応する領域ではCb,Cr信号が共に0に近い値となるためである。またblockAveCb(bx,by)、blockAveCr(bx,by)の両方、もしくはどちらか一方が所定の閾値以上である場合は、評価ブロックはカンシの領域に位置しないため、有効ブロックと判定して対応する評価ブロックのeffectiveBlockFlagNow(bx,by)を1とする。
 有効ブロック判定部335は上述した判定処理のうちの1つもしくは任意の組み合わせの判定を行い、すべての評価ブロックに対するeffectiveBlockFlagNow(bx,by)をAF領域設定部337と有効ブロック情報保存部336に出力する。ここで有効ブロック判定部335が複数の判定処理を行う場合は、すべての判定処理に対して有効ブロックであると判定された評価ブロックに対して、最終的にeffectiveBlockFlagNow(bx,by)を1とすればよい。また、複数の判定処理に対して、1つでも無効ブロックと判定された評価ブロックに対してはeffectiveBlockFlagNow(bx,by)を0とすればよい。
 また特徴量算出部334は、必要に応じて上述していない任意の特徴量を算出し、有効ブロック判定部335は算出した特徴量に応じて任意の判定処理を行い、各評価ブロックが有効ブロックであるか否かを判定してもよい。
 有効ブロック情報保存部336は、AF制御部339から出力される制御信号に従って、有効ブロック判定部335から出力された全ての評価ブロックのeffectiveBlockFlagNow(bx,by)を保存し、基準画像の有効判定フラグeffectiveBlockFlagRef(bx,by)としてAF領域設定部337に出力する。有効ブロック情報保存部336及び基準画像の詳細については後述する。
 AF領域設定部337は有効ブロック判定部335から出力される現在画像の有効ブロック判定フラグeffectiveBlockFlagNow(bx,by)と、有効ブロック情報保存部336から出力される基準画像の有効ブロック判定フラグeffectiveBlockFlagRef(bx,by)からAF領域を設定し、コントラスト値決定部338に出力する。具体的には、例えば図14(A)に示すようなeffectiveBlockFlagNow(bx,by)と図14(B)に示すようなeffectiveBlockFlagRef(bx,by)に対して各評価ブロック毎に論理積を算出し、その結果を図14(C)に示すようなAF領域フラグafAreaFlag(bx,by)としてコントラスト値決定部338に出力する。このような処理を行うことで、AF領域設定部337は現在画像と基準画像の両方の画像で有効ブロックと判定された評価ブロックの集合をAF領域として設定することができる。
 コントラスト値決定部338は、AF領域設定部337から出力されるafAreaFlag(bx,by)とコントラスト値算出部332から出力される現在画像の各評価ブロックのコントラスト値blockContrastValNow(bx,by) から、現在画像のコントラスト値contrastValNowを決定し、AF制御部339に出力する。さらにコントラスト値決定部338は、AF領域設定部337から出力されるafAreaFlag(bx,by)とコントラスト値保存部333から出力される基準画像の各評価ブロックのコントラスト値blockContrastValRef(bx,by)から、基準画像のコントラスト値contrastValRefを決定し、AF制御部339に出力する。具体的にはコントラスト値決定部338は、afAreaFlag(bx,by)が1である評価ブロックに対応するblockContrastValNow(bx,by)の総和を算出し、これをcontrastValNowとする。さらにコントラスト値決定部338は、afAreaFlag(bx,by)が1である評価ブロックに対応するblockContrastValRef(bx,by)の総和を算出し、これをcontrastValRefとする。このような処理を行うことで、コントラスト値決定部338は現在画像と基準画像の両方の画像で有効ブロックと判定された評価ブロックのみを用いて、それぞれの画像に対応するコントラスト値(画像コントラスト値)を決定することができる。
 AF制御部339は、制御部360から出力されるAF開始/終了信号に従って、コントラスト値決定部338から出力される現在画像のコントラスト値contrastValNow及び基準画像のコントラスト値contrastValRef を用いてAF制御を行う。この時AF制御部339は、フォーカスレンズ240に要求されるレンズ位置(要求レンズ位置)をレンズ位置制御部340に出力することで、フォーカスレンズ240の位置を制御する。またAF制御部339は、レンズ位置制御部340からフォーカスレンズ位置を取得する。さらにAF制御部339は、制御部360から撮像素子260の制御信号(例えば画像の取得を終了するタイミング信号等)を取得する。
 2.3 処理の詳細
 AF制御部339がシングルAFを行う場合の動作を、図4に示すフローチャートを用いて説明する。AF制御部339は、制御部360からAF開始信号が出力された場合、例えばフォーカスレンズ240の可動域の任意の一方の端(レンズ位置A)を要求レンズ位置としてレンズ位置制御部340に出力する(S101)。フォーカスレンズ240がレンズ位置Aに到達したら、AF制御部339は要求レンズ位置をレンズの可動域のもう一方の端(レンズ位置B)に変更し、フォーカスレンズ240のスキャン動作を開始し、合焦レンズ位置の検出(ピーク検出)を行う(S102)。
 次にAF制御部339は、現在画像がスキャン開始後1枚目の画像であるかの判定を行い(S103)、1枚目である場合は、有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、effectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、blockContrastValRef(bx,by)として保存されるように制御信号を出力する。またAF制御部339は、レンズ位置制御部340から現在画像取得時のフォーカスレンズ位置lensPosNowを取得し、これを基準画像取得時のフォーカスレンズ位置lensPosRefとして保存する(S104)。その後AF制御部339は、ピーク検出を継続する。
 またAF制御部339は、現在画像がスキャン開始後2枚目以降の画像である場合(S103でNoの場合)は、現在画像のコントラスト値contrastValNowを取得する(S105)。この際には、保存されているeffectiveBlockFlagRef(bx,by)を読み出しAF領域を設定する処理等が行われることになる。
 そしてAF制御部339は、コントラスト値決定部338から出力されるcontrastValNowとcontrastValRefを取得して比較する(S106)。contrastValNowがcontrastValRefよりも大きい場合(S106でYesの場合)、AF制御部339は有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、新たなeffectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力することで、effectiveBlockFlagRef(bx,by)を更新する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、新たなblockContrastValRef(bx,by)として保存されるように制御信号を出力することで、blockContrastValRef(bx,by)を更新する。またAF制御部339は、レンズ位置制御部340からlensPosNowを取得し、これを新たなlensPosRefとして保存することで、lensPosRefを更新する(S107)。その後AF制御部339は、ピーク検出を継続する。
 またAF制御部339は、contrastValNowがcontrastValRefよりも小さい場合(S106でNoの場合)、contrastValNowとcontrastValRef * Kを比較する(S108)。ここでKは0から1の間の任意の係数である。contrastValNowがcontrastValRef * Kよりも大きい場合、AF制御部339はeffectiveBlockFlagRef(bx,by)、blockContrastValNow(bx,by)、lensPosRefの更新を行わず、ピーク検出を継続する。一方、contrastValNowがcontrastValRef * K以下(その値を含む)になった場合(S108でNoの場合)、AF制御部339はlensPosRefをピーク位置と判定してピーク検出を終了する(S109)。
 現在画像が更新されるタイミングに合わせてこのような一連の動作を行うことで、AF制御部339は合焦レンズ位置をlensPosRefとして検出することができる。このことについて、図9を用いてより詳しく説明する。図9はフォーカスレンズ位置と画像のコントラスト値の一般的な関係を表す概略図である。レンズ位置Aからレンズ位置Bに向かってフォーカスレンズ240のスキャン動作を行った場合、図9に示すようにフォーカスレンズ240が合焦レンズ位置に近づく従ってコントラスト値は増加し、合焦レンズ位置から離れるに従ってコントラスト値は減少することになる。
 本実施形態では、前述したように現在画像と基準画像の両方の画像で有効ブロックと判定された評価ブロックのみを用いて、それぞれの画像に対応するコントラスト値であるcontrastValNowとcontrastValRefを算出している。このため、基準画像や現在画像における輝点やカンシの有無及びその位置の違いに等よって有効ブロックの位置や数が変化することから、contrastValNow 及びcontrastValRefの絶対値は変化する。しかし、contrastValRefとcontrastValNowの大小関係は、基準画像取得時のフォーカスレンズ位置と現在画像取得時のフォーカスレンズ位置によって図9と同様に決定される。
 例えば、図9に状態1として示すフォーカスレンズ位置が合焦レンズ位置に近づく状態では、この時に取得されるcontrastValNow1はcontrastValRef1より大きくなる。この状態では、lensPosRefは現在画像取得時のフォーカスレンズ位置lensPosNowに順次更新される。
 また、図9に状態2として示すフォーカスレンズ位置が合焦レンズ位置を超えて遠ざかる状態では、この時に取得されるcontrastValNow2はcontrastValRef2より小さくなる。この状態では、lensPosRefに合焦レンズ位置が保存される。合焦レンズ位置と現在画像取得時のフォーカスレンズ位置の差が大きくなり、contrastValNow2がcontrastValRef2 * K 以下(その値を含む)になった時点でAF制御部339はピーク検出を終了するため、この時lensPosRefには合焦レンズ位置が保存されていることになる。
 ここでAF制御部339は、前述の係数Kを適切に設定することで、被写体である生体や撮像部200のわずかな移動やノイズの影響等により合焦レンズ位置以外のフォーカスレンズ位置でコントラスト値の減少が発生した場合もピークの誤検出を防止することが可能となり、精度よく合焦レンズ位置を検出することが可能になる。
 ピーク検出の終了後、AF制御部339はlensPosRefを要求レンズ位置としてレンズ位置制御部340に出力し、フォーカスレンズ240がlensPosRefに到達したら合焦動作が完了したとしてシングルAFを終了する。
 このような制御を行うことで本実施形態における内視鏡システムは、被写体となる生体がわずかに動いたこと等に起因して画像中の輝点の位置が変動した場合や、ユーザーがカンシを動かした場合など、除外すべき被写体の画像中の位置がAF中に変化した場合も正しくシングルAFを行うことが可能となる。
 2.4 変形例
 次に本実施形態の変形例について、図5に示すフローチャートを用いて説明する。S201,S202については、図4のS101,S102と同様である。本変形例におけるAF制御部339は、まず現在画像がスキャン開始後1枚目の画像であるかの判定を行い(S203)、1枚目である場合は、有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、effectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、blockContrastValRef(bx,by)として保存されるように制御信号を出力する。またAF制御部339は、レンズ位置制御部340からlensPosNowを取得し、これをlensPosRefとして保存する(S204)。その後AF制御部339は、ピーク検出を継続する。
 またAF制御部339は、現在画像がスキャン開始後2枚目の画像であるかの判定を行い(S205)、2枚目である場合は、まず有効ブロック情報保存部336に保存されたeffectiveBlockFlagRef(bx,by)を、基準画像の1枚前の画像の有効ブロック判定フラグeffectiveBlockFlagOld(bx,by)にコピーするように制御信号を出力する。さらにAF制御部339は、コントラスト値保存部333に保存されたblockContrastValRef(bx,by)を、基準画像の1枚前の画像の各評価ブロックのコントラスト値blockContrastValOld(bx,by)にコピーするように制御信号を出力する。またAF制御部339は、lensPosRefを基準画像の1枚前の画像のフォーカスレンズ位置lensPosOldにコピーする。次にAF制御部339は、有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、effectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、blockContrastValRef(bx,by)として保存されるように制御信号を出力する。またAF制御部339は、レンズ位置制御部340からlensPosNowを取得し、これをlensPosRefとして保存する(S206)。その後AF制御部339は、ピーク検出を継続する。
 またAF制御部339は、現在画像がスキャン開始後3枚目以降の画像である場合(S205でNoの場合)は、コントラスト値決定部338から出力されるcontrastValNowとcontrastValRefを取得して比較する(S207,S208)。
 contrastValNowがcontrastValRefよりも大きい場合(S208でYesの場合)、AF制御部339はまず有効ブロック情報保存部336に保存されたeffectiveBlockFlagRef(bx,by)を、effectiveBlockFlagOld(bx,by)にコピーするように制御信号を出力し、effectiveBlockFlagOld(bx,by)を更新する。さらにAF制御部339は、コントラスト値保存部333に保存されたblockContrastValRef(bx,by)を、blockContrastValOld(bx,by)にコピーするように制御信号を出力し、blockContrastValOld(bx,by)を更新する。またAF制御部339は、lensPosRef をlensPosOldにコピーすることでlensPosOldを更新する。次にAF制御部339は、有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、effectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、blockContrastValRef(bx,by)として保存されるように制御信号を出力する。またAF制御部339は、レンズ位置制御部340からlensPosNowを取得し、これをlensPosRefとして保存する(S209)。その後AF制御部339は、ピーク検出を継続する。
 またAF制御部339は、contrastValNowがcontrastValRefよりも小さい場合(S208でNoの場合)、contrastValNowとcontrastValRef * Kを比較する(S210)。ここでKは0から1の間の任意の係数である。contrastValNowがcontrastValRef * Kよりも大きい場合(S210でYesの場合)、AF制御部339はeffectiveBlockFlagRef(bx,by)、blockContrastValNow(bx,by)、lensPosRefの更新を行わず、ピーク検出を継続する。一方、contrastValNowがcontrastValRef * K以下(その値を含む)になった場合(S210でNoの場合)、AF制御部339は合焦レンズ位置が検出されたと判定してピーク検出を終了する。
 なお本変形例におけるAF領域設定部337は、有効ブロック判定部335から出力されるeffectiveBlockFlagNow(bx,by)、有効ブロック情報保存部336から出力されるeffectiveBlockFlagRef(bx,by)及びeffectiveBlockFlagOld(bx,by)の3つからAF領域を設定し、コントラスト値決定部338に出力する。具体的には、まずeffectiveBlockFlagNow(bx,by)とeffectiveBlockFlagRef(bx,by)に対して各評価ブロック毎に論理積を算出し、次にその結果とeffectiveBlockFlagOld(bx,by)に対して各評価ブロック毎に論理積を算出した結果をafAreaFlag(bx,by)としてコントラスト値決定部338に出力する。このような処理を行うことで、AF領域設定部337は現在画像と基準画像(適宜、第1の基準画像と表記する)及び基準画像の1枚前の画像(適宜、第2の基準画像と表記する)のすべてで有効ブロックと判定された評価ブロックの集合をAF領域として設定することができる。
 さらに本変形例におけるコントラスト値決定部338は、AF領域設定部337から出力されるafAreaFlag(bx,by)とコントラスト値算出部332から出力されるblockContrastValNow(bx,by) からcontrastValNowを決定し、AF制御部339に出力する。さらにコントラスト値決定部338は、AF領域設定部337から出力されるafAreaFlag(bx,by)とコントラスト値保存部333から出力されるblockContrastValRef(bx,by)及びblockContrastValOld(bx,by)から、contrastValRef及びcontrastValOldを決定し、AF制御部339に出力する。
 具体的にはコントラスト値決定部338は、afAreaFlag(bx,by)が1である評価ブロックに対応するblockContrastValNow(bx,by)の総和を算出し、これをcontrastValNowとする。さらにコントラスト値決定部338は、afAreaFlag(bx,by)が1である評価ブロックに対応するblockContrastValRef(bx,by)及びblockContrastValOld(bx,by)の総和をそれぞれ算出し、これをcontrastValRef及びcontrastValOldとする。このような処理を行うことで、コントラスト値決定部338は現在画像と基準画像及び基準画像の1枚前の画像のすべてで有効ブロックと判定された評価ブロックのみを用いて、それぞれの画像に対応するコントラスト値を決定することができる。
 ピーク検出の終了後、AF制御部339は3つレンズ位置lensPosNow、lensPosRef、lensPosOld及びこれらに対応するコントラスト値contrastValNow、contrastValRef、contrastValOldから公知のラグランジェ補間等を用いて図10に示すように、これらの3点を通る2次関数を算出する。その後、算出した2次関数に対してコントラスト値が最大となるフォーカスレンズ位置lensPosPeakを要求レンズ位置として決定し、レンズ位置制御部340に出力する(S211)。フォーカスレンズ240がlensPosPeakに到達したら合焦動作が完了したとして(S212)、シングルAFを終了する。
 このような制御を行うことで本変形例における内視鏡システムは、フォーカスレンズ240のスキャンピッチを大きくした場合も精度良く合焦レンズ位置を検出することが可能となり、高速なシングルAFを実現できる。
 なお、他の変形例として、撮像装置はAF処理後の合焦レンズ位置を用いて被写体までの距離を算出する距離計測部を備えてもよい。フォーカスレンズ位置に対応する合焦物***置は光学的な特性から一意に決定されるものであるため、フォーカスレンズ位置が所与の位置であることが決定されれば、その際の合焦物***置を求めることができる。ここでAF処理が正常に終了した後のフォーカスレンズ位置とは、撮像対象としている被写体に合焦していることが期待される合焦レンズ位置であることから、その際の被写体は合焦物***置に相当する位置にあると推定できる。このため距離計測部は例えば、合焦レンズ位置と合焦物***置の関係を表すテーブルデータをメモリに保存しておき、AF処理後の合焦レンズ位置からこのテーブルデータを用いて合焦物***置を算出し、これを被写体までの距離とすればよい。
 つまり、本実施形態の手法はAFを適切に行うものであるが、AFの結果(特にフォーカスレンズ位置)を用いて被写体までの距離を表す距離情報を算出することが可能である。取得した距離情報をどのような処理に利用するかは任意であるが、例えば距離情報から被写体の構造等を推定し、特定の凹凸構造に対して視認性を高めるための強調処理を行うことや、距離情報が所定の閾値以下であれば被写体である生体に接触する可能性があるとしてアラートを行うこと等が考えられる。
 以上の本実施形態では、撮像装置は図1に示したように、合焦物***置を調整するフォーカスレンズ240を含む光学系と、光学系で結像された被写体像を光電変換して画像を生成する撮像素子260と、フォーカスレンズ位置を制御するレンズ位置制御部340と、オートフォーカス制御を行うフォーカス制御部330と、を含む。そしてフォーカス制御部330は、図2に示したように、入力画像に複数のブロックを設定するブロック設定部331と、設定した複数のブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出するコントラスト値算出部332と、基準画像のブロックコントラスト値情報を保存するコントラスト値保存部333と、設定した複数のブロックの各ブロックの特徴量を算出する特徴量算出部334と、特徴量に基づいて、複数の前記ブロックのうち、フォーカス制御において有効である有効ブロックを判定し、判定結果を有効ブロック情報として取得する有効ブロック判定部335と、基準画像の有効ブロック情報を保存する有効ブロック情報保存部336と、基準画像の有効ブロック情報と、入力画像の有効ブロック情報からAF領域を設定するAF領域設定部337と、AF領域と基準画像のブロックコントラスト値情報から、基準画像の画像コントラスト値を決定するとともに、AF領域と入力画像のブロックコントラスト値情報から、入力画像の画像コントラスト値を決定するコントラスト値決定部338とを含み、AF領域設定部337は、基準画像と入力画像の両方で有効ブロックと判定されたブロックの集合を、AF領域として設定する。
 これにより、AFのためのコントラスト値の算出において、入力画像の有効ブロック情報だけでなく、当該入力画像との比較対象となる基準画像の有効ブロック情報も用いた処理が可能になる。よって、AF中に輝点等の画像上での位置や大きさが変化した場合であっても、適切に当該輝点等の領域を除外しつつ、比較対象となる画像間でのコントラスト値の算出条件を合わせることができるため、適切なAF制御が可能になる。
 また、フォーカス制御部330は、入力画像の画像コントラスト値が基準画像の画像コントラスト値より大きい場合は、入力画像を新たな基準画像として設定する基準画像更新処理を行ってもよい。また、フォーカス制御部330は、入力画像の画像コントラスト値が、基準画像の画像コントラスト値から算出される閾値より小さい場合は、ピークを検出したと判定してもよい。
 これにより、図9に示したようにコントラスト値のピーク位置を検出することが可能になる。本実施形態での基準画像とは、それまでに処理を行った画像のうち最もピーク位置に近いと考えられる画像である。入力画像の画像コントラスト値が基準画像の画像コントラスト値より大きい場合とは、図9の状態1に対応し、この場合は入力画像の方がよりピーク位置に近いと考えられるため、基準画像を更新する。一方、入力画像の画像コントラスト値が、基準画像の画像コントラスト値より小さい場合とは、図9の状態2に対応し、ピーク位置はその時点で保持している基準画像に対応する位置であると考えることができる。ただし、入力画像の画像コントラスト値が基準画像の画像コントラスト値よりもわずかに小さかったとしても、それはノイズ等の影響でありフォーカスの合い具合を適切に反映していない可能性も考えられる。よって、ピークを検出したという判定は、入力画像の画像コントラスト値が基準画像の画像コントラスト値に対してある程度大きい幅で減少したことを条件とするとよい。ここでは、0<K<1となる定数Kを用いて、図4のS108に示した判定を行うものとする。
 また、フォーカス制御部330は、ピークを検出したと判定した場合は、判定が行われたタイミングでの基準画像に対応するフォーカスレンズ位置にフォーカスレンズ240を移動させる指示を、レンズ位置制御部340に対して送信してもよい。
 これにより、図9のlensPosRef2に示した位置をピークとして検出し、当該位置にフォーカスレンズ240を移動させることが可能になる。この場合、実際に基準画像を取得した位置に移動させることになるため、AFの精度を向上させるためには、フォーカスレンズ240の移動幅(スキャンピッチ)はある程度(例えば、所与のレンズ位置と次のレンズ位置との間にピークがあったとしても問題がない程度に)小さくすることが望ましい。
 また、フォーカス制御部330は、フォーカス制御において、フォーカスレンズ位置を第1の位置から第2の位置へ向かって所与の移動幅で移動させ、フォーカスレンズ位置が第1の位置である場合に生成された画像を基準画像とし、第1の位置の次の位置から第2の位置まで、所与の移動幅でのフォーカスレンズ位置の移動毎に生成された画像を、順次入力画像としてもよい。
 これにより、図9に示したようにシングルAFを実現することが可能になる。ここで第1の位置とはフォーカスレンズ240の可動範囲の一端であり、第2の位置とはフォーカスレンズ240の可動範囲の他端であることが想定されるが、これに限定されるものではない。
 また、フォーカス制御部330は、基準画像として、第1の基準画像と、第1の基準画像よりも前のタイミングで取得された第2の基準画像の2つを設定し、AF領域設定部337は、第1の基準画像、第2の基準画像及び入力画像の全てで有効ブロックと判定されたブロックの集合を、AF領域として設定してもよい。
 これにより、3枚(或いはそれ以上の数)の画像について適切にコントラスト値を比較することが可能になる。画像Aと画像Bに対する第1の比較処理と、画像Bと画像Cに対する第2の比較処理を別々に行った場合、それぞれの処理で算出された画像コントラスト値は、2つの画像間の比較においてのみ有効であり、第1の比較処理で算出された画像Aのコントラスト値と、第2の比較処理で算出された画像Cのコントラスト値との比較は意味をなさない可能性がある(第1の比較処理と第2の比較処理でAF領域が同一であれば有意な比較となる可能性もあるが、それは限定されたケースである)。よって、3つ以上(その値を含む)の画像について比較処理を行うのであれば、全ての画像の有効ブロック情報を用いるとよい。
 また、フォーカス制御部330は、入力画像の画像コントラスト値が第1の基準画像の画像コントラスト値より大きい場合は、第1の基準画像を新たな第2の基準画像として設定するとともに、入力画像を新たな第1の基準画像として設定する基準画像更新処理を行ってもよい。また、フォーカス制御部330は、入力画像の画像コントラスト値が、第1の基準画像の画像コントラスト値から算出される閾値より小さい場合は、ピークを検出したと判定してもよい。
 そして、ピークを検出したと判定した場合は、フォーカス制御部330は、判定が行われたタイミングでの第1の基準画像、第2の基準画像及び入力画像の画像コントラスト値に基づく補間処理を行って極大値を求め、極大値に対応するフォーカスレンズ位置にフォーカスレンズ240を移動させる指示を、レンズ位置制御部340に対して送信してもよい。
 これにより、図10に示したように補間処理を用いたピーク位置の検出が可能になる。この場合には、仮にピーク位置において画像の取得(及びその後のコントラスト値の算出処理等)が行われていなかったとしても、当該位置をピークとして検出することができる。よって、フォーカスレンズ240を移動させる際の移動幅を図9のケースに比べて大きくすることができるため、AFに要する処理負荷の軽減、及びAF制御の高速化が可能になる。上述したように、3つ以上(その値を含む)の画像の有効ブロック情報を全て用いるため、画像コントラスト値の相対関係は適切に求めることができ、補間処理も適切に実行可能である。
 また、フォーカス制御部330は、フォーカス制御において、フォーカスレンズ位置を第1の位置から第2の位置へ向かって所与の移動幅で移動させ、フォーカスレンズ位置が第1の位置である場合に生成された画像を第2の基準画像とし、フォーカスレンズ位置が第1の位置の次の位置である場合に生成された画像を第1の基準画像とし、第1の位置の2つ後の位置から第2の位置まで、所与の移動幅でのフォーカスレンズ位置の移動毎に生成された画像を、順次入力画像としてもよい。
 これにより、図10に示したようなシングルAFを実現することが可能になる。
 また、有効ブロック判定部335は、ブロックに輝点が含まれるか否かを判定する第1の判定処理、ブロックが暗部領域であるか否かを判定する第2の判定処理、及びブロックに生体に対する処置具が含まれるか否かを判定する第3の判定処理の少なくとも1つの判定処理を行って、ブロックが有効ブロックであるか否かを判定してもよい。
 これにより、輝点、暗部領域、処置具(カンシ等)に基づいて有効ブロックか否かを判定することが可能になる。なお、この場合の特徴量としては、第1の判定処理では輝度の最大値、第2の判定処理では輝度の平均値、第3の判定処理ではCrCbそれぞれの平均値を用いることができる。なお、各判定処理の特徴量として他の値を用いてもよい。また、有効ブロックか否かの判定に第1~第3の判定処理以外の判定処理をさらに用いてもよい。
 また、撮像装置は、図1には不図示であるが、フォーカス制御部330で検出された合焦レンズ位置に基づいて、被写体までの距離情報を求める距離計測部を含んでもよい。
 これにより、フォーカス制御部330でのオートフォーカス制御の結果を用いて、被写体までの距離情報を取得することが可能になる。フォーカス制御によりAFが完了した場合には、レンズ(フォーカスレンズ240等)、像面(狭義には撮像素子260の面だが、これに限定されない)、被写体とからなる系は合焦状態にあると言える。そして、合焦状態でのフォーカスレンズ240や撮像素子260の基本的な特性は、設計事項として事前に取得しておくことができる。つまり、合焦状態での物点の位置(合焦物***置)は、合焦状態でのフォーカスレンズ240等の位置(合焦レンズ位置)が決定されれば、テーブルデータの参照等により求めることができ、これは撮像された被写体までの距離を表す情報に他ならない。
 3.第2の実施形態
 本発明の第2の実施形態に係る撮像装置(内視鏡システム)について説明する。本実施形態におけるAF制御部339はフルタイムAFを行う。なお本実施形態に係る内視鏡システムの構成は、AF制御部339を除いて第1の実施形態と同様である。
 本実施形態におけるAF制御部339の動作について、図7に示すフローチャートを用いて説明する。AF制御部339は、制御部360からAF開始信号が出力された場合、現在画像の取得が終了したタイミングでカウンタwobCntを0、フルタイムAFの開始フラグstartFlagを1とする。さらにAF制御部339は、レンズ位置制御部340からlensPosNowを取得する(S401)。次にAF制御部339は、wobCntが0かつstartFlagが1であるため(S403,S404でともにYes)、startFlagを0とし、wobCntを1とする(S405)。以後、startFlagは0のままである。さらにAF制御部339は、要求レンズ位置lensPosReq を lensPosReq = lensPosNow + wobLvlとして算出し、レンズ位置制御部340に出力する。ここでwobLvlは、図11に示すようにフォーカスレンズ240のウォブリング幅である。
 次にAF制御部339は、wobCntが1であるため(S403でNo,S406でYes)、現在画像の取得が終了したタイミングで、有効ブロック判定部335から有効ブロック情報保存部336に出力されるeffectiveBlockFlagNow(bx,by)が、effectiveBlockFlagRef(bx,by)として保存されるように制御信号を出力する。さらにAF制御部339は、コントラスト値算出部332からコントラスト値保存部333に出力されるblockContrastValNow(bx,by)が、blockContrastValRef(bx,by)として保存されるように制御信号を出力する(S407)。なお、ここでの現在画像は図11に示すようにフォーカスレンズ位置が増加する方向にウォブリングされた画像である。さらにAF制御部339はwobCntを2とした後、lensPosReq = lensPosNow - 2 * wobLvlとして算出し、レンズ位置制御部340に出力する(S408)。
 次にAF制御部339は、wobCntが2であるため(S403,S406でともにNo)、現在画像の取得が終了したタイミングで、コントラスト値決定部338から出力されるcontrastValNowとcontrastValRefを取得する(S410)。この際には、新たに取得したeffectiveBlockFlagNow(bx,by)と、S407で保存したeffectiveBlockRef(bx,by)からAF領域を求める等の処理が行われることになる。なお、ここでの現在画像は図11に示すようにフォーカスレンズ位置が減少する方向にウォブリングされた画像である。さらにAF制御部339はwobCntを0とした後、lensPosReq = lensPosNow + wobLvlとして算出し、レンズ位置制御部340に出力する(S411)。これにより、フォーカスレンズ位置はウォブリングの中心位置に戻ることになる。
 次にAF制御部339は、wobCntが0かつstartFlagが0であるため(S403でYes,S404でNo)現在画像の取得が終了したタイミングで、上記で取得したcontrastValNowとcontrastValRefを比較する(S412)。contrastValRefがcontrastValNowよりも大きい場合(S412でYesの場合)は、フォーカスレンズ位置が増加する方向に合焦レンズ位置があると考えられるため、AF制御部339はwobCntを1とした後、lensPosReq = lensPosNow + wobLvl + shiftLvlとして算出し、レンズ位置制御部340に出力する(S413)。これにより図11に示すようにウォブリングの中心位置が、フォーカスレンズ位置が増加する方向に移動することになる。
 またcontrastValRefがcontrastValNowよりも小さい場合(S412でNoの場合)は、フォーカスレンズ位置が減少する方向に合焦レンズ位置があると考えられるため、AF制御部339はwobCntを1とした後、lensPosReq = lensPosNow + wobLvl - shiftLvlとして算出し、レンズ位置制御部340に出力する(S414)。これによりウォブリングの中心位置が、フォーカスレンズ位置が減少する方向に移動することになる。
 以後も同様の動作を継続して行うことで、AF制御部339はフォーカスレンズ位置を徐々に合焦レンズ位置に近づけることで、最終的には合焦レンズ位置に到達することができる。また、被写体の移動等により合焦状態から外れた場合も上記の動作を継続して行うことで、再度合焦状態を達成できる。
 このような制御を行うことで本実施形態における撮像装置は、被写体となる生体がわずかに動いたこと等に起因して画像中の輝点の位置が変動した場合や、ユーザーがカンシを動かした場合など、除外すべき被写体の画像中の位置がAF中に変化した場合も正しくフルタイムAFを行うことが可能となる。
 以上の本実施形態では、撮像装置のフォーカス制御部330は、所与の中心位置に対して、フォーカスレンズ240が第1の方向へ移動したタイミングで取得した画像を基準画像とし、中心位置に対して、フォーカスレンズ240が第1の方向とは異なる第2の方向へ移動したタイミングで取得した画像を入力画像とする。そして、フォーカス制御部330は、基準画像の画像コントラスト値と、入力画像の画像コントラスト値の比較処理に基づいて、中心位置を更新する中心位置更新処理を行う。
 これにより、図11に示したように連続的にAF制御を行うフルタイムAFを実現することが可能になる。ここでの中心位置とは、カウンタ値(wobCnt)が0の時のフォーカスレンズ位置であり、当該中心位置を基準として、所与の移動幅(wobLvl)だけフォーカスレンズ位置を前後に振るウォブリング動作を行う。つまり本実施形態では、フォーカスレンズ240を一方に振ったときの画像と、他方に振ったときの画像の2つを比較するものであり、一連の動作が終了した場合(wobCntが0,1,2と変化して再度0に戻った場合)には、次の一連の動作では基準画像及び入力画像は新たに取得され、前の動作での基準画像及び入力画像により影響を受けることはない(処理に用いないだけで過去の基準画像等の情報を保持しておくことは妨げられない)。
 また、フォーカス制御部330は、基準画像の画像コントラスト値が入力画像の画像コントラスト値より大きい場合は、中心位置を所与のシフトレベルだけ第1の方向へ移動させる処理を中心位置更新処理として行い、基準画像の画像コントラスト値が入力画像の画像コントラスト値以下の場合は、中心位置をシフトレベルだけ第2の方向へ移動させる処理を中心位置更新処理として行ってもよい。
 これにより、画像コントラスト値の比較処理の結果に基づいて、ウォブリングの中心位置を更新することが可能になる。具体的には、基準画像と入力画像のうち、コントラスト値が高い側に合焦レンズ位置があると推定されるため、対応する方向にシフトレベル(shiftLvl)だけフォーカスレンズ240を移動させるものとする。
 4.第3の実施形態
 本発明の第3の実施形態に係る撮像装置(内視鏡システム)について、図3を用いて説明する。本実施形態に係る内視鏡システムの構成は、フォーカス制御部330を除いて第1の実施形態と同様である。
 本実施形態におけるフォーカス制御部330はブロック設定部331と、コントラスト値算出部332と、コントラスト値保存部333と、特徴量算出部334と、有効ブロック判定部335と、有効ブロック情報保存部336と、AF領域設定部337と、コントラスト値決定部338と、AF制御部339と、縮小画像生成部33aと、メモリ33bと、動き検出部33cを備えている。ブロック設定部331と、コントラスト値算出部332と、コントラスト値保存部333と、特徴量算出部334と、有効ブロック判定部335と、有効ブロック情報保存部336と、AF領域設定部337と、コントラスト値決定部338の構成は、第1の実施形態と同様である。
 縮小画像生成部33aは、ブロック設定部331で設定されたすべての評価ブロックに対して縮小画像を生成し、メモリ33bと動き検出部33cに出力する。ここで縮小画像生成部33aは、例えば図12(A)に示すように評価ブロックb(bx,by)に含まれる画素の数がN*N画素の場合、Nの約数であるMを用いて、M*M画素に含まれるY信号の画素値をすべて加算平均することで、b(bx,by)の縮小画像であるsmallB(bx,by)の画素値を算出する。このような処理をb(bx,by)に含まれるすべての画素に対して行うことで図12(B)に示すようにN/M*N/M画素のsmallB(bx,by)を生成することができる(図ではN=8、M=4として示している)。
 メモリ33bは縮小画像生成部33aから出力される縮小画像を保存し、動き検出部33cに出力する。動き検出部33cは縮小画像生成部33aから出力される現在画像の縮小画像と、メモリ33bから出力される現在画像の1枚前の画像の縮小画像から、各評価ブロックの動き量blockSAD(bx,by)を算出し、AF制御部339に出力する。具体的には、現在画像の各評価ブロックの縮小画像をsmallB1(bx,by)、現在画像の1枚前の画像の各評価ブロックの縮小画像をsmallB2(bx,by)とした場合、動き検出部33cはsmallB1(bx,by) とsmallB2(bx,by)で対応する画素の差分を算出し、各評価ブロックの縮小画像に含まれるすべての画素に対する差分の総和をblockSAD(bx,by)とする。
 なお、本実施形態では各評価ブロックの縮小画像からblockSAD(bx,by)を算出したが、これは現在画像及び現在画像の1枚前の画像の合焦度合いによりblockSAD(bx,by)の値が大きく変動することを防ぐためである。この影響が小さい場合は、縮小画像を作成せずに各評価ブロックの画素値そのものから上記と同様の手法でblockSAD(bx,by)を算出してもよい。
 次に本実施形態において、AF制御部339がシングルAFを行う場合の動作について説明する。AF制御部339は、制御部360からAF開始信号が出力された場合、例えばフォーカスレンズ240の可動域の任意の一方の端(レンズ位置A)を要求レンズ位置としてレンズ位置制御部340に出力する。フォーカスレンズ240がレンズ位置Aに到達したら、AF制御部339は要求レンズ位置をレンズの可動域のもう一方の端(レンズ位置B)に変更し、フォーカスレンズ240のスキャン動作を開始し、合焦レンズ位置の検出(ピーク検出)を行う。
 ピーク検出時のAF制御部339の動作を、図6に示すフローチャートを用いて説明する。現在画像がスキャン開始後1枚目の画像である場合(S301~S304)は、第1の実施形態(図4のS101~S104)と同様である。現在画像がスキャン開始後2枚目以降の画像である場合(S303でNoの場合)は、AF制御部339は動き検出部33cから出力されるblockSAD(bx,by)と、AF領域設定部337から出力されるafAreaFlag(bx,by)から、現在画像の動き量flameSADを算出する(S305)。具体的にはAF制御部339は、afAreaFlag(bx,by)が1である評価ブロックに対応するblockSAD(bx,by)の平均値を算出し、これをflameSADとする。
 次にAF制御部339は、算出したflameSADを所定の閾値(動き量閾値)と比較する(S306)。flameSADが閾値よりも大きい場合(S306でYesの場合)、AF制御部339は1枚前の画像に対する現在画像の動きが大きいと判断し、図6に示すようにその後の動作は行わずにピーク検出を継続する。これは現在画像の動きが大きい場合、動きボケによりcontrastValNowが低下することで、合焦レンズ位置に到達していないにもかかわらず合焦レンズ位置を検出したと判定することを防ぐためである。
 またflameSADが閾値よりも小さい場合(S306でNoの場合)、AF制御部339は第1の実施形態と同様の動作(S307~S311は図4のS105~S109に対応)を行いピーク検出を継続する。
 ピーク検出の終了後、AF制御部339はlensPosRefを要求レンズ位置としてレンズ位置制御部340に出力し、フォーカスレンズ240がlensPosRefに到達したら合焦動作が完了したとしてシングルAFを終了する。
 このような制御を行うことで本実施形態における内視鏡システムは、AF中に被写体となる生体が大きく動いた場合も、間違った合焦レンズ位置を検出することなく、安定したシングルAFを行うことが可能となる。
 なお、flameSADが閾値よりも大きい場合、その後の動作は行わずにピーク検出を継続するが、その際のフォーカスレンズ位置は変更してもよいし、そのままでもよい。フォーカスレンズ位置を変更してピーク検出を継続する場合、動きが大きい画像を取得した際のフォーカスレンズ位置ではフォーカス制御に関する処理を再度行わずに次の処理に移れるため、高速でフォーカス制御を行うことが可能である。その場合でも、フォーカスレンズ240の一回の移動量が小さい場合には、一カ所での処理がスキップされたとしても最終的に求められる合焦レンズ位置の精度に対する影響は大きくない。つまり、第1の実施形態の基本的な手法のように、そもそも精度を高めるためにフォーカスレンズ240の一回の移動量が小さくすることが想定されるケースでは、flameSADが閾値よりも大きく処理がスキップされた場合に、フォーカスレンズ位置を更新するとよい。
 一方、フォーカスレンズ240の一回の移動量が大きい場合には、一カ所での処理がスキップされた場合、コントラスト値が取得されないブランクの幅が大きくなるため、求められる合焦レンズ位置の精度に対する影響が大きい。つまり、第1の実施形態の変形例のように、フォーカスレンズ240の一回の移動量が大きくすることが想定されるケースでは、flameSADが閾値よりも大きく処理がスキップされた場合に、フォーカスレンズ位置を更新せず同一のフォーカスレンズ位置で再度処理を行うとよい。
 また、動き量を用いた処理はシングルAFと組み合わせるだけでなく、第2の実施形態で上述したフルタイムAFと組み合わせてもよい。本実施形態において、AF制御部339がフルタイムAFを行う場合の動作について、図8に示すフローチャートを用いて説明する。
 AF制御部339は、制御部360からAF開始信号が出力された場合、現在画像の取得が終了したタイミングでカウンタwobCntを0、フルタイムAFの開始フラグstartFlagを1とする。その後、第2の実施形態と同様の動作を行う。次に、AF制御部339は、wobCntが1である場合は第2の実施形態と同様の動作を行う。
 次にAF制御部339は、wobCntが2であるため現在画像の取得が終了したタイミングで、コントラスト値決定部338から出力されるcontrastValNowとcontrastValRefを取得する。その後、AF制御部339は前述と同様の手法で、現在画像と現在の1枚前の画像からflameSADを算出し保存する。ここでの現在画像と現在の1枚前の画像は、ウォブリングの中心位置からフォーカスレンズ位置がwobLvlだけ減少及び増加した画像である。つまり以上の処理(S501~S511)は、S510においてflameSADを算出する点を除いて、第2の実施形態(図7のS401~S411)と同様である。
 次にAF制御部339は、wobCntが0かつstartFlagが0であるため、現在画像の取得が終了したタイミングで、保存されているflameSADを所定の閾値と比較する(S512)。flameSADが閾値よりも大きい場合(S512でYesの場合)、AF制御部339はウォブリング中の画像の動きが大きいと判断し、図8に示すようにwobCntを1とした後、lensPosReq = lensPosNow + wobLvlとして算出しレンズ位置制御部340に出力する(S513)。これはウォブリング中の画像の動きが大きい場合、動きボケによりcontrastValNowが低下することで、合焦レンズ位置とは異なる方向にフォーカスレンズ位置が移動することを防ぐため、ウォブリングの中心位置の更新をスキップする処理となる。またflameSADが閾値よりも小さい場合(S512でNoの場合)、AF制御部339はS514~S516に示したように、第2の実施形態(図7のS412~S414)と同様の動作を行う。
 このような制御を行うことで本実施形態における撮像装置は、ウォブリング中に被写体となる生体が大きく動いた場合も、間違った方向にフォーカスレンズ位置を移動することなく、安定したフルタイムAFを行うことが可能となる。
 以上の本実施形態では、撮像装置は図3に示したように、入力画像と、入力画像の1タイミング前で取得された画像の間の動き量を求める動き検出部33cを含み、フォーカス制御部330は、動き量が所与の動き量閾値より大きい場合は、入力画像に対する処理をスキップする。
 ここで動き量は種々の手法により求めることができるが、例えば入力画像とその1タイミング前の画像との間の相違度(SAD或いはSSD等)を用いればよい。具体的には、入力画像とその1タイミング前の画像を用いて、入力画像に設定されたブロックごとの相違度であるblockSAD(bx,by)を求め、全てのブロックのうち、有効ブロック情報を用いて設定されたAF領域に含まれるブロックのblockSAD(bx,by)の総和等を当該入力画像の動き量とすればよい。
 これにより、入力画像の動き量が大きい場合には、当該入力画像を用いたAF制御をスキップすることが可能になる。動き量が大きい場合は、動きボケが発生している可能性が高く、仮にフォーカスレンズ位置が適切であったとしても入力画像のコントラスト値は小さい値となってしまう。そのような入力画像を用いてAF制御を行っても適切な結果が得られず、例えば図9のシングルAFであれば状態1にあるにも関わらず状態2であると判定し、その段階で処理を終了してしまう可能性もある。よってここでは、動き量が大きい入力画像についてはAF制御に関する処理を行わないものとした。
 また、フォーカス制御部330は、動き量が動き量閾値より大きい場合は、入力画像に対応するフォーカスレンズ位置において新たに取得された画像を、新たな入力画像としてもよい。また、フォーカス制御部330は、動き量が動き量閾値より大きい場合は、レンズ位置制御部340に対してフォーカスレンズ位置の変更指示を行い、フォーカスレンズ位置の変更後に取得された画像を、新たな入力画像としてもよい。
 これにより、動き量が大きい入力画像に対する処理のスキップ後、次の入力画像を取得する際のフォーカスレンズ位置を柔軟に選択することが可能になる。具体的には、フォーカスレンズ位置を維持して、同じフォーカスレンズ位置で入力画像の取得をやり直してもよいし、フォーカスレンズ位置を更新して、更新後のフォーカスレンズ位置で取得した入力画像に対して処理を行ってもよい。
 また、撮像装置は図3に示したように、入力画像と、入力画像の1タイミング前で取得された画像の間の動き量を求める動き検出部33cを含み、フォーカス制御部330は、動き量が所与の動き量閾値より大きい場合は、入力画像に対する処理をスキップし、所与の移動幅でのフォーカスレンズ位置の移動後に生成された画像を、新たな入力画像としてもよい。
 これにより、図9に示したシングルAFを行う場合であって、入力画像の動き量が大きい場合には、入力画像に対する処理をスキップした上でフォーカスレンズ位置を更新し、更新後のフォーカスレンズ位置で取得した画像を新たな入力画像とすることができる。図9のシングルAFでは、AF制御の精度向上のためにフォーカスレンズ240の移動幅が小さいことが想定される。よって、1つのフォーカスレンズ位置での処理をスキップしたとしても影響は少なく、このようにすることで処理のやり直しが発生しないためAFの高速化等が可能になる。
 また、撮像装置は図3に示したように、入力画像と、入力画像の1タイミング前で取得された画像の間の動き量を求める動き検出部33cを含み、フォーカス制御部330は、動き量が所与の動き量閾値より大きい場合は、入力画像に対する処理をスキップするとともに、所与の移動幅でのフォーカスレンズ位置の移動をスキップし、入力画像に対応するフォーカスレンズ位置において生成された画像を、新たな入力画像としてもよい。
 これにより、図10に示したシングルAFを行う場合であって、入力画像の動き量が大きい場合には、入力画像に対する処理だけでなく、フォーカスレンズ位置の更新処理もスキップし、同じフォーカスレンズ位置で取得した画像を新たな入力画像とすることができる。図10のシングルAFではピーク位置は補間処理で求めるため、フォーカスレンズ240の移動幅が大きいことが想定される。よって、1つのフォーカスレンズ位置での処理をスキップした場合の影響は図9等の場合に比べて大きいため、同じ位置で入力画像の取得をやり直すことが好ましい。
 また、撮像装置は図3に示したように、入力画像と、入力画像の1タイミング前で取得された画像の間の動き量を求める動き検出部33cを含み、フォーカス制御部330は、動き量が所与の動き量閾値より大きい場合は、中心位置更新処理をスキップしてもよい。
 これにより、図11に示したフルタイムAFを行う場合であって、入力画像の動き量が大きい場合には、中心位置更新処理をスキップすることができる。フルタイムAFでは2つの画像を比較して、よりよい方向にフォーカスレンズ位置を移す処理を行う以上、コントラスト値が適切に算出されずに有意な比較が行えない場合には、徒にフォーカスレンズ位置を変更するのではなく、現在位置で再度画像取得をやり直すことが好ましい。
 以上、本発明を適用した3つの実施の形態1~3及びその変形例について説明したが、本発明は、各実施の形態1~3やその変形例そのままに限定されるものではなく、実施段階では、発明の要旨を逸脱しない範囲内で構成要素を変形して具体化することができる。また、上記した各実施の形態1~3や変形例に開示されている複数の構成要素を適宜組み合わせることによって、種々の発明を形成することができる。例えば、各実施の形態1~3や変形例に記載した全構成要素からいくつかの構成要素を削除してもよい。さらに、異なる実施の形態や変形例で説明した構成要素を適宜組み合わせてもよい。また、明細書又は図面において、少なくとも一度、より広義または同義な異なる用語と共に記載された用語は、明細書又は図面のいかなる箇所においても、その異なる用語に置き換えることができる。このように、発明の主旨を逸脱しない範囲内において種々の変形や応用が可能である。
100 光源部、110 白色光源、120 集光レンズ、200 撮像部、
210 ライトガイドファイバ、220 照明レンズ、230 対物レンズ系、
240 フォーカスレンズ、250 レンズ駆動部、260 撮像素子、
300 処理部、310 A/D変換部、320 前処理部、
330 フォーカス制御部、331 ブロック設定部、332 コントラスト値算出部、333 コントラスト値保存部、334 特徴量算出部、335 有効ブロック判定部、336 有効ブロック情報保存部、337 AF領域設定部、
338 コントラスト値決定部、339 AF制御部、33a 縮小画像生成部、
33b メモリ、33c 動き検出部、340 レンズ位置制御部、
350 画像処理部、360 制御部、400 表示部、500 外部I/F部

Claims (19)

  1.  合焦物***置を調整するフォーカスレンズを含む光学系と、
     前記光学系で結像された被写体像の画像を取得する撮像素子と、
     フォーカスレンズ位置を制御するレンズ位置制御部と、
     オートフォーカス制御を行うフォーカス制御部と、
     を含み、
     前記フォーカス制御部は、
     入力画像に複数のブロックを設定するブロック設定部と、
     設定した複数の前記ブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出するコントラスト値算出部と、
     基準画像の前記ブロックコントラスト値情報を保存するコントラスト値保存部と、
     設定した複数の前記ブロックの各ブロックの特徴量を算出する特徴量算出部と、
     前記特徴量に基づいて、複数の前記ブロックのうち、前記フォーカス制御において有効である有効ブロックを判定し、判定結果を有効ブロック情報として取得する有効ブロック判定部と、
     前記基準画像の前記有効ブロック情報を保存する有効ブロック情報保存部と、
     前記基準画像の前記有効ブロック情報と、前記入力画像の前記有効ブロック情報からオートフォーカス領域を設定するオートフォーカス領域設定部と、
     前記オートフォーカス領域と前記基準画像の前記ブロックコントラスト値情報から、前記基準画像の画像コントラスト値を決定するとともに、前記オートフォーカス領域と前記入力画像の前記ブロックコントラスト値情報から、前記入力画像の前記画像コントラスト値を決定するコントラスト値決定部とを含み、
     前記オートフォーカス領域設定部は、
     前記基準画像と前記入力画像の両方で前記有効ブロックと判定された前記ブロックの集合を、前記オートフォーカス領域として設定することを特徴とする撮像装置。
  2.  請求項1において、
     前記入力画像と、前記入力画像の1タイミング前で取得された前記画像の間の動き量を求める動き検出部を含み、
     前記フォーカス制御部は、
     前記動き量が所与の動き量閾値より大きい場合は、前記入力画像に対する処理をスキップすることを特徴とする撮像装置。
  3.  請求項2において、
     前記フォーカス制御部は、
     前記動き量が前記動き量閾値より大きい場合は、前記入力画像に対応する前記フォーカスレンズ位置において新たに取得された前記画像を、新たな前記入力画像とすることを特徴とする撮像装置。
  4.  請求項2において、
     前記フォーカス制御部は、
     前記動き量が前記動き量閾値より大きい場合は、前記レンズ位置制御部に対して前記フォーカスレンズ位置の変更指示を行い、前記フォーカスレンズ位置の変更後に取得された前記画像を、新たな前記入力画像とすることを特徴とする撮像装置。
  5.  請求項1において、
     前記フォーカス制御部は、
     前記入力画像の前記画像コントラスト値が前記基準画像の前記画像コントラスト値より大きい場合は、前記入力画像を新たな前記基準画像として設定する基準画像更新処理を行い、
     前記入力画像の前記画像コントラスト値が、前記基準画像の前記画像コントラスト値から算出される閾値より小さい場合は、ピークを検出したと判定することを特徴とする撮像装置。
  6.  請求項5において、
     前記フォーカス制御部は、
     前記ピークを検出したと判定した場合は、前記判定が行われたタイミングでの前記基準画像に対応する前記フォーカスレンズ位置に前記フォーカスレンズを移動させる指示を、前記レンズ位置制御部に対して送信することを特徴とする撮像装置。
  7.  請求項5において、
     前記フォーカス制御部は、
     前記フォーカス制御において、前記フォーカスレンズ位置を第1の位置から第2の位置へ向かって所与の移動幅で移動させ、
     前記フォーカスレンズ位置が前記第1の位置である場合に生成された前記画像を、前記基準画像とし、
     前記第1の位置の次の位置から前記第2の位置まで、前記所与の移動幅での前記フォーカスレンズ位置の移動毎に生成された前記画像を、順次前記入力画像とすることを特徴とする撮像装置。
  8.  請求項7において、
     前記入力画像と、前記入力画像の1タイミング前で取得された前記画像の間の動き量を求める動き検出部を含み、
     前記フォーカス制御部は、
     前記動き量が所与の動き量閾値より大きい場合は、前記入力画像に対する処理をスキップし、
     前記所与の移動幅での前記フォーカスレンズ位置の移動後に生成された前記画像を、新たな前記入力画像とすることを特徴とする撮像装置。
  9.  請求項1において、
     前記フォーカス制御部は、
     前記基準画像として、第1の基準画像と、前記第1の基準画像よりも前のタイミングで取得された第2の基準画像の2つを設定し、
     前記オートフォーカス領域設定部は、
     前記第1の基準画像、前記第2の基準画像及び前記入力画像の全てで前記有効ブロックと判定された前記ブロックの集合を、前記オートフォーカス領域として設定することを特徴とする撮像装置。
  10.  請求項9において、
     前記フォーカス制御部は、
     前記入力画像の前記画像コントラスト値が前記第1の基準画像の前記画像コントラスト値より大きい場合は、前記第1の基準画像を新たな前記第2の基準画像として設定するとともに、前記入力画像を新たな前記第1の基準画像として設定する基準画像更新処理を行い、
     前記入力画像の前記画像コントラスト値が、前記第1の基準画像の前記画像コントラスト値から算出される閾値より小さい場合は、ピークを検出したと判定することを特徴とする撮像装置。
  11.  請求項10において、
     前記フォーカス制御部は、
     前記ピークを検出したと判定した場合は、前記判定が行われたタイミングでの前記第1の基準画像、前記第2の基準画像及び前記入力画像の前記画像コントラスト値に基づく補間処理を行って極大値を求め、前記極大値に対応する前記フォーカスレンズ位置に前記フォーカスレンズを移動させる指示を、前記レンズ位置制御部に対して送信することを特徴とする撮像装置。
  12.  請求項9において、
     前記フォーカス制御部は、
     前記フォーカス制御において、前記フォーカスレンズ位置を第1の位置から第2の位置へ向かって所与の移動幅で移動させ、
     前記フォーカスレンズ位置が前記第1の位置である場合に生成された前記画像を、前記第2の基準画像とし、
     前記フォーカスレンズ位置が前記第1の位置の次の位置である場合に生成された前記画像を、前記第1の基準画像とし、
     前記第1の位置の2つ後の位置から前記第2の位置まで、前記所与の移動幅での前記フォーカスレンズ位置の移動毎に生成された前記画像を、順次前記入力画像とすることを特徴とする撮像装置。
  13.  請求項12において、
     前記入力画像と、前記入力画像の1タイミング前で取得された前記画像の間の動き量を求める動き検出部を含み、
     前記フォーカス制御部は、
     前記動き量が所与の動き量閾値より大きい場合は、前記入力画像に対する処理をスキップするとともに、前記所与の移動幅での前記フォーカスレンズ位置の移動をスキップし、
     前記入力画像に対応する前記フォーカスレンズ位置において生成された前記画像を、新たな前記入力画像とすることを特徴とする撮像装置。
  14.  請求項1において、
     前記フォーカス制御部は、
     所与の中心位置に対して、前記フォーカスレンズが第1の方向へ移動したタイミングで取得した前記画像を前記基準画像とし、
     前記中心位置に対して、前記フォーカスレンズが前記第1の方向とは異なる第2の方向へ移動したタイミングで取得した前記画像を前記入力画像とし、
     前記フォーカス制御部は、
     前記基準画像の前記画像コントラスト値と、前記入力画像の前記画像コントラスト値の比較処理に基づいて、前記中心位置を更新する中心位置更新処理を行うことを特徴とする撮像装置。
  15.  請求項14において、
     前記フォーカス制御部は、
     前記基準画像の前記画像コントラスト値が前記入力画像の前記画像コントラスト値より大きい場合は、前記中心位置を所与のシフトレベルだけ前記第1の方向へ移動させる処理を前記中心位置更新処理として行い、
     前記基準画像の前記画像コントラスト値が前記入力画像の前記画像コントラスト値以下の場合は、前記中心位置を前記シフトレベルだけ前記第2の方向へ移動させる処理を前記中心位置更新処理として行うことを特徴とする撮像装置。
  16.  請求項14において、
     前記入力画像と、前記入力画像の1タイミング前で取得された前記画像の間の動き量を求める動き検出部を含み、
     前記フォーカス制御部は、
     前記動き量が所与の動き量閾値より大きい場合は、前記中心位置更新処理をスキップすることを特徴とする撮像装置。
  17.  請求項1において、
     前記有効ブロック判定部は、
     前記ブロックに輝点が含まれるか否かを判定する第1の判定処理、前記ブロックが暗部領域であるか否かを判定する第2の判定処理、及び前記ブロックに生体に対する処置具が含まれるか否かを判定する第3の判定処理の少なくとも1つの判定処理を行って、前記ブロックが前記有効ブロックであるか否かを判定することを特徴とする撮像装置。
  18.  請求項1において、
     前記フォーカス制御部で検出された合焦レンズ位置に基づいて、被写体までの距離情報を求める距離計測部を含むことを特徴とする撮像装置。
  19.  入力画像を取得し、
     前記入力画像に複数のブロックを設定し、
     設定した複数の前記ブロックの各ブロックのコントラスト値を表すブロックコントラスト値情報を算出し、
     設定した複数の前記ブロックの各ブロックの特徴量を算出し、算出した前記特徴量に基づいて、複数の前記ブロックのうち、フォーカス制御において有効である有効ブロックを判定して、前記入力画像の有効ブロック情報を取得し、
     前記入力画像とは合焦物***置の異なるフォーカスレンズ位置において、前記入力画像よりも前のタイミングで撮像された基準画像の前記ブロックコントラスト値情報をコントラスト値保存部から読み出すとともに、前記基準画像の前記有効ブロック情報を有効ブロック情報保存部から読み出し、
     前記基準画像と前記入力画像の両方で前記有効ブロックと判定された前記ブロックの集合を、オートフォーカス領域として設定し、
     前記オートフォーカス領域と前記基準画像の前記ブロックコントラスト値情報から、前記基準画像の画像コントラスト値を求めるとともに、前記オートフォーカス領域と前記入力画像の前記ブロックコントラスト値情報から、前記入力画像の前記画像コントラスト値を求め、
     前記基準画像の前記画像コントラスト値と、前記入力画像の前記画像コントラスト値の比較処理に基づいて、前記フォーカス制御を行うことを特徴とする撮像装置の制御方法。
PCT/JP2013/075868 2013-01-28 2013-09-25 撮像装置及び撮像装置の制御方法 WO2014115372A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP13872928.0A EP2950127A4 (en) 2013-01-28 2013-09-25 IMAGING APPARATUS AND METHOD FOR CONTROLLING THE IMAGING APPARATUS
CN201380071531.3A CN104956246A (zh) 2013-01-28 2013-09-25 摄像装置和摄像装置的控制方法
US14/810,836 US20150334289A1 (en) 2013-01-28 2015-07-28 Imaging device and method for controlling imaging device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2013012814A JP6137847B2 (ja) 2013-01-28 2013-01-28 撮像装置及び撮像装置の制御方法
JP2013-012814 2013-01-28

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/810,836 Continuation US20150334289A1 (en) 2013-01-28 2015-07-28 Imaging device and method for controlling imaging device

Publications (1)

Publication Number Publication Date
WO2014115372A1 true WO2014115372A1 (ja) 2014-07-31

Family

ID=51227179

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2013/075868 WO2014115372A1 (ja) 2013-01-28 2013-09-25 撮像装置及び撮像装置の制御方法

Country Status (5)

Country Link
US (1) US20150334289A1 (ja)
EP (1) EP2950127A4 (ja)
JP (1) JP6137847B2 (ja)
CN (1) CN104956246A (ja)
WO (1) WO2014115372A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018138140A (ja) * 2017-02-24 2018-09-06 ソニー・オリンパスメディカルソリューションズ株式会社 内視鏡装置

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5953049B2 (ja) * 2012-01-24 2016-07-13 オリンパス株式会社 内視鏡システム
CN105629628B (zh) * 2014-10-30 2018-06-22 展讯通信(上海)有限公司 自动对焦方法及装置
JPWO2016088628A1 (ja) * 2014-12-02 2017-04-27 オリンパス株式会社 画像評価装置、内視鏡システム、画像評価装置の作動方法および画像評価装置の作動プログラム
WO2017110260A1 (ja) * 2015-12-22 2017-06-29 富士フイルム株式会社 合焦制御装置、撮像装置、合焦制御方法、及び、合焦制御プログラム
GB2541041B (en) * 2016-01-07 2018-05-09 Imagination Tech Ltd Focus statistics
WO2017122348A1 (ja) * 2016-01-15 2017-07-20 オリンパス株式会社 フォーカス制御装置、内視鏡装置及びフォーカス制御装置の作動方法
JP6670854B2 (ja) * 2016-01-15 2020-03-25 オリンパス株式会社 フォーカス制御装置、内視鏡装置及びフォーカス制御装置の作動方法
CN110062596B (zh) * 2016-12-20 2022-08-16 奥林巴斯株式会社 自动焦点控制装置、内窥镜装置以及自动焦点控制装置的工作方法
CN107049214A (zh) * 2017-04-27 2017-08-18 苏州双威医疗器械科技有限公司 自动调焦显微内窥荧光成像***
JP7079123B2 (ja) * 2018-03-15 2022-06-01 キヤノン株式会社 撮像装置及びその制御方法、撮像システム
WO2020026493A1 (ja) * 2018-07-30 2020-02-06 オリンパス株式会社 内視鏡装置、駆動方法およびプログラム
CN112970242B (zh) * 2018-11-06 2022-10-25 奥林巴斯株式会社 摄像装置、内窥镜装置及摄像装置的工作方法
CN112907500B (zh) * 2019-12-03 2022-02-18 精微视达医疗科技(武汉)有限公司 一种内窥镜对焦方法及装置
CN117479012A (zh) * 2023-10-30 2024-01-30 深圳市维斯登光电有限公司 用于tft-lcd光敏阵列板的自动对焦方法和***

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004294788A (ja) 2003-03-27 2004-10-21 Fuji Photo Optical Co Ltd オートフォーカス機能を備えた電子内視鏡装置
JP2010160297A (ja) * 2009-01-08 2010-07-22 Sony Corp 撮像装置、自動合焦方法、並びにコンピューター・プログラム
JP2011053550A (ja) * 2009-09-03 2011-03-17 Canon Inc 光学機器
JP2011139760A (ja) 2010-01-06 2011-07-21 Olympus Medical Systems Corp 内視鏡システム
WO2012029357A1 (ja) * 2010-08-30 2012-03-08 オリンパスメディカルシステムズ株式会社 内視鏡装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11313240A (ja) * 1998-04-27 1999-11-09 Minolta Co Ltd デジタルカメラの画像処理方法
JP2005309323A (ja) * 2004-04-26 2005-11-04 Kodak Digital Product Center Japan Ltd 撮像用焦点距離検出方法及び撮像装置
JP4364078B2 (ja) * 2004-06-30 2009-11-11 イーストマン コダック カンパニー 撮像方法及び撮像装置
JP2008129554A (ja) * 2006-11-27 2008-06-05 Sanyo Electric Co Ltd 撮像装置及びオートフォーカス制御方法
US8929655B2 (en) * 2008-10-16 2015-01-06 Nikon Corporation Image evaluation apparatus and camera
CN101950063B (zh) * 2009-07-10 2012-08-29 佛山普立华科技有限公司 自动对焦***及自动对焦方法
JP5423287B2 (ja) * 2009-09-29 2014-02-19 リコーイメージング株式会社 撮像装置
JP5888890B2 (ja) * 2011-07-21 2016-03-22 オリンパス株式会社 フォーカス制御装置
JP5993133B2 (ja) * 2011-11-24 2016-09-14 株式会社キーエンス 画像処理センサ、フォーカス調整方法及びコンピュータプログラム

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004294788A (ja) 2003-03-27 2004-10-21 Fuji Photo Optical Co Ltd オートフォーカス機能を備えた電子内視鏡装置
JP2010160297A (ja) * 2009-01-08 2010-07-22 Sony Corp 撮像装置、自動合焦方法、並びにコンピューター・プログラム
JP2011053550A (ja) * 2009-09-03 2011-03-17 Canon Inc 光学機器
JP2011139760A (ja) 2010-01-06 2011-07-21 Olympus Medical Systems Corp 内視鏡システム
WO2012029357A1 (ja) * 2010-08-30 2012-03-08 オリンパスメディカルシステムズ株式会社 内視鏡装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2950127A4

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018138140A (ja) * 2017-02-24 2018-09-06 ソニー・オリンパスメディカルソリューションズ株式会社 内視鏡装置

Also Published As

Publication number Publication date
EP2950127A4 (en) 2016-10-05
JP2014145808A (ja) 2014-08-14
EP2950127A1 (en) 2015-12-02
CN104956246A (zh) 2015-09-30
US20150334289A1 (en) 2015-11-19
JP6137847B2 (ja) 2017-05-31

Similar Documents

Publication Publication Date Title
JP6137847B2 (ja) 撮像装置及び撮像装置の制御方法
JP6137921B2 (ja) 画像処理装置、画像処理方法及びプログラム
JP5149467B2 (ja) 内視鏡装置
JP5953187B2 (ja) 合焦制御装置、内視鏡システム及び合焦制御方法
US10306131B2 (en) Focus detection apparatus and control method therefor
JP6249769B2 (ja) 内視鏡装置、内視鏡装置の作動方法及びプログラム
US9521330B2 (en) Endoscopic image processing device, information storage device and image processing method
JP5374119B2 (ja) 距離情報取得装置、撮像装置、及びプログラム
JP6453905B2 (ja) フォーカス制御装置、内視鏡装置及びフォーカス制御装置の制御方法
JP6124655B2 (ja) 撮像装置、撮像装置の制御方法及びプログラム
JP6103849B2 (ja) 内視鏡装置及び内視鏡装置の作動方法
US20120197079A1 (en) Control device, endoscope apparatus, aperture control method, and information storage medium
US9482855B2 (en) Microscope system
US20210243376A1 (en) Imaging device, endoscope apparatus, and operating method of imaging device
JP6736670B2 (ja) 内視鏡システム
US20190268545A1 (en) Focus control device, focus control method, program, and imaging device
JP2013153813A (ja) 内視鏡装置、画像処理方法及びプログラム
JP2016178608A (ja) 画像処理装置、画像処理方法及びプログラム
JP5881910B2 (ja) 内視鏡装置
JP2011191617A (ja) 撮像装置
JP2013076823A (ja) 画像処理装置、内視鏡システム、画像処理方法及びプログラム
US20210243351A1 (en) Image processing device, image processing method, and program
JP5050282B2 (ja) 合焦検出装置、合焦検出方法および合焦検出プログラム
JP5996462B2 (ja) 画像処理装置、顕微鏡システム及び画像処理方法
JP6653386B2 (ja) 画像処理装置、内視鏡システム、プログラム及び画像処理装置の作動方法

Legal Events

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

Ref document number: 13872928

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2013872928

Country of ref document: EP