Title of Invention: Image processing apparatus, image processing method, and program Abstract: In an image processing apparatus, a defect detection unit detects a defective pixel and a defect level thereof by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by an image sensor with a threshold value for detecting white defective pixels, and/or by comparing a minimum pixel value detected at each pixel position of the plurality of images with a threshold value for detecting black defective pixels. A defective pixel selection unit selects a predetermined plurality of defective pixels with high defect degrees, and registers defect data associated with the predetermined plurality of selected defective pixels in the defect data table. A defect correction unit corrects pixel values of pixels of the image output from the image sensor, in accordance with the defect data registered in the defect data table. Detailed Description: Part general_description_paragraphs: Part CROSS REFERENCES TO RELATED APPLICATIONS: The present invention contains subject matter related to Japanese Patent Application JP 2006-313183 filed in the Japanese Patent Office on Nov. 20, 2006, the entire contents of which are incorporated herein by reference. Part BACKGROUND OF THE INVENTION: 1. Field of the Invention The present invention relates to an image processing apparatus, an image processing method, and an image processing program, and more particularly, to an image processing apparatus, an image processing method, and an image processing program, adapted to correct defective pixels of a still camera or a video camera in a highly reliable manner. 2. Description of the Related Art In a digital still camera, a digital video camera, or a similar camera, an image is taken by sensing the image and converting an optical image signal into a corresponding electric signal using an image sensor (a solid-state image sensor) such as a CCD (Charge Coupled Device) or CMOS (Complementary Metal Oxide Semiconductor) image sensor. All pixels of an image sensor are not necessarily normal, and defect can occur at some pixels. If defects occur, an image output from the image sensor having defective pixels has deviations of pixel values from correct values at defective pixels, which cause the image to become unnatural. Note that defects occur at pixels of the image sensor, and the defects of the image sensor cause an image output from the image sensor to have abnormal dots corresponding to the defective pixels. However, hereinafter, for convenience of explanation, a state in which an image sensor has defective pixels will also be described as “an image has defective pixels”. To prevent a camera from producing an unnatural image caused by defective pixels, it is desirable to detect defective pixels and correct pixel values of the detected defective pixels. Detection of defective pixels and correction of pixel values of defective pixels may be performed, for example, as follows. One method of detecting defective pixels is to compare a pixel value of each pixel of an image taken by an image sensor (hereinafter, referred to simple as an image) with a predetermined threshold value and determine, on the basis of the comparison result, whether each pixel is defective. One method of correcting pixel values of defective pixels is to determine a correct pixel value of each defective pixel from pixel values of pixels located close to the defective pixel according to a proper algorithm. Another method is to determine a correct pixel value of each defective pixel depending on a defective level indicating the degree of defect of each defective pixel. The threshold value for detecting defective pixels may be a fixed threshold value determined in advance or a variable threshold value dynamically determined depending on pixel values of pixels located close to a pixel of interest being subjected to the comparison of the pixel value with respect to the threshold value. In the method of determining whether a pixel of interest of an image is defective by comparing the pixel value of the pixel of interest with the predetermined threshold value, if the threshold value is dynamically determined depending on pixel values of pixels located close to the pixel of interest, then the method is equivalent to a method in which a predictive pixel value is determined based on pixel values of pixels located close to the pixel of interest, and the determination as to whether the pixel of interest is defective is made by judging whether the difference between the pixel value of the pixel of interest and the predictive pixel value is within an allowable small range. For example, in a case where the threshold value is set to be equal to a pixel value p of a pixel adjacent to the pixel of interest plus a fixed margin C, that is, the threshold value is set to p+C, if the pixel of interest has a pixel value v, then the determination as to whether the pixel of interest is defective or not by judging whether the pixel value v is greater than the threshold value p+C is equivalent to the determination made by employing the pixel value p of the pixel adjacent to the pixel of interest as the predictive pixel value and judging whether the difference (v−p) between the pixel value v of the pixel of interest and the predictive pixel value p is within a small range equal to the margin C. The determination as to whether the pixel of interest is defective is made, as described above, on the basis of the relative magnitude of the pixel value of the pixel of interest with respect to the threshold value. This means that if a defective pixel has a pixel value close to the threshold value, a fluctuation of the pixel value can cause the determination as to whether the pixel of interest is defective to fluctuate between affirmative and negative conclusions. One technique to prevent the above problem and improve reliability in detection of defective pixels is to evaluate the pixel value of each pixel a plurality of times. More specifically, the pixel value of each pixel is compared with the threshold value for each of a plurality of images captured by the image sensor via an image taking operation performed a plurality of times. If the number of occurrences of detection of defect at a particular pixel position is greater than a predetermined value, then the pixel at this pixel position is determined to be defective (see, for example, Japanese Unexamined Patent Application Publication No. 04-115785 or Japanese Unexamined Patent Application Publication No. 2005-341244). Part SUMMARY OF THE INVENTION: Defective pixels can be classified into two types, i.e., permanent defective pixels and intermittent defective pixels. The permanent defective pixels are always in a state in which pixels are defective. In contrast, the intermittent defective pixels are in a defective state at some times but are in a non-defective state at other times. Therefore, in the method in which the number of occurrences of detection of a defective state at each pixel position is counted, and if the number of occurrences of defective state detection for a particular pixel is greater than a threshold value, this pixel is regarded as a defective pixel, there is a possibility that intermittent defective pixels are incorrectly regarded as non-defective pixels. The higher the frequency of occurrence of defective state of intermittent defective pixels, the greater the number of occurrences of detection of defect and thus the higher the probability that intermittent defective pixels are detected as defective pixels. Conversely, the lower the frequency of occurrence of defective state of intermittent defective pixels, the smaller the number of occurrences of detection of defect and thus the lower the probability that intermittent defective pixels are detected as defective pixels. Furthermore, in the method of detecting defective pixels based on the number of occurrences of detection of defect, there is a possibility that, depending on the reference value, intermittent defective pixels with a low frequency of occurrence of defective state are not detected as defective pixels. In the method of detecting defective pixels based on the number of occurrences of detection of defect, as described above, intermittent defective pixels with a high frequency of occurrence of defective state and with a low defective level are detected as defective pixels with a high probability, but intermittent defective pixels with a low frequency of occurrence of defective state and with a high defective level are low in probability of being detected as defective pixels. Thus, although intermittent defective pixels with low defective levels detected as defective pixels are corrected, intermittent defective pixels with high defective levels which are not detected as defective pixels are not corrected. In an image, defective pixels which are high in defect level are more conspicuous than defective pixels which are low in defect level. Therefore, it is desirable to correct pixel values of defective pixels in decreasing order of defect level starting with the defective pixel with the highest defect level. In view of the above, it is desirable to provide a technique to correct defective pixels in a highly reliable manner. According to an embodiment of the present invention, there is provided an image processing apparatus adapted to process an image output from image sensing means, including defect detection means for detecting a defective pixel, and defect correction means for correcting a pixel value of a pixel of the image output from the image sensing means, in accordance with a defect data table in which defect data associated with the defective pixel detected by the defect detection means is registered, wherein the defect detection means includes at least one of white defect detection means and black defect detection means, the white defect detection means being adapted to detect a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by the image sensing means with a threshold value for detecting white defect, the black defect detection means being adapted to detect a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a minimum pixel value detected at each pixel position of the plurality of images with a threshold value for detecting black defect, and the defect detection means also includes defective pixel selection means for selecting, based on the defect levels, a predetermined plurality of defective pixels with high defect degrees, and registering defect data associated with the predetermined plurality of selected defective pixels in the defect data table. According to an embodiment of the present invention, there is provided a method/computer program of processing an image output from image sensing means, including the steps of detecting a defective pixel, and correcting a pixel value of a pixel of the image output from the image sensing means, in accordance with a defect data table in which defect data associated with the defective pixel detected in the defective pixel detection step is registered, wherein the defect detection step includes at least one of a white defect detection step and a black defect detection step, the white defect detection step including detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by the image sensing means with a threshold value for detecting white defect, the black defect detection step including detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a minimum pixel value detected at each pixel position of the plurality of images with a threshold value for detecting black defect, and the step of selecting, based on the defect levels, a predetermined plurality of defective pixels with high defect degrees, and registering defect data associated with the predetermined plurality of selected defective pixels in the defect data table. In the image processing apparatus and the image processing method/program, defective pixels are detected, and pixel values of pixels of the image output from the image sensing means are corrected in accordance with the defect data table in which defect data associated with defective pixels is registered. The detection of defective pixels includes at least one or both of a white defect detection process or a black defect detection process. The white defect detection process includes detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by the image sensing means with the threshold value for detecting white defect. The black defect detection process includes detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a minimum pixel value detected at each pixel position of the plurality of images with the threshold value for detecting black defect. Based on the defect levels, a predetermined plurality of defective pixels with high defect degrees are selected, and defect data associated with the predetermined plurality of selected defective pixels is registered in the defect data table. The computer program may be supplied via a transmission medium or a storage medium. The present invention makes it possible to correct pixel values of defective pixels in a highly reliable manner. Part DESCRIPTION OF THE PREFERRED EMBODIMENTS: Before describing an embodiment of the present invention, the correspondence between the features of the invention and the specific elements disclosed in embodiments of the present invention is discussed below. This description is intended to assure that embodiments supporting the invention are described in this specification. Thus, even if an element in the following embodiments is not described as relating to a certain feature of the present invention, that does not necessarily mean that the element does not relate to that feature of the claims. Conversely, even if an element is described herein as relating to a certain feature of the invention, that does not necessarily mean that the element does not relate to other features of the invention. According to an embodiment of the present invention, there is provided an image processing apparatus (for example, a digital still camera shown in FIG. 1) adapted to process an image output from image sensing means (for example, an image sensor 4 shown in FIG. 4) including defect detection means (for example, a defect detection unit 103 shown in FIG. 4 or a defect detection unit 303 shown in FIG. 28) for detecting a defective pixel, and defect correction means (for example, a defect correction unit 101 shown in FIG. 4 or a defect correction unit 201 shown in FIG. 28) for correcting a pixel value of a pixel of the image output from the image sensing means, in accordance with a defect data table in which defect data associated with the defective pixel detected by the defect detection means is registered. In this image processing apparatus, the defect detection means includes at least one of white defect detection means (for example, a white defect detection unit 121 shown in FIG. 5 or a white defect detection unit 321 shown in FIG. 29) and black defect detection means (for example, a black defect detection unit 122 shown in FIG. 5 or a black defect detection unit 322 shown in FIG. 29), wherein the white defect detection means is adapted to detect a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by the image sensing means with a threshold value for detecting white defect, and the black defect detection means is adapted to detect a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a minimum pixel value detected at each pixel position of the plurality of images with a threshold value for detecting black defect. The defect detection means further includes defective pixel selection means (for example, a defective pixel selection unit 123 shown in FIG. 5 or a defective pixel selection unit 323 shown in FIG. 29) for selecting, based on the defect levels, a predetermined plurality of defective pixels with high defect degrees, and registering defect data associated with the predetermined plurality of selected defective pixels in the defect data table. According to an embodiment of the present invention, there is provided a method/computer program of processing an image output from image sensing means, including the steps of detecting a defective pixel (for example, in a defect detection process shown in FIG. 14 or 31), and correcting a pixel value of a pixel of the image output from the image sensing means, in accordance with a defect data table in which defect data associated with the defective pixel detected by the defective pixel detection step is registered (for example, in a defect correction process shown in FIG. 17, 26 or 27). In this image processing method/program, the defect detection step includes at least one of a white defect detection step (for example, step S11 shown in FIG. 14 or step S151 shown in FIG. 31) and a black defect detection step (for example, step S12 shown in FIG. 14 or step S152 shown in FIG. 31), wherein the white defect detection step includes detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a maximum pixel value detected at each pixel position of a plurality of images captured via an image taking operation performed a plurality of times by the image sensing means with a threshold value for detecting white defect, and the black defect detection step includes detecting a defective pixel and a defect level indicating the degree of a defect of the detected defective pixel, by comparing a minimum pixel value detected at each pixel position of the plurality of images with a threshold value for detecting black defect. The defect detection step further includes the step (for example, step S13 or S14 shown in FIG. 14 or step S153 or S154 shown in FIG. 31) of selecting, based on the defect levels, a predetermined plurality of defective pixels with high defect degrees, and registering defect data associated with the predetermined plurality of selected defective pixels in the defect data table. Now, specific embodiments of the present invention are described below with reference to the accompanying drawings. FIG. 1 illustrates an example of a configuration of a digital still camera according to an embodiment of the present invention. A lens unit 1 including a focusing lens, a zoom lens, and other lenses serves to focus incident light on an image sensor 4 via a diaphragm 2 and a shutter 3. The diaphragm 2 adjusts the amount of light incident on the image sensor 4 via the lens unit 1, by controlling the size of an aperture via which the light passes. The shutter 3 controls an exposure time by blocking the light incident on the image sensor 4. The shutter 3 may be removed when the diaphragm 2 is configured to function also as a shutter. The image sensor 4 is implemented by a CCD or CMOS imager, and serves to sense an image and output an electric signal corresponding to the image. More specifically, the image sensor 4 performs a photoelectric conversion in accordance with a driving pulse output from a timing generator 5 such that light incident on the image sensor 4 is converted into an electric signal corresponding to the amount of incident light and the resultant electric signal is output as an image signal. The image signal output from the image sensor 4 is supplied to a front end unit 6. On a surface, on which light is incident, of the image sensor 4, a plurality of color filters (not shown) are disposed, for example, in the form of a Bayer array such that each pixel of the image sensor 4 receives light with a particular color and outputs a pixel value of the particular color. The timing generator 5 outputs driving pulses in synchronization with a horizontal synchronizing signal and a vertical synchronizing signal to drive the image sensor 4. When the image sensor 4 has an electronic shutter function, the timing generator 5 also controls the electronic shutter operation. By controlling the electronic shutter to operate at a high or low speed, it is possible to control the light exposure. The front end unit 6 includes a sample-and-hold circuit, a gain control circuit, and an analog-to-digital converter, and serves to perform pre-processing on the image signal supplied from the image sensor 4. More specifically, in the front end unit 6, the image signal output from the image sensor 4 is subjected to double-correlation sampling for removing noise, and gain control processing for adjusting a signal level, and a resultant analog image signal is subjected to an analog-to-digital conversion. The obtained digital image data is output from the front end unit 6 to a camera system LSI (Large Scale Integration) 7. In the camera system LSI 7, the image data supplied from the front end unit 6 is subjected to camera signal processing including a defect correction, digital clamping, a white balance correction, a gamma correction, and interpolation. The image data including RGB (Red, Green, and Blue) pixel values obtained as a result of the camera signal processing is supplied to an image monitor 8. The camera system LSI 7 further converts the RGB image data into image data including a luminance signal Y and color difference signals Cb and Cr. As required, the camera system LSI 7 encodes image data according to, for example, the JPEG (Joint Photographic Experts Group) standard, and supplies resultant encoded data to an image memory 9 or an external storage medium 10. The camera system LSI 7 reads the encoded data from the image memory 9 or the external storage medium 10, decodes the read data into image data, and supplies the resultant image data to the image monitor 8. The image monitor 8 is implemented, for example, by a liquid crystal panel and serves to display an image in accordance with the image data supplied from the camera system LSI 7. A user, who operates the digital still camera, can check composition by viewing the image displayed on the image monitor 8. The image memory 9 is implemented by, for example, a semiconductor memory such as SDRAM (Synchronous Dynamic Random Access Memory), and serves to temporarily store the encoded data supplied from the camera system LSI 7 and other data necessary in processing performed by the camera system LSI 7. The external storage medium 10 is, for example, a semiconductor memory removably attached to the digital still camera shown in FIG. 1, and serves to store the encoded data supplied from the camera system LSI 7. The external storage medium 10 can be removed from the digital still camera and can be carried by a user. A microcomputer 11 executes a program stored in a ROM (Read Only Memory) 13 or a nonvolatile memory 14 to control the diaphragm 2, the shutter 3, the timing generator 5, the front end unit 6, and the camera system LSI 7. An operation unit 12 includes a shutter button which is operated to capture image data sensed by the image sensor 4 and store the captured image data into the external storage medium 10, a zoom button which is operated to adjust zooming, and other various buttons. When one of these buttons is operated by a user, an operation signal corresponding to the operation performed by the user is supplied to the microcomputer 11. The ROM 13 serves to store a program executed by the microcomputer 11 and data necessary in the execution of the program. The nonvolatile memory 14 stores a program executed by the microcomputer 11. The nonvolatile memory 14 also stores data necessary in various processes performed by the microcomputer 11. FIG. 2 illustrates an example of a configuration of the camera system LSI 7 shown in FIG. 1. The camera system LSI 7 includes a camera signal processing unit 31, an image detector 32, a microcomputer interface 33, a memory interface 34, a memory controller 35, an image compressing/decompressing unit 36, and a monitor interface 37. In the camera system LSI 7, the above-described parts such as the camera signal processing unit 31 and the monitor interface 37 are connected to each other via a data bus so that image data, control data, and other data can be transmitted among them. The camera signal processing unit 31 corrects defects of image data supplied from the image sensor 4 via the front end unit 6. The camera signal processing unit 31 also performs digital signal processing including interpolation, filtering, matrix processing, luminance signal generation, and color signal generation, on the input image data, thereby producing image data including pixel values each expressed by a luminance signal and color difference signals (color signals). The image detector 32 performs a detection process on the image data supplied from the image sensor 4 via the front end unit 6 to obtain reference values used in automatic focus (AF) control, automatic exposure (AE) control, and automatic white balance (AWB) control. The microcomputer interface 33 functions as an interface with the microcomputer 11. Transmission of image data or control data between the camera system LSI 7 and the microcomputer 11 is performed via the microcomputer interface 33. The memory interface 34 functions as an interface with the image memory 9 or the external storage medium 10. That is, transmission of image data (which may be in an encoded form) between the camera system LSI 7 and the image memory 9 or the external storage medium 10 is performed via the memory interface 34. The memory controller 35 controls transmission of image data among various blocks of the camera system LSI 7 (via a data bus). The image compressing/decompressing unit 36 encodes supplied image data into a compressed form and outputs the resultant encoded data. When the image compressing/decompressing unit 36 receives encoded data, the image compressing/decompressing unit 36 decodes the supplied encoded data into a decompressed form of image data, and outputs the resultant image data. The monitor interface 37 converts supplied image data into a format for use by the image monitor 8 (FIG. 1), and supplies the resultant image data in the converted format to the image monitor 8. For example, when the image monitor 8 is configured to display an image according to the NTSC (National Television System Committee) standard, a NTSC encoder is used as the monitor interface 37. FIG. 3 illustrates an example of a configuration of the camera signal processing unit 31 shown in FIG. 2. The camera signal processing unit 31 includes a defect handling unit 51 and a digital signal processing unit 52. When image data is supplied to the camera signal processing unit 31 from the image sensor 4 via the front end unit 6, the image data is supplied to the defect handling unit 51. The defect handling unit 51 performs, on the image data supplied from the image sensor 4, a defect detection process to detect a defective pixel and a defect correction process to correct a pixel value of the detected defective pixel, as required, and supplies the resultant image data to the digital signal processing unit 52. The digital signal processing unit 52 performs a digital signal process such as an interpolation process on the image data supplied from the defect handling unit 51, and outputs resultant image data including pixel values each expressed by a luminance signal and color difference signals. The defect handling unit 51 and the digital signal processing unit 52 are controlled by the microcomputer 11 via the microcomputer interface 33. If a user operates the operation unit 12 to issue a command to perform the defect detection process, a defect detection command signal is output from the operation unit 12 as an operation signal corresponding to the operation performed by the user, and supplied to the defect handling unit 51 via the microcomputer 11 and the microcomputer interface 33. If the defect handling unit 51 receives the defect detection command signal from the microcomputer interface 33, the defect handling unit 51 performs the defect detection process. FIG. 4 illustrates an example of a configuration of the defect handling unit 51 shown in FIG. 3. In the example shown in FIG. 4, the defect handling unit 51 includes a defect correction unit 101, a defect data table memory 102, and a defect detection unit 103. The defect correction unit 101 receives image data output from the image sensor 4 (FIG. 1) via the front end unit 6. Hereinafter, such image data output from the image sensor 4 will be referred to simply as image data. The defect correction unit 101 performs a defect correction process to correct pixel values of the image data output from the image sensor 4 in accordance with defect data of defective pixels registered in a defect data table stored in the defect data table memory 102, and the defect correction unit 101 supplies corrected image data obtained as a result of the defect correction process to the digital signal processing unit 52 (FIG. 3). The defect data table memory 102 stores the defect data table in which defect data associated with defective pixels detected by the defect detection unit 103 is described. The defect data table memory 102 may be implemented using, for example, a nonvolatile memory such as a RAM (Random Access Memory) or an EEPROM (Electrically Erasable Programmable Read-only Memory). In the case in which the defect data table memory 102 is implemented using a nonvolatile memory, the defect data table is read from the nonvolatile memory 14 shown in FIG. 1 into the defect data table memory 102 in the defect handling unit 51 of the camera signal processing unit 31 (FIG. 3) via the microcomputer 11 (FIG. 1) and the microcomputer interface 33 (FIG. 2) each time the power of the digital still camera shown in FIG. 1 is turned on. In the case where the defect data table is stored in the nonvolatile memory 14 shown in FIG. 1, the defect data table may be encoded into a compressed form and the encoded defect data table may be stored in the nonvolatile memory 14. In this case, when the defect data table is read into the defect data table memory 102, the encoded defect data table is decoded into a decompressed form and the resultant decoded defect data table is stored in the defect data table memory 102. The encoding and the decoding of the defect data table may be performed by the microcomputer 11 (FIG. 17). The defect detection unit 103 is supplied with test image data to be used in the defect pixel detection process. As for the test image data, image data which is output from the image sensor 4 and which is not yet subjected to the defect correction process may be employed, or image data which is output from the image sensor 4 and which has been subjected to the defect correction process performed by the defect correction unit 101 may be employed. If the defect detection unit 103 receives test image data, the defect detection unit 103 performs the defect detection process to detect defective pixels, and the defect detection unit 103 registers defect data associated with detected defective pixels in the defect data table in the defect data table memory 102. The defect detection process and the defect correction process performed by the defect handling unit 51 configured in the above-described manner are explained in further detail below. If a user operates the operation unit 12 shown in FIG. 1 to issue a command to perform the defect detection process, a defect detection command signal is output from the operation unit 12 as an operation signal corresponding to the operation performed by the user, and supplied to the microcomputer 11. If the microcomputer 11 receives the defect detection command signal from the operation unit 12, the microcomputer 11 switches an operation mode from a normal mode in which an image is taken in a normal manner into a defect detection mode to detect defects. The microcomputer 11 then controls the timing generator 5 (FIG. 1) so that the image sensor 4 takes an image a plurality of times. A plurality of frames of image data or corrected image data obtained as a result of the image taking operation performed by the image sensor 4 are supplied as test image data to the defect detection unit 103. The microcomputer 11 controls, via the microcomputer interface 33 (FIG. 2), the defect detection unit 103 of the defect handling unit 51 in the camera signal processing unit 31 to perform the defect detection process. Under the control of the microcomputer 11, the defect detection unit 103 performs the defect detection process as described below. If the defect detection unit 103 receives the plurality of frames of test image data from the image sensor 4, the defect detection unit 103 detects defective pixels and registers defect data associated with detected defective pixels in the defect data table in the defect data table memory 102. If the defect detection unit 103 has registered defect data in the defect data table, the microcomputer 11 switches the operation mode from the defect detection mode to the normal mode. In a case where the defect data table in the defect data table memory 102 has existing defect data, new defect data produced by the defect detection unit 103 is stored in the defect data table such that the existing defect data is overwritten by the new defect data. In the operation in the normal mode, if the image sensor 4 takes an image, and resultant image data is supplied to the defect correction unit 101, the defect correction unit 101 performs the defect correction process. More specifically, the defect correction unit 101 corrects, as required, pixel values of the received test image data in accordance with the defect data table stored in the defect data table memory 102, and supplies corrected image data obtained as a result of the defect correction process to the digital signal processing unit 52 (FIG. 3). FIG. 5 illustrates an example of a configuration of the defect detection unit 103 shown in FIG. 4. The defect detection unit 103 includes a white defect detection unit 121, a black defect detection unit 122, and a defective pixel selection unit 123. The white defect detection unit 121 includes a maximum value detection unit 130 and a defective pixel detection unit 134, and serves to detect defective pixels having a pixel value higher than a normal pixel value (hereinafter such a defective pixel will be referred to as a white defective pixel) by comparing a maximum pixel value detected at each pixel of test image data captured via an image taking operation performed a plurality of times by the image sensor 4 with a threshold value for detecting white defect. When a defective pixel is detected, the white defect detection unit 121 also detects a defect level indicating the degree of the defect of the defective pixel. More specifically, in the process described above, if the maximum value detection unit 130 receives a plurality of frames of test image data obtained via the test image taking operation performed a plurality of times by the image sensor 4, the maximum value detection unit 130 including a comparator 131, a pixel selection unit 132, and a frame memory 133 detects a maximum value of pixel values at each pixel position of the plurality of frames of the test image data. More specifically, in the maximum value detection process described above, the comparator 131 compares a pixel value of each pixel of the test image data supplied to the white defect detection unit 121 with a pixel value of a corresponding pixel already stored in the frame memory 133. The comparator 131 detects a greater pixel value of the two pixel values of each pixel and supplies the detected greater pixel value to the pixel selection unit 132. In addition to the pixel value supplied from the comparator 131, the pixel selection unit 132 also receives pixel values of the pixel of interest of the test image data supplied to the white defect detection unit 121. For a first frame of test image data of the plurality of frames of test image data supplied to white defect detection unit 121 in the defect detection mode, the pixel selection unit 132 selects a pixel value of the pixel of interest of the first frame and supplies the selected pixel value to the frame memory 133. For a second and following frames of image data of the plurality of frames of image data supplied to white defect detection unit 121 in the defect detection mode, the pixel selection unit 132 selects the pixel value supplied from the comparator 131 and supplies the selected pixel value to the frame memory 133. The frame memory 133 stores the pixel value supplied from the pixel selection unit 132 as the pixel value of the pixel of interest. The defective pixel detection unit 134 compares the pixel value stored in the frame memory 133 with the threshold value for detecting white defect. If the pixel value stored in the frame memory 133 is equal to or greater than the threshold value for detecting white defect, the pixel corresponding to this pixel value is determined to be a white defective pixel. The defective pixel detection unit 134 further detects the defect level of the white defective pixel, defined by the difference between the pixel value of the white defective pixel and the threshold value for detecting white defect. The defective pixel detection unit 134 supplies defect pixel coordinates indicating the location of the white defective pixel and the defect level, as the defect data associated with the white defective pixel, to the defective pixel selection unit 123. Note that the test image data used in the detection of black defective pixels performed by the white defect detection unit 121 is obtained by capturing an image of a subject by the image sensor 4 by performing an image taking operation a plurality of times in a state in which the shutter 3 (FIG. 1) is closed. The pixel value of each pixel of image data captured by the image sensor 4 in the state in which the shutter 3 is closed corresponds to a black level if the pixel is not defective. Therefore, it is reasonable to set the threshold value for detecting white defects to a minimum value which cannot be regarded as the black level. Alternatively, the threshold value for detecting white defect may be determined based on pixel values of pixels located close to a pixel of interest under test. The black defect detection unit 122 includes a minimum value detection unit 140 and a defective pixel detection unit 144, and serves to detect defective pixels having a pixel value lower than a normal pixel value (hereinafter such a defective pixel will be referred to as a black defective pixel) by comparing a minimum pixel value detected at each pixel of test image data captured via an image taking operation performed a plurality of times by the image sensor 4 with a threshold value for detecting black defect. When a defective pixel is detected, the black defect detection unit 122 also detects a defect level indicating the degree of the defect of the defective pixel. More specifically, in the process described above, the minimum value detection unit 140 receives a plurality of frames of test image data obtained via the test image taking operation performed a plurality of times by the image sensor 4. The minimum value detection unit 140 includes a comparator 141, a pixel selection unit 142, and a frame memory 143, and detects a minimum value of pixel values obtained at each pixel position of the plurality of frames of test image data. More specifically, in the minimum value detection process described above, the comparator 141 compares a pixel value of each pixel of the test image data supplied to the black defect detection unit 122 with a pixel value of a corresponding pixel already stored in the frame memory 143. The comparator 141 detects a smaller pixel value of the two pixel values of each pixel and supplies the detected smaller pixel value to the pixel selection unit 142. In addition to the pixel value supplied from the comparator 141, the pixel selection unit 142 also receives pixel values of the pixel of interest of the test image data supplied to the black defect detection unit 122. For a first frame of test image data of the plurality of frames of test image data in the defect detection mode, the pixel selection unit 142 selects a pixel value of the pixel of interest of the first frame and supplies the selected pixel value to the frame memory 143. For a second and following frames of test image data of the plurality of frames of test image data in the defect detection mode, the pixel selection unit 142 selects the pixel value supplied from the comparator 141 and supplies the selected pixel value to the frame memory 143. The frame memory 143 stores the pixel value supplied from the pixel selection unit 142 as the pixel value of the pixel of interest. The defective pixel detection unit 144 compares the pixel value stored in the frame memory 143 with the threshold value for detecting black defect. If the pixel value stored in the frame memory 143 is equal to or greater than the threshold value for detecting black defect, the pixel corresponding to this pixel value is determined to be a black defective pixel. The defective pixel detection unit 144 further detects the defect level of the black defective pixel, defined by the difference between the pixel value of the black defective pixel and the threshold value for detecting black defect. The defective pixel detection unit 144 supplies defect pixel coordinates indicating the location of the black defective pixel and the defect level, as the defect data associated with the black defective pixel, to the defective pixel selection unit 123. Note that the test image data used in the detection of black defective pixels performed by the black defect detection unit 122 is obtained by capturing an image of a white subject such as white paper by the image sensor 4 by performing an image taking operation a plurality of times in a state in which the shutter 3 (FIG. 1) is open. The pixel value of each pixel of image data captured by the image sensor 4 for the white subject corresponds to a white level if the pixel is not defective. Therefore, it is reasonable to set the threshold value for detecting black defect to a maximum value which cannot be regarded as the white level. Alternatively, the threshold value for detecting black defect may be determined based on pixel values of pixels located close to a pixel of interest under the test. As described above, the defective pixel selection unit 123 receives defect data indicating defect pixel coordinates and defect levels of defective pixels from the white defect detection unit 121 and the black defect detection unit 122. On the basis of defect levels indicated by the defect data, the defective pixel selection unit 123 selects a predetermined number, N, of defective pixels with large defect levels and supplies defect data of the selected N defective pixels to the defect data table memory 102. The defect data table memory 102 registers the received defect data in the defect data table. In a case where the number of defect data or defective pixels supplied from the white defect detection unit 121 and the black defect detection unit 122 is smaller than the predetermined number N, the defective pixel selection unit 123 selects all defective pixels and registers the defect data of all defective pixels in the defect data table. The number N may be determined, for example, depending on the storage capacity of the defect data table memory 102. The detection of defective pixels (white defective pixels and black defective pixels) performed by the defective pixel detection units 134 and 144 shown in FIG. 5 is explained in further detail below. Defective pixels may be detected using a fixed threshold value or a variable threshold value. Hereinafter, the former defect detection method will be referred to simply as an absolute defect detection method, and the latter defect detection method will be referred to as a relative defect detection method. Referring to FIG. 6, absolute defect detection of white defective pixels using a fixed threshold value is described below. FIG. 6 illustrates examples of pixel values of five successive pixels GL, RL, GC, RR, and GR arranged in a horizontal direction in a Bayer array. Of these five pixels GL, RL, GC, RR, and GR, pixels GL, GC, and GR each have a pixel value of a G component, while pixels RL and RR each have a pixel value of a R component. In the absolute defect detection of white defective pixels, the threshold value for use in detection of white defective pixels is set to a fixed value, and a pixel value of a pixel of interest is compared with this fixed threshold value. If the pixel value of the pixel of interest is equal to or greater than the fixed threshold value, then this pixel of interest is determined to be a white defective pixel. In the example shown in FIG. 6, the pixel GC located in the center of the horizontal arrangement of five pixels GL, RL, GC, RR, and GR has a pixel value greater than the fixed threshold value defined as the threshold value for use in detection of white defective pixels, and thus the pixel GC is determined to be a white defective pixel. The fixed threshold value for use in detection of white defective pixels may be set, for example, to the minimum value which cannot be regarded as a black level. Alternatively, the fixed threshold value for use in detection of white defective pixels may be set to a value determined based on a frequency distribution of defect levels. FIG. 7 illustrates an example of a frequency distribution of defect levels. In a case where the specifications of the digital still camera shown in FIG. 1 require image quality that can be achieved by correcting at least N′ defective pixels with highest defect levels in the frequency distribution of defect levels, the fixed threshold value for use in detection of white defective pixels in a production line of the digital still camera shown in FIG. 1 may be set so that N (≧N′) pixels with highest defect levels in the frequency distribution of defect levels are detected as defect levels. Referring to FIG. 8, an example of the relative defect detection of white defective pixels using a variable threshold value as the threshold value for use in detection of white defective pixels is described below. FIG. 8 illustrates examples of pixel values of five successive pixels GL, RL, GC, RR, and GR arranged in a horizontal direction in a Bayer array. When the pixel GC located in the center of the horizontal arrangement of five pixels GL, RL, GC, RR, and GR is a pixel of interest being subjected to comparison of pixel value with the threshold value defined for use in detection of white defective pixels, a predictive value for the pixel value of the pixel GC of interest is given, for example, by the average value of pixel values of pixels located close to the pixel of interest and having the same color component as that of the pixel of interest, and more specifically, in the present example, by the average value of pixel values of pixels GL and GR. The variable threshold value for use in detection of white defective pixels is set to the sum of the predictive value of the pixel value of the pixel GC of interest and a fixed margin W (>0). The pixel value of the pixel GC of interest is then compared with the variable threshold value defined above. If the pixel value of the pixel of interest is equal to or greater than the threshold value, the pixel of interest is regarded as a white defective pixel. In the
{'bibliographic_information': "{'country': 'US', 'doc-number': '11866717', 'kind': 'B2', 'date': '20071003', 'extension': '532', 'invention_title': 'Image processing apparatus, image processing method, and program'}", 'source_file': './grant/2011/ipg110125.xml', 'source_data': 'USPTO-Grant'}