The present application claims priority from Japanese Patent Application No. JP 2005-293917 filed on Oct. 6, 2005, the disclosure of which is hereby incorporated by reference herein.
1. Field of the Invention
The present invention relates to an image processing apparatus for searching an image and, in particular, to an image processing apparatus, an image processing method, and a computer program for searching for an image similar to a template image at a high speed.
2. Description of the Related Art
As prices of memories are reduced and technology of the memory advances, the capacity of memories in image pickup apparatuses such as digital still cameras and digital video cameras increases. The number of still images and moving images stored on the image pickup apparatuses also increases. Under this circumference, any user has difficulty in finding desired still images and moving images. Japanese Unexamined Patent Application Publication No. 8-263522 discloses an image search method to overcome such a drawback. In accordance with the disclosed image search method, the user designates a desired image as a template image and searches for an image matching the template image from among images to be searched.
From the standpoint of miniaturization and low-cost design, high-performance central processing units (CPUs) are difficult to mount on the image pickup apparatus. Even if the above-described image search method is incorporated in an image pickup apparatus, search processing takes an unrealistically long time. There is a need for reducing time required for search processing. It is not only necessary to reduce search processing time but also necessary to maintain search accuracy level.
It is thus desirable to provide an image processing apparatus that performs image search at a high speed and high accuracy level.
In accordance with one embodiment of the present invention, an image processing apparatus includes a target image storage unit operable to store a plurality of target images as objects to be searched; an area selection receiving unit operable to receive a selection of a predetermined area corresponding to one of the plurality of target images; a template image generating unit operable to generate as a template image the image of the predetermined area; an image reducing unit operable to reduce the template image and the one target image at a reduction ratio corresponding to a vertical height and a horizontal width of the template image; and a similar image searching unit operable to search the reduced target image containing an image similar to the reduced template image in accordance with a genetic algorithm. The template image and the one target image are reduced at a reduction ratio corresponding to the horizontal width and the vertical height of the selected template image, and target images containing an image similar to the template image are searched for. By reducing the template image and the one target image, the areas of the template image and the target image to be matched against each other are reduced, and an amount of calculation required for matching is decreased.
The image reducing unit may not reduce the template image and the one target image if a product of the vertical height and the horizontal width of the template image is not more than a predetermined value. Even when the horizontal width and the vertical height of the selected template image are small, search accuracy level is maintained.
The template image generating unit may generate, as the template image, an image in which the predetermined selected area is expanded or reduced at a predetermined magnification ratio. Images similar to the template image that are expanded, reduced or rotated are thus searched for.
The similar image searching unit may include an individual extracting unit operable to extract a plurality of individuals in a random fashion from the reduced target image in order to generate a chromosome having chromosome information based on coordinates of the individual and the predetermined magnification ratio used to form the template image; an adaptivity calculating unit operable to calculate an adaptivity of the chromosome based on the chromosome information and a pixel value; a genetic algorithm processing unit operable to perform at least one of a selection process, a hybridization process, or a mutation process on the chromosome in order to generate a chromosome having new chromosome information, and to cause the adaptivity calculating unit to calculate an adaptivity of the chromosome having the new chromosome information; a process end indicating unit operable to indicate a process end to the process repeatedly performed in a predetermined condition by the genetic algorithm processing unit; a quasi-optimal solution determining unit operable to determine, as a quasi-optimal solution, an adaptivity having the largest value from among the adaptivities calculated last by the adaptivity calculating unit; and a similar image determining unit operable to determine that the reduced target image contains an image similar to the reduced template image when the largest one of the quasi-optimal solution is above a first threshold value. The first threshold value serves as a reference according to which the similar image determining unit determines whether the template image is contained in the target image. More specifically, if the value of the adaptivity as the quasi-optimal solution is above the first threshold value, the template image is contained in the target image. If the value of the adaptivity as the quasi-optimal solution is not above the first threshold value, the template image is not contained in the target image. In this way, information regarding an area where the template image is matched against the target image in accordance with the genetic algorithm is imparted to the chromosome. Based on the adaptivity of the chromosome, the target images containing the image similar to the template image are searched for at a high speed.
The pixel value may be a quantity expressed using one of YUV, RGB, and HSV. The adaptivity of the chromosome in accordance with the genetic algorithm is calculated based on YUV, RGB, and HSV.
The image processing apparatus may include an adaptivity calculation pre-processing unit operable to calculate the absolute value of a difference between the mean value of the pixel values in an area corresponding to the chromosome in the target image and the mean value of the pixel values in an area in the template image, and to determine whether the absolute value of the difference is above a second threshold value, wherein the adaptivity calculating unit sets, as the adaptivity, a value small enough to be excluded as the object to be determined by the similar image determining unit when the adaptivity calculation pre-processing unit determines that the absolute value of the difference is above the second threshold value. The second threshold value serves as a reference when the adaptivity is evaluated based on the absolute value of the difference between the mean value of the pixels in the area corresponding to the chromosome in the target image and the mean value of the pixel values in the area of the template image. In this way, the adaptivity of the chromosome in the genetic algorithm is determined using a method requiring a smaller amount of calculation.
The image processing apparatus may further include an adaptivity calculation pre-processing unit operable to calculate the ratio of the square of the standard deviation of the pixel values in an area in the target image corresponding to the chromosome to the square of the standard deviation of the pixel values in an area in the template image, and to determine whether the ratio falls within a predetermined range, wherein the adaptivity calculating unit sets, as the adaptivity, a value small enough to be excluded as the object to be determined by the similar image determining unit when the adaptivity calculation pre-processing unit determines that the ratio falls within the predetermined range. In this way, the adaptivity of the chromosome in the genetic algorithm is determined using a method requiring a smaller amount of calculation.
The image processing apparatus may further include an adaptivity calculation pre-processing unit for calculating the absolute value of a difference between the pixel value at the center point of an area in the target image corresponding to the chromosome and the pixel value at the center point of an area in the template image, and to determine whether the absolute value of the difference is above a second threshold value, wherein the adaptivity calculating unit sets, as the adaptivity, a value small enough to be excluded as the object to be determined by the similar image determining unit when the adaptivity calculation pre-processing unit determines that the absolute value of the difference is above the second threshold value. In this way, the adaptivity of the chromosome in the genetic algorithm is determined using a method requiring a smaller amount of calculation.
The adaptivity calculating unit may calculate the adaptivity of the chromosome from a cross-correlation function based on the pixel value and the chromosome information. The adaptivity of the chromosome in the genetic algorithm is determined from the standpoint of cross-correlation between the target image and the template image.
The adaptivity calculating unit may calculate the product of a difference between the pixel value at coordinates in the target image and the mean value of pixel values in the target image in an area where the target image and the template image overlap each other, and a difference between the pixel value at coordinates in the template image and the mean value of pixel values in the template image in the area where the target image and the template image overlap each other, sum the products at all coordinates in the area where the target image and the template image overlap each other, normalize the sum, and use the normalized sum as the cross-correlation function. The adaptivity of the chromosome in the genetic algorithm is determined from the standpoint of cross-correlation between the target image and the template image.
The image processing apparatus may further include a preparation value calculating unit operable to calculate a preparation value at each set of coordinates in the reduced template image and the reduced target image, the preparation value being obtained by summing pixel values from the origin to a set of coordinates in the reduced template image and the reduced target image; a template image preparation value table for storing the preparation values in the reduced template image in association with the respective coordinates in the reduced template image; and a target image preparation value table for storing the preparation values in the reduced target image in association with the respective coordinates in the reduced target image, wherein the adaptivity calculating unit sums the pixel values in the cross-correlation function at all coordinates in the area where the target image and the template image overlap each other using the respective preparation values for the coordinates in order to calculate the adaptivity of the chromosome. The amount of calculation required to calculate the adaptivity of the chromosome in the genetic algorithm is reduced.
The adaptivity calculating unit may calculate the product of a difference between the pixel value at coordinates in the target image and the mean value of pixel values in the target image in an area where the target image and the template image overlap each other, and a difference between the pixel value at coordinates in the template image and the mean value of pixel values in the template image in the area where the target image and the template image overlap each other, sum the products at all coordinates in the area where the target image and the template image overlap each other, normalize the sum, use the normalized sum as the cross-correlation function, calculate the cross-correlation function in terms of each of a plurality of elements forming the pixel value, square the value resulting from the cross-correlation function, sum the squared values, calculate the square root of the resulting sum, and normalize the square root value as the adaptivity. The adaptivity of the chromosome in the genetic algorithm is determined from the standpoint of cross-correlation between the target image and the template image. The cross-correlation accounts for the elements in the pixel value.
The adaptivity calculating unit may calculate the product of a difference between the pixel value at coordinates in the target image and the mean value of pixel values in the template image in an area where the target image and the template image overlap each other, and a difference between the pixel value at coordinates in the template image and the mean value of pixel values in the target image in the area where the target image and the template image overlap each other, sum the products at all coordinates in the area where the target image and the template image overlap each other, normalize the sum, and use the normalized sum as the cross-correlation function. The target images containing an image similar to the template image are accurately searched for.
The adaptivity calculating unit may use as the cross-correlation function the following equation representing cross-correlation at coordinates (X,Y):
where w represents a width of the template image, h represents a height of the template image, Target (X+i,Y+j) represents a pixel value at coordinates (X+i,Y+j) in the target image, Template(i,j) represents a pixel value at coordinates (i,j) in the template image, Mtarget represents the mean value of the pixel values in an area where the target image and the template image overlap each other, and Mtemplate represents the mean value of the pixel values in the template image. The adaptivity of the chromosome is calculated taking into consideration a DC component of the target image and the template image. The target images containing an image similar to the template image are accurately searched for.
In accordance with another embodiment of the present invention, an image processing apparatus includes a target image storage unit operable to store a plurality of target images as objects to be searched; an area selection receiving unit operable to receive a selection of a predetermined area corresponding to one of the plurality of target images; a template image generating unit operable to generate, as template images, an image in the predetermined area and an image to which the image in the predetermined area is expanded or reduced at a predetermined magnification ratio; an individual extracting unit operable to extract a plurality of individuals in a random fashion from the reduced target image in order to generate a chromosome having chromosome information based on coordinates of the individual and the predetermined magnification ratio used to form the template image; an adaptivity calculating unit operable to calculate an adaptivity of the chromosome based on the chromosome information and a pixel value; a genetic algorithm processing unit operable to perform at least one of a selection process, a hybridization process, or a mutation process on the chromosome in order to generate a chromosome having new chromosome information, and to cause the adaptivity calculating unit to calculate an adaptivity of the chromosome having the new chromosome information; a process end indicating unit operable to indicate a process end to the process repeatedly performed in a predetermined condition by the genetic algorithm processing unit; a quasi-optimal solution determining unit operable to determine, as a quasi-optimal solution, an adaptivity having the largest value from among the adaptivities calculated last by the adaptivity calculating unit; a peripheral area quasi-optimal solution determining unit operable to calculate an adaptivity in a predetermined entire area surrounding the area of the template image corresponding to the quasi-optimal solution, and to determine, as the quasi-optimal solution in the predetermined area, an adaptivity having the largest value from among the calculated adaptivities; and a similar image determining unit operable to determine that the reduced target image contains an image similar to the reduced template image when the largest one of the quasi-optimal solution determined by the quasi-optimal solution determining unit and the quasi-optimal solution in the predetermined area is above a predetermined threshold. The image processing apparatus thus reduces the possibility of search failure of the target images containing an image similar to the template image.
In accordance with another embodiment of the present invention, an image processing method and a program of an image processing apparatus including a target image storage unit storing a plurality of target images as objects to be searched, include receiving a selection of a predetermined area corresponding to one of the plurality of target images; generating as a template image the image of the predetermined area; reducing the template image and the one target image at a reduction ratio corresponding to a vertical height and a horizontal width of the template image; and searching for the reduced target image containing an image similar to the reduced template image in accordance with a genetic algorithm. The template image and the one target image are reduced at a reduction ratio corresponding to the horizontal width and the vertical height of the selected template image, and-a target image containing an image similar to the template image is searched for at a high speed.
In accordance with embodiments of the present invention, image searching is performed at a high speed and high accuracy level.
The embodiments of the present invention are described below with reference to the drawings. In the following discussion, an image pickup apparatus 100 is described as one example of an image processing apparatus.
In accordance with one embodiment of the present invention, part of the still image displayed on one of the display 130a and the display 130b is selected and extracted, and the extracted still image then serves as a template image. In accordance with the embodiment of the present invention, a touchpanel mechanism of directly pressing one of the display 130a and the display 130b is used to select part of the still image. The present invention is not limited to the touchpanel mechanism.
The template image is used when a desired image is searched for from images stored on a storage device (not shown) in the image pickup apparatus 100a and the image pickup apparatus 100b. The images to be searched for, stored on the storage device, are hereinafter referred to as target images. In accordance with one embodiment of the present invention, a target image containing an image similar to a template image is searched for. During search, the template image and the target image are reduced at a reduction ratio matching a vertical height and a horizontal width of the template image, and the target image containing the image similar to the template image is searched for using a genetic algorithm (GA).
The genetic algorithm is a technique that determines an optimal solution through probabilistic data processing by analogy to evolution of organism. More specifically, individuals are randomly extracted, and chromosomes of the same number as the individuals are generated to form an initial population. An adaptivity of each chromosome belonging to the initial population is determined. In accordance with one embodiment of the present invention, the adaptivity is an evaluation value to determine whether an image similar to the template image is contained in the target image.
Subsequent to the determination of the adaptivity, processes of selection, hybridization, and mutation are performed to generate a new chromosome. When the new chromosome is generated, the adaptivity is determined on the new chromosome in the same manner as described above. When a predetermined end condition is satisfied, the above process ends, and the chromosome having a high adaptivity is determined as a quasi-optimal solution. If the quasi-optimal solution is above a predetermined threshold value, the target image is determined as containing the image similar to the template image, and is output as a search result.
The image pickup section 10 includes an image pickup unit 11, an image pickup controller 12, and an image processor 13. The image pickup unit 11 includes a lens unit for picking up an image of a subject (corresponding to one of the lens unit 110a and the lens unit 110b of
Upon receiving a control signal supplied through the bus 40 from the controller section 30, the image pickup controller 12 generates a control signal to be supplied to the image pickup unit 11. The image pickup controller 12 supplies the generated control signal to the image pickup unit 11, thereby performing zoom control, shutter control, and exposure control processes.
Upon receiving a control signal through the bus 40 from the controller section 30, the image processor 13 performs gamma correction and automatic gain control (AGC) processes while converting the image pickup signal into a digital video signal.
The recording and reproducing processor section 20 includes an image encoding and decoding unit 21, a recording controller 22, and a synchronous dynamic random access memory (SDRAM) 23. The image encoding and decoding unit 21 encodes and multiplexes the video signal supplied through the bus 40 from the image pickup section 10, thereby converting the video signal into compressed data. The image encoding and decoding unit 21 also decodes compressed data into a video signal.
Upon receiving compressed data from the image encoding and decoding unit 21, the recording controller 22 writes the received compressed data onto the recording device 70. The recording controller 22 reads compressed data from the recording device 70 and supplies the read data to the image encoding and decoding unit 21. The recording device 70 may be external or internal to the image pickup apparatus 100. The recording device 70 includes but is not limited to one of a memory card, into which a flash memory is packaged, a magnetic disk such as a hard disk, an optical disk such as DVD, and a magneto-optical (MO) disk. The SDRAM 23 serves as a working area for encoding and decoding processes of the image encoding and decoding unit 21.
The controller section 30 includes a system control unit 31, an input control unit 32, a display control unit 33, an output image processor 34, an external device controller 35, and a network controller 36.
The system control unit 31 generally controls the controller section 30. The key input device 50 connected to the input control unit 32 includes a plurality of keys such as a mode switching key switching between an image pickup mode and another mode such as a playback mode, a zoom adjustment key, an exposure adjustment key, a shutter key (corresponding to the shutter 120a of
The input control unit 32 relays an operation signal from the key input device 50 and the touchpanel input unit 62 to the system control unit 31. The system control unit 31 determines whether any key is operated on the key input device 50 and the touchpanel input unit 62 and performs control process in response to the determination results.
The display 61 connected to the display control unit 33 may include a liquid-crystal display (LCD), and under the control of the system control unit 31, displays a video signal supplied from the image pickup section 10 and the video signal read from the recording device 70 via the bus 40. The display 61 corresponds to each of the display 130a and the display 130b of
The output image processor 34 performs a predetermined modification process on the video data during playback of the video data. The modification process includes color correction on the video data. The process, performed on the video data by the output image processor 34, could be performed by the system control unit 31.
An external device 80 connected to the external device controller 35 includes but is not limited to a personal computer. The external device 80 may be connected to the external device controller 35 using a universal serial bus (USB) cable. Connection means between the external device 80 and the external device controller 35 is not limited to the USB cable. The external device controller 35 controls data exchange between the image pickup apparatus 100 and the external device 80.
The network controller 36 controls data exchange performed between the image pickup apparatus 100 and a network 90. The network 90 includes but is not limited to one of the Internet and a local area network (LAN).
The area selection receiver 601 receives selection of one target image from among a plurality of target images stored on the target image storage unit 231 and selection of an area to be extracted as a template image in the target image.
The template image generator 301 generates the template image by extracting from the target image the area to be extracted as the template image in the target image received by the area selection receiver 601.
The template image generator 301 generates an image that is obtained by expanding or reducing at a predetermined magnification ratio the template image generated as a result of extraction. The expanded or reduced image is used as a template image. The template image generator 301 generates an image that is obtained by rotating by a predetermined angle each of the template image generated as a result of extraction, the expanded image and the reduced image. The image rotated by the predetermined angle is also used as a template image.
The image reducer 302 reduces the template images generated by the template image generator 301 and the target image at a reduction ratio corresponding to the horizontal width and the vertical height of the template image. By reducing the template image and the target image, an amount of calculation involved in a subsequent search process is reduced, and the search process is performed at a high speed. If the template image and the target image are reduced in size, difference and noise in the detail of each image typically not essential in the search process become difficult to detect, and search accuracy is increased.
However, if the template image is already small, further reduction can lead to a degraded accuracy. If the product of the horizontal width and the vertical height of the template image is not more than a predetermined value, accuracy drop is avoided by setting the reduction ratio of the template image and the target image to 1 (with no reduction).
The similar image searcher 310 searches a target image containing an image similar to a template image using a genetic algorithm. The similar image searcher 310 includes an individual extractor 311, an adaptivity calculation pre-processor 312, an adaptivity calculator 313, a genetic algorithm processor 314, a process end indicator 315, a quasi-optimal solution determiner 316, a peripheral area quasi-optimal solution determiner 317, a similar image determiner 318, a preparation value calculator 319, a target image preparation value table 320, and a template image preparation value table 321.
The individual extractor 311 randomly extracts a plurality of individuals from the target image reduced by the image reducer 302, and generates chromosomes of the number equal to the number of individuals. The chromosome has chromosome information based on coordinates on the target image of the individual and a predetermined magnification ratio at the expansion or reduction of the template image. The initial population in the genetic algorithm discussed with reference to
The coordinates of the individual on the target image and the predetermined magnification ratio at the expansion or reduction of the template image, represented in the chromosome information, is a matching area where matching is performed by overlapping the template image expanded or reduced at the predetermined magnification ratio on the target image. The origin of the template image expanded or reduced at the predetermined magnification ratio is set to a top left corner thereof. With the top left corner located at coordinates of the template image of the chromosome, an area where the target image and the template image overlap each other is the matching area.
The adaptivity calculation pre-processor 312 calculates the absolute value of a difference between the mean value of pixel values in the matching area of the template image and the mean value of pixel values in the matching area of the target image. In accordance with the present embodiment, the pixel value is represented using one of YUV, RGB and HSV color representations, and is luminance [0] color difference, for example. The adaptivity calculation pre-processor 312 thus calculates the absolute value of the difference between the mean values of the luminances [0] color differences in the matching areas of the target image and the template image.
If the adaptivity calculation pre-processor 312 determines that the absolute value of the difference between the mean values of pixel values in the matching areas of the target image in the matching area and the template image is above a predetermined threshold, the adaptivity calculator 313 to be discussed later determines that the adaptivity of the chromosome corresponding to the matching area is a sufficiently small number including zero. More specifically, if the adaptivity calculation pre-processor 312 determines that the absolute value of the difference between the mean values of pixel values in the matching areas of the target image and the template image is above the predetermined threshold, it is estimated that the matching area of the target image contains no image similar to the template image, and there is no need for calculating the adaptivity. A value small enough to be excluded from similarity determination process (including zero) is set as the adaptivity calculated by the adaptivity calculator 313.
The adaptivity calculation pre-processor 312 calculates the ratio of squared standard deviations of the pixel values in the matching areas of the target image and the template image, thereby determining the need for the adaptivity calculation. If the adaptivity calculation pre-processor 312 determines that the ratio of squared standard deviations of the pixel values falls out of a predetermined range, the adaptivity calculator 313 sets the adaptivity of the chromosome corresponding to the matching area to a sufficiently small value including zero. More specifically, if the adaptivity calculation pre-processor 312 determines that the ratio of squared standard deviations of the pixel values falls out of the predetermined range, it is estimated that the matching area of the target image contains no image similar to the template image, and there is need for calculating the adaptivity. In this case, the adaptivity set by the adaptivity calculator 313 needs to be a value small enough to be excluded from similarity determination process (including zero).
The adaptivity calculation pre-processor 312 may calculate the absolute value of a difference between pixel values at the center points of the matching areas in the target image and the template image, thereby determining the need for the adaptivity calculation. If it is determined that the absolute value of the difference between pixel values at the center points of the matching areas in the target image and the template image is above a predetermined threshold, the adaptivity calculator 313 sets the adaptivity of the chromosome corresponding to the matching area to a small value including zero. More specifically, if it is determined that the absolute value of the difference between pixel values at the center points of the matching areas in the target image and the template image is above the predetermined threshold, it is estimated that the matching area of the target image contains no image similar to the template image. There is no need for calculating the adaptivity. In this case, the adaptivity set by the adaptivity calculator 313 needs to be a value sufficiently small to be excluded from similarity determination process (including zero).
The adaptivity of the chromosome is thus evaluated based on the absolute value of the difference between the mean values of the pixel values in the matching areas of the target image and the template image, and/or based on the ratio of the squared standard deviations of the pixel values in the matching areas in the target image and the template image, and/or based on the absolute value of the difference between the pixel values at the center points of the matching areas in the target image and the template image. Alternatively, the adaptivity of the chromosome may be evaluated based on all three of these factors. The evaluation of the adaptivity of the chromosome performed by the adaptivity calculation pre-processor 312 will be described later in detail.
The adaptivity calculator 313 calculates the adaptivity of the chromosome generated from the individual extracted by the individual extractor 311. Determination as to whether an image similar to a template image is contained in a target image is performed using the adaptivity. More specifically, if the adaptivity is higher than the predetermined threshold, it is determined that the image similar to the template image is contained in the target image. In accordance with one embodiment of the present invention, a cross-correlation function is used as a function to calculate the adaptivity, and equation (1) shows one example of cross-correlation function:
The cross-correlation function represented by equation (1) provides a similarity between the template image in the matching area and the target image in the matching area, and has a value falling within a range of −2≦f(X,Y)≦1. If the target image fully matches the template image in the matching area, f(X,Y)=1. In equation (1), w and h respectively represent the width and height of the template image. Target (X+i,Y+j) represents a pixel value at coordinates (X+i,Y+j) in the target image, Template(i,j) represents a pixel value at coordinates (i,j) in the template image, Mtarget represents the mean value of the pixel values in the matching area of the target image, and Mtemplate represents the mean value of the pixel values in the template image.
The adaptivity may be calculated using equation (2), instead of equation (1), as the cross-correlation function to be used by the adaptivity calculator 313. Equation (2) as the cross-correlation function is formulated by interchanging Mtarget and Mtemplate with each other in equation (1). The rest of equation (2) remains unchanged from equation (1):
Equation (2) is now compared with equation (1). “Target (X+i,Y+j)−Mtarget” in the cross-correlation function in equation (1) represents only an AC component of a pixel value in the target image with a DC component of the pixel value removed in the target image. “Template (i,j)−Mtemplate” represents only an AC component of the pixel value in the template image with a DC component of the pixel in the template image removed in the template image. Since the numerator is the product of the AC component of the pixel value in the target image and the AC component of the pixel value in the template image in equation (1), the result reflects no DC component. If the target image is matched against the template image, f(X,Y) can result in a high value even with no similarity therebetween.
“Target (X+i,Y+j)−Mtemplate” in the cross-correlation function of equation (2) is the pixel value in the target image with the DC component of the pixel value in the template image removed therefrom, and “Template(i,j)−Mtarget” is the pixel value in the template image with the DC component of the pixel value in the target image removed therefrom. If there is a difference between the DC component of the pixel value in the target image and the DC component of the pixel value in the template image, there remains not only an AC component but also a DC component in each of Target (X+1,Y+1)−Mtemplate and Template (i,j)−Mtarget. In other words, the result also reflects the DC component. The adaptivity calculated using equation (2) provides a higher accuracy search than using equation (1).
The adaptivity calculator 313 uses one of equations (1) and (2) to calculate the adaptivity. Equation (3) may also be used:
Equation (3) is used to calculate the adaptivity when YUV is used as the pixel value. f_Y(X,Y) represents f(X,Y) in one of equations (1) and (2) with Y component (luminance) used for the pixel value. f_U(X,Y) represents f(X,Y) in one of equations (1) and (2) with U component (difference between luminance signal and blue component) used for the pixel value. f_V(X,Y) represents f(X,Y) in one of equations (1) and (2) with V component (difference between luminance signal and red component) used for the pixel value.
In equation (3), squares of f_Y(X,Y), f_U(X,Y) and f_V(X,Y) are summed, and square root of the sum is determined. The square root of the sum is divided by square root of 3 for normalization. In equation (3), YUV are summed at ratio of 1:1:1. Alternatively, another ratio may be employed to stress any one component of YUV.
Equation (3) provides the result that reflects not only the Y component (luminance) but also the U component (difference between the luminance signal and the blue component) and the V component (difference between the luminance signal and the red component). Highly accurate matching is thus performed.
The value of f(X,Y) discussed with reference to equations (1) through (3) falls within a range of −1 to 1. The adaptivity calculator 313 may provide as the calculation result an adaptivity “f′(X,Y)=(f(X,Y)+1)/2” having a range of 0 to 1.
The genetic algorithm processor 314 performs the selection, hybridization, and mutation processes onto the chromosome having the adaptivity calculated by the adaptivity calculator 313, thereby a chromosome having new chromosome information. In the selection process, chromosomes of a predetermined number are selected according to the adaptivity calculated by the adaptivity calculator 313. In the hybridization process, chromosomes selected in the selection are paired, and part of the chromosome information of the pair chromosomes is interchanged. In the mutation process, part of the chromosome information of the chromosome is changed with a predetermined probability.
Since the selection, the hybridization, and the mutation processes are performed with a predetermined probability, the population becomes a mixture of chromosomes having no change in the chromosome information and chromosomes having new chromosome information subsequent to the process of the genetic algorithm processor 314. After the genetic algorithm processor 314 performs the selection, the hybridization, and the mutation processes, the processes of the adaptivity calculation pre-processor 312 and the adaptivity calculator 313 are performed again.
In predetermined condition, the process end indicator 315 issues a process end command to end the processes repeatedly performed by the adaptivity calculation pre-processor 312, the adaptivity calculator 313, and the genetic algorithm processor 314. The predetermined condition may be reached after 50 generations of processes performed by the adaptivity calculation pre-processor 312, the adaptivity calculator 313 and the genetic algorithm processor 314, and the process end command may be issued, but the present invention is not limited to this condition.
Upon receiving the process end command from the process end indicator 315, the adaptivity calculator 313 supplies the quasi-optimal solution determiner 316 with a plurality of adaptivities calculated last. The quasi-optimal solution determiner 316 determines as a quasi-optimal solution the chromosome corresponding to the highest adaptivity from among the plurality of adaptivities supplied from the adaptivity calculator 313.
The peripheral area quasi-optimal solution determiner 317 matches the target image against the template image in all of a predetermined area surrounding the matching area corresponding to the chromosome determined as the quasi-optimal solution by the quasi-optimal solution determiner 316. The peripheral area quasi-optimal solution determiner 317 thus calculates the adaptivities using equations (1) through (3) in each peripheral matching area. The peripheral area quasi-optimal solution determiner 317 determines as the quasi-optimal solution the chromosome having the highest adaptivity from among the calculated adaptivities.
The broadness of the predetermined area surrounding the matching area corresponding to the chromosome determined as the quasi-optimal solution by the quasi-optimal solution determiner 316 may be determined as a predetermined broadness such as from the boundary of the matching area to a predetermined pixel. The peripheral area quasi-optimal solution determiner 317 matches the target image against the template image in the predetermined area surrounding the matching area corresponding to the chromosome determined as the quasi-optimal solution. This is because if the target image is matched against the template image using the genetic algorithm, an optimum area for matching the target image against the template image cannot always be found.
The similar image determiner 318 determines whether a higher one of the highest adaptivity determined by the quasi-optimal solution determiner 316 and the adaptivity calculated by the peripheral area quasi-optimal solution determiner 317 is above a predetermined threshold. If the similar image determiner 318 determines that the higher adaptivity is above the predetermined adaptivity, the search result that the image similar to the template image is contained in the target image is output.
The preparation value calculator 319 calculates a preparation value that is obtained by summing pixel values from the origin of the template image and the target image reduced by the image reducer 302 to any coordinates. The calculation of the preparation value is performed at all coordinates in the reduced template image and the reduced target image. Let ii(X,Y) represent the preparation value and i(X′,Y′) represent a pixel value at (X′,Y′) in the target image, and the preparation value ii(X,Y) is expressed by the following equation (4):
Equation (4) sums the pixel values at each coordinate within an area defined by 0≦X′≦X, and 0≦Y′≦Y in X′Y′ space. In the X′Y′ space, the top left corner of the target image serves as the origin, and the leftward direction serves as a positive direction of X′ coordinate and the downward direction serves as a positive direction of Y′ coordinate. An intermediate value s(X,Y) is considered to calculate the preparation value. Equation (5) shows the relationship of the preparation value ii(X,Y), the pixel value i(X′,Y′) at (X′,Y′) in the target image and the intermediate value s(X,Y) wherein the values of s(X,−1) and ii(−1,Y) required to calculate ii(0,0) are zero, respectively:
S(X,Y)=S(X,Y-1)+i(X,Y)ii(X,Y)=ii(X-1,Y)+S(X,Y) Equations (5)
The preparation value calculator 319 calculates the preparation value at each of the coordinates in the target image using equations (4) and (5), and the calculation result is then stored onto the target image preparation value table 320. In the same way as described above, the preparation value calculator 319 calculates the preparation value at each of the coordinates in the template image, and the calculation result is then stored onto the template image preparation value table 321.
Similarly, a preparation value iii(X,Y) that is a sum of squared pixel values at each coordinate is also calculated at each of the coordinates in each of the target image and the template image. The calculation results are stored onto the target image preparation value table 320 and the template image preparation value table 321, respectively. The preparation value iii(X,Y) is expressed by the following equation (6):
The adaptivity calculator 313 calculates equations (1) through (3) using the above-described preparation values. How to use the preparation values in the calculation of equations (1) through (3) is described below with reference to
If the pixel value is luminance, the more the pixel values are calculated, the larger the preparation value becomes. The image thus becomes lighter as it goes downward rightly. A gradation image 202 of
When the adaptivity in an area 203 in the target image 200 is calculated, equations (1) through (3) discussed with reference to
Let (X,Y) represent the coordinates of point A, w represent the length between points A and B, and h represent the length between A and C as shown in
In equation (7), term a1 is a sum of squared pixel values in the area 203 defined by point A at coordinates (X,Y) and point D at coordinates (X+w,Y+h). The term 1a is calculated using the preparation value iii(X,Y) in the target image. In other words, the term al is the sum of the squared values in the area 203 in the gradation image 202 representing the preparation value of
Term a2 is a product of 2Mtarget and the sum of the pixel values in the area 203 defined by the point A at coordinates (X,Y) and the point D at coordinates (X+w,Y+h). The term a2 can be calculated using the preparation value ii(X,Y) in the target image. Like the term a1, the term a2 is determined from 2Mtarget {ii(A)+ii(D)−ii(B)−ii(C)}. Term a3 is Mtargetwh. Equation relating to the target image out of the denominator of equation 1 is determined using ii(X,Y) and iii(X,Y) in the target image. Equation relating to the template image out of the denominator of equation 1 is determined in a similar way. Here, ii(A) represents a preparation value ii(X,Y) at the coordinates of the point A, and the same is true of the other formats.
Equation (8) is an expanded form of the numerator of equation (1).
Term b1 in equation (8) cannot be calculated using the preparation value. Term b2 is determined from Mtarget {ii(A)+ii(D)−ii(B)−ii(C)} using the preparation value ii(X,Y) in the template image as in equation (7). Term b3 is determined from Mtemplate {ii(A)+ii(D)−ii(B)−ii(C)} using the preparation value ii(X,Y) in the target image. Term b4 is expressed as MtargetMtemplatewh. From the above discussion, the numerator of equation (1) is determined using ii(X,Y) and iii(X,Y) in the target image and the template image.
The use of the preparation value in equation (1) has been discussed. Similarly, the preparation value is used in each of equations (2) and (3). Since an amount of calculation is reduced by calculating equations (1) through (3) using the preparation value, high speed searching is performed.
The coordinates 3201 include all coordinates of the template image, and the target image preparation value table 320 includes the preparation values ii(X,Y) 3202 and the preparation values iii(X,Y) 3203 corresponding to the coordinates. Here, ii(A) and iii(A) respectively represent the preparation value ii(X,Y) and the preparation value iii(X,Y) at the coordinates of point A. The same is true of other formats. The adaptivity calculator 313 calculates the adaptivity of the chromosome by referencing the target image preparation value table 320. The template image preparation value table 321 has a structure similar to the target image preparation value table 320.
A user selects a desired template image with the stylus 501 with the desired image displayed on the display screen 600, and then selects an OK button 623. As shown in
When the target image 611 is displayed on the display screen 600 as shown in
If an OK button 624 is selected with the area 614 displayed, a template image is generated. To select another area with the area 614 displayed, a return button 625 is selected and an area in the target image 611 is selected.
The template image generator 301 generates template images 615a through 615d by expanding or reducing the template image 615. The template images 615a through 615d are respectively generated by expanding the template image 615 by 1.21, 1.1, 1.0, 0.909, and 0.826 times. As shown in
Number sequences 1.21, 1.1, 1.0, 0.909, and 0.826 are respectively considered as (1.1)2, (1.1)1, (1.1)0, (0.1)−1, and (1.1)−2, namely, geometric sequences having the common ratio of 1.1. The use of a large common ratio increases the possibility of search miss when image search is performed using the template image. The use of a small common ratio increases an amount of calculation when image search is performed using the template image. The common ratio is preferably but not limited to 1.1 or so. A common ratio of 1.09 or 1.2 is also acceptable.
Not only the images obtained by expanding or reducing the template image 615 but also a template image 616 obtained by rotating the template image 615 as shown in
The target image 617 and the template image 615 are reduced at a reduction ratio k responsive to the horizontal width and the vertical height of the template image. The reduction ratio k may be the one represented by the following equation (9) wherein a and b respectively represent the horizontal width and the vertical height of the template image 615:
With the target image and the template image reduced, the amount of calculation involved in the search process to be discussed later is decreased. The search process is thus performed at a high speed. With the target image and the template image reduced, difference and noise in the detail of each image typically not essential in the search process becomes difficult to detect, and search accuracy is increased.
The X coordinate 401 and the Y coordinate 402 are converted into gray code, and coded into the chromosome information. Rather than being directly coded into the chromosome information, the magnification ratio 403 is indexed, converted into gray code and then coded into the chromosome information.
For example, the individual extractor 311 may extract n individuals and n chromosomes may be generated. The roulette 410 is partitioned into n sectors. The adaptivities of chromosome A, chromosome B, chromosome D, . . . are high to low in that order. The areas of the sectors in the roulette 410 are shown in
The roulette 410 is rotated in the direction represented by the arrow in
The selection, hybridization, and mutation processes discussed with reference to
In accordance with one embodiment of the present invention, the calculation of the adaptivity using equations (1) through (3) needs to be skipped in the matching area such as the matching area 631 in order to reduce the amount of calculation in the adaptivity calculator 313. As previously discussed with reference to
The pixel value may be represented by YUV. Equations (10) represent a condition on the absolute value of the difference between the mean values of the pixel values in the matching areas in the target image and the template image to omit adaptivity calculation of the chromosome as much as possible. Let MYtarget, MUtarget, and MVtarget respectively represent mean values of a Y component (luminance), a U component (difference between a luminance signal and a blue component), and a V component (difference between a luminance signal and a red component) in the target image. Let MYtemplate, MUtemplate, and MVtemplate represent mean values of a Y component (luminance), a U component (difference between a luminance signal and a blue component), and a V component (difference between a luminance signal and a red component) in the template image:
If the absolute value of the difference between the mean values of the pixel values in the matching areas in the target image and the template image calculated by the adaptivity calculation pre-processor 312 satisfies all of equations (10), the adaptivity calculator 313 sets a value small enough to be excluded from similarity determination as an adaptivity (including zero).
When the pixel value is represented by YUV, equations (11) represent a condition on the ratio of the squared standard deviations of the pixels in the matching areas in the target image and the template image to omit adaptivity calculation of the chromosome as much as possible. Let σUtarget and σVtarget represent mean values of a U component (difference between a luminance signal and a blue component), and a V component (difference between the luminance signal and a red component) in the target image. Let σUtemplate and σVtemplate represent mean values of a U component (difference between a luminance signal and a blue component), and a V component (difference between the luminance signal and a red component) in the template image.
Standard deviation σYtarget of the Y component (luminance) in the target image is expressed as in equation (12) if the mean value MYtarget of the Y component (luminance) in the target image is used:
(σYtarget)2=Σ(MYtarget)2−(ΣMYtarget)2 Equation (12)
If the ratio of the squared standard deviations of the pixel values in the matching areas in the target image and the template image calculated by the adaptivity calculation pre-processor 312 satisfies all equations (11), the adaptivity calculator 313 sets a value small enough to be excluded from similarity determination process as an adaptivity (including zero).
When the pixel value is represented by YUV, equations (13) represent a condition on the absolute value of the difference between the pixel values at the center points in the matching areas in the target image and the template image to omit adaptivity calculation of the chromosome as much as possible. Let CUtarget and CVtarget represent a U component (difference between a luminance signal and a blue component), and a V component (difference between the luminance signal and a red component) at the center point of the matching area in the target image. Let CUtemplate and CVtemplate represent a U component (difference between a luminance signal and a blue component), and a V component (difference between the luminance signal and a red component) at the center point of the matching area in the template image.
If the absolute value of the difference between the pixel values at the center points in the matching areas in the target image and the template image calculated by the adaptivity calculation pre-processor 312 satisfies all conditions of equations (13), the adaptivity calculator 313 sets a value small enough to be excluded from similarity determination process as an adaptivity (including zero).
Adaptivity is thus evaluated using equations (10), (11) and (13). If an evaluation result is poor, the adaptivity calculator 313 sets a value small enough to be excluded from similarity determination process as an adaptivity (including zero) without using f(X,Y) for adaptivity calculation. Since f(X,Y) is not used in the calculation of adaptivity, the target image containing the image similar to the template image is searched at a high speed.
In accordance with the genetic algorithm, no entire area of the template image is evaluated in detail, and there is a high possibility that a better quasi-optimal solution is present in the peripheral area of the quasi-optimal solution determined in accordance with the genetic algorithm. In accordance with one embodiment of the present invention, after the quasi-optimal solution is determined, adaptivity is further determined in the peripheral area surrounding the matching area corresponding to the quasi-optimal solution with the matching area shifted. The peripheral area quasi-optimal solution determiner 317 determines the adaptivity using equations (1) through (3) discussed with reference to
If the highest adaptivity from among the adaptivities in the peripheral area determined by the peripheral area quasi-optimal solution determiner 317 is higher than the adaptivity determined to be the quasi-optimal solution by the quasi-optimal solution determiner 316, the highest adaptivity from among the adaptivities in the peripheral area determined by the peripheral area quasi-optimal solution determiner 317 is set to be a new adaptivity. That determination is performed by the similar image determiner 318. If the adaptivity determined to be the quasi-optimal solution is above a predetermined threshold, it is estimated that the target image contains the image similar to the template image.
When a target image 671 containing the image similar to the template image is hit in the search, the target image 671 is displayed on the display screen 600. The target image 671 may be a thumbnail. The order of the target images to be displayed on the display screen 600 is from high adaptivity to low adaptivity. The number of template images to be displayed on the display screen 600 at a time may be two. Using a scroll control 673, another hit template image may be displayed.
With a search progress display 672 showing the progress of search arranged on the display screen 600, a user can monitor the current status of search. With a suspend button 674 for suspending the search process, the user may suspend the search process when a desired target image is hit and displayed.
Operation of the image pickup apparatus 100 in accordance with one embodiment of the present invention is described below with reference to the drawings.
The template image generator 301 generates a template image in accordance with an area of the target image received (step S912). In step S912, images obtained through expanding, reducing, and rotating the image corresponding to the area of the target image with the selection thereof received are also generated as the template images.
The image reducer 302 reduces the template image generated in step S912 at a reduction ratio corresponding to the horizontal width and the vertical height of the template image (step S913). The preparation value calculator 319 calculates the preparation value of the reduced template image (step S914).
It is determined in step S915 whether an unsearched target image is stored on the target image storage unit 231. If there is no unsearched target image, the search process ends. If it is determined in step S915 that unsearched target images are stored, the image reducer 302 reduces one of unsearched target images (step S916). The reduction ratio in step S916 equals the reduction ratio of the template image in step S913. The preparation value calculator 319 calculates the preparation value of the reduced target image (step S917).
The adaptivity for determining whether the predetermined target image reduced in step S917 contains the image similar to the template image is then calculated. The highest adaptivity is set as the quasi-optimal solution (step S918).
The similar image determiner 318 determines whether the adaptivity determined as the quasi-optimal solution in step S918 is higher than the predetermined threshold (step S919). If it is determined in step S919 that the adaptivity determined as the quasi-optimal solution in step S918 is higher than the predetermined threshold, the target image is determined to contain the image similar to the template image and is then output (step S920). If it is determined in step S919 that the adaptivity determined as the quasi-optimal solution in step S918 is lower than the predetermined threshold, the target image is determined not to contain the image similar to the template image. The above process is repeated until no unsearched template images are present on the target image storage unit 231 in step S915.
The adaptivity of each chromosome is calculated (step S922). The calculation of the adaptivity is performed at two phases, one phase by the adaptivity calculation pre-processor 312 and the other phase by the adaptivity calculator 313.
The adaptivity calculation pre-processor 312 calculates the absolute value of the difference between the mean values of the pixel values in the matching areas of the target image and the template image, the ratio of the squared standard deviations of the pixel values in the matching areas in the target image and the template image, and the absolute value of the difference between the pixel values at the center points of the matching areas in the target image and the template image. The adaptivity calculation pre-processor 312 evaluates these resulting values using equations (10) through (13), and determines whether to exclude the values from the similarity determination process.
Using equations (1) through (3), the adaptivity calculator 313 calculates the adaptivity of the chromosome not determined to be excluded from the similarity determination process by the adaptivity calculation pre-processor 312. Since the adaptivity calculation pre-processor 312 determines beforehand the chromosome to be excluded from the similarity determination process, the amount of calculation of the adaptivity calculator 313 is reduced. High-speed searching process is thus performed.
A predetermined number of chromosomes are selected from the chromosomes having the adaptivities calculated in step S922 (step S923). In accordance with one embodiment of the present invention, the chromosomes are selected using the roulette discussed with reference to
The mutation process is performed on the chromosome (step S925). In accordance with one embodiment of the present invention, the mutation process is performed in the manner discussed with reference to
The process performed in steps S922 through S925 is subject to a process end condition, in which the process is terminated after repeating the process to 50 generations of chromosomes. Subsequent to step S925, the process end indicator 315 determines whether the process end condition is satisfied (step S926).
If the process in steps S922 through S925 is determined to end, the quasi-optimal solution determiner 316 determines the highest adaptivity from among adaptivities calculated last as the quasi-optimal solution (step S927). The peripheral area quasi-optimal solution determiner 317 calculates the adaptivity in the peripheral area surrounding the matching area corresponding to the quasi-optimal solution determined in step S927 (step S928).
It is determined whether the adaptivity determined by the peripheral area quasi-optimal solution determiner 317 is better than the adaptivity corresponding to the quasi-optimal solution determined by the quasi-optimal solution determiner 316 (step S929). If the adaptivity determined by the peripheral area quasi-optimal solution determiner 317 is better than the adaptivity corresponding to the quasi-optimal solution determined by the quasi-optimal solution determiner 316, the highest adaptivity from among the adaptivities calculated by the peripheral area quasi-optimal solution determiner 317 is set to be the quasi-optimal solution. The resulting quasi-optimal solution overwrites the preceding quasi-optimal solution (step S930).
In accordance with one embodiment of the present invention, the image reducer 302 reduces the template image and the target image at the reduction ratio corresponding to the horizontal width and the vertical height of the template image. The areas to matched against each other between the template image and the target image are decreased, and the amount of calculation is also decreased. High-speed search process is thus performed. If the template image and the target image are reduced in size, difference and noise in the detail of each image typically not essential in the search process become difficult to detect, and search accuracy is increased.
Before the adaptivity calculator 313 calculates the adaptivity of the chromosome, the adaptivity calculation pre-processor 312 determines the adaptivity using the manner requiring a smaller amount of calculation. The amount of calculation of the adaptivity calculator 313 is thus reduced. With the adaptivity calculator 313 using the preparation value in the calculation of the cross-correlation function, the amount of calculation of the cross-correlation function is reduced. Even higher speed search process is performed with the two above-described advantages.
After the quasi-optimal solution is calculated using the genetic algorithm, the peripheral area quasi-optimal solution determiner 317 calculates the adaptivity in the peripheral area surrounding the matching area corresponding to the quasi-optimal solution. A better adaptivity is thus calculated. Image search accuracy is further increased.
The image pickup apparatus has been discussed as an example of the image processing apparatus in accordance with embodiments of the present invention. The present invention is applicable to other type of electronic apparatuses processing images.
The embodiments of the present invention have been discussed for exemplary purposes only. As will be discussed below, the elements in each embodiment correspond to the elements in each claim. The present invention is not limited to the correspondence discussed below, and various changes are possible in the correspondence without departing from the scope of the present invention.
In one embodiment of the present invention, the target image storage unit corresponds to the target image storage unit 231. The area selection receiving unit corresponds to the area selection receiver 601. The template image generating unit corresponds to the template image generator 301. The image reducing unit corresponds to the image reducer 302. The similar image searching unit corresponds to the similar image searcher 310.
In accordance with one embodiment of the present invention, the individual extracting unit corresponds to the individual extractor 311. The adaptivity calculating unit corresponds to the adaptivity calculator 313. The genetic algorithm processing unit corresponds to the genetic algorithm processor 314. The process end indicating unit corresponds to the process end indicator 315. The quasi-optimal solution determining unit corresponds to the quasi-optimal solution determiner 316. The similar image determining unit corresponds to the similar image determiner 318.
In accordance with embodiments of the present invention, the adaptivity calculation pre-processing unit corresponds to the adaptivity calculation pre-processor 312.
In accordance with one embodiment of the present invention, the preparation value calculating unit corresponds to the preparation value calculator 319. The template image preparation value table corresponds to the template image preparation value table 321. The target image preparation value table corresponds to the target image preparation value table 320.
In accordance with one embodiment of the present invention, the target image storage unit corresponds to the target image storage unit 231. The area selection receiving unit corresponds to the area selection receiver 601. The template image generating unit corresponds to the template image generator 301. The individual extracting unit corresponds to the individual extractor 311. The adaptivity calculating unit corresponds to the adaptivity calculator 313. The genetic algorithm processing unit corresponds to the genetic algorithm processor 314. The process end indicating unit corresponds to the process end indicator 315. The quasi-optimal solution determining unit corresponds to the quasi-optimal solution determiner 316. The peripheral area quasi-optimal solution determining unit corresponds to the peripheral area quasi-optimal solution determiner 317. The similar image determining unit corresponds to the similar image determiner 318.
In accordance with embodiments of the present invention, the target image storage unit corresponds to the target image storage unit 231. The step of receiving the selection of the predetermined area corresponds to step S911. The step of generating as the template image corresponds to step S912. The step of reducing the images corresponds to steps S913 and S916. The step of searching the similar image corresponds to steps S915, S918, and S919.
The process discussed with reference to the embodiments of the present invention may be considered as a method containing a series of steps. The process may be also considered as a program for causing a computer to perform the series of steps. The program may be stored on a recording medium.
It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and alterations may occur depending on design requirements and other factors insofar as they are within the scope of the appended claims or the equivalents thereof.
Number | Date | Country | Kind |
---|---|---|---|
P2005-293917 | Oct 2005 | JP | national |