Method and device for shape extraction, and size measuring device and distance measuring device

When an image is captured in a wood lumber measuring mode, a distance to wood lumber is detected. An area extracting unit 51 for a component drawing image area extracts component image areas 53A-53L of the wood lumber. A drawing generator 61 for a component drawing image selects the component image areas 53A-53L successively to generate a component drawing image 62. Among shape lines in the component drawing image 62, an eliminator 66 eliminates a paracentral shape line 71, an edge side shape line 72, a peripheral shape line 73 and determined shape lines 74. If a total pixel number of a portion where an estimated elliptical shape 76 generated by a shape estimation unit 67 is overlapped on a residual shape line 75 disposed inside a corrected drawing image 64 is more than a threshold, it is judged that the estimated elliptical shape 76 is correctly shaped. An object shape determining unit 83 extracts the estimated elliptical shape 76 as a shape of wood lumber. A size measuring unit 84 measures a size of the estimated elliptical shape. A size determining unit 85 determines an actual size of the wood lumber according to the size measured by the size measuring unit 84, the distance to the wood lumber and a focal length.

TECHNICAL FIELD

The present invention relates to a method and device for extracting a shape of a particular object from inside an object image, and a device for measuring a size of the extracted object and a distance to the object.

BACKGROUND ART

A size measuring device has been suggested recently, in which an object is imaged to measure its size. The size measuring device recognizes an image of the object on a screen according to a feature value such as color, shape and the like, and extracts the shape of an object image being recognized. The size of the object is arithmetically determined according to the extracted shape of the object image. In order to extract the shape of the object image, the image is converted into a drawing image in which shape lines are used to express the image. The extraction is based on the shape lines included in the drawing image.

In a lung region extraction device disclosed in Patent Document 1, the object image is positioned at the center of the frame at the time of extracting the object image, to eliminate the shape lines contacting a boundary edge of the image. In the lung region extraction device, the shape of the object image is exactly extracted by not extracting lines other than the shape lines in the object image.

PRIOR ART DOCUMENTS

Patent Documents

SUMMARY OF INVENTION

Problems to Be Solved by The Invention

A method of edge detection is used for conversion into the drawing image. The shape lines are formed according to detected edges. Thus, the drawing image expressed by the shape lines contains the shape lines (outer shape lines) expressing an outer shape of the object image, but also includes a partial image or patterned lines (pseudo shape lines). It is necessary to extract the outer shape lines from the drawing image correctly for the purpose of precisely extracting the shape of the object image. In the device disclosed in Patent Document 1, pseudo shape lines contacting the boundary edge of the image are eliminated. However, the remainder of the pseudo shape lines are not eliminated, for example, pseudo shape lines disposed inside the outer shape lines, and pseudo shape lines disposed outside the outer shape lines but not contacting the boundary edge of the image. Numerous pseudo shape lines other than the outer shape lines become extracted, so that the shape of the object image cannot be correctly extracted.

An object of the present invention is to provide a method and device for shape extraction, and size measuring device and distance measuring device, in which a shape of the object image can be correctly extracted.

Means for Solving the Problems

In order to achieve the above object, a shape extraction device of the present invention includes an area extracting unit, a drawing generator, an eliminator, a shape estimation unit, an evaluation unit and an object shape determining unit. The area extracting unit recognizes component images in which it is presumed that an object in a particular shape is imaged within a frame, to extract component image areas from the frame in which the component images are respectively present. The drawing generator sequentially selects the component image areas, and converts images including the component image in the selected component image areas into respectively a drawing image, to generate a component drawing image. The eliminator eliminates one shape line and/or a certain shape line as an unwanted shape line among shape lines included in respectively the component drawing image, the one shape line having a center in a substantially equal position to a center of the component drawing image and having vertical and horizontal sizes equal to or less than substantially a half of a size of the component drawing image, the certain shape line being disposed on a straight line passing a center point of the one shape line and a center point of the component drawing image. The shape estimation unit determines an estimated shape by optimizing a size of the particular shape so as to correspond to a corrected drawing image after elimination of the unwanted shape line. The evaluation unit judges appropriacy of the estimated shape by evaluating degree of overlap between the estimated shape and the corrected drawing image. The object shape determining unit specifies the estimated shape as a shape of the object extracted from the frame if it is judged that the estimated shape is appropriate.

Also, preferably, if the component image areas overlap on one another, the eliminator further eliminates a shape line of the corrected drawing image in relation to the object of which a shape has been specified.

Preferably, the eliminator further eliminates a shape line contacting a boundary edge of the component image areas.

Also, preferably, the shape estimation unit splits the corrected drawing image into plural areas, and selects a shape line from each of the plural areas, to determine the estimated shape according to a plurality of the selected shape line.

Also, preferably, if it is judged that the estimated shape is inappropriate, the eliminator eliminates a shape line outside the estimated shape.

Also, preferably, the drawing generator includes a plurality of target image detection filters between which thresholds are different for extracting an image to be converted into a drawing image among images included in the selected component image areas, the drawing generator converts the image extracted with each of the target image detection filters into a drawing image, to generate the component drawing image. If it is judged that the estimated shape is inappropriate, the drawing generator generates a new component drawing image by changing over the target image detection filters.

Also, preferably, the drawing generator includes a plurality of target image detection filters between which thresholds are different for extracting an image to be converted into a drawing image among images included in the selected component image areas, the drawing generator converts the image extracted with each of the target image detection filter into a drawing image, to generate a plurality of the component drawing image for any one of the component image areas. The shape estimation unit determines a plurality of the estimated shape respectively by use of the plural component drawing images. The evaluation unit evaluates respectively the plural estimated shapes. The object shape determining unit specifies one of the plural estimated shapes as a shape of the object with a highest evaluation result in the evaluation unit.

Also, preferably, the drawing generator has a plurality of thresholds for binarizing images included in the selected component image areas to generate the component drawing image, and binarizes the images included in the selected component image areas according to any one of the thresholds to generate the component drawing image. If it is judged that the estimated shape is inappropriate, the drawing generator generates a new component drawing image by changing over the thresholds.

Also, preferably, the drawing generator has a plurality of thresholds for binarizing images included in the selected component image areas to generate the component drawing image, and binarizes the images included in the selected component image areas according to each one of the thresholds to generate a plurality of the component drawing image for any one of the component image areas. The shape estimation unit determines a plurality of the estimated shape respectively by use of the plural component drawing images. The evaluation unit evaluates respectively the plural estimated shapes. The object shape determining unit specifies one of the plural estimated shapes as a shape of the object with a highest evaluation result in the evaluation unit.

Also, preferably, a threshold setting unit determines a threshold for generating the component drawing image by binarizing images included in the selected component image areas. The drawing generator binarizes the images included in the selected component image areas according to the threshold determined by the threshold setting unit, and generates the component drawing image. If it is judged that the estimated shape is inappropriate, the threshold setting unit determines a new threshold, and the drawing generator generates a new component drawing image according to the new threshold.

Also, preferably, a threshold setting unit determines a plurality of thresholds for generating the component drawing image by binarizing images included in the selected component image areas. The drawing generator binarizes the images included in the selected component image areas for each of the plural thresholds and generates the plural component drawing images for one of the component image areas. The shape estimation unit determines a plurality of the estimated shape respectively by use of the plural component drawing images. The evaluation unit evaluates respectively the plural estimated shapes. The object shape determining unit specifies one of the plural estimated shapes as a shape of the object with a highest evaluation result in the evaluation unit.

A size measuring device of the present invention includes an area extracting unit, a drawing generator, an eliminator, a shape estimation unit, an evaluation unit, an object shape determining unit, a rangefinding unit, a size measuring unit and a size determining unit. The area extracting unit recognizes component images in which it is presumed that an object in a particular shape is imaged within a frame, to extract component image areas from the frame in which the component images are respectively present. The drawing generator sequentially selects the component image areas, and converts images including the component image in the selected component image areas into respectively a drawing image, to generate a component drawing image. The eliminator eliminates one shape line and/or a certain shape line as an unwanted shape line among shape lines included in respectively the component drawing image, the one shape line having a center in a substantially equal position to a center of the component drawing image and having vertical and horizontal sizes equal to or less than substantially a half of a size of the component drawing image, the certain shape line being disposed on a straight line passing a center point of the one shape line and a center point of the component drawing image. The shape estimation unit determines an estimated shape by optimizing a size of the particular shape so as to correspond to a corrected drawing image after elimination of the unwanted shape line. The evaluation unit judges appropriacy of the estimated shape by evaluating degree of overlap between the estimated shape and the corrected drawing image. The object shape determining unit specifies the estimated shape as a shape of the object extracted from the frame if it is judged that the estimated shape is appropriate. The rangefinding unit measures a distance to the object for imaging the object. The size measuring unit measures a size of the shape of the object specified by the object shape determining unit. The size determining unit determines an actual size of the object according to the distance measured by the rangefinding unit and the size measured by the size measuring unit.

Also, preferably, a magnification input unit inputs an imaging magnification for imaging the object. The size determining unit determines the actual size of the object according to the distance measured by the rangefinding unit, the size measured by the size measuring unit, and the imaging magnification input by the magnification input unit.

A distance measuring device of the present invention includes an area extracting unit, a drawing generator, an eliminator, a shape estimation unit, an evaluation unit, an object shape determining unit, a size input unit, a size measuring unit and a distance determining unit. The area extracting unit recognizes component images in which it is presumed that an object in a particular shape is imaged within a frame, to extract component image areas from the frame in which the component images are respectively present. The drawing generator sequentially selects the component image areas, and converts images including the component image in the selected component image areas into respectively a drawing image, to generate a component drawing image. The eliminator eliminates one shape line and/or a certain shape line as an unwanted shape line among shape lines included in respectively the component drawing image, the one shape line having a center in a substantially equal position to a center of the component drawing image and having vertical and horizontal sizes equal to or less than substantially a half of a size of the component drawing image, the certain shape line being disposed on a straight line passing a center point of the one shape line and a center point of the component drawing image. The shape estimation unit determines an estimated shape by optimizing a size of the particular shape so as to correspond to a corrected drawing image after elimination of the unwanted shape line. The evaluation unit judges appropriacy of the estimated shape by evaluating degree of overlap between the estimated shape and the corrected drawing image. The object shape determining unit specifies the estimated shape as a shape of the object extracted from the frame if it is judged that the estimated shape is appropriate. The size input unit inputs an actual size of the object. The size measuring unit measures a size of the shape of the object specified by the object shape determining unit. The distance determining unit determines a distance to the object for imaging the object according to the actual size input by the size input unit and the size measured by the size measuring unit.

Also, preferably, a magnification input unit inputs an imaging magnification for imaging the object. The distance determining unit determines the distance to the object according to the actual size input by the size input unit, the size measured by the size measuring unit, and the imaging magnification input by the magnification input unit.

A shape extraction method of the present invention includes an area extracting step, a drawing generation step, an elimination step, a shape estimation step, an evaluation step and an object shape determining step. In the area extracting step, component images are recognized in which it is presumed that an object in a particular shape is imaged within a frame, to extract component image areas from the frame in which the component images are respectively present. In the drawing generation step, the component image areas are sequentially selected, and images including the component image in the selected component image areas are converted into respectively a drawing image, to generate a component drawing image. In the elimination step, one shape line and/or a certain shape line as an unwanted shape line is eliminated among shape lines included in respectively the component drawing image, the one shape line having a center in a substantially equal position to a center of the component drawing image and having vertical and horizontal sizes equal to or less than substantially a half of a size of the component drawing image, the certain shape line being disposed on a straight line passing a center point of the one shape line and a center point of the component drawing image. In the shape estimation step, an estimated shape is determined by optimizing a size of the particular shape so as to correspond to a corrected drawing image after elimination of the unwanted shape line. In the evaluation step, appropriacy of the estimated shape is judged by evaluating degree of overlap between the estimated shape and the corrected drawing image. In the object shape determining step, the estimated shape is specified as a shape of the object extracted from the frame if it is judged that the estimated shape is appropriate.

Effect of the Invention

In the present invention, one shape line and/or a certain shape line as an unwanted shape line is eliminated among shape lines included in respectively the component drawing image, the one shape line having a center in a substantially equal position to a center of the component drawing image and having vertical and horizontal sizes equal to or less than substantially a half of a size of the component drawing image, the certain shape line being disposed on a straight line passing a center point of the one shape line and a center point of the component drawing image. An estimated shape is determined by optimizing a size of the particular shape so as to correspond to a corrected drawing image after elimination of the unwanted shape line. Thus, it is possible correctly to extract the object shape.

Also, if the component image areas overlap on one another, a shape line of the corrected drawing image in relation to the object of which a shape has been specified is also eliminated. Thus, it is possible to specify the object shape in a still more precise manner.

MODE FOR CARRYING OUT THE INVENTION

As shown inFIG. 1, a digital camera10has a lens barrel11in a front surface of a camera body10a. A taking lens12is incorporated in the lens barrel11. The lens barrel11, while a power source of the digital camera10is turned off, is contained inside the camera body10a, and while the power source is turned on, protrudes from the front surface of the camera body10aand is set in a wide-angle position. A zoom lens having a magnification lens12aand a focus lens12b(seeFIG. 3) is used as the taking lens12.

A flash light source15is disposed on the front surface of the camera body10a. The flash light source15is driven by a CPU40(seeFIG. 3) and emits flash light to an object. A power source button17, a release button18and the like are disposed on an upper surface of the camera body10a.

In the digital camera10, there are an imaging mode, a playback mode and a measuring mode. The imaging mode is for capturing a still image. The playback mode is for playing back the captured image. The measuring mode is for imaging an object to measure its actual size. Also, the measuring mode is a plurality of measuring modes according to types of the object (for example, a wood lumber measuring mode, a box measuring mode and the like).

The release button18is in a two-step structure. In the imaging mode and the measuring mode, when the release button18is depressed lightly (halfway), adjustment of exposure and focus adjustment are carried out as operation preparatory for capturing an image. When the release button18is depressed further (fully), an image is captured.

As shown inFIG. 2, a back surface of the camera body10ahas an LCD20, menu keys21and a zoom button22. The LCD20displays an image and various setting conditions. The menu keys21are for setting the condition of capturing an image and selection of modes. The zoom button22changes a magnification of the taking lens12. The zoom button22is manipulated to move the magnification lens12abetween a wide-angle position and telephoto position, to enlarge or reduce an image.

As shown inFIG. 3, a color image sensor, for example a CCD31is disposed behind the taking lens12for incidence of object light passed through the taking lens12. The CCD31generates three-color signals of a time sequence by photoelectric conversion of an object image as well-known in the art, and sends the three-color signals to a correlated double sampling circuit (CDS)32. A TG (timing generator)38is controlled by the CPU40, and generates a timing signal for driving, to drive the CCD31. The three-color signals generated by the CCD31are processed by the CDS32for elimination of a noise component, and converted into three-color signals corresponding correctly to accumulated charge amounts of respective cells of the CCD31. The three-color signals output by the CDS32are amplified by an amplifier (AMP)33according to the ISO sensitivity, and sent to an A/D converter34.

The A/D converter34converts the three-color signals digitally to form three-color image data (hereinafter referred to simply as image data). A zoom motor39aand a focus motor39bare driven through motor drivers (not shown) by the CPU40, and move the magnification lens12aand the focus lens12bfor zooming and focusing.

An EEPROM (not shown) is connected with the CPU40. In the EEPROM, various control programs and information for setting are recorded as well-known in the art. The CPU40reads the programs in the EEPROM, and controls relevant elements.

While a live image is displayed, an image input controller36sends image data from the A/D converter34to a video memory41. While an image is captured, the image input controller36sends the same to a buffer memory42. In the imaging of the live image, the image data of the live image with a low definition is recorded to the video memory41temporarily. The live image data is sent through a data bus37to an LCD driver43, to display the live image on the LCD20. When the release button18is depressed fully for capturing in the imaging mode or measuring mode, captured image data of a high definition is recorded to the buffer memory42temporarily. A memory controller44records the image data read from the buffer memory42to a memory card45. The CPU40causes the memory controller44to record a focal length to the memory card45, the focal length expressing a zoom magnification (imaging magnification) upon full depression of the release button18.

When the release button18is depressed halfway, a photometry/rangefinding unit47detects brightness of an object and a distance to the object according to image data of a live image, and determines a white balance correction amount and lens in-focus position according to a result of the detection. The photometry/rangefinding unit47operates at a cyclic period while the live image is displayed. Note that the object distance can be measured by a well-known method, such as phase difference detection and the like.

The photometry/rangefinding unit47successively transmits results of detection of the brightness and object distance to the CPU40. The CPU40moves the focus lens12baccording to the lens in-focus position from the photometry/rangefinding unit47. Also, the CPU40controls a shutter speed (charge storing time) of the CCD31and the operation of the flash light source15according to the brightness from the photometry/rangefinding unit47.

A battery48is contained inside the digital camera10, and supplies power to various elements such as the LCD20and the CPU40. A control circuit (not shown) for the battery48controls the power supply to the elements.

When the release button18is depressed fully in the measuring mode, an area extracting unit51for a component drawing image area reads an object image52in the buffer memory42. As shown inFIG. 4A, the area extracting unit51recognizes a component image having a particular shape predetermined for the object image52(elliptical for a sectional form of a wood lumber material in the wood lumber measuring mode, and quadrilateral in the box measuring mode). In the present embodiment, the wood lumber measuring mode is selected.12wood lumber images54A-54L are included in the object image52.

As shown inFIG. 4B, the area extracting unit51extracts component image areas53A-53L where a component image of each object (wood lumber material) in the object image52is present according to a result of the recognition. InFIGS. 4A and 4B, fine lines are omitted from the depiction. Note that the extracted component image area can be analyzed to judge a wood lumber image and an image other than the wood lumber image according to the color of the image, so that a component image area without including a wood lumber image can be removed initially, for example, a component image area including a circular image similar to the wood lumber material.

As shown inFIG. 5A, a drawing generator61for a component drawing image (seeFIG. 3) selects one of the component image areas53A-53L (for example, the component image area53A) extracted by the area extracting unit51.

The drawing generator61includes a target image detection filter63for extracting an image for conversion into a drawing image among images inside the selected component image area. The target image detection filter63analyzes changes in the color inside the selected component image area in numerical analysis, and extracts an image of which a change in the color is larger than a predetermined detection threshold.

As shown inFIG. 5B, the drawing generator61produces a component drawing image62by converting the image extracted by the target image detection filter63into the drawing image. In the present embodiment, the drawing generator61selects the component image area53A, component image area53B, component image area53C, . . . , component image area53K and component image area53L in the listed order and produces the component drawing image62corresponding to each of those.

An eliminator66(seeFIG. 3) eliminates a paracentral shape line71(shape line included in an area surrounded by the broken line inFIG. 5B), an edge side shape line72, and a peripheral shape line73from shape lines included in the component drawing image62. The paracentral shape line71has a center in the same position as the center of the component drawing image62, and has sizes equal to or less than a half of that of the component drawing image62in the vertical and horizontal directions. The edge side shape line72contacts the boundary edge of the component image area53A. The peripheral shape line73lies on a straight line (two-dot-dash line inFIG. 5B) passing the center point CP1as a center (center of gravity) of the shape lines themselves and the center point CP2of the component drawing image62. The center point PC1of the shape lines is a point of the average of the X and Y coordinates in the pixel coordinate system of one shape line. Also, the point of the center coordinates of the straight line passing the ends of one shape line may be a center point CP1of the shape lines. An area for defining the paracentral shape line71is also changeable suitably.

As shown inFIG. 6, a shape estimation unit67(seeFIG. 3) performs ellipse fitting of a corrected drawing image64after elimination of the shape lines71-73in the eliminator66according to a well-known fitting method. The shape estimation unit67determines an estimated elliptical shape76of an optimized size of the ellipse (particular shape) for correspondence to the corrected drawing image64. In the box measuring mode, the fitting of the box shape is carried out to determine the estimated box shape.

A shape evaluation unit81for an estimated shape (seeFIG. 3) evaluates the estimated elliptical shape76and detects its appropriacy. The shape evaluation unit81detects a total pixel number of an overlapped portion between a residual shape line75inside the corrected drawing image64and the estimated elliptical shape76. The shape evaluation unit81, if the total pixel number is more than a predetermined threshold, judges that the estimated elliptical shape76is appropriate, and if the total pixel number is equal to or less than the threshold, judges that the estimated elliptical shape76is not appropriate. Note that the threshold can be changeable, and can be determined by a user.

If the shape evaluation unit81judges that the estimated elliptical shape76is inappropriate, the eliminator66eliminates shape lines disposed outside the estimated elliptical shape76. Then the shape evaluation unit81carries out determination and evaluation of the estimated elliptical shape76again, and repeats those until it is judged that the estimated elliptical shape76is appropriate.

If the shape evaluation unit81judges that the estimated elliptical shape76is appropriate, an object shape determining unit83specifies the estimated elliptical shape76as a shape of the wood lumber material. A size measuring unit84measures a size (size of the wood lumber material in the object image) of the estimated elliptical shape76specified by the object shape determining unit83. The size measuring unit84measures a height and width of the estimated elliptical shape76.

A size determining unit85obtains an actual size of the wood lumber material according to the size measured by the size measuring unit84, the distance to the wood lumber material detected by the photometry/rangefinding unit47, and the focal length (zoom magnification) of the taking lens12. The obtained actual size data of the wood lumber material is recorded to the memory card45.

As shown inFIG. 7, an estimated elliptical shape of the component image areas53A-53F has been determined to determine the shape of the wood lumber material for the time of converting images included in the component image area53G into a drawing image to produce the component drawing image62. Thus, the eliminator66eliminates also determined shape lines74(shape lines used with the component image areas53A-53F) of the component images of which the shapes have been specified, namely the shape lines disposed in the left or bottom of the component drawing image62, as well as the shape lines71-73. Similarly, the determined shape lines74in addition to the shape lines71-73are eliminated at the time of specifying the shape of the wood lumber material in the component image areas53B-53F and53H-53L.

The operation of the first embodiment is described by referring to the flow chart ofFIG. 8. The release button18is depressed halfway in the wood lumber measuring mode (Step (hereinafter referred to as S)1). A distance (object distance) to the wood lumber material (object) is detected by the photometry/rangefinding unit47. Then the release button18is depressed fully for capturing an image (S2). Image data of an image captured by the CCD31is recorded to the buffer memory42, and then retrieved by the area extracting unit51(S3). The area extracting unit51recognizes an ellipse in the object image52, to extract the component image areas53A-53L of the wood lumber material in the object image52(S4).

The drawing generator61selects one of the component image areas53A-53L (for example, the component image area53A) extracted by the area extracting unit51. The target image detection filter63analyzes a change in the color inside the component image area53A by the numerical analysis, and extracts an image of which a change in the color is higher than the detection threshold. The drawing generator61generates the component drawing image62(S5) by converting the extracted image into a drawing image.

The eliminator66eliminates the paracentral shape line71, the edge side shape line72, the peripheral shape line73and the determined shape lines74from shape lines included in the component drawing image62(S6), the paracentral shape line71having a center substantially in the same position as a center of the component drawing image62, and having vertical and horizontal sizes equal to or less than a half of that of the component drawing image62, the edge side shape line72contacting a boundary edge of the component image area53A, the peripheral shape line73lying on a straight line passing the center CP1of the shape line itself and the center CP2of the component drawing image62, and the determined shape lines74being associated with the estimated elliptical shape76which has been already specified.

The shape estimation unit67performs ellipse fitting to the corrected drawing image64after elimination of the shape lines71-74, and determines the estimated elliptical shape76(S7) by estimating the wood lumber shape. The shape evaluation unit81detects a total pixel number of an overlapped portion between the residual shape line75in the corrected drawing image64and the estimated elliptical shape76, and checks whether the total pixel number is more than a threshold (S8). If the total pixel number is more than the threshold (Y in S8), it is judged that the estimated elliptical shape76is appropriate. So the object shape determining unit83specifies the estimated elliptical shape76as a shape of a wood lumber material (S9). The size measuring unit84measures (S10) a size of the specified the estimated elliptical shape76(size of the wood lumber material in the object image). The size determining unit85arithmetically determines the actual size of the wood lumber material (S11) according to the size measured by the size measuring unit84, the distance to the wood lumber material detected by the photometry/rangefinding unit47, and the focal length. The data of the determined actual size of the wood lumber material is recorded to the memory card45.

If the total pixel number is equal to or less than the threshold (N in S8), it is judged that the estimated elliptical shape76is not appropriate. The eliminator66eliminates the shape lines disposed outside the estimated elliptical shape76. Then the steps including S7and thereafter are carried out again. S1-S12are carried out for all of the component image areas53A-53L.

Accordingly, the paracentral shape line71, the edge side shape line72, the peripheral shape line73and the determined shape lines74are eliminated from the shape lines included in the component drawing image62, to specify the shape by use of the corrected drawing image64after eliminating the shape lines71-74. It is possible exactly to specify the shape in comparison with a method of specifying the shape by use of the component drawing image62inclusive of the shape lines71-74.

In a second embodiment shown inFIG. 9, the corrected drawing image64is split into four areas. The shape estimation unit67selects at least one shape line from each of the areas. Elements the same as those of the first embodiment are designated by the same reference numerals, and are not described further.

The shape estimation unit67divides the corrected drawing image64into first to fourth areas64a-64d, and selects a shape line disposed in a predetermined position (for example, center) of each of the areas64a-64d, for example, by one shape line. The shape estimation unit67performs the ellipse fitting for all the selected shape lines and determines the estimated elliptical shape76. Thus, time taken for determining the estimated elliptical shape76is shorter than the method of ellipse fitting for all the shape lines within the corrected drawing image64. Note that the division number for dividing the corrected drawing image64is not limited to four but is changeable suitably. For the division, it is preferable to divide the corrected drawing image64about its center point equally. The number of the shape line to be selected from each of the areas is not limited to one but is changeable suitably.

In a digital camera100of a third embodiment shown inFIGS. 10 and 11, the photometry/rangefinding unit is omitted. A distance to a wood lumber material is arithmetically determined by use of the size measured by the size measuring unit84. Elements the same as those of the first embodiment are designated by the same reference numerals, and are not described further.

As shown inFIG. 10, the digital camera100includes a distance determining unit101for arithmetically determining the distance to the wood lumber material (object). For imaging in the wood lumber measuring mode, a user manipulates the menu keys21to input an actual size of the wood lumber material as object. The distance determining unit101determines the distance to the wood lumber material according to the size measured by the size measuring unit84, the input actual size of the wood lumber material, and the focal length.

The operation of the third embodiment is described next by referring to a flow chart ofFIG. 11. In the wood lumber measuring mode (S101), the menu keys21are operated to input an actual size of the wood lumber material as object (S102). The release button18is depressed fully (S103) to input the captured image data to the area extracting unit51(S104). S105-S111and S113are the same as S4-S10and S12of the first embodiment, and are not described further.

When the size measuring unit84measures the size (size of the wood lumber material in the object image) of the estimated elliptical shape76(S111), the distance determining unit101arithmetically determines a distance to the wood lumber material (S112) according to the size measured by the size measuring unit84, the input actual size of the wood lumber material, and the focal length. The determined distance data to the wood lumber material is recorded to the memory card45. S101-S113are carried out for all of the component image areas53A-53L.

A digital camera110of a fourth embodiment shown inFIGS. 12 and 13produces the component drawing image62newly if the shape evaluation unit81judges that the estimated elliptical shape76is not appropriate.

As shown inFIG. 12, a drawing generator111for a component drawing image includes a plurality of (for example10) target image detection filters112a-112jfor extracting an image to be converted into a drawing image among the images inside the selected component image area. The target image detection filters112a-112jare different in the detection threshold for extracting an image for conversion into a drawing image. The drawing generator111extracts an image for conversion into a drawing image by use of any one of the target image detection filters112a-112j. The drawing generator in produces the component drawing image62by converting the extracted image into the drawing image.

If the shape evaluation unit81judges that the estimated elliptical shape76is not appropriate, the drawing generator111changes one of the target image detection filters112a-112jfor use, extracts an image again, and forms the component drawing image62newly. This is repeated until it is judged that the estimated elliptical shape76is appropriate. In the embodiment, the drawing generator111uses the target image detection filter112a, target image detection filter112b, target image detection filter112c, . . . , target image detection filter112iand target image detection filter112jin the listed order.

If it is judged in all the target image detection filters112a-112jthat the estimated elliptical shapes76are inappropriate, then the object shape determining unit83specifies one of the estimated elliptical shapes76as a shape of a wood lumber material with a highest result of the evaluation.

The operation of the fourth embodiment is described next by referring to a flow chart ofFIG. 13. The release button18is depressed fully (S202) in the wood lumber measuring mode (S201). Then captured image data is input to the area extracting unit51(S203).

The area extracting unit51extracts the component image areas53A-53L of pieces of the wood lumber material in the object image52(S204). The drawing generator111selects one of the component image areas53A-53L (for example, the component image area53A) extracted by the area extracting unit51. Any one of the target image detection filters112a-112j(for example, the target image detection filter112a) analyzes a change in the color inside the component image area53A according to the numerical analysis, and extracts an image of which the change in the color is higher than the detection threshold. The drawing generator111generates the component drawing image62by converting the extracted image into a drawing image (S205). S206-S211are the same as S6-S11of the first embodiment, and are not described further.

If the pixel total number is equal to or smaller than the threshold (N in S208), it is judged that the estimated elliptical shape76is not appropriate. At this time, one of the target image detection filters112a-112jfor use is changed over (S212), to extract an image for conversion into a drawing again. The drawing generator111creates a new component drawing image62according to the newly extracted image (S205). Then the steps including S206and thereafter are carried out again. S201-S212are carried out for all of the component image areas53A-53L. It is possible to measure a distance to the wood lumber material by applying the structure of the fourth embodiment to the third embodiment.

A digital camera120of a fifth embodiment shown inFIGS. 14 and 15generates a plurality of (for example, five) component drawing images62from one component image area.

A drawing generator121for a component drawing image includes a plurality of (for example, five) target image detection filters122a-122efor extracting images for conversion into drawing images among images included in the selected component image area. The target image detection filters122a-122eare different in the detection threshold for extracting an image for conversion into a drawing image. The drawing generator121extracts images by use of respectively the target image detection filters122a-122e, and produces five component drawing images62in correspondence thereto. The shape estimation unit67determines five estimated elliptical shapes76by use of the five component drawing images62. The shape evaluation unit81evaluates and checks the five estimated elliptical shapes76. The object shape determining unit83specifies one of the estimated elliptical shapes76as a wood lumber shape with a highest value of an evaluation result in the shape evaluation unit81. The size measuring unit84measures the size of the specified estimated elliptical shape76.

The operation of the fifth embodiment is described by referring to the flow chart ofFIG. 15. In the wood lumber measuring mode (S301), the release button18is depressed fully for capturing an image (S302). Image data of a captured image is input to the area extracting unit51(S303). The area extracting unit51extracts the component image areas53A-53L of the pieces of the wood lumber material in the object image52(S304). The drawing generator61selects one of the component image areas53A-53L (for example, the component image area53A) extracted by the area extracting unit51. Each one of the target image detection filters122a-122eanalyzes a change in the color inside the component image area53A according to the numerical analysis, and extracts an image of which the change in the color is higher than the detection threshold. The drawing generator111converts the image extracted by each of the target image detection filters122a-122einto a drawing image, and generates five component drawing images62corresponding to the target image detection filters122a-122e(S305).

The eliminator66eliminates the paracentral shape line71, the edge side shape line72, the peripheral shape line73and the determined shape lines74from each of the five component drawing images62(S306).

The shape estimation unit67performs the ellipse fitting to each of the five corrected drawing images64, and determines the five estimated elliptical shapes76(S307). The shape evaluation unit81detects a total pixel number of an overlapped portion of each of the five estimated elliptical shapes76with the residual shape line75. The shape evaluation unit81evaluates the five estimated elliptical shapes76according to the respectively detected total pixel number (S308).

The object shape determining unit83specifies one of the estimated elliptical shapes76as a wood lumber shape with a highest value of an evaluation result in the shape evaluation unit81(S309). The size measuring unit84measures the size of the specified estimated elliptical shape76(S310). The size determining unit85arithmetically determines an actual size of the wood lumber material according to the size measured by the size measuring unit84, the distance to the wood lumber material detected by the photometry/rangefinding unit47, and the focal length. S301-S311are carried out for all of the component image areas53A-53L. It is possible to measure the distance to the wood lumber material by applying the structure of the fifth embodiment to the third embodiment.

A digital camera130of a sixth embodiment shown inFIGS. 16 and 17includes a threshold setting unit131for determining a detection threshold for extracting an image to be converted into a drawing image among images included in the selected component image area.

As shown inFIG. 16, the threshold setting unit131analyzes the hue inside the selected component image area, and produces a histogram of the value of the hue, and obtains the detection threshold by adding a constant to a peak value of the produced histogram. Note that a constant may be subtracted from the peak value to obtain the detection threshold. A detection threshold can be a value equal to a difference from the peak value which appears at a constant frequency, a value or equal to a ratio to the peak value which appears at a constant frequency, or a value equal to a smallest difference from the peak value which appears at a constant frequency.

A drawing generator132for a component drawing image binarizes the image included in the component image area (extracts an image of which the value of the hue is higher than the detection threshold) according to the detection threshold set by the threshold setting unit131, and generates the component drawing image62.

If it is judged that the estimated elliptical shape76is not appropriate, the threshold setting unit131changes a constant for addition to the peak value, and determines a detection threshold again. The drawing generator132generates the component drawing image62newly according to the new detection threshold. This is repeated until it is judged that the estimated elliptical shape76is appropriate.

The operation of the sixth embodiment is described next by referring to a flow chart ofFIG. 17. The release button18is depressed fully (S402) in the wood lumber measuring mode (S401). Then captured image data is input to the area extracting unit51(S403). The area extracting unit51extracts the component image areas53A-53L of the pieces of the wood lumber material in the object image52(S404).

The drawing generator132selects one of the component image areas53A-53L (for example, the component image area53A) extracted by the area extracting unit51. The threshold setting unit131analyzes the hue inside the component image area53A, and produces a histogram of the value of the hue. The threshold setting unit131determines the detection threshold (S405) by adding a constant to a peak value of the produced histogram. The drawing generator132extracts an image of which the value of the hue is higher than the detection threshold determined by the threshold setting unit131among the images included in the component image area53A. The drawing generator132converts the extracted image into a drawing to create the component drawing image62(S406). S407-S412are the same as S6-S11of the first embodiment, and are not described further.

If the total pixel number is equal to or less than the threshold (N in S409), then it is judged that the estimated elliptical shape76is not appropriate. The threshold setting unit131changes the constant for addition to the peak value of the histogram of the hue value of the component image area53A, and arithmetically determines a new detection threshold (S413). The drawing generator132extracts an image from the component image area53A by use of the new detection threshold, and generates the component drawing image62newly according to the new detection threshold (S406). Then the steps including S407and thereafter are carried out again. S401-S413are carried out for all of the component image areas53A-53L. Note that a distance to the wood lumber material can be measured by applying the structure of the sixth embodiment to the third embodiment.

In the above embodiments, the digital camera is described. However, the present invention can be used in an image processing device (system) constituted by the digital camera, personal computer and the like. In this structure, the personal computer carries out the extraction of component image areas, generation of a component drawing image, elimination of unwanted shape lines, determination of an estimated shape, evaluation of appropriacy of the estimated shape, designation of the shape of an object, and measurement of the size of the object, according to the object image captured by the digital camera. Furthermore, the present invention can be used for a stereo camera for capturing a plurality of view images by imaging from a plurality of viewpoints, and a cellular telephone with a camera, and the like. For use in the stereo camera, a front elevational image as viewed in a front elevation is generated according to plural view images, so that the various processes are carried out according to the front elevational image.

In the above embodiments, the shape of the object is specified, and the actual size of the object or the distance to the object is measured according to the shape of the object. However, it is possible to specify at least the shape of the object.

In the embodiments described above, the paracentral shape line, edge side shape line, peripheral shape line and determined shape lines are eliminated from shape lines included in the component drawing image. However, it is possible to eliminate at least either one of the paracentral shape line and peripheral shape line.

Furthermore, it is possible to measure the size of the wood lumber material in a sequence of, for example, highness in the degree of coincidence of the shape, or in a sequence of highness of the definition. Also, the sequence can be determined by a user.

In the above embodiments, the estimated elliptical shape is evaluated for the appropriacy according to the total pixel number of the portion of overlapping the estimated elliptical shape with the shape lines within the corrected drawing image. Alternatively, it is possible to evaluate the appropriacy according to the pixel number of the shape lines within a predetermined distance from the estimated elliptical shape. It is preferable to carryout weighting of the shape lines in an order of nearness to the estimated elliptical shape.

In the sixth embodiment described above, the threshold setting unit determines the detection threshold again if it is judged that the estimated elliptical shape is not appropriate. However, the threshold setting unit can previously determine plural detection thresholds, with which a plurality of component drawing images can be generated. In this structure, one of the component drawing images of which an evaluation result is the highest is used for determining the actual size of the wood lumber material.

Note that, although the threshold setting unit sets the detection threshold in the sixth embodiment described above, a plurality of detection thresholds can be predetermined.

Description of the Reference Numerals

53A-53L component image areas

54A-54L wood lumber images

64a-64dfirst to fourth areas

71paracentral shape line

72edge side shape line

73peripheral shape line

74determined shape lines

75residual shape line