WO2019138930A1 - 錠剤検査方法および錠剤検査装置 - Google Patents

錠剤検査方法および錠剤検査装置 Download PDF

Info

Publication number
WO2019138930A1
WO2019138930A1 PCT/JP2018/048426 JP2018048426W WO2019138930A1 WO 2019138930 A1 WO2019138930 A1 WO 2019138930A1 JP 2018048426 W JP2018048426 W JP 2018048426W WO 2019138930 A1 WO2019138930 A1 WO 2019138930A1
Authority
WO
WIPO (PCT)
Prior art keywords
tablet
main surface
edge
area
image
Prior art date
Application number
PCT/JP2018/048426
Other languages
English (en)
French (fr)
Inventor
和隆 谷口
Original Assignee
株式会社Screenホールディングス
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from JP2018004210A external-priority patent/JP7075218B2/ja
Priority claimed from JP2018004206A external-priority patent/JP7083646B2/ja
Priority claimed from JP2018004211A external-priority patent/JP6980538B2/ja
Application filed by 株式会社Screenホールディングス filed Critical 株式会社Screenホールディングス
Priority to CN202310949454.2A priority Critical patent/CN116973369A/zh
Priority to CN201880086537.0A priority patent/CN111602047B/zh
Publication of WO2019138930A1 publication Critical patent/WO2019138930A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/85Investigating moving fluids or granular solids
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8806Specially adapted optical and illumination features
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8806Specially adapted optical and illumination features
    • G01N2021/8841Illumination and detection on two sides of object
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques

Definitions

  • the present invention relates to a tablet inspection method and a tablet inspection apparatus, and more particularly to an inspection technique using a camera for imaging a tablet.
  • Patent Document 1 tablet inspection apparatuses for inspecting the appearance of tablets have been proposed (for example, Patent Documents 1 and 2).
  • the inspection unit includes transport means for transporting the tablets, and four imaging devices (cameras) for imaging the tablets being transported.
  • the two cameras image the top and bottom of the tablet respectively, and the remaining two cameras image the sides of the tablet from opposite sides.
  • the inspection unit performs an appearance inspection by performing image processing on each of the captured images captured by the camera.
  • the inspection apparatus is provided with the conveyor which conveys a tablet, and one imaging device for imaging the tablet in conveyance.
  • the imaging device captures an image so that the upper surface of the tablet viewed from the upper side and the side surface of the tablet viewed from four sides are included in one captured image.
  • the imaging device includes one camera and four prisms.
  • the camera is disposed on the upper side of the tablet, and light from the upper surface of the tablet is imaged on the imaging surface of the camera.
  • the prisms are arranged in the four sides of the tablet and reflect light from the side of the tablet to the camera. The light is also imaged on the imaging surface of the camera. Thereby, the camera can image the external appearance of the tablet seen from five directions.
  • the inspection apparatus performs an appearance inspection of a tablet by performing image processing on a captured image captured by a camera.
  • patent document 3 is also posted as a technique relevant to this application.
  • Patent Document 2 the upper surface of the tablet viewed from the upper side and the side surface of the tablet viewed from the four sides are separated from each other in the captured image. That is, in the first to fifth regions separated from each other in the captured image, the upper surface of the tablet and the side surface of the tablet are shown.
  • this invention aims at the tablet inspection method and tablet inspection apparatus which can distinguish the main surface and the side surface with high precision in the captured image which the main surface and the side surface of a tablet mutually touch.
  • the 1st mode of the tablet inspection method is a tablet inspection method which inspects the appearance of the tablet which has a pair of the 1st principal surface, the 2nd principal surface, and the side, and picturizes the tablet Forming a captured image including both the first main surface and the side surface, and identifying a main surface area and a side surface region respectively occupied by the first main surface and the side surface in the captured image (B) and a step (c) of performing an inspection process on the main surface area and the side surface area, wherein the step (b) is performed on the contour of the first main surface in the captured image.
  • An approximate line of the main surface edge is calculated as the contour of the main surface region based on the step (b1) of identifying the corresponding main surface edge and a function indicating the shape of the contour of the main surface region in the captured image.
  • a second aspect of the tablet inspection method is the tablet inspection method according to the first aspect, wherein the tablet has a substantially disk shape, the function is a function indicating an ellipse, and the approximate line is an ellipse It is.
  • a third aspect of the tablet inspection method is the tablet inspection method according to the first or second aspect, wherein the main surface area and the side surface area constitute a tablet area occupied by the tablet in the captured image.
  • the step (b1) includes the steps of: performing an edge detection process on the captured image to generate an edge image; and identifying a tablet edge corresponding to the contour of the tablet area from the edge image (B12), a portion of the periphery of the first main surface in the captured image which is a part of the contour of the tablet region, and the main surface outside corresponding to the periphery of the second main surface in the captured image Extracting an edge and a lateral outer edge from the tablet edge (b13); and searching the edge image for a predetermined distance from the lateral outer edge along a predetermined direction. Searching a pixel in the pixel to specify a boundary edge corresponding to the boundary between the main surface area and the side surface area (b14); And (b14) of identifying as a surface edge.
  • a fourth aspect of the tablet inspection method is the tablet inspection method according to the third aspect, wherein, in the step (b14), a pixel in the search area of the edge image, which corresponds to the pixel The boundary edge is identified by searching for a pixel whose pixel value of the pixel of the captured image is larger than a predetermined threshold.
  • a fifth aspect of the tablet inspection method is the tablet inspection method according to the third or fourth aspect, wherein, in the step (b14), in the search area, from the side outer edge toward the main surface outer edge in the search area The pixel is searched to identify the boundary edge.
  • a sixth aspect of the tablet inspection method is the tablet inspection method according to any one of the first to fifth aspects, wherein the surface roughness of one of the first main surface and the side surface of the tablet is greater than the other. Also, in the step (c), when the value of each pixel obtained by performing edge strength processing on one of the main surface area and the side surface area of the captured image is larger than a first threshold, Obtained by performing an edge strength process on the other of the main surface area and the side surface area in the step (c1) of determining that the one of the first main surface and the side surface of the tablet has a defect Determining that a defect has occurred in the other of the first main surface and the side surface of the tablet when the pixel value of each pixel is greater than a second threshold value larger than the first threshold value (c2 And.
  • a seventh aspect of the tablet inspection method is the tablet inspection method according to any one of the first to sixth aspects, wherein one of the first main surface and the side surface of the tablet in the captured image is from the other.
  • the step (c) when the pixel value of each pixel of the main surface area and the side surface area of the captured image is smaller than a third threshold, the first main surface of the tablet and the pixel A step (c1) of determining that a defect has occurred in the one of the side surfaces, and a pixel value of each of the other pixels of the main surface area and the side surface area of the captured image is smaller than the third threshold. Determining (c2) determining that the other of the first main surface and the side surface of the tablet has a defect when it is smaller than a threshold value.
  • An eighth aspect of the tablet inspection method is the tablet inspection method according to any one of the first to seventh aspects, wherein a dividing line is formed on the first main surface of the tablet, and b) includes a step (b3) of specifying a dividing line area including the dividing line and an undivided area not including the dividing line in the main surface area in the pickup image, and in the step (c), the pickup image
  • a dividing line is formed on the first main surface of the tablet
  • b) includes a step (b3) of specifying a dividing line area including the dividing line and an undivided area not including the dividing line in the main surface area in the pickup image, and in the step (c), the pickup image
  • the pixel value of each pixel obtained by performing edge strength processing on the secant region of the image is larger than a fifth threshold, it is determined that a defect has occurred in the secant region, and the non-image of the captured image is determined
  • a ninth aspect of the tablet inspection apparatus is a tablet inspection apparatus for inspecting the appearance of a tablet having a pair of first main surfaces and a second main surface and a side surface, wherein the first main surface and the side surface of the tablet
  • an image processing unit that performs inspection processing on the side surface area, and the image processing unit specifies a main surface edge corresponding to the outline of the first main surface in the captured image, and The approximate line of the major surface edge is determined as the contour of the major surface region based on a function predetermined as the shape of the contour of the major surface region.
  • a tenth aspect of the tablet inspection method is the tablet inspection method for inspecting the appearance of a tablet, which comprises imaging a tablet and capturing images including a plurality of images in which the appearance of the tablet viewed from a plurality of imaging directions is captured. Step (a) of generating, Step (b) of performing inspection processing on the captured image for detecting a defect candidate of the tablet, and the first region of the tablet reflected in the plurality of images by the inspection processing And (c) determining that the tablet has a defect when a common defect candidate is detected in two or more of the plurality of images.
  • An eleventh aspect of the tablet inspection method is the tablet inspection method according to the tenth aspect, wherein the second region of the tablet is formed on only n (n is an integer of 2 or more) images of the plurality of images.
  • a twelfth aspect of the tablet inspection method is the tablet inspection method according to the tenth or eleventh aspect, wherein the third region of the tablet is shown in only one of the plurality of images, and the inspection The method further includes the step (f) of determining that the tablet has a defect when a defect candidate is detected in the third region of the one image by the processing.
  • a thirteenth aspect of the tablet inspection method is the tablet inspection method according to any one of the tenth to twelfth aspects, wherein a mask area not to be inspected in the inspection process is set for each of the plurality of images, The fourth region of the tablet is copied to an inspection target region other than the mask region in only m (an integer of 2 or more) images among the plurality of images, and in the step (c), the inspection process is performed.
  • m an integer of 2 or more
  • a fourteenth aspect of the tablet inspection method is the tablet inspection method according to the thirteenth aspect, wherein in each of the plurality of images, a pixel value is equal to or more than a predetermined value than other regions due to specular reflection of light to the tablet. An area including an area to be raised is set as the mask area.
  • a fifteenth aspect of the tablet inspection method is the tablet inspection method according to the thirteenth or fourteenth aspect, wherein the tablet has a first main surface, which is the first region, and a first surface facing the first main surface.
  • An end having two main surfaces and a side surface connecting the peripheral edge of the first main surface and the peripheral edge of the second main surface, and located on both sides of a side surface area occupied by the side surface of the tablet in each of the plurality of images.
  • An area is set to the mask area.
  • a sixteenth aspect of the tablet inspection method is the tablet inspection method according to any one of the tenth to fifteenth aspects, wherein the tablet has a first main surface which is the first region, and the first main surface. And a side surface connecting the periphery of the first main surface and the periphery of the second main surface, wherein the step (b) includes, in each of the plurality of images, the tablet Identifying a main surface edge corresponding to the outline of the main surface area indicated by the first main surface, and a function predetermined as the shape of the outline of the main surface area in each of the plurality of images (B2) of obtaining an approximate line of the main surface edge as the contour of the main surface region based on the step (b3) of detecting a defect candidate in each of the plurality of images; In c), the position of each pixel relative to the main surface area is Based of the relationship between the mutual images, the detected defect candidates in the step (b3) to determine whether common to the two or more images.
  • a seventeenth aspect of the tablet inspection method is the tablet inspection method according to the sixteenth aspect, wherein the first main surface of the tablet has a substantially circular shape in plan view, and the function shows an ellipse It is a function and the approximation line is an ellipse.
  • An eighteenth aspect of the tablet inspection method is the tablet inspection method according to the sixteenth or seventeenth aspect, wherein the tablet has a substantially disc shape, and the side surface of the tablet in each of the plurality of images.
  • the side surface area occupied by and the main surface area constitute a tablet area, and when each of the plurality of images is referred to as an inspection image, the step (b1) performs an edge detection process on the inspection image.
  • a nineteenth aspect of the tablet inspection method is the tablet inspection method according to the eighteenth aspect, wherein in the step (b14), the pixel in the search area of the edge image, which corresponds to the pixel The boundary edge is identified by searching for a pixel whose pixel value of the pixel of the inspection image is larger than a predetermined threshold.
  • a twentieth aspect of the tablet inspection method is the tablet inspection method according to the eighteenth or nineteenth aspect, wherein, in the step (b14), in the search area, the side outer edge toward the main surface outer edge in the search area The pixel is searched to identify the boundary edge.
  • a twenty-first aspect of the tablet inspection apparatus is the tablet inspection apparatus for inspecting the appearance of a tablet, which is an image of a tablet, and a captured image including a plurality of images in which the appearance of the tablet viewed from a plurality of imaging directions is captured.
  • the image processing unit includes an imaging unit to generate and an image processing unit, and the image processing unit performs an inspection process for detecting a defect candidate of a tablet on the captured image, and the inspection process generates the plurality of images. In the first region of the tablet to be photographed, when a common defect candidate is detected in two or more of the plurality of images, it is determined that the tablet has a defect.
  • a twenty-second aspect of the tablet inspection method is a tablet inspection method for inspecting the appearance of a tablet having a pair of first main surface and second main surface, and a side surface, comprising imaging the tablet and processing the first main surface And a step (a) of generating a captured image in which both of the side surfaces are captured, and corresponding to a boundary between a main surface region and a side surface region occupied by the first main surface and the side surface of the tablet in the captured image.
  • a boundary edge is identified, and a first approximate line approximating the boundary edge is calculated based on a function indicating the shape of the boundary in the captured image, and each pixel on the boundary edge and the step And (c) determining that a chipping has occurred in the peripheral edge of the first main surface of the tablet when the distance between the first approximate line and the first approximate line is longer than a predetermined threshold value.
  • a twenty-third aspect of the tablet inspection method is the tablet inspection method according to the twenty-second aspect, wherein the main surface area and the side surface area constitute a tablet area occupied by the tablet in the captured image
  • the step (b) is a step (b1) of performing edge detection processing on the captured image to generate an edge image, and a step (b2) of identifying a tablet edge corresponding to the contour of the tablet area from the edge image And a portion of the periphery of the first main surface in the captured image that is a part of the contour of the tablet region, and a main surface outer edge and a side surface respectively corresponding to the periphery of the second main surface in the captured image Extracting an outer edge from the tablet edge (b3); searching for pixels in a search area at a predetermined distance from the side outer edge along the predetermined direction in the edge image And determining the boundary edge (b4) and the main surface outer edge and the boundary edge based on a function indicating the shape of the outline of the main region in the captured image.
  • the method includes the
  • a twenty-fourth aspect of the tablet inspection method is the tablet inspection method according to the twenty-third aspect, wherein the tablet has a substantially disc shape, the function is a function indicating an ellipse, and the second approximate line Is an ellipse.
  • a twenty-fifth aspect of the tablet inspection method is the tablet inspection method according to the twenty-third or the twenty-fourth aspect, wherein in the step (b4), the pixel in the search area of the edge image is The boundary edge is identified by searching for a pixel whose pixel value of the corresponding captured image pixel is larger than a predetermined threshold value.
  • a twenty-sixth aspect of the tablet inspection method is the tablet inspection method according to the twenty-fourth or twenty-fifth aspect, wherein, in the step (b4), in the search area, the side outer edge toward the main surface outer edge in the search area The pixel is searched to identify the boundary edge.
  • a twenty-seventh aspect of the tablet inspection method is the tablet inspection method according to any one of the twenty-third to twenty-sixth aspects, wherein the second approximate line of the main surface edge calculated in the step (b5) is used. Extracting the third approximate line of the main surface outer edge, and when the distance between each pixel on the main surface outer edge and the third approximate line is longer than a predetermined threshold value, Determining the chipping at the periphery of the first main surface.
  • a twenty-eighth aspect of the tablet inspection method is the tablet inspection method according to any one of the twenty-third to twenty-seventh aspects, wherein the second approximate line of the main surface edge calculated in the step (b5) is used.
  • a twenty-ninth aspect of the tablet inspection apparatus is the tablet inspection apparatus for inspecting the appearance of a tablet having a pair of first main surface and second main surface and a side surface, comprising imaging a tablet to obtain the first main surface And an imaging unit that generates a captured image including both of the side surfaces, and an image processing unit, wherein the image processing unit is a main surface area occupied by the first main surface and the side surface of the tablet in the captured image.
  • a boundary edge corresponding to the boundary between the image and the side area is identified, and a first approximate line approximating the boundary edge is calculated based on a function indicating the shape of the boundary in the captured image;
  • a predetermined threshold value it is determined that the periphery of the first main surface of the tablet is chipped.
  • the main surface area can be obtained with high accuracy. It can be identified. As a result, the main surface area and the side surface area can be distinguished with high accuracy.
  • an appropriate function is adopted according to the shape of the tablet, so that the main surface can be identified with high accuracy.
  • the main surface edge can be appropriately obtained.
  • the main surface area can be identified with higher accuracy.
  • the fifth aspect of the tablet inspection method even if a dividing line is formed on the main surface of the tablet, it is possible to avoid false detection of an edge corresponding to the dividing line as a boundary edge.
  • the sixth aspect of the tablet inspection method it is possible to suppress false detection of defect leak and defect in both the main surface area and the side surface area.
  • the seventh aspect of the tablet inspection method it is possible to suppress false detection of defect leak and defect in both the main surface area and the side surface area.
  • the eighth aspect of the tablet inspection method it is possible to suppress the false detection of the defect leak and the defect in both the secant region and the non-secant region.
  • the tablet inspection method and the twenty-first aspect of the tablet inspection apparatus when it is determined that a common defect candidate is detected in two or more images, it is determined that the tablet is defective. It is possible to suppress false reports at the time of defect detection.
  • the eleventh aspect of the tablet inspection method it is possible to further suppress the rare false alarm.
  • a defect in the third area can be detected.
  • defects in the fourth area can be appropriately detected.
  • the fourteenth aspect of the tablet inspection method it is possible to avoid false detection of the light intensity on the tablet as a defect.
  • the end area of the side area where the detection of a defect is difficult is set as the mask area, so that the influence on the defect detection due to false detection or omission of defect candidate in the end area is avoided. it can.
  • the sixteenth aspect of the tablet inspection method since the outline of the main surface area is obtained based on the function determined in advance as the shape of the outline of the main surface area, the accuracy of specifying the main surface area is high. According to this, it is possible to improve the accuracy of the correspondence between the two or more images of the pixels in the main surface area, and to improve the determination accuracy of the step (c).
  • the main surface can be identified with high accuracy.
  • the main surface edge can be appropriately obtained.
  • the main surface area can be identified with higher accuracy in each of the plurality of images.
  • the twentieth aspect of the tablet inspection method even if a dividing line is formed on the main surface of the tablet, it is possible to avoid erroneous detection of an edge corresponding to the dividing line as a boundary edge.
  • the tablet produced on the boundary of the first main surface and the side surface Chipping can be detected.
  • the first approximate line of the boundary edge can be appropriately obtained.
  • an appropriate function is adopted according to the shape of the tablet, so it is possible to calculate the second approximate line closer to the main surface of the tablet.
  • the twenty-fifth aspect of the tablet inspection method it is possible to calculate a first approximate line closer to the shape of the boundary between the main surface and the side surface in the captured image.
  • the twenty-sixth aspect of the tablet inspection method even if a dividing line is formed on the main surface of the tablet, it is possible to avoid false detection of an edge corresponding to the dividing line as a boundary edge.
  • chipping of a tablet generated on the periphery of the first main surface can be detected.
  • chipping of a tablet generated on the periphery of the second main surface can be detected.
  • FIG. 1 is a view schematically showing an example of the configuration of a tablet printing apparatus 10. As shown in FIG.
  • the tablet printing apparatus 10 includes a tablet inspection apparatus 1 and a print head 6.
  • the tablet inspection apparatus 1 is an apparatus for inspecting the appearance of the tablet 9.
  • FIG. 2 is a perspective view schematically showing an example of the tablet 9.
  • the tablet 9 has a substantially disc shape.
  • the tablet 9 includes a pair of main surfaces 9a and 9b and a side surface 9c.
  • a so-called flat lock or a lock with R can be adopted as the disk shape.
  • the main surfaces 9a and 9b face each other, and have substantially the same circular shape in plan view.
  • One and the other of the main surfaces 9a and 9b may be referred to as front and back, respectively, and may also be referred to as top and bottom.
  • the main surface 9a and the side surface 9c of the tablet 9 are connected to each other to form a corner, and the main surface 9b and the side surface 9c are also connected to each other to form a corner.
  • the diameter of the tablet 9 may be set to, for example, about 5 mm to about 10 several mm, and the thickness thereof may be set to, for example, about 5 mm or less.
  • tablet inspection apparatus 1 includes hopper 2, transport drum 3, transport unit 4, imaging head 5, sorting unit 7 and control unit 8.
  • the hopper 2 is a loading unit for loading the tablet 9 into the tablet printing apparatus 10.
  • the hopper 2 is provided above the ceiling of a housing (not shown) of the tablet printing apparatus 10.
  • the tablets 9 fed from the hopper 2 are guided to the transport drum 3.
  • the elements other than the hopper 2 are provided inside the housing of the tablet printing apparatus 10.
  • the transport drum 3 has a substantially cylindrical shape, and the central axis of the transport drum 3 is disposed along the Y-axis direction.
  • the transport drum 3 is rotated counterclockwise on the paper surface of FIG. 1 about a central axis as a rotation center by a rotary drive motor (not shown).
  • the rotation drive motor is controlled by, for example, the control unit 8.
  • a plurality of suction holes are formed along the circumferential direction on the outer peripheral surface of the transport drum 3.
  • Each of the plurality of suction holes is in communication with a suction mechanism (not shown) provided inside the conveyance drum 3.
  • the suction mechanism is controlled by, for example, the control unit 8. By operating the suction mechanism, negative pressure lower than atmospheric pressure can be applied to each of the plurality of adsorption holes.
  • each suction hole of the transport drum 3 can hold one tablet 9 by suction.
  • the transport unit 4 is disposed below the transport drum 3.
  • the tablets 9 adsorbed and held on the outer peripheral surface of the transport drum 3 move in the circumferential direction as the transport drum 3 rotates.
  • the suction mechanism releases the adsorption on the tablet 9, whereby the tablet 9 falls and is delivered to the transport unit 4.
  • the transport unit 4 transports the tablets 9.
  • the transport unit 4 is a belt conveyor, and includes a transport belt 41 and a pair of pulleys 42.
  • the pair of pulleys 42 is disposed, for example, at an interval in the X-axis direction, and the central axis of itself is disposed along the Y-axis direction.
  • Each of the pair of pulleys 42 rotates around its own central axis.
  • the transport belt 41 is stretched around a pair of pulleys 42. As at least one of the pair of pulleys 42 is rotationally driven by a drive motor (not shown), the transport belt 41 travels in the direction shown by the arrow in FIG. 1.
  • the drive motor is controlled by, for example, the control unit 8.
  • a plurality of suction holes are formed along the circumferential direction.
  • Each of the plurality of suction holes is in communication with a suction mechanism (not shown) provided inside the conveyance belt 41.
  • the suction mechanism is controlled by, for example, the control unit 8. By operating the suction mechanism, negative pressure lower than atmospheric pressure can be applied to each of the plurality of adsorption holes.
  • each suction hole of the conveyance belt 41 can hold one tablet 9 by suction.
  • the transport belt 41 travels while suction-holding the tablets 9, the tablets 9 are transported in the direction away from the transport drum 3 along the X-axis direction.
  • the imaging head 5 is disposed on the downstream side of the transport drum 3 midway along the transport path of the tablets 9 by the transport portion 4 and at a position facing the transport portion 4.
  • the imaging area of the imaging head 5 includes a part of the transport belt 41.
  • the imaging head 5 images the tablet 9 to generate a captured image.
  • the imaging head 5 outputs this captured image to the control unit 8.
  • An example of a specific internal configuration of the imaging head 5 will be described in detail later.
  • the control unit 8 inspects the appearance of the tablet 9 by performing image processing on the input captured image.
  • the controller 8 determines that the tablet 9 is defective if the appearance of the tablet 9 is defective, and determines that the tablet 9 is good if the appearance of the tablet 9 is not defective.
  • Examples of the defects include impurities attached to the tablet 9 or defects such as defects in shape (e.g., chipping) of the tablet 9. An example of specific image processing by the control unit 8 will be described in detail later.
  • the print head 6 is disposed on the downstream side of the imaging head 5 above the transport belt 41 while the tablets 9 are being transported.
  • the print head 6 is controlled by, for example, the control unit 8 and performs a printing process on the tablet 9.
  • the print head 6 includes a plurality of discharge nozzles (not shown), and discharges ink droplets from the discharge nozzles by an inkjet method.
  • the inkjet method may be a piezo method in which a piezoelectric element (piezoelectric element) is deformed by applying a voltage to discharge ink droplets, or a heater is energized to heat the ink, whereby the ink droplets are discharged. It may be a thermal method of discharging the ink.
  • an edible ink manufactured using a material recognized by the Food Sanitation Law is used.
  • the control unit 8 may determine the necessity of the printing process according to the inspection result of the tablet 9. . More specifically, when the tablet 9 is determined to be non-defective in the appearance inspection, the control unit 8 controls the print head 6 to print the tablet 9 so that the tablet 9 is defective. If it is determined, the print head 6 may be controlled so as not to print the tablet 9. According to this, unnecessary print processing can be avoided.
  • the sorting unit 7 sorts the tablets 9 in accordance with the result of the appearance inspection.
  • the sorting unit 7 has a non-defective box and a defective item box. These boxes have a box-like shape opened upward.
  • the non-defective box stores the tablets 9 determined to be non-defective
  • the defective box stores the tablets 9 determined to be non-defective.
  • these boxes are arranged side by side along the X-axis direction on the lower side of the transport belt 41.
  • the control unit 8 controls the suction mechanism in the transport belt 41 to release the adsorption on the tablet 9. Thereby, the tablet 9 falls into the inside of the non-defective item box and is accommodated therein.
  • the tablets 9 determined to be defective are similarly stored inside the defective box.
  • control unit 8 controls various components, and performs an appearance inspection of the tablet 9 by performing image processing on a captured image input from the imaging head 5.
  • the control unit 8 is an electronic circuit device, and may have, for example, a data processing device and a storage medium.
  • the data processing device may be, for example, an arithmetic processing device such as a CPU (Central Processor Unit).
  • the storage unit may have a non-transitory storage medium (for example, a ROM (Read Only Memory) or a hard disk) and a temporary storage medium (for example, a RAM (Random Access Memory)).
  • the non-temporary storage medium may store, for example, a program that defines a process performed by the control unit 8.
  • the processing unit executes this program, whereby the control unit 8 can execute the processing defined in the program.
  • part or all of the processing performed by the control unit 8 may be performed by hardware.
  • the imaging head 5 images the tablet 9 on the way of conveyance from the direction in which at least two surfaces of the tablet 9 appear.
  • the tablets 9 may be adsorbed and held by the transport belt 41 with the main surface 9b facing the transport belt 41, and may be adsorbed and held by the transport belt 41 with the main surface 9a facing the transport belt 41. It is also possible. In the following, for convenience of explanation, it is assumed that the tablet 9 is held on the transport belt 41 with the main surface 9 b facing the transport belt 41 side. Further, in a state where the tablets 9 are adsorbed and held by the conveyance belt 41, at least a part of the side surface 9 c on the main surface 9 a side is exposed from the conveyance belt 41.
  • FIG. 3 and FIG. 4 are diagrams schematically showing an example of the internal configuration of the imaging head 5.
  • the imaging head 5 includes an inspection camera 51, a lens group 52, a mirror 53, and a pyramidal mirror 54.
  • the inspection camera 51 is an image sensor such as, for example, a charge coupled device (CCD) image sensor or a complementary metal oxide semiconductor (CMOS) image sensor.
  • the inspection camera 51 is disposed in a position in which the imaging surface thereof faces the conveyance belt 41 at a position where it faces a part of the conveyance path of the tablet 9 in the Z-axis direction.
  • CCD charge coupled device
  • CMOS complementary metal oxide semiconductor
  • the mirror 53 is provided to guide light from the major surface 9 a and the side surface 9 c of the tablet 9 to the pyramidal mirror 54 described later.
  • the tablet 9 is stopped at a position facing the inspection camera 51 in the Z-axis direction.
  • mirror 53 is located between inspection camera 51 and tablet 9 in the Z-axis direction, and is disposed outside of tablet 9 in plan view (that is, viewed along the Z-axis direction). It is done. Also, the mirror 53 is disposed to face each surface of the pyramidal mirror 54.
  • the pyramidal mirror 54 guides the light from the major surface 9 a and the side surface 9 c of the tablet 9 reflected by the mirror 53 to the imaging surface of the inspection camera 51 via the lens group 52.
  • the pyramidal mirror 54 is configured of four mirrors, and the pyramidal mirror 54 is disposed to face each of the mirrors 53.
  • a part of the light reflected or scattered by the main surface 9a and the side surface 9c of the tablet 9 proceeds obliquely upward to one of the mirrors 53, is reflected by the mirror 53, and the light reflected by the mirror 53 is pyramidal type
  • the imaging surface of the inspection camera 51 After being reflected by the mirror 54, an image is formed on the imaging surface of the inspection camera 51 through the lens group 52.
  • the angles of the reflecting surfaces of the mirror 53 and the pyramidal mirror 54 with respect to the ground are adjusted so that light traveling obliquely upward from the major surface 9 a and the side surface 9 c of the tablet 9 can be reflected toward the imaging surface of the inspection camera 51 It is done.
  • the inspection camera 51 can image the appearance of the tablet 9 viewed from the mirror 53. That is, the inspection camera 51 can substantially image the tablet 9 in an oblique direction, and the captured image includes both the main surface 9 a and the side surface 9 c of the tablet 9.
  • FIG. 3 an example of the light path is shown by a broken line.
  • a plurality of (four in the drawing) mirrors 53 are arranged.
  • two mirrors 53 are spaced apart in the X-axis direction, and the remaining two mirrors 53 are spaced apart in the Y-axis direction.
  • the tablet 9 is surrounded by the mirror 53 in four directions in plan view.
  • a pyramidal mirror 54 is disposed at the center of the four mirrors 53.
  • the light reflected by each mirror 53 is further reflected by the pyramidal mirror 54, and is imaged on the imaging surface of the inspection camera 51 through the lens group 52.
  • the light reflected by the four mirrors 53 is imaged on different areas of the imaging surface of the inspection camera 51.
  • the imaging head 5 images the tablet 9 from four directions, and generates a captured image including the appearance of the tablet 9 viewed from four directions.
  • FIG. 5 is a diagram schematically illustrating an example of the captured image IM1.
  • the captured image IM1 includes the appearance of the tablet 9 viewed from four directions, and in any of these, the main surface 9a and the side surface 9c of the tablet 9 are shown.
  • the side surface 9c of the tablet 9 can be imaged over the entire circumference.
  • the main surface 9a and the side surface 9c of the tablet 9 shown in the captured image IM1 will be referred to as the main surface 9aa and the side surface 9ca, respectively, in order to be distinguished from the main surface 9a and the side surface 9c of the actual tablet 9.
  • the imaging head 5 may have an illumination light source (not shown).
  • the illumination light source irradiates the tablet 9 with light. Thereby, the brightness of the tablet 9 in the captured image IM1 can be improved.
  • the present invention is not necessarily limited thereto.
  • Another optical element such as a prism may be employed as an element for bending the light path.
  • the control unit 8 performs image processing on the captured image IM1 input from the imaging head 5, and performs an appearance inspection of the captured tablet 9.
  • the control unit 8 functions as an image processing unit.
  • FIG. 6 is a view schematically showing an example of a captured image IM11 obtained by imaging the tablet 9 having a defect from one direction.
  • defects d1 and d2 are present on the main surface 9aa and the side surface 9ca of the tablet 9, respectively.
  • the control unit 8 specifies the main surface area Ra occupied by the main surface 9aa of the tablet 9 in the captured image IM11 and the side surface area Rc occupied by the side surface 9ca of the tablet 9, and makes each of the main surface area Ra and the side surface area Rc. Perform inspection processing. The following more specifically describes.
  • FIG. 7 is a flowchart showing an example of the operation in the tablet inspection apparatus 1.
  • the imaging head 5 captures an image of the tablet 9 during conveyance from the direction in which both the main surface 9a and the side surface 9c of the tablet 9 appear, and a captured image in which both the main surface 9a and the side surface 9c of the tablet 9 appear Generate IM11.
  • the imaging head 5 outputs the captured image IM11 to the control unit 8.
  • control unit 8 specifies the main surface area Ra and the side surface area Rc in the captured image IM11. This specification is performed, for example, by a series of processes of steps S2 to S6 in FIG.
  • step S2 the control unit 8 performs edge detection processing on the captured image IM11 to generate an edge image.
  • the control unit 8 performs edge detection processing on the captured image IM11 from which the background area BR has been deleted.
  • the background region BR is a region other than the tablet region TR occupied by the tablet 9 in the captured image IM11.
  • the tablet region TR is constituted by the main surface region Ra and the side surface region Rc.
  • the control unit 8 In order to delete the background area BR, the control unit 8 first distinguishes between the tablet area TR and the background area BR in the captured image IM11. For example, the control unit 8 uses a binarization process on the captured image IM11 to distinguish the tablet area TR from the background area BR. Since the background area BR includes the conveyance belt 41, if the contrast between the actual color of the conveyance belt 41 and the color of the tablets 9 is increased in order to accurately distinguish the tablet area TR and the background area BR. Good. For example, when the tablets 9 are white-based, the transport belt 41 is made black.
  • the control unit 8 specifies the background area BR, the control unit 8 deletes the background area BR in the captured image IM11. For example, the control unit 8 deletes the background area BR by setting the pixel values of all the pixels in the background area BR to zero.
  • the control unit 8 performs edge detection processing on the captured image IM11 from which the background area BR has been deleted, and generates an edge image.
  • the edge strength processing includes, for example, calculation processing of the difference in pixel value between the respective pixels, whereby a region having a large difference in pixel value between pixels in the captured image IM11 is emphasized in the edge strength image.
  • the control unit 8 determines for each pixel whether the pixel value is larger than a predetermined edge threshold.
  • the edge threshold may be set in advance and stored in the storage medium of the control unit 8, for example.
  • the control unit 8 detects a pixel having a pixel value larger than the edge threshold to generate an edge image.
  • this edge image is generated based on the captured image IM11 from which the background area BR has been removed, an edge in the background area BR (for example, unevenness of the transport belt 41) is not detected in the edge image. That is, the edge (hereinafter referred to as a tablet edge) corresponding to the contour of the tablet region TR is positioned at the outermost periphery of the edge group in the edge image.
  • step S3 the control unit 8 specifies the tablet edge as follows. That is, the control unit 8 specifies the edge located at the outermost periphery among the edge group in the edge image as the tablet edge P0 (see FIG. 8).
  • FIG. 8 is a view schematically showing an example of the tablet edge P0.
  • the tablet edge P0 is schematically shown divided into a plurality of edges.
  • the tablet edge P0 is composed of a side outer edge P1, a main surface outer edge P2, and a pair of side ridge line edges P4.
  • the side outer edge P1 is an edge corresponding to a portion of the periphery of the main surface 9b of the tablet 9 that is captured in the captured image IM11. Since the major surface 9b has a circular shape, the side outer edge P1 ideally has a semi-elliptical shape.
  • the term "semi-elliptical shape" as used herein refers to a shape obtained by dividing an ellipse into two at its major axis.
  • the main surface outer edge P2 is an edge corresponding to a portion of the periphery of the main surface 9aa of the tablet 9 in the captured image IM11 which is not in contact with the side surface 9ca. It can be said that this main surface outer edge P2 is an edge corresponding to a part of the contour of the tablet region TR in the periphery of the main surface 9aa of the tablet 9. Since the major surface 9a has a circular shape, the major surface outer edge P2 ideally has a semi-elliptical shape. More specifically, the side outer edge P1 and the main surface outer edge P2 have a semi-elliptical shape that bulges to the opposite side.
  • the pair of side edge line edges P4 ideally extends in a straight line, and connects both ends of the main surface outer edge P2 to both ends of the side surface outer edge P1.
  • the pair of side edge line edges P4 is an edge corresponding to a part of the outline of the side surface 9ca of the tablet 9 in the captured image IM11.
  • the pair of side edge line edges P4 extend substantially in parallel, and the extending direction thereof is predetermined by the arrangement of the internal configuration of the imaging head 5.
  • the side edge line edge P4 extends in a direction intersecting at approximately 45 degrees with respect to the lateral direction in the captured image IM11.
  • a pair of side ridgeline edge P4 is not completely perfect parallel in fact.
  • the pair of side edge line edges P4 are slightly inclined so as to be closer to each other as the side outer edge P1 side is approached. In the following, for the sake of simplicity, it is assumed that the pair of side ridge edges P4 are parallel. If it thinks more strictly, what is necessary is just to grasp the extending direction of side edge line edge P4 described below as the direction represented by the bisector of the extending direction of a pair of side edge line edge P4.
  • the boundary edge P3 corresponding to the boundary between the main surface 9aa and the side surface 9ca of the tablet 9 in the captured image IM11 is indicated by a broken line.
  • the boundary edge P3 is an edge corresponding to the boundary between the main surface area Ra and the side surface area Rc.
  • the boundary edge P3 ideally has a semi-elliptical shape that bulges on the opposite side to the major surface outer edge P2.
  • One set of the main surface outer edge P2 and the boundary edge P3 corresponds to the periphery of the main surface 9aa of the tablet 9, and ideally exhibits an elliptical shape.
  • one set of the major surface outer edge P2 and the boundary edge P3 is also referred to as a major surface edge P23.
  • step S5 the control unit 8 specifies the boundary edge P3 from the edge image.
  • the boundary edge P3 is specified as described below.
  • the boundary edge P3 and the side outer edge P1 have a semi-elliptical shape bulging on the same side.
  • the boundary edge P3 and the side outer edge P1 have substantially the same shape. That is, the boundary edge P3 exists in a region in which the side surface outer edge P1 is moved in parallel along the predetermined direction D1 toward the main surface outer edge P2 by the length of the side surface ridge line edge P4. Since the length of the side ridge line edge P4 is predetermined according to the thickness of the tablet 9 and the arrangement of the internal configuration of the imaging head 5, if the side outer edge P1 is specified, the region where the boundary edge P3 exists is estimated. be able to.
  • the control unit 8 searches for a boundary edge P3 by searching for pixels in a search area R1 (see also FIG. 9) separated from the side surface outer edge P1 by a predetermined distance toward the main surface outer edge P2 along the predetermined direction D1. Identify. FIG. 9 is a view schematically showing an example of the search area R1. In describing an example of the search area R1, a center line L0 of the search area R1 and lines L1 to L4 forming an outline of the search area R1 are introduced.
  • the center line L0 is a line obtained by moving the side outer edge P1 by the length of the side edge P4 along the predetermined direction D1 toward the main surface outer edge P2.
  • the center line L0 and the boundary edge P3 are schematically shown by one curve in the example of FIG. 9, these may actually be different.
  • the lines L1 and L2 are lines obtained by moving the center line L0 along the predetermined direction D1 to the opposite side by a predetermined width.
  • the line L1 is closer to the side outer edge P1 than the line L2.
  • the lines L3 and L4 extend along the predetermined direction D1 and connect both ends of the lines L1 and L2, respectively.
  • the search area R1 is an area surrounded by one set of these lines L1 to L4.
  • a pixel group arranged in the search area R1 along the predetermined direction D1 will be referred to as a “row”.
  • FIG. 10 is a flowchart illustrating an example of the search process of the control unit 8.
  • the control unit 8 initializes the values N and M to one.
  • the value N indicates the number of the row in the search area R1
  • the value M indicates the number of the pixel belonging to the row.
  • the first pixel is a pixel on the line L1
  • the Mth pixel is a pixel next to the (M-1) th pixel in each row.
  • step S52 the control unit 8 determines whether or not the Nth row and Mth pixel in the search area R1 of the edge image indicates an edge. If a negative determination is made, in step S53, the control unit 8 adds 1 to the value M to update the value M, and executes step S52 again using the updated value M. That is, if a pixel indicating an edge (hereinafter also referred to as an edge pixel) can not be detected, the same determination is made for the next pixel.
  • an edge pixel a pixel indicating an edge
  • step S54 the control unit 8 recognizes the pixel as a component of the boundary edge P3.
  • step S55 the control unit 8 adds 1 to the value N to update the value N, and initializes the value M to 1.
  • step S56 control unit 8 determines whether value N is larger than reference value Nref.
  • the reference value Nref is the total number of rows included in the search area R1. That is, the control unit 8 determines whether all the rows have been searched. If it is determined that all the lines have not been searched, the control unit 8 executes step S52 again. If it is determined that all the lines have been searched, the control unit 8 ends the search processing.
  • the control unit 8 sequentially selects pixels from the line L1 and specifies the edge pixel detected first as a component of the boundary edge P3.
  • the search direction of the pixel is schematically indicated by a solid arrow in the search area R1, and the end point of the arrow indicates a component of the boundary edge P3.
  • the control unit 8 specifies, as the main surface edge P23, a pair of the main surface outer edge P2 specified in step S4 and the boundary edge P3 specified in step S5.
  • the main surface edge P23 can be appropriately and easily obtained.
  • the main surface edge P23 corresponds to the periphery of the main surface 9aa of the tablet 9 in the captured image IM11
  • the main surface edge P23 actually detected does not necessarily have an ideal elliptical shape.
  • the light irradiated in the vicinity of the peripheral edge of the main surface 9a of the tablet 9 has unevenness, or the light reflected regularly from a part in the vicinity of the peripheral edge is imaged on the inspection camera 51 and a part of pixel values May have a very large value compared to other pixel values.
  • a defect may occur in the vicinity of the peripheral edge.
  • the major surface edge P23 may be different from the ideal elliptical shape.
  • step S6 the control unit 8 calculates an approximate line (ellipse) approximate to the major surface edge P23 as the contour of the major surface area Ra based on the function of the ellipse. More generally, the control unit 8 sets the approximate line of the major surface edge P23 as the contour of the major surface region Ra based on a reference function predetermined as the shape of the contour of the major surface region Ra in the captured image IM11. calculate.
  • the reference function here is a function that represents the shape of the outline of the main surface area Ra, and is a function whose position and size are variables.
  • the length of the major axis, the length of the minor axis, the extending direction of the major axis, and the center can be adopted as variables.
  • the control unit 8 calculates an ellipse E1 (more specifically, the length of the major axis, the length of the minor axis, and the extending direction and center of the major axis) approximating the major surface edge P23 by the least square method, for example.
  • the tablet 9 has a substantially disk shape. That is, the main surface 9a of the tablet 9 has a substantially circular shape. Therefore, in the captured image IM11, the periphery of the major surface 9aa ideally has an elliptical shape. Corresponding to this, a function of an ellipse is used as a function indicating the contour of the main surface area Ra. Therefore, the outline of main surface area Ra can be specified appropriately.
  • the half ellipse on the side 9ca side is also referred to as the half ellipse El.
  • the semi-ellipse E11 corresponds to an approximation line of the boundary edge P3.
  • step S7 the control unit 8 calculates an approximation line (semi-ellipse) approximating the side outer edge P1 based on the ellipse E1. For example, while moving the ellipse E1 along the predetermined direction D1, the control unit 8 calculates the ellipse E2 along the side outer edge P1 using the Levenberg-Marquardt (LM) method.
  • LM Levenberg-Marquardt
  • control unit 8 divides this ellipse E2 by its major axis, and obtains a semi-elliptic E21 which is farther from the boundary edge P3 among the obtained two semi-elliptics as an approximation line of the side outer edge P1.
  • the control unit 8 may reduce the ellipse E1 at a predetermined rate. This is because, in a perspective view such as the captured image IM11, the peripheral edge of the main surface 9b of the tablet 9 is smaller than the peripheral edge of the main surface 9a of the tablet 9 at a predetermined ratio. This predetermined ratio is preset according to the thickness of the tablet 9.
  • the control unit 8 does not necessarily calculate the ellipse E2 based on the ellipse E1, and does not need to calculate the semi-elliptic E21 from the ellipse E2.
  • the control unit 8 may calculate a half ellipse E21 using the LM method while obtaining the half ellipse E11 from the ellipse E1 and moving the half ellipse E11 along the predetermined direction D1.
  • the semi-ellipse E11 may be reduced at a predetermined ratio in calculating the semi-ellipse E21.
  • the control unit 8 calculates a pair of straight lines connecting the both ends of the semi-ellipse E11 and E21, and grasps the semi-ellipse E11 and E21 and the pair of straight lines as the outline of the side region Rc occupied by the side surface 9ca of the tablet 9. .
  • the side region Rc is specified with higher accuracy.
  • step S8 the control unit 8 performs inspection processing (image processing) on the main surface area Ra and the side surface area Rc in the captured image IM11.
  • inspection processing image processing
  • control unit 8 may detect a defect as follows. That is, the control unit 8 performs edge strength processing on the main surface area Ra and the side surface area Rc of the captured image IM11 to generate an edge strength image. As described above, when the edge strength image is already generated during generation of the edge image, the edge strength image may be used.
  • the control unit 8 determines for each pixel whether the pixel value in the main surface area Ra of the edge intensity image is larger than a threshold (hereinafter referred to as a defect threshold) Th1, and when an affirmative determination is made, It is determined that the pixel indicates the outline of the defect. Since the pixel is in the main surface area Ra, the control unit 8 may determine that the main surface 9 a of the tablet 9 has a defect. The same applies to the side surface region Rc. Thereby, the defects d1 and d2 can be detected.
  • a defect threshold hereinafter referred to as a defect threshold
  • defect threshold Th1 be set independently of each other in the main surface area Ra and the side surface area Rc of the captured image IM11. The reasons are described below.
  • the surface condition (for example, surface roughness) of the tablet 9 may be different in the major surface 9 a and the side surface 9 c.
  • the surface roughness of the main surface 9a of the tablet 9 is smaller than the surface roughness of the side surface 9c
  • the inter-pixel variation in the luminance component in the main surface region Ra of the captured image IM11 is the variation in the luminance component in the side region Rc It becomes smaller than.
  • This variation between pixels is quantified as the pixel value of each pixel in the edge intensity image.
  • the maximum value Ma of the values of the pixels in the main surface area Ra of the edge strength image is smaller than the maximum value Mc of the values of the pixels in the side surface area Rc of the edge strength image.
  • a common defect threshold Th1 for the main surface region Ra and the side surface region Rc it is considered to set a common defect threshold Th1 for the main surface region Ra and the side surface region Rc.
  • the defect threshold value Th1 is set to a value larger than the maximum value Mc in accordance with the side surface region Rc, an unnecessarily large value is set to the main surface region Ra. According to this, a leak may occur in the defect detection on the main surface 9 a of the tablet 9.
  • the defect threshold value Th1 is set to a small value according to the main surface area Ra, the surface roughness of the side surface 9c of the tablet 9 can be erroneously detected as a defect.
  • defect thresholds Th1 are set independently for the main surface region Ra and the side surface region Rc.
  • the defect threshold Th1 (hereinafter referred to as defect threshold Th11) for the main surface area Ra where the main surface 9a having a small surface roughness appears is the defect threshold Th1 for the side surface area Rc where the side surface 9c having a large surface roughness appears.
  • a defect threshold Th12 the control unit 8 executes inspection processing using defect threshold values Th1 different from each other on the main surface region Ra and the side surface region Rc.
  • control unit 8 determines whether the value of each pixel of the main surface area Ra of the edge intensity image is larger than the defect threshold Th11. In other words, the control unit 8 determines whether the value of each pixel obtained by performing the edge strength processing on the main surface area Ra is larger than the defect threshold value Th11. When it is determined that the value of a certain pixel is larger than the defect threshold Th11, the control unit 8 determines that the pixel indicates the outline of the defect, and determines that a defect is generated on the main surface 9a of the tablet.
  • the control unit 8 may detect all defects by performing the above determination on all the pixels in the main surface area Ra. Alternatively, if the presence or absence of a defect in the tablet 9 is simply determined, the above determination on the remaining pixels may be omitted when one defect is detected. This point is the same as in the inspection process described below.
  • control unit 8 determines whether the value of each pixel of the side surface region Rc of the edge strength image is larger than the defect threshold Th12 larger than the defect threshold Th11. In other words, the control unit 8 determines whether the value of each pixel obtained by performing edge strength processing on the side surface region Rc is larger than the defect threshold value Th12. When it is determined that the value of a certain pixel is larger than the defect threshold Th12, the control unit 8 determines that the pixel indicates the outline of the defect, and determines that the side surface 9c of the tablet has a defect.
  • the defect threshold Th1 may be set in advance and stored in a storage medium of the control unit 8.
  • the control unit 8 may automatically set the defect threshold value Th1 in accordance with the pixel values of the main surface area Ra and the side surface area Rc of the tablet 9 determined to be non-defective.
  • the control unit 8 may adopt a value larger by a predetermined value than the maximum value Mc in the side surface region Rc of the tablet 9 determined to be non-defective as the defect threshold Th11 for the side surface region Rc.
  • the control unit 8 may adopt a value larger by a predetermined value than the maximum value Ma of the main surface area Ra of the tablet 9 determined to be non-defective as the defect threshold Th12 for the main surface area Ra.
  • the defect threshold Th11 for the main surface region Ra may be set larger than the defect threshold Th12 for the side surface region Rc.
  • the control unit 8 may perform a second inspection process described below, instead of the above-described first inspection process or together with the first inspection process.
  • the control unit 8 may detect a defect as follows. That is, the control unit 8 determines, for each pixel, whether the pixel value in the main surface area Ra of the captured image IM11 is smaller than the defect threshold Th2, and when an affirmative determination is made, the pixel indicates a defect. It is determined that Since the pixel is in the main surface area Ra, the control unit 8 may determine that the main surface 9 a of the tablet 9 has a defect. The same applies to the side surface region Rc. Thereby, the defects d1 and d2 can be detected.
  • defect threshold Th2 be also set independently of each other for the main surface region Ra and the side surface region Rc. The reasons are described below.
  • the brightness (average of luminance) in the main surface area Ra of the captured image IM11 may be different from the brightness in the side surface area Rc.
  • the reason is that the way the light strikes the major surface 9 a and the side surface 9 c of the tablet 9 may be different.
  • the main surface area Ra is brighter than the side surface area Rc will be described as a representative example.
  • the common defect threshold Th2 it is considered to set the common defect threshold Th2 to the main surface region Ra and the side surface region Rc in the captured image IM11.
  • the defect threshold value Th2 is reduced in order to suppress erroneous detection of a dark portion as a defect in the side surface region Rc, detection omission may occur in the bright main surface region Ra.
  • the defect threshold value Th2 is increased in order to suppress detection omission in the main surface area Ra, it is possible to erroneously detect a dark portion in the side surface area Rc as a defect.
  • the defect threshold value Th2 is set independently of each other for the main surface area Ra and the side surface area Rc in the captured image IM11.
  • the defect threshold Th2 (hereinafter referred to as defect threshold Th21) for the main surface area Ra in which the bright main surface 9a appears is referred to as the defect threshold Th2 for the side surface area Rc in which the dark side surface 9c appears (hereinafter referred to as the defect threshold Th22) Set larger than). That is, the control unit 8 executes inspection processing using defect threshold values Th2 different from each other on the main surface region Ra and the side surface region Rc in the captured image IM11.
  • control unit 8 determines whether the value of each pixel of the main surface region Ra of the captured image IM11 is smaller than the defect threshold value Th21. When it is determined that the value of a certain pixel is smaller than the defect threshold Th21, the control unit 8 determines that the pixel indicates a defect and determines that a defect is generated on the main surface 9a of the tablet.
  • control unit 8 determines whether the value of each pixel of the side surface region Rc of the captured image IM11 is smaller than a defect threshold Th22 smaller than the defect threshold Th21. When it is determined that the value of a certain pixel is smaller than the defect threshold value Th22, the control unit 8 determines that the pixel indicates a defect, and determines that a defect is generated on the side surface 9c of the tablet.
  • the defect threshold value Th2 may be set in advance, for example, or may be set according to the brightness of the main surface area Ra and the side surface area Rc of the tablet 9 determined to be non-defective.
  • the control unit 8 adopts, as the defect threshold Th21 for the side surface region Rc, a value smaller than the minimum value of the pixel values in the side surface region Rc of the captured image IM11 of the tablet 9 determined to be non-defective.
  • a value smaller than the minimum value of pixel values in the main surface area Ra by a predetermined value may be adopted as the defect threshold value Th22 for the main surface area Ra.
  • the defect threshold Th21 for the main surface region Ra may be set smaller than the defect threshold Th22 for the side surface region Rc.
  • both end regions close to the pair of side surface ridgeline edges P4 in the side surface region Rc may be excluded from the inspection processing target. This is because the surface state of the side surface 9c in the both end regions is difficult to visually recognize in the captured image IM11.
  • the center line L0 of the search area R1 is a line obtained by moving the side outer edge P1, but the side outer edge P1 may be enlarged by a predetermined magnification during this movement. .
  • the boundary edge P3 is larger than the side outer edge P1 at a predetermined magnification.
  • the edge pixel first detected in the search in each row of the search area R1 is grasped as a component of the boundary edge P3.
  • the calculation accuracy of the ellipse E1 may be reduced. The details will be described below.
  • FIG. 11 is a view schematically showing an example of an edge in an edge image when a chipping occurs in the boundary between the major surface 9 aa and the side surface 9 ca of the tablet 9.
  • an edge P ′ is detected along the outline of the chipping generated in the tablet 9.
  • the edge P ' is schematically shown by a thick line.
  • pixels on the edge on the line L1 side among the edge P ' are grasped as components of the boundary edge P3.
  • some of the pixels grasped as components of the boundary edge P3 are schematically indicated by black circles.
  • the component of the boundary edge P3 is biased to the edge Pc 'on the line L1 side of the edge P'. Therefore, the semi-ellipse E11 approximating the boundary edge P3 is likely to deviate from the periphery of the major surface 9aa of the tablet 9. That is, the identification accuracy of the main surface area Ra may be reduced.
  • the second embodiment it is intended to further improve the identification accuracy of the main surface region Ra. Specifically, paying attention to the distribution of pixel values of the defect area in the captured image IM11, the components of the boundary edge P3 are dispersed to the edge Pc ′ of the edge P ′ and the edge Pa ′ on the line L2 side. In addition, it is intended to identify the boundary edge P3.
  • the configuration of the tablet inspection apparatus 1 according to the second embodiment is the same as that of the first embodiment.
  • the method of specifying the boundary edge P3 by the control unit 8 is different from that of the first embodiment.
  • the chipped surface of the tablet 9 is rougher than the surface roughness of the main surface 9a and the side surface 9c, and the luminance component in the defect area in the captured image IM11 is dispersed. Therefore, the luminance component also varies in the outline (edge P ') of the defect area. Therefore, the pixel values on the edge Pa 'in the captured image IM11 also vary in a certain range, and the pixel values on the edge Pc' also vary in a similar range.
  • the control unit 8 searches for a pixel in the search area R1 of the edge image, and for which the pixel value in the corresponding captured image IM11 is larger than a predetermined threshold (hereinafter, referred to as a brightness threshold).
  • the brightness threshold is set in advance in accordance with the brightness of the major surface 9 aa of the tablet 9.
  • the brightness threshold is preset to a value within the above range.
  • Such brightness threshold can be set, for example, by simulation or experiment.
  • the brightness threshold may be stored in, for example, a storage medium of the control unit 8.
  • FIG. 12 is a flowchart showing an example of search processing by the control unit 8.
  • the control unit 8 further executes step S57.
  • This step S57 is executed when an affirmative determination is made in step S52.
  • the control unit 8 determines whether the pixel value of the Nth row and Mth pixel in the search area R1 of the captured image IM11 is larger than the brightness threshold.
  • step S57 When a negative determination is made in step S57, the control unit 8 executes step S53, and when a positive determination is made, the control unit 8 executes step S54.
  • the edge pixel is the boundary edge P3. If the pixel value of the pixel of the captured image IM11 is larger than the brightness threshold, the edge image is recognized as a component of the boundary edge P3.
  • FIG. 13 is a view schematically showing an example of an edge in an edge image when the boundary between the main surface 9 aa and the side surface 9 ca of the tablet 9 is chipped. Also in the example of FIG. 13, some of the pixels grasped as the boundary edge P3 are schematically shown by black circles. As illustrated in FIG. 13, the pixels are dispersed at the edges Pa ′ and Pc ′ of the edge P ′. In other words, the brightness threshold is set so that the pixel grasped as the boundary edge P3 is not biased to only one side at the edge P '.
  • the brightness (for example, the average value, median value, maximum value or minimum value of pixel values (or brightness values) of the main surface 9 aa of the tablet 9) applies to the side surface 9 ca of the tablet 9.
  • the brightness threshold when the brightness is higher than the brightness, the brightness of the main surface 9 aa is adopted as the brightness threshold, and when the brightness of the main surface 9 aa of the tablet 9 is lower than the brightness of the side surface 9 ca of the tablet 9, the brightness The brightness of the side 9 ca is adopted as the threshold.
  • a semi-elliptic E11 approximating such boundary edge P3 is a semi-elliptic closer to the periphery of the major surface 9aa of the tablet 9. As a result, the main surface region Ra can be identified with higher accuracy.
  • the configuration of the tablet inspection apparatus 1 according to the third embodiment is the same as that of the first embodiment.
  • the control unit 8 divides the main surface area Ra in the captured image IM11 into a plurality of areas.
  • FIG. 14 schematically shows an example of a tablet 9A which is another example of the tablet 9.
  • a dividing line 91 is formed on the main surface 9a of the tablet 9A.
  • the dividing line 91 is a groove extending straight through the center of the main surface 9a from end to end of the main surface 9a.
  • the dividing line 91 can be erroneously detected as a defect.
  • the third embodiment it is intended to divide the main surface area Ra into a dividing line area and a non-dividing line area, and to independently set the defect threshold Th1 (or defect threshold Th2) for each area.
  • the main surface 9 a of the tablet 9 has a peripheral portion 9 a 1 and a central portion 9 a 2.
  • the central portion 9a2 of the main surface 9a is flat except for the dividing line 91, and the peripheral portion 9a1 is inclined such that the central portion 9a2 bulges relative to the peripheral portion 9a1.
  • the difference in pixel value between pixels is large in the region near the boundary between the peripheral portion 9a1 and the central portion 9a2 compared to the other regions, and the boundary is defective Can be falsely detected.
  • control unit 8 divides the main surface area Ra into a dividing line area, a peripheral area, and a central area, and intends to independently set the defect threshold Th1 (or the defect threshold Th2) for each area.
  • FIG. 15 schematically shows an example of division of the main surface region Ra.
  • the control unit 8 divides the main surface area Ra into a dividing line area Ra1, a pair of peripheral area Ra2 and a pair of central areas Ra3.
  • the dividing line area Ra1 is an area including the dividing line 91
  • the peripheral area Ra2 is an area other than the dividing line area Ra1, and is an area including the boundary between the peripheral part 9a1 and the central part 9a2 of the tablet 9.
  • the central region Ra3 is a region which is neither a dividing line region Ra1 nor a peripheral region Ra2. Since the peripheral area Ra2 and the central area Ra3 do not include the dividing line area Ra1, one set of the peripheral area Ra2 and the central area Ra3 constitutes a non-dividing area.
  • FIG. 16 is a flowchart showing an example of the operation of the tablet inspection apparatus 1 according to the third embodiment. Steps S11 to S17 are the same as steps S1 to S7, respectively, so the detailed description will be omitted.
  • step S18 the control unit 8 divides the main surface area Ra into a dividing line area Ra1, a peripheral area Ra2, and a central area Ra3. The details will be described below.
  • the control unit 8 calculates the ellipse E3 by reducing the center of the ellipse E1 at a predetermined first ratio, with the center of the ellipse E1 as the reduction center.
  • the first ratio may be set in advance and stored in the storage medium of the control unit 8.
  • the first ratio is, for example, 1/2 or less, and is 1/3 as a more specific example.
  • the control unit 8 obtains an image moment for a group of edges in the ellipse E3 in the edge image, and obtains an extending direction of the group of edges.
  • the direction in which the group of edges in the ellipse E3 extends can be understood as the extending direction of the dividing line 91.
  • the group of edges is regarded as an ellipse, and the inclination of the major axis of the ellipse may be understood as the direction in which the dividing line 91 extends.
  • the following equation indicates the angle ⁇ of the major axis of the ellipse with respect to the x-axis.
  • the x-axis is the horizontal direction of the captured image IM11 '
  • the y-axis is the vertical direction of the captured image IM11'.
  • Equations (1) to (3) indicate the dispersion in the x-axis direction, the dispersion in the y-axis direction, and the covariance in the xy-axis, respectively.
  • the control unit 8 specifies an area expanded by a predetermined width on both sides as a dividing line area Ra1.
  • the predetermined width may be set in advance and stored in the storage medium of the control unit 8.
  • the dividing line area Ra1 is an area extending from the end to the end of the main surface area Ra.
  • the control unit 8 calculates the ellipse E4 by reducing the center of the ellipse E1 at a predetermined second ratio with the center of the reduction as the center of the ellipse E1.
  • the second ratio is larger than the first ratio, and the ellipse E4 is set to be inside the boundary between the peripheral portion 9a1 and the central portion 9a2 of the major surface 9aa.
  • This second ratio may also be stored in the storage medium of the control unit 8.
  • the control unit 8 specifies an area other than the dividing line area Ra1 among the areas in the ellipse E4 as a pair of central areas Ra3.
  • control unit 8 specifies a region obtained by removing the whole of the dividing line region Ra1 and the pair of central regions Ra3 from the main surface region Ra as a pair of peripheral region Ra2.
  • step S19 the control unit 8 performs image processing on each of the main surface area Ra and the side surface area Rc to perform inspection processing.
  • the side region Rc is the same as that of the first embodiment.
  • the defect threshold Th1 for the dividing line region Ra1 is set to be higher than the defect threshold Th1 for the undivided line regions (the peripheral region Ra2 and the central region Ra3).
  • the defect threshold Th1 for the peripheral region Ra2 is set higher than the defect threshold Th1 for the central region Ra3.
  • the defect threshold Th1 for the dividing line region Ra1 is set the highest, the defect threshold Th1 for the peripheral region Ra2 is set next higher, and the defect threshold Th1 for the central region Ra3 is set the lowest.
  • the control unit 8 determines that a defect is generated in the dividing line region Ra1.
  • the undivided regions one set of the peripheral region Ra2 and the central region Ra3.
  • the control unit 8 determines that a defect occurs in the peripheral area Ra2.
  • the control unit 8 determines that a defect occurs in the central area Ra3.
  • defects can be detected with high accuracy by suppressing the false detection of the defect leakage and the defects in each region.
  • a dividing line 91 is formed on the main surface 9a of the tablet 9A, and the peripheral edge portion 9a1 and the central portion 9a2 form an obtuse angle. Therefore, even if the tablet 9A is a good product, an edge is included in the main surface area Ra of the edge image.
  • the control unit 8 may search for pixels in the direction from the side outer edge P1 to the main surface outer edge P2 in the search area R1. According to this, it is possible to avoid false detection of the edge corresponding to the boundary between the peripheral portion 9a1 and the central portion 9a2 and the edge corresponding to the dividing line 91 as the boundary edge P3.
  • Fourth Embodiment Foreign matter such as dust may enter the inside of the imaging device (for example, the imaging head 5) and adhere to, for example, a lens or the like.
  • the imaging device for example, the imaging head 5
  • the foreign matter may overlap with the tablet in the captured image IM1.
  • the foreign matter is erroneously detected as a defect.
  • some of the plurality of light receiving elements constituting the imaging surface of the camera may fail.
  • the pixel value of the pixel corresponding to the malfunctioning light receiving element is, for example, zero without indicating a normal value.
  • this pixel is located inside the tablet in the captured image, the pixel is erroneously detected as a defect, even if the tablet 9 does not actually have a defect.
  • the fourth embodiment it is intended to provide a tablet inspection method and a tablet inspection apparatus capable of suppressing false detection of a defect.
  • the imaging head 5 does not necessarily have to image the tablet 9 from a plurality of imaging directions, but in the fourth embodiment, the imaging head 5 has a tablet 9 from a plurality of imaging directions. It is essential to take an image.
  • the function and operation of the control unit 8 according to the fourth embodiment are different from those of the first embodiment, as described in detail later.
  • FIG. 17 is a diagram schematically illustrating an example of the captured image IM1.
  • the captured image IM1 includes four images IM11 to IM14 that respectively capture the appearance of the tablet 9 viewed from the four imaging directions, and in any of these, the main surface 9a and the side surface 9c of the tablet 9 are captured. There is.
  • the side surface 9c of the tablet 9 can be imaged over the entire circumference.
  • the entire region of the main surface 9a of the tablet 9 is shown in any of the four images IM11 to IM14 (corresponding to inspection images). Therefore, the main surface 9a is a common surface common to the images IM11 to IM14.
  • the side surface 9 c of the tablet 9 regions corresponding to the imaging direction are respectively captured in the images IM 11 to IM 14.
  • defect candidates dA1 and dA2 appear in the captured image IM1.
  • the defect candidate mentioned here is a candidate that may be a defect of the tablet 9.
  • the defect candidate dA1 since the defect candidate dA1 is commonly shown in any of the images IM11 to IM14, it can be said that the defect is generated on the tablet 9.
  • the defect candidate dA2 appears in only one image IM12 and does not appear in the other images IM11, IM13, and IM14.
  • the defect candidate dA 2 is not a defect generated in the tablet 9 but can be said to be generated due to the imaging head 5.
  • the defect candidate dA2 is considered to indicate an abnormality (for example, attached matter) of the lens group 52, the mirror 53 or the pyramidal mirror 54, or an abnormality of the imaging surface of the inspection camera 51. Therefore, it is not preferable to detect the defect candidate dA2 as a defect of the tablet 9.
  • FIG. 18 is a flowchart showing an example of the operation in the tablet inspection apparatus 1.
  • the imaging head 5 captures an image of the tablet 9 during conveyance from a plurality of imaging directions, and generates a captured image IM1.
  • the imaging head 5 outputs the captured image IM1 to the control unit 8.
  • step SA2 the control unit 8 performs an inspection process (image process) on the captured image IM1. That is, the control unit 8 performs an inspection process on the images IM11 to IM14.
  • the specifying process is a process of specifying a tablet area occupied by the tablet 9 in each of the images IM11 to IM14. Thereby, the position and shape of the tablet area are specified in each of the images IM11 to IM14.
  • the candidate detection process is a process of detecting a defect candidate in each of the images IM11 to IM14.
  • the candidate detection process includes, for example, a process of determining whether or not the pixel is a pixel indicating a defect candidate based on the pixel value of each pixel of each of the images IM11 to IM14, and the defect candidate is detected as a result of the determination. .
  • the identification process identifies the tablet area of the tablet 9 in each of the images IM11 to IM14, and the candidate detection process identifies the position of the defect candidate in each of the images IM11 to IM14. It is identified in each of the images IM11 to IM14. That is, the position of the defect candidate on the tablet 9 is specified for each of the images IM11 to IM14. Therefore, it can be said that this inspection process is a process of detecting the position of the defect candidate with respect to the tablet area.
  • the control unit 8 performs defect authenticity processing based on the result of inspection processing of the images IM11 to IM14.
  • the defect authenticity process is a process of determining whether the defect candidate detected by the inspection process indicates a defect of the tablet 9, that is, the process of determining the authenticity of the defect candidate.
  • the control unit 8 can use a common defect candidate (for example, the defect candidate dA1 for the images IM11 to IM14). ) Is detected, it is determined that the tablet 9 is defective.
  • a defect candidate for example, defect candidate dA2
  • control unit 8 generates the defect candidate on tablet 9 Judge not a defect.
  • the control unit 8 obtains the geometrical correspondence of each pixel in the tablet area in the images IM11 to IM14. That is, the control unit 8 obtains the correspondence of pixels that capture the same point on the tablet 9.
  • the control unit 8 determines whether the defect candidate is common to the images IM11 to IM14 based on the correspondence relationship. Specifically, the positions of defect candidates are compared based on the correspondence relationship. When the positions correspond to each other in the images IM11 to IM14, the controller 8 determines that the tablet 9 has a defect. When the positions do not correspond to each other, the defect candidate is not a defect generated on the tablet 9. I will judge.
  • the control unit 8 may determine that the tablet 9 has a defect. According to this, it can be avoided that the tablet 9 having a possibility of defect is judged as non-defective.
  • the defect candidate is not regarded as a defect. Therefore, false reports at the time of defect detection can be suppressed.
  • FIG. 19 is a flowchart showing a specific example of the inspection process.
  • an example of inspection processing for one image IM12 will be described as a representative.
  • the inspection process of the other images IM11, IM13, IM14 is the same.
  • FIG. 20 schematically shows an example of the image IM12.
  • a tablet area TR is an area occupied by the tablet 9 in the image IM12.
  • the background area BR is an area other than the tablet area TR in the image IM12.
  • the main surface area Ra is an area occupied by the main surface 9a of the tablet 9 in the image IM12
  • the side surface area Rc is an area occupied by the side surface 9c of the tablet 9 in the image IM12.
  • the main surface area Ra and the side surface area Rc constitute a tablet area TR.
  • Each area is similarly defined for the images IM11, IM13, IM14.
  • a main surface 9aa and a side surface 9ca are referred to as a main surface 9aa and a side surface 9ca, respectively.
  • the control unit 8 executes steps SA21 to SA26 as the above-mentioned specifying process.
  • the control unit 8 specifies the main surface area Ra and the side surface area Rc that constitute the tablet area TR.
  • step SA21 the control unit 8 performs edge detection processing on the image IM12 as in step S2 of FIG. 7 to generate an edge image.
  • step SA22 the control unit 8 specifies the tablet edge P0 corresponding to the outline of the tablet region TR as in step S3 of FIG. 7 (see FIG. 21).
  • FIG. 21 is a view schematically showing an example of the tablet edge P0. Also in the example of FIG. 21, the tablet edge P0 is shown divided into a plurality of edges, as in FIG. In the example of FIG. 21, unlike the case of FIG. 8, a dividing line edge P5 corresponding to the dividing line 91 is indicated by a broken line.
  • control unit 8 extracts side outer edge P1 and main surface outer edge P2 from tablet edge P0 specified in step SA22 as in step S4 in FIG. .
  • step SA24 the control unit 8 specifies the boundary edge P3 in the edge image, as in step S5 of FIG.
  • the control unit 8 searches a search area R1 separated by a predetermined distance from the side outer edge P1 along the predetermined direction D1 toward the main surface outer edge P2 (see also FIG. 22) The pixel within is searched to specify the boundary edge P3.
  • FIG. 22 is a diagram schematically showing an example of the search area R1. In FIG. 22, a part of the dividing line edge P5 is also shown.
  • An example of search processing by the control unit 8 is the same as the flowchart of FIG.
  • the pixel on the dividing line edge P5 is not identified as a component of the boundary edge P3. Because the dividing line edge P5 is located on the main surface outer edge P2 side with respect to the boundary edge P3, the control unit 8 moves the search area R1 from the line L1 side to the line L2 side (that is, from the side surface outer edge P1 to the main surface This is because the search is made to the outer edge P2 side). That is, according to this search processing, the control unit 8 can specify the component of the boundary edge P3 before searching for the pixel of the dividing line edge P5. That is, false detection of the dividing line edge P5 as the boundary edge P3 can be avoided.
  • the control unit 8 specifies, as the main surface edge P23, a pair of the main surface outer edge P2 specified in step SA23 and the boundary edge P3 specified in step SA24.
  • control unit 8 calculates an approximate line (ellipse) approximate to main surface edge P23 as the contour of main surface area Ra based on the function of the ellipse as in step S6 of FIG. .
  • the control unit 8 calculates an ellipse E1 (more specifically, the length of the major axis, the length of the minor axis, and the extending direction and center of the major axis) approximating the major surface edge P23 by the least square method, for example.
  • the ellipse E1 may be, for example, an expression shown in the coordinate system of the captured image IM1 (or the image IM12).
  • the contour of the principal surface region Ra is specified with higher accuracy. can do.
  • the position of the defect candidate with respect to the main surface area Ra can be specified with high accuracy.
  • step SA26 the control unit 8 specifies the contour of the side surface region Rc. This process is the same process as step S7 in FIG.
  • the control unit 8 performs a candidate detection process on the image IM12.
  • the candidate detection process can use the first inspection process and the second inspection process described in the first embodiment.
  • a specific example of the candidate detection process will be described.
  • the control unit 8 may detect a defect candidate as follows. That is, the control unit 8 performs edge strength processing on the image IM12 from which the background area BR is deleted, and generates an edge strength image. If an edge strength image is already generated during generation of an edge image, the edge strength image may be used.
  • the control unit 8 determines, for each pixel, whether the pixel value of the edge intensity image is larger than the threshold Th1, and when an affirmative determination is made, determines that the pixel indicates the contour of the defect candidate. . Thereby, defect candidates dA1 and dA2 can be detected.
  • the threshold value Th1 may be set in advance and stored in a storage medium of the control unit 8.
  • the control unit 8 may perform a second candidate detection process described below in place of the above-described first candidate detection process or together with the first candidate detection process.
  • the control unit 8 may detect a defect as follows. That is, the control unit 8 determines for each pixel whether the pixel value in the tablet region TR of the image IM12 is smaller than the threshold Th2, and when an affirmative determination is made, the pixel indicates a defect candidate. It is determined that For example, the threshold value Th2 may be set in advance and stored in a storage medium of the control unit 8.
  • a pixel indicating a defect candidate (or an outline thereof) is also referred to as a candidate pixel.
  • FIG. 23 is a flowchart showing an example of the defect authenticity process.
  • control unit 8 determines whether at least one defect candidate is common to two or more of images IM11 to IM14. Specifically, the control unit 8 determines whether the defect candidate is common based on the correspondence between the images IM11 to IM14 of the position of each pixel with respect to the main surface area Ra. Therefore, the control unit 8 first obtains this correspondence. That is, the control unit 8 obtains the correspondence of pixels indicating the same point on the main surface 9a of the tablet 9 in the images IM11 to IM14.
  • the control unit 8 generates bird's eye view images IM41 to IM44 based on the images IM11 to IM14, respectively.
  • the bird's-eye view image referred to here is an image obtained by viewing the tablet 9 along the Z-axis direction.
  • the control unit 8 calculates the imaging direction of the image IM11 based on the ratio of the major axis A and the minor axis B of the ellipse E1 in the image IM11.
  • the control unit 8 performs image conversion on the image IM11 based on the angle ⁇ to generate a bird's-eye view image IM41.
  • the shape of the outline of the main surface 9a in this bird's-eye view image IM41 is a circle whose diameter is the long axis of the ellipse E1.
  • the control unit 8 similarly generates bird's-eye view images IM42 to IM44 based on the images IM12 to IM14.
  • FIG. 24 schematically shows an example of bird's-eye view images IM41 to IM44.
  • the main surface 9ab in order to distinguish the main surface 9a of the tablet 9 in the bird's-eye view images IM41 to IM44 from the main surface 9a of the actual tablet 9, it will be referred to as the main surface 9ab.
  • the control unit 8 determines that the difference in the size of these circles F1 is larger than a predetermined value.
  • the bird's eye view images IM41 to IM44 may be enlarged or reduced so as to be smaller.
  • pixels at the same position in the circle F1 indicate the same point on the main surface 9a of the tablet 9. That is, FIG. 24 substantially shows the correspondence of each pixel between the main surface areas Ra of the images IM11 to IM14.
  • the control unit 8 determines whether or not the defect candidate for the main surface area Ra matches in two or more bird's-eye views of the bird's-eye view images IM41 to IM44.
  • "coincidence” does not necessarily mean perfect coincidence, and includes a state in which the difference is smaller than a predetermined degree. If the defect candidates match each other in two or more bird eye images, the control unit 8 determines that the defect candidates (for example, defect candidate dA1) are common in the two or more images, and the tablet 9 (more Specifically, it is determined that a defect has occurred on the main surface 9a).
  • the match determination of the defect candidate may be performed as follows. For example, the control unit 8 determines whether or not the positions (positions with respect to the peripheral area Ra) of the plurality of candidate pixels constituting the defect candidate match each other in two or more images. For example, in each of the images IM11 to IM14, it is assumed that the defect candidate dA1 is configured by candidate pixels Q1 [0] to Q1 [10]. Control unit 8 determines whether or not the positions of candidate images Q1 [n] (n: 0 to 10) with respect to main surface region Ra coincide with each other in two or more of images IM11 to IM14. The control unit 8 may determine that the defect candidates match when these match.
  • the match of the defect candidate based on the position and the shape of the defect candidate.
  • all the candidate pixels constituting the defect candidate do not have to match each other between two or more images, and some candidate pixels may have a mismatch. The more the number of candidate pixels that allow the mismatch, the looser the condition on the shape.
  • the control unit 8 is required to specify candidate pixels constituting each defect candidate in each of the images IM11 to IM14. This can be done, for example, as follows. That is, for example, in each of the images IM11 to IM14, the control unit 8 calculates the distance between candidate pixels and extracts candidate pixel groups having a small distance between each other as the same defect candidate. Thus, for example, candidate pixels Q1 [0] to Q1 [10] belonging to defect candidate dA1 in each of images IM11 to IM14 are identified, and candidate pixels Q2 [0] to Q2 [10] belonging to defect candidate dA2 in image IM12. Is identified.
  • the control unit 8 determines that the defect candidate dA1 is a defect of the tablet 9, and determines that the tablet 9 has a defect.
  • the control unit 8 determines that the defect candidate dA2 is not a defect of the tablet 9.
  • step SA31 the control unit 8 determines in step SA33 that no defect has occurred in the tablet 9 (more specifically, the main surface 9a).
  • the determination on another defect candidate may be omitted.
  • the determination may be performed for all defect candidates.
  • the specification accuracy of the main surface area Ra is high as described above. According to this, it is possible to improve the accuracy of the correspondence between the images of the positions of the respective pixels in the main surface region Ra, and to improve the accuracy in the determination of the defect true or false.
  • the area 9c1 is located approximately at the center of the side surface 9c in the image IM11 and at the end of the side surface 9c in the images IM12 and IM13. Therefore, the area 9c1 appears wide in the image IM11, and appears very narrow in the images IM12 and IM13. Therefore, the defect in the area 9c1 of the tablet 9 is less likely to be visually recognized in the images IM12 and IM13 than the image IM11, and is not easily detected as a defect candidate.
  • the area 9c1 at the end of the side face 9c in the images IM12 and IM13 may be excluded from the target of the candidate detection process.
  • the control unit 8 may set an area on the end side of the side surface area Rc in the images IM12 and IM13 as a mask area to be not inspected. According to this, it is possible to prevent false detection of a defect candidate in the end region or the occurrence of defect detection failure.
  • FIG. 25 is a flowchart showing an example of inspection processing.
  • step SA28 is further executed as compared with FIG. This step SA28 is performed between steps SA26 and SA27.
  • control unit 8 sets a mask area.
  • the control unit 8 sets end regions located at both ends of the side region Rc identified in step SA26 as a mask region.
  • the width of the end area (the width along the semi-ellipse E11) may be determined in advance, or the control unit 8 may calculate a predetermined ratio of the width of the side area Rc as the width of the end area.
  • the control unit 8 does not detect a pixel in the mask area as a defect candidate in the candidate detection process of step SA27. According to this, the area 9c1 of the tablet 9 is subjected to the substantial candidate detection process only in the image IM11. This is because the area 9c1 does not appear in the image IM14, but appears in the mask area in the images IM12 and IM13.
  • the control unit 8 performs defect authenticity processing on the area 9c1 as follows. That is, when the defect candidate is detected in the area 9c1 by the candidate detection process for the image IM11, the control unit 8 selects the tablet 9 (more specifically, regardless of the result of the candidate detection process for the other images IM12 to IM14. It is determined that a defect has occurred in the region 9c1) of the side surface 9c. That is, for the area 9c1 where candidate detection processing is performed only with the image IM11, candidate detection processing is not performed with the other images IM12 to IM14. It is regarded as a defect. Thereby, a defect in the region 9c1 of the side surface 9c can be detected.
  • region 9c2 adjacent to region 9c1 of side surface 9c of tablet 9 in the circumferential direction is captured in images IM11 and IM12, and is not captured in images IM13 and IM14.
  • the area 9c2 has, for example, the same width as an area obtained by dividing the side surface 9c of the tablet 9 in the circumferential direction into twelve equal parts.
  • the area 9c2 is located on the end side of the center of the side surface 9c in the images IM11 and IM12, but is away from the end of the side surface 9c.
  • the area 9c2 is not set as the mask area, and corresponds to the inspection target area.
  • the control unit 8 performs defect authenticity processing on the area 9c2 as follows. That is, when the common candidate detection in the area 9c1 is detected by the candidate detection process on the images IM11 and IM12, the control unit 8 selects the tablet 9 (more specifically, regardless of the result of the candidate detection process on the images IM13 and IM14). In fact, it is determined that a defect has occurred in the region 9c2) of the side surface 9c.
  • the control unit 8 sets the first region of the tablet 9 in which the candidate detection process is performed only on one image, and the second region of the tablet 9 in which the candidate detection process is performed in a plurality of images. It is sufficient to carry out defect authenticity processing as in That is, the control unit 8 determines that a defect has occurred in the tablet 9 when a defect candidate is detected in the first region of the one image for the first region, and a plurality of second regions are detected. It is determined that the tablet 9 has a defect when a common defect candidate is detected in the second region of two or more images of the images.
  • FIG. 26 is a flowchart showing an example of defect authenticity processing for the side surface area.
  • step SA34 is further executed, and the conditions for executing step SA32 are different.
  • Step SA34 is executed when a negative determination is made in step SA31.
  • control unit 8 determines whether the region corresponding to at least one defect candidate in side region Rc is not a target of defect detection in all the other images (that is, not a target of candidate detection processing). To judge.
  • the correspondence between the images IM11 to IM14 of the position of each pixel with respect to the side surface region Rc can be obtained in the same manner as the main surface region Ra.
  • four images of the tablet 9 viewed from the side are generated based on the images IM11 to IM14, respectively.
  • the side surface 9c of the tablet 9 seen from the four directions is shown.
  • the correspondence between the four images of the pixels in the side surface region Rc may be set in advance.
  • step SA34 the control unit 8 determines that the tablet 9 (more specifically, the side surface 9c) has a defect. That is, even if the defect candidate is not common to two or more images, if the defect candidate is originally another image outside the object of defect detection, the defect candidate is not naturally detected in the other image . Therefore, in this case, the defect candidate detected in one image is regarded as the defect of the tablet 9.
  • step SA34 the control unit 8 determines in step SA33 that the side surface 9c of the tablet 9 is not defective.
  • the determination may not necessarily be performed on all the defect candidates in each of steps SA31 and SA32. Further, if it is determined that a defect has occurred in the tablet 9 in one of the defect authenticity process (FIG. 23) for the main surface area and the defect authenticity process (FIG. 26) for the side surface area, the other may be omitted.
  • step SA34 is necessarily performed regardless of the determination result of step SA31, and determination on all the defect candidates may be performed in each of steps SA31 and SA32. Further, in this case, both the defect authenticity processing for the main surface area and the defect authenticity processing for the side surface area are performed.
  • the center line L0 of the search area R1 is described as a line obtained by moving the side outer edge P1, but the side outer edge P1 may be enlarged at a predetermined magnification during this movement. Strictly speaking, the boundary edge P3 is larger than the side outer edge P1 at a predetermined magnification.
  • the control unit 8 sets the end region of the side surface region Rc as the mask region in each of the images IM11 to IM14.
  • other regions may be set as mask regions.
  • a sugar-coated tablet is adopted as the shape of the tablet 9 and described.
  • the tablet 9 has a flat shape in which spheres are reduced in a uniaxial direction, and the tablet 9 has a circular shape when viewed perpendicularly to the widest surface.
  • the shape of the tablet 9 is not limited to this.
  • FIG. 27 schematically shows an example of a captured image IM1 '.
  • the captured image IM1 ' is an image obtained by imaging the tablet 9 of a sugar-coated tablet by the imaging head 5.
  • Images IM11 'to IM14' of the captured image IM1 ' show the appearance of the tablet 9 as viewed from different imaging directions.
  • the outline of the tablet 9 ideally has an elliptical shape.
  • each point on the surface of the tablet 9 in the images IM11 'to IM14' is indicated by a two-dot chain line.
  • Such a correspondence relationship may be set in advance in association with, for example, a function indicating the outline of the tablet 9, and may be stored in the storage medium of the control unit 8.
  • mask regions MR1 to MR4 are set in the images IM11 'to IM14'.
  • the mask regions MR1 to MR4 are regions in which pixel values can be much higher than pixel values in other regions.
  • Such a region is generated by specular reflection of light emitted from the illumination light source by the tablet 9. That is, when the specularly reflected light is imaged on a part of the imaging surface of the inspection camera 51 through the mirror 53, the pyramidal mirror 54 and the lens group 52, an area corresponding to the part of the imaging surface The pixel value of the pixel in the regular reflection region is much higher than the other pixel values. Therefore, the mask area is set to include this regular reflection area. Thereby, it can be avoided that the intensity of light on the tablet 9 is erroneously detected as a defect.
  • the mask regions MR1 to MR4 are shown as elliptical ring regions.
  • the mask area MR1 may be set in advance in association with a function indicating the outline of the tablet 9, for example.
  • the control unit 8 may specify an area where the pixel value of the pixel in the image IM11 'is larger than the mask threshold, and set the area as the mask area MR1.
  • the mask threshold may be set in advance and stored in a storage medium of the control unit 8, for example.
  • the regions MR1 to MR4 overlap in the same region, the regions are included in the mask regions MR1 to MR4 in the images IM11 'to IM14', so inspection is performed on any of the images IM11 'to IM14'. It does not become an object. But such a possibility is very low.
  • the common surface of the tablet 9 that appears in any of the images IM11 'to IM14' is divided into the following four types of regions. That is, the first area is an area located in the inspection target area in all of the images IM11 ′ to IM14 ′, and the second area is located in the inspection target area in only three of the images IM11 ′ to IM14 ′. It is an area, and the third area is an area located in the inspection target area in only two of the images IM11 ′ to IM14 ′, and the fourth area is the inspection target area in only one of the images IM11 ′ to IM14 ′ It is an area located inside.
  • FIG. 28 is a flowchart showing an example of inspection processing.
  • the control unit 8 generates an edge image in the same manner as at step SA21.
  • the controller 8 specifies the tablet edge in the same manner as at step SA22.
  • an approximate line (ellipse) approximating the tablet edge is specified as the contour of the tablet region based on the function of the ellipse. More generally, an approximate line approximating a tablet edge is specified based on a reference function indicating the contour of the tablet 9 in IM11 to IM14.
  • control unit 8 sets a mask area as shown in FIG. 27, for example.
  • control unit 8 performs candidate detection processing on each of the images IM11 'to IM14'.
  • the candidate detection process is as described above.
  • a defect candidate is detected, and the position of the defect candidate with respect to the tablet area is specified.
  • the control unit 8 operates as follows in the defect authenticity process. That is, the control unit 8 causes the tablet 9 to have a defect when a common defect candidate is detected in two or more of the images IM11 ′ to IM14 ′ in the first to third regions. I will judge. The control unit 8 determines that the tablet 9 has a defect when the defect candidate is detected in one of the images IM11 'to IM14' in the fourth region.
  • side area and side of tablet may be read as “tablet area” and “tablet”, respectively.
  • control unit 8 may specify the boundary edge P3 according to the flowchart of FIG.
  • the chippings formed on the periphery of the upper surface of the tablet are located on the outer periphery of the tablet.
  • the outer periphery of the tablet here means the outline of the tablet area which a tablet occupies in a captured image.
  • this one-way imaging captures both the top and side surfaces of the tablet.
  • the top and side surfaces of the tablet are in contact with each other in the captured image. That is, in this captured image, a portion in contact with the side surface of the periphery of the top surface of the tablet is located not inside the periphery of the tablet (outline of the tablet region) but inside the tablet region. When a chipping of the tablet occurs in the portion, it is difficult to detect the chipping from the captured image.
  • the tablet inspection method and tablet inspection device which can detect the chipping of the tablet which arose on the boundary of the main surface and the side in the image pick-up picture which the main surface and the side of a tablet touch mutually are provided. Intends to be
  • inspection apparatus 1 concerning 5th Embodiment is the same as that of 1st Embodiment.
  • the function and operation of the control unit 8 according to the fourth embodiment are different from those of the first embodiment, as described in detail later.
  • FIG. 29 is a view schematically showing an example of a captured image IM11 obtained by imaging a tablet 9 in which a defect has occurred from one direction.
  • a chipping B1 is present at the boundary between the major surface 9aa and the side surface 9ca of the tablet 9.
  • the control unit 8 performs image processing on the captured image IM11 to detect the chipping B1 of the tablet 9. The following more specifically describes.
  • FIG. 30 is a flowchart showing an example of the operation in the tablet inspection apparatus 1.
  • the imaging head 5 captures an image of the tablet 9 during conveyance from the direction in which both the main surface 9a and the side surface 9c of the tablet 9 appear, as in step S1 of FIG. A captured image IM11 in which both 9a and the side surface 9c appear is generated.
  • the imaging head 5 outputs the captured image IM11 to the control unit 8.
  • the control unit 8 detects a main surface edge corresponding to the contour of the main surface area Ra occupied by the main surface 9aa of the tablet 9 in the captured image IM11. As shown in FIG. 29, when chipping B1 occurs at the boundary between main surface region Ra and side surface region Rc, the main surface edge is an edge corresponding to the outline of main surface 9aa including chipping B1. Understand that there is.
  • the detection of the main surface edge is performed, for example, by a series of processes in steps SB2 to SB5 of FIG.
  • step SB2 the control unit 8 performs edge detection processing on the captured image IM11 to generate an edge image, as in step S2 of FIG.
  • step SB3 the controller 8 specifies the tablet edge P0 corresponding to the contour of the tablet region TR (see also FIG. 31), as in step S3 of FIG.
  • FIG. 31 is a view schematically showing an example of the tablet edge P0. Also in the example of FIG. 31, the tablet edge P0 is shown divided into a plurality of edges, as in FIG.
  • step SB4 the control unit 8 extracts the side outer edge P1 and the main surface outer edge P2 from the tablet edge P0 specified in step SB3 as in step S4 in FIG. .
  • step SB5 the control unit 8 specifies the boundary edge P3 from the edge image, as in step S5 in FIG.
  • the boundary edge P3 is an edge corresponding to the boundary between the major surface 9aa and the side surface 9ca of the tablet 9 in the captured image IM11.
  • the boundary edge P3 is an edge corresponding to the boundary between the main surface area Ra and the side surface area Rc.
  • the boundary edge P3 includes a part of the edge corresponding to the outline of the chip B1. A specific example of the boundary edge P3 will be described later.
  • the boundary edge P3 When no chipping B1 occurs in the tablet 9, the boundary edge P3 ideally has a semi-elliptical shape that bulges on the opposite side to the major surface outer edge P2 (see also FIG. 8). That is, the boundary edge P3 has the same shape as the side surface outer edge P1. Furthermore, since the tablet 9 is not so thick here, it can be considered that the boundary edge P3 and the side outer edge P1 have substantially the same shape, unless the tablet 9 has a chipping B1. That is, the boundary edge P3 exists in a region in which the side surface outer edge P1 is moved in parallel along the predetermined direction D1 toward the main surface outer edge P2 by the length of the side surface ridge line edge P4. Since the length of the side ridge line edge P4 is predetermined according to the thickness of the tablet 9 and the arrangement of the internal configuration of the imaging head 5, if the side outer edge P1 is specified, the region where the boundary edge P3 exists is estimated. be able to.
  • control unit 8 searches for a boundary edge P3 by searching for pixels in a search area R1 (see also FIG. 32) separated from the side surface outer edge P1 by a predetermined distance toward the main surface outer edge P2 along the predetermined direction D1. Identify. FIG. 32 schematically shows an example of the search area R1.
  • the center line L0 is a line obtained by moving the side outer edge P1 by the length of the side edge P4 along the predetermined direction D1 toward the main surface outer edge P2. Further, although in the example of FIG. 32 a part of the boundary edge P3 and a part of the center line L0 are shown to coincide with each other, they may actually be different from each other.
  • the lines L1 and L2 are lines obtained by moving the center line L0 along the predetermined direction D1 to the opposite side by a predetermined width. This predetermined width is preset according to the size of the chipped chip B1 assumed. In FIG. 32, the line L1 is closer to the side outer edge P1 than the line L2.
  • the lines L3 and L4 extend along the predetermined direction D1 and connect both ends of the lines L1 and L2, respectively.
  • the search area R1 is an area surrounded by one set of these lines L1 to L4.
  • FIG. 32 a chipped edge P 'corresponding to the contour of the chip B1 and a part of the dividing line edge P5 corresponding to the dividing line 91 are also shown.
  • the pixel on the missing edge P ' is specified as a component of the boundary edge P3 as follows. That is, a pixel on the edge Pc 'on the line L1 side (that is, the side surface outer edge P1 side) of the chipped edge P' is identified as a component of the boundary edge P3.
  • a pixel on the edge Pc 'on the line L1 side (that is, the side surface outer edge P1 side) of the chipped edge P' is identified as a component of the boundary edge P3.
  • some of the pixels identified as components of the boundary edge P3 are schematically indicated by black circles.
  • the control unit 8 specifies one set of the main surface outer edge P2 specified in step SB4 and the boundary edge P3 specified in step SB5 as the main surface edge P23.
  • the major surface edge P23 does not have an ideal oval shape, and deviates from the ideal oval shape in a portion corresponding to the chip B1 (see also FIG. 33 described later) ). Therefore, if an approximate line close to the ideal ellipse is calculated, the notch B1 can be detected based on the portion where the approximate line and the main surface edge P23 diverge.
  • control unit 8 calculates an approximate line (ellipse) approximate to the major surface edge P23 based on the function of the ellipse as in step 6 of FIG.
  • the tablet 9 has a substantially disk shape. That is, the main surface 9a of the tablet 9 has a substantially circular shape. Therefore, in the captured image IM11, the periphery of the major surface 9aa ideally has an elliptical shape. In the present embodiment, a function of an ellipse is used as a reference function correspondingly. Therefore, it is possible to appropriately calculate an approximate line close to the contour of main surface area Ra.
  • Two half ellipses E11 and E12 obtained by dividing the ellipse E1 by the major axis correspond to approximate lines of the major surface outer edge P2 and the boundary edge P3, respectively.
  • step SB7 the control unit 8 calculates an approximate line (semi-elliptic) approximate to the side face outer edge P1 based on the ellipse E1, as in step S7 of FIG.
  • FIG. 33 is a diagram schematically showing an example of various edges and their approximate lines for the tablet 9 in which the chipping B1 has occurred.
  • the major surface edge P23 extends along the portion of the outline of the notch B1 on the side surface 9ca and the periphery of the major surface 9aa.
  • the side outer edge P1 and the semi-ellipse E21 that is an approximation line thereof are shown to coincide with each other, they may actually be different from each other.
  • step SB8 the control unit 8 executes an inspection process.
  • This inspection process is a process for detecting chipping that has occurred on the peripheral edge of the main surfaces 9 a and 9 b of the tablet 9.
  • FIG. 34 is a flowchart showing a specific example of this inspection process.
  • the control unit 8 extracts semi-ellipses E11 and E12 as approximation lines of the main surface outside edge P2 and the boundary edge P3 from the ellipse E1 which is an approximation line of the main surface edge P23.
  • the control unit 8 calculates half ellipses obtained by dividing the ellipse E1 by its long axis as half ellipses E11 and E12.
  • control unit 8 determines that distance d between each pixel on boundary edge P3 and half ellipse E12 (see also FIG. 33) is greater than a predetermined threshold (hereinafter referred to as distance threshold) dth. Determine if it is long.
  • the distance threshold dth may be set in advance and stored in the storage medium of the control unit 8, for example. In the example of FIG. 33, the distance d between a certain pixel on the boundary edge P3 and the semi-ellipse E12 is shown.
  • control unit 8 determines the periphery of main surface 9a of tablet 9 (more specifically, the boundary between main surface 9aa and side surface 9ca in captured image IM11) in step SB83. Judging that there is a defect in If a negative determination is made, the control unit 8 does not execute step SB83.
  • FIG. 35 is a flowchart showing a more specific example of the processing of steps SB82 and SB83.
  • control unit 8 initializes value n to one.
  • the value n is a number indicating a pixel on the boundary edge P3.
  • the pixels on the boundary edge P3 are sequentially numbered sequentially from one end to the other end.
  • step SB802 the control unit 8 calculates the distance d between the n-th pixel on the boundary edge P3 (hereinafter referred to as the target pixel) and the half ellipse E12. For example, the control unit 8 calculates the distance between the pixel of interest and each of the pixels on the half ellipse E12, and selects the smallest value as the distance d.
  • control unit 8 determines whether distance d is longer than distance threshold dth. If a positive determination is made, the control unit 8 determines in step SB804 that the pixel of interest is a pixel indicating the outline of a chip, and determines that a defect is generated on the periphery of the main surface 9a of the tablet 9. Do. Next, the control unit 8 executes step SB805 described later. On the other hand, if a negative determination is made, the control unit 8 executes step SB805 without executing step SB804.
  • control unit 8 adds 1 to the value n to update the value n.
  • control unit 8 determines whether value n is larger than reference value nref.
  • the reference value nref is the total number of pixels constituting the boundary edge P3. That is, it is determined whether the determination is completed for all the pixels on the boundary edge P3. If a negative determination is made in step SB806, the control unit 8 executes step SB802 again because the determination has not been completed for all the pixels. On the other hand, when an affirmative determination is made in step SB806, control unit 8 ends the process.
  • the above determination is made for all pixels on the boundary edge P3.
  • the above-mentioned judgment on the remaining pixels may be omitted. The same applies to all inspection processes described below.
  • control unit 8 determines whether or not the distance between each pixel on main surface outer edge P2 and semi-elliptic E11 that is an approximation line thereof is longer than distance threshold dth. to decide.
  • the control unit 8 has a chip at the periphery of the main surface 9a of the tablet 9 (more specifically, the portion of the captured image IM11 not in contact with the side surface 9ca) I will judge. If a negative determination is made, the control unit 8 does not execute step SB85.
  • control unit 8 determines whether or not the distance between each pixel on side surface outer edge P1 and half ellipse E21 as an approximation line thereof is longer than distance threshold dth. If a positive determination is made, control unit 8 determines in step SB87 that the periphery of main surface 9b of tablet 9 (more specifically, a portion appearing in captured image IM11) is chipped. . If a negative determination is made, the control unit 8 does not execute step SB87.
  • the chipping which arose on the periphery of main surface 9a, 9b of the tablet 9 can be detected.
  • control unit 8 does not necessarily have to execute all the determinations in steps SB82, SB84, and SB86. When a positive determination is made in any one of the control units 8, the remaining determination may be omitted.
  • control unit 8 calculates an approximation line (ellipse E1) approximating the major surface edge P23, and extracts the semi-ellipses E11 and E12 from the ellipse E1.
  • control unit 8 calculates an approximate line (semi-elliptic curve E12) of the boundary edge P3 based on a reference function previously determined as the shape of the boundary between the main surface 9aa and the side surface 9ca of the tablet 9 in the captured image IM11.
  • control unit 8 approximates the main surface outer edge P2 based on a reference function predetermined as the shape of a portion not in contact with the side surface 9ca of the peripheral surface of the main surface 9aa of the tablet 9 in the captured image IM11.
  • the semi-ellipse E11 may be calculated.
  • Steps SB802 to SB804 determines that the pixel exhibits a missing outline. That is, when the one pixel is separated from the semi-ellipse E12 by a distance longer than the distance threshold dth, it is determined that the pixel exhibits a missing outline.
  • a notch B1 occurs, referring also to FIG. 33, a plurality of continuous pixels on the boundary edge P3 are separated from the semi-ellipse E12 by a distance longer than the distance threshold dth.
  • control unit 8 determines whether a plurality of pixels separated from the semi-ellipsoid E12 at a distance d longer than the distance threshold dth are continuous on the boundary edge P3, and an affirmative determination is made. It is determined that the group of consecutive pixels show the outline of chipping B1, and the periphery of the main surface 9a of the tablet 9 (more specifically, the boundary between the main surface 9aa and the side surface 9ca of the captured image IM11) It is determined that a missing B1 has occurred.
  • FIG. 36 is a flowchart showing an example of a specific method of such inspection processing.
  • control unit 8 initializes values n and m to 1 and 0, respectively.
  • the value m indicates the number of continuous pixels on the boundary edge P3 which are pixels separated from the semi-ellipse E12 by a distance longer than the distance threshold dth, as will be apparent from the following description.
  • Steps SB812 and SB813 are the same as steps SB802 and SB803, respectively.
  • step SB814 the control unit 8 adds 1 to the value m to update the value m.
  • control unit 8 adds 1 to value n to update value n.
  • control unit 8 determines whether value n is larger than reference value nref. That is, the control unit 8 determines whether the process has been performed on all the pixels on the boundary edge P3. If a negative determination is made, the control unit 8 executes step SB812 again to make a determination on the next pixel. On the other hand, if an affirmative determination is made, the control unit 8 ends the process.
  • control unit 8 determines whether value m is larger than a threshold (hereinafter referred to as a continuous threshold) mth.
  • a threshold hereinafter referred to as a continuous threshold
  • the continuous threshold mth may be set in advance and stored in a storage medium of the control unit 8.
  • control unit 8 causes a group of (n ⁇ m + 1) -th to (n ⁇ 1) -th pixels to indicate a missing outline. It is determined that there is a chipping B1 at the periphery of the main surface 9a (more specifically, the boundary between the main surface 9aa and the side surface 9ca in the captured image IM11).
  • control unit 8 initializes value m to 0, and executes step SB815. If a negative determination is made in step SB817, control unit 8 executes step SB819 without executing step SB818.
  • value m is initialized to zero when a pixel whose distance d is shorter than distance threshold dth is detected (step SB 819), and pixels whose distance d is longer than distance threshold dth continue Every time it is detected, it is incremented (step SB815). Therefore, the value m indicates the number of consecutive pixels whose distance d is longer than the distance threshold dth. Then, when the value m is larger than the continuous threshold value mth, the control unit 8 determines that a chip has occurred (steps SB 817 and SB 818). This makes it possible to suppress chipping error detection and detect chipping with higher accuracy.
  • This inspection process is also applicable to the side outer edge P1 and the main surface outer edge P2.
  • the components of the boundary edge P3 are an edge P 'on the line L1 side and an edge Pa' on the line L2 side.
  • the boundary edge P3 is specified to be dispersed.
  • the control unit 8 specifies the boundary edge P3 by executing the flowchart of FIG.
  • the semi-elliptic E11 approximating the boundary edge P3 is a semi-elliptical closer to the periphery of the main surface 9aa of the tablet 9, and the ellipse E1 approximate to the major surface edge P23 is by the periphery of the main surface 9aa of the tablet 9 It becomes a close ellipse.
  • FIG. 37 is a diagram schematically showing an example of various edges and their approximate lines for the tablet 9 in which the chipping B1 has occurred. Since the components of the boundary edge P3 are dispersed to the edges Pa 'and Pc' at the chipped edge P ', in the example of FIG. 37, the chipped edge P' is partially identified as a component of the boundary edge P3. The chipped edge P 'is shown in dashed lines for the sake of illustration. Further, in the example of FIG. 37, the main surface outer edge P2 and the semi-ellipse E11 are shown to match each other, and the side outer edge P1 and the semi-ellipse E21 are shown to match each other. The boundary edge P3 is shown to coincide with the semi-ellipse E12 in parts other than the chipped edge P '. In practice, these may be different from one another.
  • the distance d between each pixel on the boundary edge P3 and the semi-ellipse E12 is calculated larger at the missing edge P ′. Therefore, chipping B1 is easier to detect. In other words, the chip B1 can be detected with higher accuracy.
  • both the pixels on the edge Pa' and the pixels on the edge Pc ' can be used to detect the missing B1.
  • the chipping B1 is formed to be biased to the main surface 9aa side, that is, the edge Pc 'is not projected so much to the side surface 9ca side, but is projected to the main surface 9aa side Even if there is, the chipping B1 can be detected. The details will be described below.
  • FIG. 38 is a diagram schematically showing an example of various edges and their approximate lines when the notch B1 does not protrude toward the side surface 9ca. If the notch B1 does not extend much toward the side surface 9ca, the distance d between each pixel on the edge Pc 'and the semi-ellipse E12 becomes short. Then, depending on the shape of the notch B1, the distance d for all the pixels on the edge Pc 'may be shorter than the distance threshold dth. At this time, if the component of the boundary edge P3 is biased to the edge Pc 'by employing the search processing of FIG. 32, the chip B1 can not be detected in the subsequent inspection processing.
  • the chip B1 can be detected in the subsequent inspection processing. This is because, in this inspection process, it is determined whether the distance d between the pixel on the edge Pa 'of the boundary edge P3 and the half ellipse E12 and the distance threshold dth are large (steps SB82 and SB83).
  • the first to fourth embodiments may be applied to the fifth embodiment.
  • the transport posture of the tablet 9 may be reversed, and the appearance inspection on the tablet 9 may be performed in that state. According to this, an appearance inspection can be performed on the entire surface (main surfaces 9a and 9b and side surface 9c) of the tablet 9.
  • the tablet 9 had a substantially disc shape.
  • a so-called flat lock or a lock with R can be adopted as the disk shape.
  • the tablet 9 is not necessarily limited to the disk shape. That is, the main surfaces 9a and 9b do not necessarily have to have a circular shape. Since the shapes of the major surfaces 9a and 9b are known, the shape of the periphery of the major surface 9a (or major surface 9b) that will appear in the captured image IM11 (or IM11 ′, hereinafter the same) Can be Although this reference function indicates the shape, it is a function whose size and position are variables.
  • the reference function may be stored in advance in, for example, a storage medium of the control unit 8.
  • the control unit 8 may generate an edge image from the captured image IM11, and obtain an approximate line of the major surface edge included in the edge image based on the reference function.
  • the main surface area Ra in the captured image IM11 can be calculated with higher accuracy.
  • Imaging unit imaging head
  • Image processing unit control unit
  • 9 tablets 9a first main surface (main surface) 9b
  • Side d1, d2 defect dA1, dA2 defect candidate E1 second approximate line (ellipse)
  • E11 Third approximate line (half-elliptic)
  • E12 First approximation line (half-elliptic)
  • E21 Fourth approximate line (semi-elliptic) IM1, IM1 'Captured image MR1 to MR4 Mask area
  • P0 Tablet edge P1 Side outer edge P2 Main surface outer edge
  • P3 Boundary edge P23
  • Main surface edge Ra Main area Rc Side area TR Tablet area

Landscapes

  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Signal Processing (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

錠剤検査方法は工程(a)~工程(c)を備える。工程(a)にて、錠剤を撮像して、錠剤の第1主面および側面の両方が写る撮像画像を生成する。工程(b)にて、撮像画像において第1主面および側面がそれぞれ占める主面領域および側面領域を特定する。工程(c)にて、主面領域および側面領域に対してそれぞれ検査処理を行う。工程(b)は、撮像画像において、第1主面の輪郭に対応した主面エッジを特定する工程(b1)と、撮像画像における前記主面領域の輪郭の形状として予め決められた関数に基づいて、主面エッジの近似線を主面領域の輪郭として求める工程(b2)とを備える。

Description

錠剤検査方法および錠剤検査装置
 この発明は、錠剤検査方法および錠剤検査装置に関し、特に錠剤を撮像するカメラを用いた検査技術に関する。
 従来から、錠剤の外観を検査する錠剤検査装置が提案されている(例えば特許文献1,2)。特許文献1においては、検査部は、錠剤を搬送する搬送手段と、搬送中の錠剤を撮像するための4つの撮像装置(カメラ)とを備えている。2つのカメラはそれぞれ錠剤の上面および下面を撮像し、残り2つのカメラは錠剤の側面を互いに反対側から撮像する。検査部はカメラによって撮像された撮像画像の各々に対して画像処理を行うことで外観検査を行う。
 この特許文献1では、複数のカメラを用いるので、コストが高い。これに対して特許文献2では、検査装置は、錠剤を搬送するコンベアと、搬送中の錠剤を撮像するための一つの撮像装置を備えている。撮像装置は、上側から見た錠剤の上面、および、四方から見た錠剤の側面を一つの撮像画像内に収めるように撮像する。
 具体的には、この撮像装置は一つのカメラと4つのプリズムとを備えている。カメラは錠剤の上側に配置されており、錠剤の上面からの光がカメラの撮像面に結像される。またプリズムは錠剤の四方に配置されており、錠剤の側面からの光をカメラへと反射させる。当該光もカメラの撮像面に結像される。これにより、カメラは5方向から見た錠剤の外観を撮像できる。検査装置は、カメラによって撮像された撮像画像に対して画像処理を行うことにより、錠剤の外観検査を行う。
 また本願に関連する技術として、特許文献3も掲示する。
国際公開第2015/041112号 特開2012-123009号公報 特開2004-45097号公報
 特許文献2では、上側から見た錠剤の上面、および、四方から見た錠剤の側面は撮像画像において互いに離間している。つまり、撮像画像内の互いに離間した第1領域から第5領域において、それぞれ錠剤の上面および錠剤の側面が写っている。
 このような撮像画像において、第1領域から第5領域を区別することは容易である。よって、第1領域から第5領域のそれぞれに適した(つまり、主面および側面のそれぞれに適した)画像処理を行うことも容易である。
 ところで、錠剤を上方斜めから撮像すれば、この一方向の撮像により錠剤の上面および側面の両方を撮像することができる。そこで、この撮像画像において上面および側面を区別し、その各々について画像処理を行うことが考えられる。しかしながら、この撮像画像においては錠剤の上面および側面は互いに接しているので、錠剤の上面および側面を高い精度で区別することは困難である。
 そこで、本発明は、錠剤の主面および側面が互いに接する撮像画像において、主面および側面を高い精度で区別できる錠剤検査方法および錠剤検査装置を提供することを目的とする。
 上記課題を解決するため、錠剤検査方法の第1の態様は、一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査方法であって、錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する工程(a)と、前記撮像画像において前記第1主面および前記側面がそれぞれ占める主面領域および側面領域を特定する工程(b)と、前記主面領域および前記側面領域に対してそれぞれ検査処理を行う工程(c)と、を備え、前記工程(b)は、前記撮像画像において、前記第1主面の輪郭に対応した主面エッジを特定する工程(b1)と、前記撮像画像における前記主面領域の輪郭の形状を示す関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として算出する工程(b2)とを備える。
 錠剤検査方法の第2の態様は、第1の態様にかかる錠剤検査方法であって、前記錠剤は略円盤形状を有しており、前記関数は楕円を示す関数であり、前記近似線は楕円である。
 錠剤検査方法の第3の態様は、第1または第2の態様にかかる錠剤検査方法であって、前記主面領域および前記側面領域は、前記撮像画像において前記錠剤が占める錠剤領域を構成しており、前記工程(b1)は、前記撮像画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b11)と、前記錠剤領域の輪郭に対応する錠剤エッジを前記エッジ画像から特定する工程(b12)と、前記撮像画像における前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記撮像画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b13)と、前記エッジ画像において前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記主面領域と前記側面領域との間の境界に対応する境界エッジを特定する工程(b14)と、前記主面外側エッジおよび前記境界エッジの一組を前記主面エッジとして特定する工程(b14)とを備える。
 錠剤検査方法の第4の態様は、第3の態様にかかる錠剤検査方法であって、前記工程(b14)では、前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記撮像画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する。
 錠剤検査方法の第5の態様は、第3または第4の態様にかかる錠剤検査方法であって、前記工程(b14)では、前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する。
 錠剤検査方法の第6の態様は、第1から第5のいずれか一つの態様にかかる錠剤検査方法であって、前記錠剤の前記第1主面および前記側面の一方の表面粗さは他方よりも小さく、前記工程(c)は、前記撮像画像の前記主面領域および前記側面領域の一方に対してエッジ強度処理を行って得られた各画素の値が第1閾値よりも大きいときに、前記錠剤の前記第1主面および前記側面の前記一方に欠陥が生じていると判断する工程(c1)と、前記主面領域および前記側面領域の他方に対してエッジ強度処理を行って得られた各画素の画素値が、前記第1閾値よりも大きな第2閾値よりも大きいときに、前記錠剤の前記第1主面および前記側面の前記他方に欠陥が生じていると判断する工程(c2)とを備える。
 錠剤検査方法の第7の態様は、第1から第6のいずれか一つの態様にかかる錠剤検査方法であって、前記撮像画像において前記錠剤の前記第1主面および前記側面の一方は他方よりも明るく、前記工程(c)は、前記撮像画像の前記主面領域および前記側面領域の一方の各画素の画素値が第3閾値よりも小さいときに、前記錠剤の前記第1主面および前記側面の前記一方に欠陥が生じていると判断する工程(c1)と、前記撮像画像の前記主面領域および前記側面領域の他方の各画素の画素値が、前記第3閾値よりも小さな第4閾値より小さいときに、前記錠剤の前記第1主面および前記側面の前記他方に欠陥が生じていると判断する工程(c2)とを備える。
 錠剤検査方法の第8の態様は、第1から第7のいずれか一つの態様にかかる錠剤検査方法であって、前記錠剤の前記第1主面には割線が形成されており、前記工程(b)は、前記撮像画像において前記主面領域のうち前記割線を含む割線領域と前記割線を含まない非割線領域とを特定する工程(b3)を含み、前記工程(c)において、前記撮像画像の前記割線領域に対してエッジ強度処理を行って得られた各画素の画素値が第5閾値よりも大きいときに、前記割線領域において欠陥が生じていると判断し、前記撮像画像の前記非割線領域に対してエッジ強度処理を行って得られた各画素の画素値が前記第5閾値よりも小さな第6閾値よりも大きいときに、前記非割線領域において欠陥が生じていると判断する。
 錠剤検査装置の第9の態様は、一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査装置であって、錠剤の前記第1主面および前記側面の両方が写る方向から前記錠剤を撮像して撮像画像を生成する撮像部と、前記撮像画像において前記第1主面および前記側面がそれぞれ占める主面領域および側面領域を特定し、前記主面領域および前記側面領域に対してそれぞれ検査処理を行う画像処理部とを備え、前記画像処理部は、前記撮像画像において、前記第1主面の輪郭に対応した主面エッジを特定し、前記撮像画像における前記主面領域の輪郭の形状として予め決められた関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として求める。
 錠剤検査方法の第10の態様は、錠剤の外観を検査する錠剤検査方法であって、錠剤を撮像して、複数の撮像方向から見た錠剤の外観がそれぞれ写る複数の画像を含む撮像画像を生成する工程(a)と、錠剤の欠陥候補を検出する検査処理を、前記撮像画像に対して行う工程(b)と、前記検査処理によって、前記複数の画像に写る前記錠剤の第1領域において、前記複数の画像のうち2以上の画像で共通の欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程(c)とを備える。
 錠剤検査方法の第11の態様は、第10の態様にかかる錠剤検査方法であって、前記錠剤の第2領域は前記複数の画像のうちn(nは2以上の整数)個の画像のみに写っており、前記検査処理によって、前記n個の画像のうち2以上の画像で共通の欠陥候補が前記第2領域において検出されたときに、前記錠剤に欠陥が生じていると判断する工程(d)を更に備える。
 錠剤検査方法の第12の態様は、第10または第11の態様にかかる錠剤検査方法であって、前記錠剤の第3領域は前記複数の画像のうち1つの画像のみに写っており、前記検査処理によって、前記1つの画像の前記第3領域において欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程(f)を更に備える。
 錠剤検査方法の第13の態様は、第10から第12のいずれか一つの態様にかかる錠剤検査方法であって、前記検査処理の検査対象とならないマスク領域が前記複数の画像ごとに設定され、前記錠剤の第4領域は前記複数の画像のうちm(2以上の整数)個の画像のみにおいて前記マスク領域以外の検査対象領域に写っており、前記工程(c)において、前記検査処理によって、前記m個の画像のうち2以上の画像で共通の欠陥候補が前記第4領域において検出されたときに、前記錠剤に欠陥が生じていると判断する。
 錠剤検査方法の第14の態様は、第13の態様にかかる錠剤検査方法であって、前記複数の画像のそれぞれにおいて、前記錠剤に対する光の正反射によって画素値が他の領域よりも所定値以上高くなる領域を含む領域が前記マスク領域に設定される。
 錠剤検査方法の第15の態様は、第13または第14の態様にかかる錠剤検査方法であって、前記錠剤は、前記第1領域たる第1主面と、前記第1主面と対面する第2主面と、前記第1主面の周縁および前記第2主面の周縁を連結する側面とを有し、前記複数の画像のそれぞれにおいて前記錠剤の側面が占める側面領域の両側に位置する端領域が前記マスク領域に設定される。
 錠剤検査方法の第16の態様は、第10から第15のいずれか一つの態様にかかる錠剤検査方法であって、前記錠剤は、前記第1領域たる第1主面と、前記第1主面と対面する第2主面と、前記第1主面の周縁および前記第2主面の周縁を連結する側面とを有し、前記工程(b)は、前記複数の画像の各々において、前記錠剤の前記第1主面が示す主面領域の輪郭に対応した主面エッジを特定する工程(b1)と、前記複数の画像の各々において、前記主面領域の輪郭の形状として予め決められた関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として求める工程(b2)と、前記複数の画像の各々において欠陥候補を検出する工程(b3)とを有し、前記工程(c)において、前記主面領域に対する各画素の位置の前記複数の画像の相互間における対応関係に基づいて、前記工程(b3)で検出された欠陥候補が前記2以上の画像において共通するのか否かを判断する。
 錠剤検査方法の第17の態様は、第16の態様にかかる錠剤検査方法であって、前記錠剤の前記第1主面は平面視で略円形状を有しており、前記関数は楕円を示す関数であり、前記近似線は楕円である。
 錠剤検査方法の第18の態様は、第16または第17の態様にかかる錠剤検査方法であって、前記錠剤は略円盤形状を有しており、前記複数の画像の各々において、前記錠剤の側面が占める側面領域と、前記主面領域とは錠剤領域を構成しており、前記複数の画像の各々を検査画像と呼ぶと、前記工程(b1)は、前記検査画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b11)と、前記検査画像において前記錠剤領域の輪郭に対応する錠剤エッジを、前記エッジ画像から特定する工程(b12)と、前記検査画像において前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記検査画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b13)と、前記エッジ画像において、前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記主面領域と前記側面領域との間の境界に対応する境界エッジを特定する工程(b14)と、前記主面外側エッジおよび前記境界エッジの一組を前記主面エッジとして特定する工程(b14)とを備える。
 錠剤検査方法の第19の態様は、第18の態様にかかる錠剤検査方法であって、前記工程(b14)では、前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記検査画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する。
 錠剤検査方法の第20の態様は、第18または第19の態様にかかる錠剤検査方法であって、前記工程(b14)では、前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する。
 錠剤検査装置の第21の態様は、錠剤の外観を検査する錠剤検査装置であって、錠剤を撮像して、複数の撮像方向から見た錠剤の外観がそれぞれ写る複数の画像を含む撮像画像を生成する撮像部と、画像処理部とを備え、前記画像処理部は、錠剤の欠陥候補を検出する検査処理を、前記撮像画像に対して行う工程と、前記検査処理によって、前記複数の画像に写る前記錠剤の第1領域において、前記複数の画像のうち2以上の画像で共通の欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程とを実行する。
 錠剤検査方法の第22の態様は、一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査方法であって、錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する工程(a)と、前記撮像画像において前記錠剤の前記第1主面および前記側面がそれぞれ占める主面領域と側面領域との間の境界に対応する境界エッジを特定し、前記境界エッジに近似する第1近似線を、前記撮像画像での前記境界の形状を示す関数に基づいて算出する工程(b)と、前記境界エッジ上の各画素と前記第1近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する工程(c)とを備える。
 錠剤検査方法の第23の態様は、第22の態様にかかる錠剤検査方法であって、前記主面領域および前記側面領域は、前記撮像画像において前記錠剤が占める錠剤領域を構成しており、前記工程(b)は、前記撮像画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b1)と、前記錠剤領域の輪郭に対応する錠剤エッジを前記エッジ画像から特定する工程(b2)と、前記撮像画像における前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記撮像画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b3)と、前記エッジ画像において前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記境界エッジを特定する工程(b4)と、前記撮像画像での前記主面領域の輪郭の形状を示す関数に基づいて、前記主面外側エッジおよび前記境界エッジの一組たる主面エッジの第2近似線を算出する工程(b5)と、前記第2近似線から前記境界エッジの前記第1近似線を抽出する工程(b6)とを備える。
 錠剤検査方法の第24の態様は、第23の態様にかかる錠剤検査方法であって、前記錠剤は略円盤形状を有しており、前記関数は楕円を示す関数であり、前記第2近似線は楕円である。
 錠剤検査方法の第25の態様は、第23または第24の態様にかかる錠剤検査方法であって、前記工程(b4)では、前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記撮像画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する。
 錠剤検査方法の第26の態様は、第24または第25の態様にかかる錠剤検査方法であって、前記工程(b4)では、前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する。
 錠剤検査方法の第27の態様は、第23から第26のいずれか一つの態様にかかる錠剤検査方法であって、前記工程(b5)において算出した前記主面エッジの前記第2近似線から、前記主面外側エッジの第3近似線を抽出する工程と、前記主面外側エッジ上の各画素と前記第3近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する工程とを備える。
 錠剤検査方法の第28の態様は、第23から第27のいずれか一つの態様にかかる錠剤検査方法であって、前記工程(b5)において算出した前記主面エッジの前記第2近似線から、前記側面外側エッジの第4近似線を抽出する工程と、前記側面外側エッジ上の各画素と前記第4近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第2主面の周縁に欠けが生じていると判断する工程とを備える。
 錠剤検査装置の第29の態様は、一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査装置であって、錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する撮像部と、画像処理部とを備え、前記画像処理部は、前記撮像画像において前記錠剤の前記第1主面および前記側面がそれぞれ占める主面領域と側面領域との間の境界に対応する境界エッジを特定し、前記境界エッジに近似する第1近似線を、前記撮像画像での前記境界の形状を示す関数に基づいて算出し、前記境界エッジ上の各画素と前記第1近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する。
 錠剤検査方法の第1の態様および錠剤検査装置の第9の態様によれば、主面領域の輪郭の形状を示す関数に基づいて近似線を算出しているので、高い精度で主面領域を特定できる。ひいては、高い精度で主面領域と側面領域とを区別できる。
 錠剤検査方法の第2の態様によれば、錠剤の形状に応じて適切な関数を採用しているので、高い精度で主面を特定できる。
 錠剤検査方法の第3の態様によれば、主面エッジを適切に得ることができる。
 錠剤検査方法の第4の態様によれば、主面領域をより高い精度で特定できる。
 錠剤検査方法の第5の態様によれば、錠剤の主面に割線が形成されていたとしても、当該割線に対応するエッジを境界エッジとして誤検出することを回避できる。
 錠剤検査方法の第6の態様によれば、主面領域および側面領域の両方において欠陥漏れおよび欠陥の誤検出を抑制できる。
 錠剤検査方法の第7の態様によれば、主面領域および側面領域の両方において欠陥漏れおよび欠陥の誤検出を抑制できる。
 錠剤検査方法の第8の態様によれば、割線領域および非割線領域の両方において欠陥漏れおよび欠陥の誤検出を抑制できる。
 錠剤検査方法の第10の態様および錠剤検査装置の第21の態様によれば、2以上の画像で共通の欠陥候補を検出したときに、錠剤に欠陥が生じていると判断しているので、欠陥検出時の虚報を抑制できる。
 錠剤検査方法の第11の態様によれば、極まれな虚報をさらに抑制できる。
 錠剤検査方法の第12の態様によれば、第3領域内の欠陥を検出できる。
 錠剤検査方法の第13の態様によれば、第4領域における欠陥を適切に検出できる。
 錠剤検査方法の第14の態様によれば、錠剤上の光の強弱を欠陥と誤検出することを回避できる。
 錠剤検査方法の第15の態様によれば、欠陥の検出が困難な側面領域の端領域をマスク領域に設定するので、端領域における欠陥候補の誤検出あるいは検出漏れによる欠陥検出への影響を回避できる。
 錠剤検査方法の第16の態様によれば、主面領域の輪郭の形状として予め決められた関数に基づいて主面領域の輪郭を求めているので、主面領域の特定精度が高い。これによれば、主面領域の各画素の2以上の画像の相互間の対応関係の精度を向上でき、工程(c)の判断精度を向上できる。
 錠剤検査方法の第17の態様によれば、錠剤の形状に応じて適切な関数を採用しているので、高い精度で主面を特定できる。
 錠剤検査方法の第18の態様によれば、主面エッジを適切に得ることができる。
 錠剤検査方法の第19の態様によれば、複数の画像の各々において主面領域をより高い精度で特定できる。
 錠剤検査方法の第20の態様によれば、錠剤の主面に割線が形成されていたとしても、当該割線に対応するエッジを境界エッジとして誤検出することを回避できる。
 錠剤検査方法の第22の態様および錠剤検査装置の第29の態様によれば、錠剤の第1主面および側面が互いに接する撮像画像において、第1主面および側面の境界上に生じた錠剤の欠けを検出できる。
 錠剤検査方法の第23の態様によれば、境界エッジの第1近似線を適切に得ることができる。
 錠剤検査方法の第24の態様によれば、錠剤の形状に応じて適切な関数を採用しているので、より錠剤の主面に近い第2近似線を算出できる。
 錠剤検査方法の第25の態様によれば、撮像画像における主面と側面との間の境界の形状により近い第1近似線を算出することができる。
 錠剤検査方法の第26の態様によれば、錠剤の主面に割線が形成されていたとしても、当該割線に対応するエッジを境界エッジとして誤検出することを回避できる。
 錠剤検査方法の第27の態様によれば、第1主面の周縁に生じる錠剤の欠けを検出できる。
 錠剤検査方法の第28の態様によれば、第2主面の周縁に生じる錠剤の欠けを検出できる。
錠剤検査装置の構成の一例を概略的に示す図である。 錠剤の一例を示す斜視図である。 撮像ヘッドの内部構成の一例を概略的に示す図である。 撮像ヘッドの内部構成の一例を概略的に示す図である。 撮像画像の一例を概略的に示す図である。 撮像画像の一例を概略的に示す図である。 錠剤検査装置の動作の一例を示すフローチャートである。 撮像画像において錠剤の外周に対応する錠剤エッジの一例を概略的に示す図である。 撮像画像において錠剤の主面と側面との間の境界に対応する境界エッジの特定方法の一例を説明するための図である。 境界エッジの特定方法の一例を示すフローチャートである。 境界エッジの特定方法の他の一例を説明するための図である。 境界エッジの特定方法の他の一例を示すフローチャートである。 境界エッジの特定方法の他の一例を説明するための図である。 錠剤の一例を示す斜視図である。 撮像画像の一例を概略的に示す図である。 錠剤検査装置の動作の他の一例を示すフローチャートである。 撮像画像の一例を概略的に示す図である。 錠剤検査装置の動作の一例を示すフローチャートである。 検査処理の一例を示すフローチャートである。 画像の一例を概略的に示す図である。 錠剤の外周に対応する錠剤エッジの一例を概略的に示す図である。 画像において錠剤の主面と側面との間の境界に対応する境界エッジの特定方法の一例を説明するための図である。 主面領域に対する欠陥真偽処理の一例を示すフローチャートである。 画像間の各画素の対応関係の一例を示す図である。 検査処理の他の一例を示すフローチャートである。 側面領域に対する欠陥真偽処理の一例を示すフローチャートである。 撮像画像の他の一例を概略的に示す図である。 検査処理の他の一例を示すフローチャートである。 撮像画像の一例を概略的に示す図である。 錠剤検査装置の動作の一例を示すフローチャートである。 撮像画像において錠剤の外周に対応する錠剤エッジの一例を概略的に示す図である。 撮像画像において錠剤の主面と側面との間の境界に対応する境界エッジの特定方法の一例を説明するための図である。 各種エッジおよびその近似線の一例を概略的に示す図である。 検査処理の一例を示すフローチャートである。 検査処理のより具体的な一例を示すフローチャートである。 検査処理のより具体的な他の一例を示すフローチャートである。 各種エッジおよびその近似線の他の一例を概略的に示す図である。 各種エッジおよびその近似線の他の一例を概略的に示す図である。
 以下、図面を参照しつつ実施の形態について詳細に説明する。図面においては、理解容易の目的で、必要に応じて各部の寸法や数を誇張または簡略化して描いている。なお、図面においては同様な構成及び機能を有する部分については同じ符号が付されており、下記説明では重複説明が省略される。また各図において、構成要素の方向関係を明確にするため、Z軸方向を鉛直方向とし、XY平面を水平面とするXYZ直交座標系を適宜付している。
 第1の実施の形態.
 図1は、錠剤印刷装置10の構成の一例を概略的に示す図である。錠剤印刷装置10は錠剤検査装置1と印刷ヘッド6とを備えている。
 錠剤検査装置1は錠剤9の外観を検査する装置である。図2は、錠剤9の一例を概略的に示す斜視図である。図2の例では、錠剤9は略円盤形状を有している。具体的には、錠剤9は一対の主面9a,9bと側面9cとを備えている。例えばこの円盤形状として、いわゆる平錠またはR付き錠を採用できる。主面9a,9bは互いに対面しており、平面視において、略同一の円形状を有する。この主面9a,9bの一方および他方はそれぞれ表面および裏面と呼ばれることがあり、また上面および下面と呼ばれることもある。
 錠剤9の主面9aおよび側面9cは角部を形成しながら互いに連結されており、主面9bおよび側面9cも角部を形成しながら互いに連結されている。錠剤9の直径は例えば5[mm]程度~10数[mm]程度に設定され、その厚みは例えば5[mm]程度以下に設定され得る。
 図1を参照して、錠剤検査装置1はホッパー2と搬送ドラム3と搬送部4と撮像ヘッド5と選別部7と制御部8とを備えている。
 ホッパー2は、錠剤9を錠剤印刷装置10内に投入するための投入部である。このホッパー2は、錠剤印刷装置10の筐体(図示省略)の天井部上側に設けられている。ホッパー2から投入された錠剤9は搬送ドラム3に導かれる。なお、ホッパー2を除く他の要素は錠剤印刷装置10の筐体の内部に設けられている。
 搬送ドラム3は略円柱状の形状を有しており、その中心軸がY軸方向に沿う姿勢で配置されている。搬送ドラム3は図示省略の回転駆動モータによって当該中心軸を回転中心として図1の紙面上で反時計回りに回転される。この回転駆動モータは例えば制御部8によって制御される。
 搬送ドラム3の外周面には複数の吸着孔(不図示)が周方向に沿って並んで形成されている。複数の吸着孔のそれぞれは搬送ドラム3の内部に設けられた吸引機構(図示省略)と連通している。この吸引機構は例えば制御部8によって制御される。この吸引機構を作動させることによって複数の吸着孔のそれぞれに大気圧よりも低い負圧を作用させることができる。これにより、搬送ドラム3の各吸着孔は1個の錠剤9を吸着保持することができる。
 搬送部4は搬送ドラム3の下方に配置されている。搬送ドラム3の外周面に吸着保持された錠剤9は搬送ドラム3の回転に伴って周方向に移動する。錠剤9が搬送ドラム3の下方側まで移動したときに吸引機構が錠剤9に対する吸着を解除することにより、錠剤9が落下して搬送部4へと受け渡される。
 搬送部4は錠剤9を搬送する。図1の例では、搬送部4はベルトコンベアであって、搬送ベルト41と一対のプーリ42とを備えている。一対のプーリ42は例えばX軸方向において間隔を空けて配置されており、自身の中心軸がY軸方向に沿う姿勢で配置されている。一対のプーリ42はそれぞれ自身の中心軸を回転中心として回転する。
 搬送ベルト41は一対のプーリ42に掛け渡されている。一対のプーリ42の少なくともいずれか一方が図示省略の駆動モータによって回転駆動されることにより、搬送ベルト41が図1の矢印にて示す向きに回走する。この駆動モータは例えば制御部8によって制御される。
 搬送ベルト41の外周面にも、図示省略の複数の吸着孔がその周方向に沿って並んで形成されている。複数の吸着孔のそれぞれは搬送ベルト41の内部に設けられた吸引機構(図示省略)と連通している。この吸引機構は例えば制御部8によって制御される。この吸引機構を作動させることによって複数の吸着孔のそれぞれに大気圧よりも低い負圧を作用させることができる。これにより、搬送ベルト41の各吸着孔は1個の錠剤9を吸着保持することができる。
 搬送ベルト41が錠剤9を吸着保持しながら回走することにより、錠剤9はX軸方向に沿って搬送ドラム3から遠ざかる方向に搬送される。
 撮像ヘッド5は搬送部4による錠剤9の搬送経路の途中において搬送ドラム3の下流側で、搬送部4と対向する位置に配置されている。この撮像ヘッド5の撮像エリアは搬送ベルト41の一部を含んでいる。撮像ヘッド5は錠剤9がこの撮像エリア内を移動するときに錠剤9を撮像して、撮像画像を生成する。撮像ヘッド5はこの撮像画像を制御部8へ出力する。撮像ヘッド5の具体的な内部構成の一例については後に詳述する。
 制御部8は、入力された撮像画像に対して画像処理を施すことにより、錠剤9の外観を検査する。制御部8は錠剤9の外観に欠陥が生じている場合にはその錠剤9を不良品と判断し、錠剤9の外観に欠陥が生じていない場合にはその錠剤9を良品と判断する。当該欠陥としては、錠剤9に付着した不純物または錠剤9の形状上の不備(例えば欠け)などの欠陥を例示できる。制御部8による具体的な画像処理の一例については後に詳述する。
 印刷ヘッド6は錠剤9の搬送途中において撮像ヘッド5の下流側で、搬送ベルト41の上方に配置されている。印刷ヘッド6は例えば制御部8によって制御され、錠剤9に対して印刷処理を行う。印刷ヘッド6は複数の吐出ノズル(図示省略)を備えており、各吐出ノズルからインクジェット方式によってインクの液滴を吐出する。インクジェットの方式は、ピエゾ素子(圧電素子)に電圧を加えて変形させてインクの液滴を吐出するピエゾ方式であっても良いし、ヒータに通電してインクを加熱することによってインクの液滴を吐出するサーマル方式であっても良い。本実施形態においては、錠剤9に印刷処理を行うため、インクとしては食品衛生法で認められている原料によって製造された可食性インクを使用する。
 図1の例では、印刷ヘッド6は撮像ヘッド5よりも搬送経路の下流側に位置しているので、制御部8は錠剤9の検査結果に応じて印刷処理の要否を決定してもよい。より具体的には、外観検査において錠剤9が良品と判断された場合には、制御部8はその錠剤9に対して印刷処理を行うように印刷ヘッド6を制御し、錠剤9が不良品と判断された場合には、その錠剤9に対して印刷処理を行わないように印刷ヘッド6を制御してもよい。これによれば、不要な印刷処理を回避することができる。
 選別部7は外観検査の結果に応じて錠剤9を選別する。例えば選別部7は良品ボックスおよび不良品ボックスを有している。これらのボックスは上方に開口した箱状の形状を有している。良品ボックスは良品と判断された錠剤9を収容し、不良品ボックスは不良品と判断された錠剤9を収容する。例えばこれらのボックスは搬送ベルト41の下方側においてX軸方向に沿って並んで配置されている。制御部8は良品と判断した錠剤9が良品ボックスの開口部の直上に位置するときに、搬送ベルト41内の吸引機構を制御してその錠剤9に対する吸着を解除する。これにより、錠剤9は良品ボックスの内部へと落下して、これに収容される。不良品と判断された錠剤9についても同様にして、不良品ボックスの内部に収容される。
 制御部8は上述したように各種の構成要素を制御し、また、撮像ヘッド5から入力される撮像画像に対して画像処理を行うことで錠剤9の外観検査を行う。
 この制御部8は電子回路機器であって、例えばデータ処理装置および記憶媒体を有していてもよい。データ処理装置は例えばCPU(Central Processor Unit)などの演算処理装置であってもよい。記憶部は非一時的な記憶媒体(例えばROM(Read Only Memory)またはハードディスク)および一時的な記憶媒体(例えばRAM(Random Access Memory))を有していてもよい。非一時的な記憶媒体には、例えば制御部8が実行する処理を規定するプログラムが記憶されていてもよい。処理装置がこのプログラムを実行することにより、制御部8が、プログラムに規定された処理を実行することができる。もちろん、制御部8が実行する処理の一部または全部がハードウェアによって実行されてもよい。
 <撮像ヘッド>
 撮像ヘッド5は錠剤9の少なくとも2つの面が写る方向から、搬送途中の錠剤9を撮像する。なお錠剤9は、その主面9bが搬送ベルト41側を向く姿勢で搬送ベルト41に吸着保持されることもあれば、その主面9aが搬送ベルト41側を向く姿勢で搬送ベルト41に吸着保持されることもある。以下では、説明の便宜上、錠剤9はその主面9bが搬送ベルト41側を向く姿勢で搬送ベルト41に保持されるものとする。また錠剤9が搬送ベルト41に吸着保持された状態では、側面9cのうち少なくとも主面9a側の一部は搬送ベルト41から露出している。
 撮像ヘッド5は錠剤9の主面9aおよび側面9cの両方が写る方向から錠剤9を撮像する。これにより、錠剤9の主面9aおよび側面9cの両方が写る撮像画像を生成する。図3および図4は、撮像ヘッド5の内部構成の一例を概略的に示す図である。例えば撮像ヘッド5は検査カメラ51とレンズ群52とミラー53とと角錐型ミラー54とを備えている。検査カメラ51は例えばCCD(Charge Coupled Device)イメージセンサまたはCMOS(Complementary Metal Oxide Semiconductor)イメージセンサなどのイメージセンサである。この検査カメラ51は錠剤9の搬送経路の一部とZ軸方向で対向する位置において、その撮像面が搬送ベルト41側を向く姿勢で配置されている。
 ミラー53は、錠剤9の主面9aおよび側面9cからの光を後述する角錐型ミラー54に導くために設けられている。このミラー53の位置を説明するに当たって、便宜的に、錠剤9が検査カメラ51とZ軸方向で向かい合う位置に停止していると仮定する。図3を参照して、ミラー53はZ軸方向において検査カメラ51と錠剤9との間に位置しており、平面視において(つまりZ軸方向に沿って見て)錠剤9よりも外側に配置されている。また、ミラー53は角錐型ミラー54の各面に対向するように配置されている。
 角錐型ミラー54は、ミラー53で反射した錠剤9の主面9aおよび側面9cからの光を、レンズ群52を介して検査カメラ51の撮像面に導く。角錐型ミラー54は、4つのミラーによって構成されており、各ミラー53と対向するように角錐型ミラー54が配置されている。
 錠剤9の主面9aおよび側面9cで反射または散乱された光の一部はミラー53の一つに向かって斜め上方へと進み、当該ミラー53で反射し、ミラー53で反射した光は角錐型ミラー54で反射した上で、レンズ群52を介して検査カメラ51の撮像面に結像する。換言すれば、錠剤9の主面9aおよび側面9cから斜め上方に進む光を検査カメラ51の撮像面に向けて反射できるように、ミラー53および角錐型ミラー54の反射面の地面に対する角度が調整されている。
 これにより、検査カメラ51は当該ミラー53から見た錠剤9の外観を撮像することができる。つまり、検査カメラ51は実質的に錠剤9を斜め方向から撮像することができ、その撮像画像には、錠剤9の主面9aおよび側面9cの両方が含まれることになる。なお図3では、光の経路の一例が破線で示されている。
 図4の例では、複数(図では4つ)のミラー53が配置されている。例えば2つのミラー53がX軸方向において間隔を空けて配置されており、残り2つのミラー53がY軸方向において間隔を空けて配置されている。これによれば、錠剤9は平面視において四方をミラー53によって囲まれることになる。さらに、4つのミラー53の中央に角錐型ミラー54が配置されている。各ミラー53で反射された光は角錐型ミラー54でさらに反射され、レンズ群52を介して検査カメラ51の撮像面に結像される。具体的には、4つのミラー53で反射された光は検査カメラ51の撮像面のうち互いに異なる領域に結像される。これにより、撮像ヘッド5は4方向から錠剤9を撮像し、4方向から見た錠剤9の外観を含む撮像画像を生成する。
 図5は、撮像画像IM1の一例を概略的に示す図である。撮像画像IM1には、4方向から見た錠剤9の外観が含まれており、これらのいずれにおいても、錠剤9の主面9aおよび側面9cが写っている。ここでは4方向から錠剤9を撮像するので、錠剤9の側面9cを全周に亘って撮像することができる。以下では、撮像画像IM1に写る錠剤9の主面9aおよび側面9cを、実際の錠剤9の主面9aおよび側面9cと区別すべく、それぞれ主面9aaおよび側面9caと呼ぶ。
 撮像ヘッド5は図示省略の照明用光源を有していてもよい。この照明用光源は錠剤9へと光を照射する。これにより、撮像画像IM1における錠剤9の明るさを向上できる。
 また、図3および図4の例では、ミラー53および角錐型ミラー54によって光の経路を曲げているものの、必ずしもこれに限らない。光の経路を曲げる素子として、プリズムなどの他の光学素子を採用してもよい。
 <検査>
 制御部8は、撮像ヘッド5から入力される撮像画像IM1に対して画像処理を行い、撮像された錠剤9の外観検査を行う。よって、制御部8は画像処理部として機能することとなる。
 以下では、説明の簡単のために、一方向から見た錠剤9の外観について説明を行う。図6は、欠陥が生じている錠剤9を一方向から撮像した撮像画像IM11の一例を概略的に示す図である。図6の例では、錠剤9の主面9aaおよび側面9caにはそれぞれ欠陥d1,d2が存在している。
 制御部8は、撮像画像IM11において錠剤9の主面9aaが占める主面領域Raと、錠剤9の側面9caが占める側面領域Rcとを特定し、主面領域Raおよび側面領域Rcに対してそれぞれ検査処理を行う。以下、より具体的に説明する。
 図7は、錠剤検査装置1における動作の一例を示すフローチャートである。まずステップS1にて、撮像ヘッド5は錠剤9の主面9aおよび側面9cの両方が写る方向から搬送途中の錠剤9を撮像して、錠剤9の主面9aおよび側面9cの両方が写る撮像画像IM11を生成する。撮像ヘッド5はこの撮像画像IM11を制御部8へと出力する。
 次に制御部8は撮像画像IM11における主面領域Raおよび側面領域Rcを特定する。この特定は例えば図7のステップS2~S6の一連の処理によって実行される。
 まずステップS2にて、制御部8は撮像画像IM11に対してエッジ検出処理を行ってエッジ画像を生成する。ただしここでは、制御部8は、背景領域BRを削除した撮像画像IM11に対してエッジ検出処理を行う。背景領域BRとは、撮像画像IM11において錠剤9が占める錠剤領域TR以外の領域である。この錠剤領域TRは主面領域Raおよび側面領域Rcによって構成される。
 背景領域BRの削除のために、まず制御部8は撮像画像IM11の錠剤領域TRと背景領域BRとを区別する。例えば制御部8は撮像画像IM11に対する二値化処理を用いて、錠剤領域TRと背景領域BRとを区別する。背景領域BRには、搬送ベルト41が含まれているので、錠剤領域TRと背景領域BRとを精度よく区別するために、実際の搬送ベルト41の色と錠剤9の色とのコントラストを大きくするとよい。例えば錠剤9が白色系である場合には、搬送ベルト41を黒色とする。制御部8は背景領域BRを特定すると、撮像画像IM11において背景領域BRを削除する。例えば制御部8は背景領域BR内の全ての画素の画素値を零にすることで、背景領域BRを削除する。
 次に制御部8は、背景領域BRを削除した撮像画像IM11に対してエッジ検出処理を行って、エッジ画像を生成する。エッジ検出処理の具体的な処理方法は特に制限される必要は無いものの、その一例について簡単に説明する。例えば制御部8は除去後の撮像画像IM11に対してエッジ強度処理を行って、エッジ強度画像を生成する。エッジ強度処理は例えば各画素間の画素値の差の算出処理を含み、これにより、撮像画像IM11において画素間の画素値の差の大きい領域がエッジ強度画像において強調される。制御部8はこのエッジ強度画像において、画素値が所定のエッジ閾値よりも大きいか否かを画素ごとに判断する。エッジ閾値は例えば予め設定されて制御部8の記憶媒体に記憶されてもよい。制御部8はエッジ閾値よりも大きい画素値を有する画素を検出して、エッジ画像を生成する。
 このエッジ画像は背景領域BRが除去された撮像画像IM11に基づいて生成されるので、背景領域BR内のエッジ(例えば搬送ベルト41の凹凸)はエッジ画像において検出されない。つまり、錠剤領域TRの輪郭に対応するエッジ(以下、錠剤エッジと呼ぶ)はエッジ画像内のエッジ群のうち最外周に位置することになる。
 そこでステップS3にて、制御部8は錠剤エッジを次のように特定する。即ち、制御部8はエッジ画像におけるエッジ群のうち、最外周に位置するエッジを錠剤エッジP0(図8参照)として特定する。
 図8は、錠剤エッジP0の一例を模式的に示す図である。図8の例では、模式的に、錠剤エッジP0が複数のエッジに分割して示されている。この錠剤エッジP0は側面外側エッジP1と主面外側エッジP2と一対の側面稜線エッジP4によって構成されている。側面外側エッジP1は、錠剤9の主面9bの周縁のうち撮像画像IM11に写っている部分に対応するエッジである。主面9bは円形状を有しているので、側面外側エッジP1は理想的には半楕円形状を有している。ここでいう半楕円形状とは、楕円をその長軸で2つに分割して得られる形状をいう。
 主面外側エッジP2は撮像画像IM11における錠剤9の主面9aaの周縁のうち側面9caとは接していない部分に対応するエッジである。この主面外側エッジP2は錠剤9の主面9aaの周縁のうち錠剤領域TRの輪郭の一部に対応するエッジである、ともいえる。主面9aは円形状を有しているので、主面外側エッジP2は理想的には半楕円形状を有している。より具体的には、側面外側エッジP1および主面外側エッジP2は互いに反対側に膨らむ半楕円形状を有している。
 一対の側面稜線エッジP4は理想的には直線状に延在しており、主面外側エッジP2の両端をそれぞれ側面外側エッジP1の両端に連結している。一対の側面稜線エッジP4は撮像画像IM11における錠剤9の側面9caの輪郭の一部に対応するエッジである。一対の側面稜線エッジP4はほぼ平行に延在しており、その延在方向は撮像ヘッド5の内部構成の配置によって予め決まっている。ここでは、側面稜線エッジP4は撮像画像IM11内の横方向に対して略45度で交差する方向に延在しているものとする。
 なお一対の側面稜線エッジP4は実際には完全な平行ではない。一対の側面稜線エッジP4は側面外側エッジP1側に向かうにしたがって互いに近づくように僅かに傾斜している。以下では簡単のために、一対の側面稜線エッジP4は平行であると仮定する。より厳密に考えるのであれば、以下で述べる側面稜線エッジP4の延在方向を、一対の側面稜線エッジP4の延在方向の二等分線で表される方向と把握すればよい。
 図8の例では、撮像画像IM11における錠剤9の主面9aaと側面9caとの間の境界に対応する境界エッジP3を破線で示している。言い換えれば、境界エッジP3は主面領域Raと側面領域Rcとの間の境界に対応するエッジである。境界エッジP3は理想的には、主面外側エッジP2とは反対側に膨らむ半楕円形状を有している。主面外側エッジP2および境界エッジP3の一組は錠剤9の主面9aaの周縁に対応しており、理想的に楕円形状を呈する。以下では、主面外側エッジP2および境界エッジP3の一組を主面エッジP23とも呼ぶ。
 再び図7を参照して、ステップS4にて、制御部8はステップS3で特定した錠剤エッジP0から、側面外側エッジP1および主面外側エッジP2を抽出する。例えば制御部8は錠剤エッジP0のうち、所定方向D1(=側面稜線エッジP4の延在方向)に沿って延在するエッジを側面稜線エッジP4と特定する。そして制御部8は、錠剤エッジP0から側面稜線エッジP4を除いた2つのエッジのうち、所定側(図では右上側)にある一方を側面外側エッジP1と特定し、他方を主面外側エッジP2と特定する。
 次にステップS5にて、制御部8は境界エッジP3をエッジ画像から特定する。例えば、境界エッジP3の形状と側面外側エッジP1の形状との類似性を考慮して、以下で説明するように境界エッジP3を特定する。
 まず境界エッジP3と側面外側エッジP1との幾何学的な関係について述べる。境界エッジP3および側面外側エッジP1は同じ側に膨らむ半楕円形状を有している。またここでは錠剤9はさほど厚くないので、境界エッジP3および側面外側エッジP1はほぼ同一形状を有している、と考えることができる。つまり、境界エッジP3は側面外側エッジP1を所定方向D1に沿って主面外側エッジP2側へと、側面稜線エッジP4の長さの分だけ平行移動させた領域に存在している。側面稜線エッジP4の長さは錠剤9の厚みおよび撮像ヘッド5の内部構成の配置に応じて予め決まっているので、側面外側エッジP1が特定されれば、境界エッジP3が存在する領域を推定することができる。
 そこで制御部8は、側面外側エッジP1から所定方向D1に沿って主面外側エッジP2側へと所定距離だけ離れた探索領域R1(図9も参照)内の画素を探索して境界エッジP3を特定する。図9は、探索領域R1の一例を模式的に示す図である。この探索領域R1の一例を説明するにあたって、その探索領域R1の中心線L0と、探索領域R1の輪郭を形成する線L1~L4とを導入する。
 中心線L0は側面外側エッジP1を側面稜線エッジP4の長さの分だけ、所定方向D1に沿って主面外側エッジP2側へと移動させた線である。なお図9の例では、模式的に中心線L0と境界エッジP3とを一つの曲線で示しているものの、実際にはこれらは相違し得る。
 線L1,L2は、中心線L0を所定方向D1に沿って互いに反対側へと所定幅だけ移動させた線である。図9では、線L1は線L2よりも側面外側エッジP1に近い。線L3,L4は所定方向D1に沿って延在しており、それぞれ線L1,L2の両端を連結する。探索領域R1はこれらの線L1~L4の一組によって囲まれた領域である。
 以下では説明の便宜上、探索領域R1において所定方向D1に沿って並ぶ画素群を、「行」と呼ぶ。
 図10は、制御部8の探索処理の一例を示すフローチャートである。まずステップS51にて、制御部8は値N,Mをそれぞれ1に初期化する。値Nは探索領域R1内の行の番号を示しており、値Mはその行に属する画素の番号を示している。第1番目の画素は線L1上の画素であり、第M番目の画素は各行において第(M-1)番目の画素の隣の画素である。
 次にステップS52にて、制御部8はエッジ画像の探索領域R1内の第N行第M番目の画素がエッジを示すか否かを判断する。否定的な判断がなされたときには、ステップS53にて、制御部8は値Mに1を加算して値Mを更新し、更新後の値Mを用いて再びステップS52を実行する。つまり、エッジを示す画素(以下、エッジ画素とも呼ぶ)を検出できなければ、次の画素について同様の判断を行うのである。
 ステップS52において肯定的な判断がなされたときには、ステップS54にて、制御部8はその画素を境界エッジP3の構成要素として把握する。次にステップS55にて、制御部8は値Nに1を加算して値Nを更新し、値Mを1に初期化する。次にステップS56にて、制御部8は値Nが基準値Nrefよりも大きいか否かを判断する。基準値Nrefは探索領域R1に含まれる行の総数である。つまり、制御部8は全ての行を探索したか否かを判断する。全ての行を探索してないと判断したときには、制御部8はステップS52を再び実行する。全ての行を探索したと判断したときには、制御部8は探索処理を終了する。
 以上のように、制御部8は探索領域R1内の各行において、線L1から画素を順次に選択し、最初に検出したエッジ画素を境界エッジP3の構成要素として特定する。なお図9の例示では、画素の探索方向を探索領域R1内の実線矢印で模式的に示しており、矢印の終点は、境界エッジP3の構成要素を示している。
 制御部8は、ステップS4で特定した主面外側エッジP2およびステップS5で特定した境界エッジP3の一組を、主面エッジP23として特定する。
 以上のように、本実施の形態によれば、主面エッジP23を適切かつ容易に得ることができる。
 ところで、この主面エッジP23は撮像画像IM11における錠剤9の主面9aaの周縁に対応するものの、実際に検出された主面エッジP23は理想的な楕円形状を呈するとは限らない。例えば錠剤9の主面9aの周縁近傍に照射される光にむらが生じていたり、あるいは、当該周縁近傍の一部から正反射した光が検査カメラ51に結像されて、一部の画素値が他の画素値に比べて非常に大きな値を有している場合がある。あるいは、当該周縁近傍に欠陥が生じている場合もある。このような場合には、主面エッジP23は理想的な楕円形状と相違し得る。
 そこでステップS6にて、制御部8は楕円の関数に基づいて、主面エッジP23に近似する近似線(楕円)を主面領域Raの輪郭として算出する。より一般的に説明すれば、制御部8は撮像画像IM11における主面領域Raの輪郭の形状として予め決められた基準関数に基づいて、主面エッジP23の近似線を主面領域Raの輪郭として算出する。ここでいう基準関数とは、主面領域Raの輪郭の形状を表す関数であって、その位置および大きさが変数となる関数をいう。楕円の関数であれば、例えばその長軸の長さ、短軸の長さ、長軸の延在方向、および、中心などを変数として採用できる。制御部8は例えば最小二乗法により主面エッジP23に近似する楕円E1(より具体的にはその長軸の長さ、短軸の長さ、長軸の延在方向および中心)を算出する。
 以上のように、主面領域Raの輪郭を示す関数に基づいて主面エッジP23の近似線を主面領域Raの輪郭として算出しているので、より高い精度で主面領域Raの輪郭を特定することができる。また上述の具体例では、錠剤9が略円盤形状を有している。つまり、錠剤9の主面9aが略円形状を有している。よって、撮像画像IM11において主面9aaの周縁は理想的には楕円形状を有する。これに対応して、楕円の関数が主面領域Raの輪郭を示す関数として用いられている。したがって、適切に主面領域Raの輪郭を特定することができる。
 以下では、楕円E1をその長軸で分割して得られる2つの半楕円のうち、側面9ca側の半楕円を半楕円E11とも呼ぶ。この半楕円E11は境界エッジP3の近似線に相当することになる。
 次にステップS7にて、制御部8は側面外側エッジP1に近似する近似線(半楕円)を楕円E1に基づいて算出する。例えば制御部8は楕円E1を所定方向D1に沿って移動させながらレーベンバーグ・マルカート(LM)法を用いて、側面外側エッジP1に沿う楕円E2を算出する。この楕円E2は錠剤9の主面9bの周縁に相当する。よって、制御部8はこの楕円E2をその長軸で分割し、得られた2つの半楕円のうち、境界エッジP3よりも遠い方にある半楕円E21を側面外側エッジP1の近似線として求める。
 制御部8はこの楕円E2の算出に際して、楕円E1を所定の割合で縮小させてもよい。撮像画像IM11のような斜視図において、錠剤9の主面9bの周縁は錠剤9の主面9aの周縁よりも所定割合で小さくなるからである。この所定割合は錠剤9の厚みに応じて予め設定される。
 なお制御部8は必ずしも楕円E1に基づいて楕円E2を算出し、楕円E2から半楕円E21を算出する必要はない。例えば制御部8は楕円E1から半楕円E11を求め、この半楕円E11を所定方向D1に沿って移動させながらLM法を用いて半楕円E21を算出してもよい。また半楕円E21の算出に当たって半楕円E11を所定割合で縮小しても構わない。
 制御部8は、半楕円E11,E21の両端をそれぞれ連結する一対の直線を算出し、半楕円E11,E21および当該一対の直線を、錠剤9の側面9caが占める側面領域Rcの輪郭として把握する。
 このように境界エッジP3および側面外側エッジP1に近似する近似線(半楕円E11,E21)を側面領域Rcの輪郭の一部として採用しているので、より高い精度で側面領域Rcを特定することができる。
 次にステップS8にて、制御部8は撮像画像IM11における主面領域Raおよび側面領域Rcに対して検査処理(画像処理)を行う。以下、検査処理の具体例について述べる。
 <第1検査処理(エッジ強度処理)>
 さて、撮像画像IM11において欠陥d1(図6参照)が占める領域と、その欠陥d1の周囲の領域との境界部では、画素間の画素値の差が大きくなる。同様に、撮像画像IM11において欠陥d2が占める領域と、その欠陥d2の周囲の領域との境界部では、画素間の画素値の差が大きくなる。
 そこで制御部8は次のように欠陥を検出してもよい。即ち、制御部8は撮像画像IM11の主面領域Raおよび側面領域Rcに対してエッジ強度処理を行ってエッジ強度画像を生成する。なお上述のように、エッジ画像の生成の途中でエッジ強度画像が既に生成されている場合には、そのエッジ強度画像を用いればよい。
 制御部8はエッジ強度画像の主面領域Raにおける画素値が閾値(以下、欠陥閾値と呼ぶ)Th1よりも大きいか否かを画素ごとに判断し、肯定的な判断がなされたときに、その画素は欠陥の輪郭を示していると判断する。当該画素は主面領域Ra内にあるので、制御部8は錠剤9の主面9aに欠陥が生じていると判断してもよい。側面領域Rcについても同様である。これにより、欠陥d1,d2を検出することができる。
 この欠陥閾値Th1は撮像画像IM11の主面領域Raおよび側面領域Rcにおいて互いに独立して設定されることが望ましい。以下、その理由について述べる。
 例えば錠剤9の表面状態(例えば表面粗さ)は主面9aおよび側面9cにおいて相違する場合がある。例えば錠剤9の主面9aの表面粗さが側面9cの表面粗さよりも小さい場合、撮像画像IM11の主面領域Ra内の輝度成分の画素間のばらつきは、側面領域Rc内の輝度成分のばらつきよりも小さくなる。この画素間のばらつきはエッジ強度画像において各画素の画素値として定量化される。よって、錠剤9が良品であれば、エッジ強度画像の主面領域Ra内の画素の値の最大値Maはエッジ強度画像の側面領域Rc内の画素の値の最大値Mcよりも小さくなる。
 ここで、主面領域Raおよび側面領域Rcに対して共通の欠陥閾値Th1を設定することを考慮する。例えば欠陥閾値Th1を側面領域Rcに応じて最大値Mcよりも大きい値に設定すると、主面領域Raに対して不要に大きな値を設定することになる。これによれば、錠剤9の主面9aに対する欠陥検出に漏れが生じ得る。逆に、欠陥閾値Th1を主面領域Raに応じて小さい値に設定すると、錠剤9の側面9cの表面粗さを欠陥として誤検出し得る。
 そこで、主面領域Raおよび側面領域Rcに対して欠陥閾値Th1を互いに独立して設定する。上述の例では、表面粗さが小さい主面9aが写る主面領域Raに対する欠陥閾値Th1(以下、欠陥閾値Th11と呼ぶ)を、表面粗さが大きい側面9cが写る側面領域Rcに対する欠陥閾値Th1(以下、欠陥閾値Th12と呼ぶ)よりも小さく設定する。つまり、制御部8は主面領域Raおよび側面領域Rcに対して、互いに異なる欠陥閾値Th1を用いた検査処理をそれぞれ実行する。
 より具体的には、制御部8はエッジ強度画像の主面領域Raの各画素の値が欠陥閾値Th11よりも大きいか否かを判断する。言い換えれば、制御部8は主面領域Raに対してエッジ強度処理を行って得られた各画素の値が欠陥閾値Th11よりも大きいか否かを判断する。制御部8はある画素の値が欠陥閾値Th11よりも大きいと判断したときに、その画素が欠陥の輪郭を示していると判断し、錠剤の主面9aに欠陥が生じていると判断する。
 なお制御部8は主面領域Ra内の全ての画素に対して上記判断を行って全ての欠陥を検出してもよい。あるいは、単に錠剤9の欠陥の有無を判断するのであれば、一つの欠陥を検出したときに、残りの画素についての上記判断を省略してよい。この点は、以下で述べる検査処理でも同様である。
 また制御部8はエッジ強度画像の側面領域Rcの各画素の値が、欠陥閾値Th11よりも大きな欠陥閾値Th12よりも大きいか否かを判断する。言い換えれば、制御部8は側面領域Rcに対してエッジ強度処理を行って得られた各画素の値が欠陥閾値Th12よりも大きいか否かを判断する。制御部8はある画素の値が欠陥閾値Th12よりも大きいと判断したときに、その画素が欠陥の輪郭を示していると判断し、錠剤の側面9cに欠陥が生じていると判断する。
 これにより、主面領域Raおよび側面領域Rcにおける欠陥漏れおよび欠陥の誤検出を抑制して、高い精度で欠陥を検出できる。
 欠陥閾値Th1は例えば予め設定されて制御部8の記憶媒体に記憶されていてもよい。あるいは、制御部8は良品と判断した錠剤9についての主面領域Raおよび側面領域Rcの画素値に応じて、欠陥閾値Th1を自動で設定してもよい。具体的には、例えば制御部8は良品と判断された錠剤9の側面領域Rcにおける最大値Mcよりも所定値だけ大きな値を、側面領域Rcに対する欠陥閾値Th11に採用してもよい。同様に、制御部8は良品と判断された錠剤9の主面領域Raにおける最大値Maよりも所定値だけ大きな値を、主面領域Raに対する欠陥閾値Th12に採用してもよい。
 なお錠剤9の主面9aの表面粗さが側面9cの表面粗さよりも大きい場合には、主面領域Raに対する欠陥閾値Th11を側面領域Rcに対する欠陥閾値Th12よりも大きく設定すればよい。
 <第2検査処理>
 制御部8は上述の第1検査処理に替えて、あるいは、第1検査処理と共に、以下で述べる第2検査処理を行ってもよい。
 さて、欠陥d1,d2が例えば黒色系の付着物である場合、この欠陥d1,d2に対応する領域の画素値は他の領域の画素値よりも小さくなる。そこで制御部8は次のようにして欠陥を検出してもよい。即ち、制御部8は撮像画像IM11の主面領域Raにおける画素値が欠陥閾値Th2よりも小さいか否かを画素ごとに判断し、肯定的な判断がなれたときに、その画素は欠陥を示していると判断する。当該画素は主面領域Ra内にあるので、制御部8は錠剤9の主面9aに欠陥が生じていると判断してもよい。側面領域Rcについても同様である。これにより、欠陥d1,d2を検出することができる。
 この欠陥閾値Th2も主面領域Raおよび側面領域Rcに対して互いに独立して設定されることが望ましい。以下、その理由について述べる。
 撮像画像IM11の主面領域Ra内の明るさ(輝度の平均)が側面領域Rc内の明るさと相違する場合がある。なぜなら、錠剤9の主面9aおよび側面9cに対する光の当り方が異なり得るからである。以下では、代表的に主面領域Raが側面領域Rcよりも明るい場合について説明する。
 まず、撮像画像IM11における主面領域Raおよび側面領域Rcに対して共通の欠陥閾値Th2を設定することを考慮する。この場合、側面領域Rcにおいて単に暗い部分を欠陥として誤検出することを抑制すべく欠陥閾値Th2を小さくすると、明るい主面領域Raにおいて検出漏れが生じ得る。逆に、主面領域Raにおける検出漏れを抑制すべく、欠陥閾値Th2を大きくすると、側面領域Rcにおいて単に暗い部分を欠陥として誤検出し得る。
 そこで、撮像画像IM11における主面領域Raおよび側面領域Rcに対して欠陥閾値Th2を互いに独立して設定する。上述の例では、明るい主面9aが写る主面領域Raに対する欠陥閾値Th2(以下、欠陥閾値Th21と呼ぶ)を、暗い側面9cが写る側面領域Rcに対する欠陥閾値Th2(以下、欠陥閾値Th22と呼ぶ)よりも大きく設定する。つまり、制御部8は撮像画像IM11における主面領域Raおよび側面領域Rcに対して、互いに異なる欠陥閾値Th2を用いた検査処理をそれぞれ実行する。
 より具体的には、制御部8は撮像画像IM11の主面領域Raの各画素の値が欠陥閾値Th21よりも小さいか否かを判断する。制御部8はある画素の値が欠陥閾値Th21よりも小さいと判断したときに、その画素が欠陥を示していると判断し、錠剤の主面9aに欠陥が生じていると判断する。
 また制御部8は撮像画像IM11の側面領域Rcの各画素の値が、欠陥閾値Th21よりも小さな欠陥閾値Th22よりも小さいか否かを判断する。制御部8はある画素の値が欠陥閾値Th22よりも小さいと判断したときに、その画素が欠陥を示していると判断し、錠剤の側面9cに欠陥が生じていると判断する。
 これにより、主面領域Raおよび側面領域Rcにおける欠陥漏れおよび欠陥の誤検出を抑制して、高い精度で欠陥を検出できる。
 欠陥閾値Th2は例えば予め設定されていてもよく、あるいは、良品と判断された錠剤9についての主面領域Raおよび側面領域Rcの明るさに応じて設定されてもよい。後者の場合、例えば制御部8は良品と判断された錠剤9の撮像画像IM11の側面領域Rcにおける画素値の最小値よりも所定値だけ小さい値を、側面領域Rcに対する欠陥閾値Th21に採用し、主面領域Raにおける画素値の最小値よりも所定値だけ小さい値を、主面領域Raに対する欠陥閾値Th22に採用してもよい。
 なお主面領域Raが側面領域Rcよりも暗い場合には、主面領域Raに対する欠陥閾値Th21を側面領域Rcに対する欠陥閾値Th22よりも小さく設定すればよい。
 また上述の例では、主面領域Raおよび側面領域Rcに対して異なる閾値で同種の検査処理を行っているものの、主面領域Raおよび側面領域Rcに対して異なる種類の検査処理を行ってもよい。
 また上述の例では、側面領域Rcの全体に対して検査処理を行うものの、側面領域Rcのうち一対の側面稜線エッジP4にそれぞれ近い両端領域は検査処理の対象から除いてもよい。両端領域における側面9cの表面状態は撮像画像IM11において視認しにくいからである。
 また上述の例では、探索領域R1の中心線L0は側面外側エッジP1を移動させて得られた線であると説明したが、この移動に際して側面外側エッジP1を所定倍率で拡大しても構わない。厳密には、境界エッジP3は側面外側エッジP1よりも所定倍率で大きいからである。
 また上述の例では、一方向から見た錠剤9の撮像画像について説明したものの、複数方向から見た錠剤9の撮像画像に対しても同様の処理を行ってもよい。
 第2の実施の形態.
 第1の実施の形態では、探索領域R1の各行における探索で最初に検出されたエッジ画素を境界エッジP3の構成要素として把握した。この場合、撮像画像IM11において錠剤9の主面9aaと側面9caとの間の境界に欠陥が生じていれば、楕円E1の算出精度が低下し得る。以下、具体的に説明する。
 図11は、錠剤9の主面9aaと側面9caとの間の境界に欠けが生じたときの、エッジ画像におけるエッジの一例を概略的に示す図である。図11に例示するように、錠剤9に生じた欠けの輪郭に沿ってエッジP’が検出されている。図11の例示では、エッジP’を太線で模式的に示している。第1の実施の形態で述べた探索処理によれば、エッジP’のうち線L1側のエッジ上の画素が境界エッジP3の構成要素として把握されることになる。図11の例においては、境界エッジP3の構成要素として把握される画素のいくつかを模式的に黒丸で示している。つまり、境界エッジP3の構成要素がエッジP’のうち線L1側のエッジPc’に偏ってしまう。したがって、境界エッジP3に近似する半楕円E11は錠剤9の主面9aaの周縁からずれやすい。つまり、主面領域Raの特定精度が低下し得る。
 第2の実施の形態では、主面領域Raの特定精度を更に向上することを企図する。具体的には、撮像画像IM11における欠陥領域の画素値の分布に着目して、境界エッジP3の構成要素がエッジP’のうちエッジPc’と、線L2側のエッジPa’に分散されるように、境界エッジP3を特定することを企図する。
 第2の実施の形態にかかる錠剤検査装置1の構成は第1の実施の形態と同様である。ただし、制御部8による境界エッジP3の特定方法が第1の実施の形態と相違する。
 さて、錠剤9の欠けの表面は主面9aおよび側面9cの表面粗さに比べて粗く、撮像画像IM11における欠陥領域内の輝度成分はばらついている。よって、欠陥領域の輪郭(エッジP’)においても輝度成分はばらついている。したがって、撮像画像IM11におけるエッジPa’上の画素値もある範囲でばらついており、エッジPc’上の画素値も同様の範囲内でばらついている。
 そこで、制御部8は、エッジ画像の探索領域R1内の画素であって、対応する撮像画像IM11における画素値が所定の閾値(以下、明るさ閾値と呼ぶ)よりも大きい画素を探索する。この明るさ閾値は錠剤9の主面9aaの明るさに応じて予め設定される。例えば明るさ閾値は上記範囲内の値に予め設定される。このような明るさ閾値は例えばシミュレーションまたは実験等によって設定することができる。明るさ閾値は例えば制御部8の記憶媒体に記憶されていてもよい。以下、具体的な動作の一例について説明する。
 図12は、制御部8による探索処理の一例を示すフローチャートである。図10と比較して、制御部8はステップS57を更に実行する。このステップS57はステップS52において肯定的な判断がなされたときに実行される。ステップS57では、制御部8は撮像画像IM11の探索領域R1における第N行第M番目の画素の画素値が明るさ閾値よりも大きいか否かを判断する。
 ステップS57にて否定的な判断がなされたときには、制御部8はステップS53を実行し、肯定的な判断がなされたときには、制御部8はステップS54を実行する。
 これによれば、たとえ探索領域R1内のエッジ画素であっても、そのエッジ画素に対応する撮像画像IM11の画素の画素値が明るさ閾値よりも小さい場合には、そのエッジ画素は境界エッジP3の構成要素とは把握されず、撮像画像IM11の当該画素の画素値が明るさ閾値よりも大きい場合に、そのエッジ画像が境界エッジP3の構成要素と把握される。
 この結果、境界エッジP3の構成要素として把握される画素がエッジP’上で分散される。図13は、錠剤9の主面9aaと側面9caとの間の境界に欠けが生じたときの、エッジ画像におけるエッジの一例を概略的に示す図である。図13の例でも、境界エッジP3として把握される画素のいくつかが模式的に黒丸で示されている。図13に例示するように、当該画素はエッジP’のエッジPa’,Pc’に分散される。言い換えれば、境界エッジP3として把握される画素がエッジP’において一方側のみに偏らないように明るさ閾値が設定される。より具体的な一例として、錠剤9の主面9aaの明るさ(例えば画素値(あるいは輝度値)の平均値、中央値、最大値または最小値など、以下、同様)が錠剤9の側面9caの明るさよりも高い場合には、当該明るさ閾値として主面9aaの明るさを採用し、錠剤9の主面9aaの明るさが錠剤9の側面9caの明るさよりも低い場合には、当該明るさ閾値として側面9caの明るさを採用する。
 このような境界エッジP3に近似する半楕円E11は錠剤9の主面9aaの周縁により近い半楕円となる。ひいては、より高い精度で主面領域Raを特定することができる。
 第3の実施の形態.
 第3の実施の形態にかかる錠剤検査装置1の構成は第1の実施の形態と同様である。ただし、制御部8は撮像画像IM11における主面領域Raを複数の領域に分割する。
 図14は、錠剤9の他の一例である錠剤9Aの一例を概略的に示す図である。錠剤9Aの主面9aには割線91が形成されている。割線91は主面9aの中心を通って主面9aの端から端まで直線状に延びる溝である。
 このような錠剤9Aを撮像した撮像画像IM11’(図15参照)においては、割線91に相当する領域では他の領域に比べて画素値の差が大きい。よって、割線91を欠陥として誤検出し得る。
 そこで第3の実施の形態では、主面領域Raを割線領域と非割線領域とに分割し、各領域に対して欠陥閾値Th1(あるいは欠陥閾値Th2)を独立して設定することを企図する。
 なお図14の例では、錠剤9の主面9aは周縁部9a1および中央部9a2を有している。主面9aの中央部9a2は割線91を除いて平坦であり、周縁部9a1は中央部9a2が周縁部9a1に対して盛り上がるように傾斜している。
 このような錠剤9Aを撮像した撮像画像IM11’では、周縁部9a1と中央部9a2との間の境界近傍の領域では他の領域に比べて画素間の画素値の差が大きく、当該境界を欠陥として誤検出し得る。
 そこでここでは、制御部8は主面領域Raを割線領域、周縁領域および中央領域に分割し、各領域に対して欠陥閾値Th1(あるいは欠陥閾値Th2)を独立して設定することを企図する。
 図15は、主面領域Raの分割例を概略的に示す図である。図15に例示するように、制御部8は主面領域Raを割線領域Ra1と一対の周縁領域Ra2と一対の中央領域Ra3とに分割する。図15の例では、割線領域Ra1、周縁領域Ra2および中央領域Ra3の相互の境界を破線で示している。割線領域Ra1は割線91を含む領域であり、周縁領域Ra2は割線領域Ra1以外の領域であって、錠剤9の周縁部9a1と中央部9a2との境界を含む領域である。中央領域Ra3は割線領域Ra1でも周縁領域Ra2でもない領域である。周縁領域Ra2および中央領域Ra3は割線領域Ra1を含まない領域であるので、周縁領域Ra2および中央領域Ra3の一組は非割線領域を構成している。
 図16は、第3の実施の形態にかかる錠剤検査装置1の動作の一例を示すフローチャートである。ステップS11~S17はそれぞれステップS1~S7と同様であるので、詳細な説明を省略する。
 ステップS17の次のステップS18にて、制御部8は、主面領域Raを割線領域Ra1、周縁領域Ra2および中央領域Ra3に分割する。以下、具体的に説明する。
 まず制御部8は楕円E1の中心を縮小中心として楕円E1を所定の第1割合で縮小して楕円E3を算出する。第1割合は予め設定されて制御部8の記憶媒体に記憶されていてよい。第1割合は例えば1/2以下であって、より具体的な一例として3分の1である。そして、制御部8はエッジ画像における楕円E3内のエッジの一群に対して画像モーメントを求め、当該エッジの一群の延びる方向を求める。当該エッジの一群は主として割線91に対応するエッジで構成されるので、楕円E3内のエッジの一群の延びる方向は割線91の延びる方向であると把握できる。簡単には、当該エッジの一群を楕円に見立てて、その楕円の長軸の傾きを割線91の延びる方向と把握すればよい。以下の式は、楕円の長軸のx軸に対する角度θを示している。ここでいうx軸は撮像画像IM11’の横方向であり、y軸は撮像画像IM11’の縦方向である。
Figure JPOXMLDOC01-appb-M000001
 (x,y)はエッジ画像の楕円E3内における各エッジ画素の座標を示し、θは楕円の長軸とx軸との間の角度を示す。式(1)~式(3)はそれぞれx軸方向の分散、y軸方向の分散、xy軸の共分散を示す。
 制御部8は、算出した割線91の延在方向に平行な直線であって楕円E1の中心を通る直線から、それぞれ両側に所定幅だけ広げた領域を割線領域Ra1として特定する。所定幅は予め設定されて、制御部8の記憶媒体に記憶されていてもよい。割線領域Ra1は主面領域Raの端から端まで延びる領域である。
 次に制御部8は楕円E1の中心を縮小中心として楕円E1を所定の第2割合で縮小して楕円E4を算出する。第2割合は第1割合よりも大きく、楕円E4が主面9aaの周縁部9a1と中央部9a2との境界よりも内側となるように設定される。この第2割合も制御部8の記憶媒体に記憶されていてもよい。制御部8は楕円E4内の領域のうち割線領域Ra1以外の領域を一対の中央領域Ra3として特定する。
 次に制御部8は、割線領域Ra1および一対の中央領域Ra3の全体を主面領域Raから除いた領域を一対の周縁領域Ra2として特定する。
 次にステップS19にて、制御部8は主面領域Raおよび側面領域Rcに対してそれぞれ画像処理を行って検査処理を行う。側面領域Rcについては第1の実施の形態と同様である。
 主面領域Raについては、割線領域Ra1、周縁領域Ra2および中央領域Ra3に対してそれぞれ異なる欠陥閾値Th1を採用する。なおここでは、錠剤9の主面9aにおいて周縁部9a1と中央部9a2との間の境界がなす角部は、割線91の角部よりも緩やかである。この場合、例えば割線領域Ra1に対する欠陥閾値Th1を非割線領域(周縁領域Ra2および中央領域Ra3)に対する欠陥閾値Th1よりも高く設定する。また非割線領域においては、周縁領域Ra2に対する欠陥閾値Th1を中央領域Ra3に対する欠陥閾値Th1よりも高く設定する。
 以上のように、割線領域Ra1に対する欠陥閾値Th1を最も高く設定し、周縁領域Ra2に対する欠陥閾値Th1を次に高く設定し、中央領域Ra3に対する欠陥閾値Th1を最も低く設定する。
 制御部8はエッジ強度画像の割線領域Ra1における各画素の画素値が割線領域Ra1の欠陥閾値Th1よりも大きいときに、割線領域Ra1において欠陥が生じていると判断する。非割線領域(周縁領域Ra2および中央領域Ra3の一組)についても同様である。具体的には、制御部8はエッジ強度画像の周縁領域Ra2における各画素の画素値が周縁領域Ra2の欠陥閾値Th1よりも大きいときに、周縁領域Ra2において欠陥が生じていると判断する。また制御部8はエッジ強度画像の中央領域Ra3における各画素の画素値が中央領域Ra3の欠陥閾値Th1よりも大きいときに、中央領域Ra3において欠陥が生じていると判断する。
 これにより、第1の実施の形態と同様に、各領域における欠陥漏れおよび欠陥の誤検出を抑制して、高い精度で欠陥を検出できる。
 <探索>
 図14の例では、錠剤9Aの主面9aには、割線91が形成され、また周縁部9a1と中央部9a2とが鈍角の角を形成している。よって錠剤9Aが良品であっても、エッジ画像の主面領域Ra内にはエッジが含まれる。その一方で錠剤9Aが良品であれば、錠剤9Aの側面9cには角部が形成されていないので、エッジ画像の側面領域Rc内にはエッジが形成されない。したがって、境界エッジP3の特定において、第1の実施の形態で述べたように、制御部8は探索領域R1を側面外側エッジP1から主面外側エッジP2へと向かう方向で画素を探索するとよい。これによれば、周縁部9a1と中央部9a2との境界に対応するエッジ、および、割線91に対応するエッジを、境界エッジP3として誤検出することを回避できる。
 第4の実施の形態.
 ごみ等の異物が撮像装置(例えば撮像ヘッド5)の内部に進入し、例えばレンズ等に付着することがある。この場合、実際には錠剤9に欠陥が生じていなくても、撮像画像IM1において当該異物が錠剤と重なって写る場合がある。この場合、当該異物が欠陥として誤検出される。
 またカメラの撮像面を構成する複数の受光素子のうちいくつかが故障することもある。故障した受光素子に対応する画素の画素値は正常値を示さずに例えば零となる。この画素が撮像画像において錠剤の内部に位置している場合には、実際には錠剤9に欠陥が生じていなくても、当該画素が欠陥として誤検出される。
 そこで、第4の実施の形態では、欠陥の誤検出を抑制できる錠剤検査方法および錠剤検査装置を提供することを企図する。
 第4の実施の形態にかかる錠剤検査装置1の構成の一例は第1の実施の形態と同様である。なお、第1の実施の形態では、撮像ヘッド5は必ずしも複数の撮像方向から錠剤9を撮像する必要はないものの、第4の実施の形態では、撮像ヘッド5は複数の撮像方向から錠剤9を撮像することが必須である。また第4の実施の形態にかかる制御部8の機能および動作は、後に詳述するように、第1の実施の形態と相違する。
 図17は、撮像画像IM1の一例を概略的に示す図である。撮像画像IM1には、4つの撮像方向から見た錠剤9の外観をそれぞれ写す4つの画像IM11~IM14が含まれており、これらのいずれにおいても、錠剤9の主面9aおよび側面9cが写っている。ここでは4方向から錠剤9を撮像するので、錠剤9の側面9cを全周に亘って撮像することができる。
 図17の例示では、錠剤9の主面9aの全領域が4つの画像IM11~IM14(検査画像に相当)のいずれにも写っている。よって、主面9aは画像IM11~IM14に共通して写る共通面である。一方で、錠剤9の側面9cでは、撮像方向に応じた領域がそれぞれ画像IM11~IM14に写る。また図17の例では、撮像画像IM1には欠陥候補dA1,dA2が写っている。ここでいう欠陥候補とは、錠剤9の欠陥である可能性のある候補である。
 図17の例では、この欠陥候補dA1は画像IM11~IM14のいずれにも共通に写っているので、錠剤9に生じた欠陥であるといえる。一方で、欠陥候補dA2は一つの画像IM12のみに写っており、他の画像IM11,IM13,IM14には写っていない。この欠陥候補dA2は錠剤9に生じた欠陥ではなく、撮像ヘッド5に起因して生じたものといえる。例えば、欠陥候補dA2はレンズ群52、ミラー53または角錐型ミラー54の異常(例えば付着物)、あるいは、検査カメラ51の撮像面の異常を示す、と考えられる。よって、欠陥候補dA2を錠剤9の欠陥として検出することは好ましくない。
 <検査>
 図18は、錠剤検査装置1における動作の一例を示すフローチャートである。まずステップSA1にて、撮像ヘッド5は複数の撮像方向から搬送途中の錠剤9を撮像して、撮像画像IM1を生成する。撮像ヘッド5はこの撮像画像IM1を制御部8へと出力する。
 次にステップSA2にて、制御部8は検査処理(画像処理)を撮像画像IM1に対して行う。つまり制御部8は画像IM11~IM14に対して検査処理を行う。
 この検査処理の具体的な例は後に述べるものの、ここではまず、その概要について簡単に説明する。例えば制御部8は検査処理として特定処理および候補検出処理を行う。特定処理は、各画像IM11~IM14において錠剤9が占める錠剤領域を特定する処理である。これにより、錠剤領域の位置および形状が画像IM11~IM14の各々において特定される。
 候補検出処理は、各画像IM11~IM14において欠陥候補を検出する処理である。候補検出処理は、例えば各画像IM11~IM14の各画素の画素値に基づいてその画素が欠陥候補を示す画素であるか否かを判別する処理を含み、その判別結果として欠陥候補が検出される。
 上記特定処理によって、各画像IM11~IM14における錠剤9の錠剤領域が特定され、上記候補検出処理によって、各画像IM11~IM14における欠陥候補の位置が特定されるので、錠剤領域に対する欠陥候補の位置が各画像IM11~IM14において特定される。つまり、その錠剤9上における欠陥候補の位置が画像IM11~IM14ごとに特定される。したがって、この検査処理は錠剤領域に対する欠陥候補の位置を検出する処理であるともいえる。
 次にステップSA3にて、制御部8は画像IM11~IM14の検査処理の結果に基づいて欠陥真偽処理を行う。欠陥真偽処理は検査処理によって検出された欠陥候補が錠剤9の欠陥を示しているのか否かを判断する、つまり欠陥候補の真偽を判断する処理である。具体的には、制御部8は検査処理によって、画像IM11~IM14のいずれにも写る錠剤9の領域(例えば主面9a)において、画像IM11~IM14の画像で共通の欠陥候補(例えば欠陥候補dA1)が検出されているときに、錠剤9には欠陥が生じていると判断する。一方で、制御部8は検査処理によって、画像IM11~IM14の当該領域のうち一つのみで欠陥候補(例えば欠陥候補dA2)が検出されているきには、その欠陥候補は錠剤9に生じた欠陥ではないと判断する。
 この欠陥真偽処理の具体的な例も後に述べるものの、ここではまず、その概要について簡単に説明する。例えば制御部8は、画像IM11~IM14における錠剤領域内の各画素の幾何学的な対応関係を求める。つまり、制御部8は錠剤9上の同じ点を写す画素の対応関係を求める。次に制御部8は画像IM11~IM14において欠陥候補が共通しているか否かを、当該対応関係に基づいて判断する。具体的には、当該対応関係に基づいて欠陥候補の位置を対比する。制御部8は当該位置が画像IM11~IM14において互いに対応しているときには、錠剤9に欠陥が生じていると判断し、互いに対応していないときには、その欠陥候補は錠剤9に生じた欠陥ではないと判断する。
 なお4つの画像IM11~IM14の全てで共通の欠陥候補が検出されなくても、2以上の画像に共通の欠陥候補が検出されたときには、その欠陥候補が錠剤9の欠陥である可能性を排除しきれない。そこで制御部8は、画像IM11~IM14のうち少なくとも二つに共通の欠陥候補が検出されたときには、錠剤9に欠陥が生じたと判断してもよい。これによれば、欠陥の可能性がある錠剤9を良品と判断することを回避できる。
 以上のように、錠剤検査装置1によれば、画像IM11~IM14の少なくとも二つにおいて共通の欠陥候補が検出されない限り、その欠陥候補を欠陥とはみなさない。したがって、欠陥検出時の虚報を抑制できる。
 <検査処理の具体例>
 図19は、検査処理の具体的な一例を示すフローチャートである。ここでは、代表的に一つの画像IM12に対する検査処理の一例を説明する。他の画像IM11,IM13,IM14の検査処理も同様である。
 この画像IM12に対する検査処理を説明するにあたって、まず画像IM12内の各領域を定義する。図20は、画像IM12の一例を概略的に示す図である。ここで、錠剤領域TR、背景領域BR、主面領域Raおよび側面領域Rcを導入する。錠剤領域TRは画像IM12において錠剤9が占める領域である。背景領域BRは画像IM12のうち錠剤領域TR以外の領域である。主面領域Raは画像IM12において錠剤9の主面9aが占める領域であり、側面領域Rcは画像IM12において錠剤9の側面9cが占める領域である。主面領域Raおよび側面領域Rcは錠剤領域TRを構成する。画像IM11,IM13,IM14についても同様に各領域が定義される。以下では、画像IM12に写る錠剤9の主面9aおよび側面9cを実際の錠剤9の主面9aおよび側面9cと区別すべく、それぞれ主面9aaおよび側面9caと呼ぶ。
 制御部8は上記特定処理としてステップSA21~SA26を実行する。ここでは、制御部8は、錠剤領域TRを構成する主面領域Raおよび側面領域Rcを特定する。まず、ステップSA21にて、制御部8は、図7のステップS2と同様に、画像IM12に対してエッジ検出処理を行って、エッジ画像を生成する。
 次にステップSA22にて、制御部8は、図7のステップS3と同様に、錠剤領域TRの輪郭に対応する錠剤エッジP0を特定する(図21参照)。図21は、錠剤エッジP0の一例を模式的に示す図である。図21の例でも、図8と同様に、錠剤エッジP0が複数のエッジに分割して示されている。なお図21の例では、図8とは異なって、割線91に対応する割線エッジP5が破線で示されている。
 再び図19を参照して、ステップSA23にて、制御部8は、図7のステップS4と同様に、ステップSA22で特定した錠剤エッジP0から、側面外側エッジP1および主面外側エッジP2を抽出する。
 次にステップSA24にて、制御部8は、図7のステップS5と同様に、境界エッジP3をエッジ画像において特定する。例えば第1の実施の形態と同様にして、制御部8は、側面外側エッジP1から所定方向D1に沿って主面外側エッジP2側へと所定距離だけ離れた探索領域R1(図22も参照)内の画素を探索して境界エッジP3を特定する。図22は、探索領域R1の一例を模式的に示す図である。なお図22では、割線エッジP5の一部も示されている。制御部8による探索処理の一例は図10のフローチャートと同様であるので、ここでは繰り返しの説明を避ける。
 この探索処理によれば、割線エッジP5上の画素は境界エッジP3の構成要素として特定されない。なぜなら、割線エッジP5は境界エッジP3に対して主面外側エッジP2側に位置しているところ、制御部8は探索領域R1を線L1側から線L2側へ(つまり側面外側エッジP1から主面外側エッジP2側へ)探索するからである。つまり、この探索処理によれば、制御部8は割線エッジP5の画素を探索するよりも前に境界エッジP3の構成要素を特定することができる。つまり、割線エッジP5を境界エッジP3として誤検出することを回避できる。
 制御部8は、ステップSA23で特定した主面外側エッジP2およびステップSA24で特定した境界エッジP3の一組を、主面エッジP23として特定する。
 次にステップSA25にて、制御部8は、図7のステップS6と同様に、楕円の関数に基づいて、主面エッジP23に近似する近似線(楕円)を主面領域Raの輪郭として算出する。制御部8は例えば最小二乗法により主面エッジP23に近似する楕円E1(より具体的にはその長軸の長さ、短軸の長さ、長軸の延在方向および中心)を算出する。この楕円E1は例えば撮像画像IM1(あるいは画像IM12)の座標系で示される式であってもよい。
 以上のように、主面領域Raの輪郭を示す関数に基づいて主面エッジP23の近似線を主面領域Raの輪郭として算出しているので、より高い精度で主面領域Raの輪郭を特定することができる。ひいては、主面領域Raに対する欠陥候補の位置を高い精度で特定できる。
 次にステップSA26にて、制御部8は側面領域Rcの輪郭を特定する。この処理は、図7のステップS7と同様の処理である。
 次にステップSA27にて、制御部8は画像IM12に対して候補検出処理を行う。候補検出処理は、第1の実施の形態で述べた第1検査処理および第2検査処理を利用することができる。以下、候補検出処理の具体例について述べる。
 <第1候補検出処理(エッジ強度処理)>
 画像IM12において欠陥候補dA1,dA2(図20参照)が占める領域と、その欠陥候補dA1,dA2の周囲の領域との境界部では、画素間の画素値の差が大きくなる。そこで制御部8は次のように欠陥候補を検出してもよい。即ち、制御部8は、背景領域BRを削除した画像IM12に対してエッジ強度処理を行ってエッジ強度画像を生成する。なおエッジ画像の生成の途中でエッジ強度画像が既に生成されている場合には、そのエッジ強度画像を用いればよい。
 制御部8はエッジ強度画像の画素値が閾値Th1よりも大きいか否かを画素ごとに判断し、肯定的な判断がなされたときに、その画素は欠陥候補の輪郭を示していると判断する。これにより、欠陥候補dA1,dA2を検出することができる。閾値Th1は例えば予め設定されて制御部8の記憶媒体に記憶されてもよい。
 <第2候補検出処理>
 制御部8は上述の第1候補検出処理に替えて、あるいは、第1候補検出処理と共に、以下で述べる第2候補検出処理を行ってもよい。
 さて、欠陥候補dA1,dA2が例えば黒色系の付着物である場合、この欠陥候補dA1,dA2に対応する領域の画素値は他の領域の画素値よりも小さくなる。そこで制御部8は次のようにして欠陥を検出してもよい。即ち、制御部8は、画像IM12の錠剤領域TR内の画素値が閾値Th2よりも小さいか否かを画素ごとに判断し、肯定的な判断がなれたときに、その画素は欠陥候補を示していると判断する。閾値Th2は例えば予め設定されて制御部8の記憶媒体に記憶されてもよい。
 以下では、欠陥候補(あるいはその輪郭)を示す画素を候補画素とも呼ぶ。
 <欠陥真偽処理の具体例>
 図23は、欠陥真偽処理の一例を示すフローチャートである。ここでは、主面領域Ra内の欠陥候補が錠剤9の欠陥を示しているか否かを判断する例について説明する。ステップSA31にて、制御部8は少なくとも一つの欠陥候補が画像IM11~IM14のうち2以上の画像で共通しているか否かを判断する。具体的には、制御部8は主面領域Raに対する各画素の位置の、画像IM11~IM14の相互間における対応関係に基づいて、欠陥候補が共通しているか否かを判断する。そこでまず制御部8はこの対応関係を求める。つまり制御部8は、画像IM11~IM14において錠剤9の主面9a上の同じ点を示す画素の対応関係を求める。
 このような対応関係は、例えば次のように求めることができる。例えば、制御部8は画像IM11~IM14に基づいてそれぞれ鳥瞰画像IM41~IM44をそれぞれ生成する。ここでいう鳥瞰画像とは、錠剤9をZ軸方向に沿って見た画像である。例えば制御部8は画像IM11における楕円E1の長軸Aと短軸Bの比に基づいて画像IM11についての撮像方向を算出する。この撮像方向は、当該撮像方向と水平面とがなす角度θ(sinθ=B/A)によって表すことができる。なお、角度θは必ずしも算出される必要は無く、撮像ヘッド5の内部構成の配置に応じて予め設定されていてもよい。
 制御部8は角度θに基づいて画像IM11に対して画像変換を行って、鳥瞰画像IM41を生成する。この鳥瞰画像IM41における主面9aの輪郭の形状は楕円E1の長軸を直径とする円となる。制御部8は同様にして画像IM12~IM14に基づいて鳥瞰画像IM42~IM44を生成する。これにより、鳥瞰画像IM41~IM44には、Z軸方向から見た錠剤9の外観が写る。図24は、鳥瞰画像IM41~IM44の一例を概略的に示す図である。以下では、鳥瞰画像IM41~IM44における錠剤9の主面9aを実際の錠剤9の主面9aと区別すべく、主面9abと呼ぶ。
 鳥瞰画像IM41~IM44において錠剤9の主面9abの周縁を示す円F1の大きさが互いに大きく相違している場合には、制御部8はこれらの円F1の大きさの差が所定値よりも小さくなるように、鳥瞰画像IM41~IM44を拡大または縮小してもよい。このような鳥瞰画像IM41~IM44において円F1内で同じ位置にある画素が錠剤9の主面9a上の同じ点を示すことになる。つまり、図24は実質的に画像IM11~IM14の主面領域Raの相互間における各画素の対応関係を示している。
 制御部8は主面領域Raに対する欠陥候補が鳥瞰画像IM41~IM44のうち2以上の鳥瞰画像で一致するか否かを判断する。なお、本願でいう「一致」とは必ずしも完全な一致を意味する必要はなく、差が所定程度よりも小さい状態を含む。2以上の鳥瞰画像において欠陥候補が互いに一致していれば、制御部8は2以上の画像において欠陥候補(例えば欠陥候補dA1)が共通していると判断し、ステップSA32にて錠剤9(より具体的には主面9a)に欠陥が生じていると判断する。
 欠陥候補の一致判断は次のようにして行われてもよい。例えば制御部8は、欠陥候補を構成する複数の候補画素の各々の位置(周縁領域Raに対する位置)が、2以上の画像において互いに一致しているか否かを判断する。例えば画像IM11~IM14の各々において欠陥候補dA1が候補画素Q1[0]~Q1[10]によって構成されているとする。制御部8は、主面領域Raに対する候補画像Q1[n](n:0~10)の位置が画像IM11~IM14のうち2以上の画像で互いに一致しているか否かを判断する。制御部8はこれらが一致しているときに、欠陥候補が一致していると判断してもよい。これによれば、欠陥候補の位置および形状に基づいて欠陥候補の一致判断を行うことができる。もちろん、欠陥候補を構成する全ての候補画素が2以上の画像間で互いに一致している必要は無く、若干の候補画素で不一致があっても構わない。不一致を許容する候補画素の数が多いほど、形状に関する条件が緩まることになる。
 このような一致判断のために、制御部8は、各欠陥候補を構成する候補画素を各画像IM11~IM14において特定する必要がある。これは例えば次のように行うことができる。即ち、例えば、制御部8は各画像IM11~IM14において、候補画素の相互間の距離を算出し、相互間の距離が小さい候補画素群を同じ欠陥候補として抽出する。これにより、例えば画像IM11~IM14の各々において欠陥候補dA1に属する候補画素Q1[0]~Q1[10]が特定され、画像IM12において欠陥候補dA2に属する候補画素Q2[0]~Q2[10]が特定される。
 ここでは、主面領域Raに対する候補画素Q1[n]の位置は複数の画像IM11~IM14で互いに一致する。よって、制御部8は欠陥候補dA1が錠剤9の欠陥であると判断し、錠剤9に欠陥が生じていると判断する。一方で、主面領域Raに対する候補画素Q2[n]の位置は複数の画像IM11~IM14間で一致しないので、制御部8は欠陥候補dA2が錠剤9の欠陥ではないと判断する。
 ステップSA31にて否定的な判断がなされると、ステップSA33にて制御部8は錠剤9(より具体的には主面9a)に欠陥が生じていないと判断する。
 なお、欠陥の個数を検出する必要がなく、単に錠剤9の欠陥の有無を検出すればよい場合には、必ずしも全ての欠陥候補について判断を行わなくてもよい。一つの欠陥候補が2以上の画素で共有していると判断した場合には、他の欠陥候補についての判断を省略してもよい。一方で、錠剤9に生じた欠陥の個数を検出する場合には、全ての欠陥候補について判断を行えばよい。
 上述の例では、主面領域Raの輪郭の形状として予め決められた関数に基づいて主面領域Raの輪郭を求めているので、上述のように主面領域Raの特定精度が高い。これによれば、主面領域Ra内の各画素の位置の画像間の対応関係の精度を向上でき、欠陥真偽の判断精度を向上できる。
 <側面領域>
 上述の例では、錠剤9の主面9aに対する外観検査について述べた。ここでは、錠剤9の側面9cに対する外観検査について述べる。この錠剤9の側面9cでは、その撮像方向に応じた領域がそれぞれ画像IM11~IM14に写る。例えば図17を参照して、錠剤9の側面9cのうち領域9c1が画像IM11~IM13に写っており、画像IM14には写っていない。この領域9c1は錠剤9の側面9cを周方向に例えば6等分して得られる領域と同程度の幅を有している。図17の例では、領域9c1は画像IM11において側面9cのほぼ中央に位置し、画像IM12,IM13においては側面9cの端に位置する。よって領域9c1は画像IM11においては広く写り、画像IM12,IM13において非常に狭く写る。したがって、錠剤9の領域9c1内の欠陥は画像IM11に比して画像IM12,IM13では視認されにくく欠陥候補として検出されにくい。
 そこで、画像IM12,IM13において側面9cの端の領域9c1は候補検出処理の対象から除いてもよい。言い換えれば、制御部8は画像IM12,IM13において側面領域Rcの端側の領域を、非検査対象たるマスク領域に設定してもよい。これによれば、端領域において欠陥候補を誤検出したり、あるいは、欠陥の検出漏れが生じたりすることを回避できる。
 図25は、検査処理の一例を示すフローチャートである。図25の例では、図19と比較して、ステップSA28が更に実行される。このステップSA28はステップSA26,SA27の間で実行される。ステップSA28では、制御部8はマスク領域を設定する。例えば制御部8は、ステップSA26で特定した側面領域Rcの両端に位置する端領域を、マスク領域に設定する。端領域の幅(半楕円E11に沿う幅)は予め決められていてもよく、あるいは、制御部8が側面領域Rcの幅の所定割合を端領域の幅として算出してもよい。
 制御部8はステップSA27の候補検出処理において、マスク領域内の画素を欠陥候補として検出しない。これによれば、錠剤9の領域9c1は画像IM11のみにおいて実質的な候補検出処理が行われることになる。なぜなら、領域9c1は画像IM14には写っておらず、画像IM12,IM13ではマスク領域内に写っているからである。
 制御部8は領域9c1については次のように欠陥真偽処理を行う。即ち、制御部8は、画像IM11に対する候補検出処理によって領域9c1内に欠陥候補が検出されているときに、他の画像IM12~IM14の候補検出処理の結果に関わらず、錠剤9(より具体的には側面9cの領域9c1)に欠陥が生じていると判断する。つまり画像IM11のみで候補検出処理が行われる領域9c1については、他の画像IM12~IM14で候補検出処理が行われないので、画像IM11において欠陥候補が検出されれば、その欠陥候補を錠剤9の欠陥とみなすのである。これにより、側面9cの領域9c1における欠陥を検出することができる。
 図17を参照して、錠剤9の側面9cの領域9c1と周方向で隣り合う領域9c2は画像IM11,IM12に写っており、画像IM13,IM14には写っていない。この領域9c2は例えば錠剤9の側面9cを周方向に12等分して得られる領域と同程度の幅を有している。この領域9c2は画像IM11,IM12において側面9cの中央よりも端側に位置しているものの、その側面9cの端から離れている。画像IM11,IM12において領域9c2はマスク領域に設定されておらず、検査対象領域に相当する。
 制御部8は領域9c2については次のように欠陥真偽処理を行う。即ち、制御部8は、画像IM11,IM12に対する候補検出処理によって領域9c1に共通の候補検出が検出されているときに、画像IM13,IM14に対する候補検出処理の結果に関わらず、錠剤9(より具体的には側面9cの領域9c2)に欠陥が生じていると判断する。つまり画像IM11,IM12のみに写る領域9c2については、他の画像IM13,IM14で候補検出処理が行われないので、画像IM11,IM12の領域9c2において共通の欠陥候補が検出されたときに、その欠陥候補を錠剤9の欠陥とみなすのである。これにより、高い精度で側面9cの領域9c2における欠陥を検出できる。
 なお上記の例では領域9c1,9c2について述べたものの、他の領域についても同様である。要するに、制御部8は、一つの画像のみにおいて候補検出処理が行われる錠剤9の第1領域、および、複数の画像において候補検出処理が行わる錠剤9の第2領域に対しては、それぞれ次のように欠陥真偽処理を行えばよい。即ち制御部8は、第1領域については、当該一つの画像の第1領域に欠陥候補が検出されているときに錠剤9に欠陥が生じていると判断し、第2領域については、複数の画像のうち2以上の画像の第2領域で共通の欠陥候補が検出されているときに錠剤9に欠陥が生じていると判断する。
 図26は、側面領域に対する欠陥真偽処理の一例を示すフローチャートである。図23と比較して、ステップSA34が更に実行され、またステップSA32を実行するための条件が相違する。ステップSA34はステップSA31にて否定的な判断がなされたときに実行される。ステップSA34にて、制御部8は、側面領域Rc内の少なくとも一つの欠陥候補に対応する領域が他の画像の全てで欠陥検出の対象外(つまり候補検出処理の対象外)であるか否かを判断する。
 なお側面領域Rcに対する各画素の位置の画像IM11~IM14間の対応関係は主面領域Raと同様にして求めることができる。例えば錠剤9を真横から見た4つの画像をそれぞれ画像IM11~IM14に基づいて生成する。当該4つの画像では、4方向から見た錠剤9の側面9cがそれぞれ写る。側面領域Rc内の各画素の、当該4つの画像間の対応関係は予め設定されていればよい。
 例えば画像IM11の領域9c1において欠陥候補を検出した場合について説明する。この領域9c1は他の画像IM12~IM14の全てで欠陥検出の対象外である。例えば領域9c1は画像IM12,IM13においてマスク領域であり、画像IM14にはそもそも存在しない。よってこの場合、ステップSA34では肯定的な判断が行われる。このときステップSA32にて、制御部8は錠剤9(より具体的には側面9c)に欠陥が生じていると判断する。つまり、たとえ欠陥候補が2以上の画像で共通していなくても、その欠陥候補がそもそも他の画像で欠陥検出の対象外である場合には、その欠陥候補は当然に他の画像では検出されない。よってこの場合には、1つの画像において検出された欠陥候補を錠剤9の欠陥とみなすのである。
 ステップSA34にて否定的な判断がなされたときには、ステップSA33にて、制御部8は錠剤9の側面9cに欠陥が生じていないと判断する。
 なお欠陥の個数を検出する必要がなく、単に錠剤9の欠陥の有無を検出すればよい場合には、各ステップSA31,SA32において必ずしも全ての欠陥候補について判断を行わなくてもよい。また主面領域に対する欠陥真偽処理(図23)および側面領域に対する欠陥真偽処理(図26)の一方で錠剤9に欠陥が生じていると判断すれば、他方を省略してもよい。
 錠剤9に生じた欠陥の個数を検出する場合には、全ての欠陥候補について判断を行えばよい。つまりステップSA31の判断結果に依らず、必ずステップSA34を行い、またステップSA31,SA32の各々において全ての欠陥候補についての判断を行えばよい。またこの場合、主面領域に対する欠陥真偽処理および側面領域に対する欠陥真偽処理の両方を行う。
 <探索領域の中心線>
 上述の例では、探索領域R1の中心線L0は側面外側エッジP1を移動させて得られた線であると説明したが、この移動に際して側面外側エッジP1を所定倍率で拡大しても構わない。厳密には、境界エッジP3は側面外側エッジP1よりも所定倍率で大きいからである。
 <マスク領域>
 上記の例では、制御部8は各画像IM11~IM14において側面領域Rcの端領域をマスク領域に設定した。しかるに、他の領域をマスク領域に設定してもよい。ここでは、好適な説明のために、錠剤9の形状として糖衣錠を採用して説明する。この錠剤9は球体を一軸方向に縮小させた扁平形状を有しており、最も広い面に対して垂直にみると錠剤9は円形状を有している。なお錠剤9の形状はこれに限らない。
 図27は、撮像画像IM1’の一例を概略的に示す図である。撮像画像IM1’は撮像ヘッド5によって糖衣錠の錠剤9を撮像して得られる画像である。撮像画像IM1’の画像IM11’~IM14’には、それぞれ異なる撮像方向から見た錠剤9の外観が示されている。各画像IM11’~IM14’において錠剤9の輪郭は理想的には楕円形状を有する。
 図27の例示では、画像IM11’~IM14’において錠剤9の表面上の各点の対応関係が二点鎖線で示されている。このような対応関係は、例えば錠剤9の輪郭を示す関数に対応付けて予め設定されて、制御部8の記憶媒体に記憶されてもよい。
 図27の例示では、画像IM11’~IM14’には、マスク領域MR1~MR4が設定されている。このマスク領域MR1~MR4は、画素値が他の領域における画素値よりも大幅に高くなり得る領域である。このような領域は、照明用光源から照射された光が錠剤9で正反射されることにより生じる。つまり、この正反射光がミラー53、角錐型ミラー54およびレンズ群52を介して検査カメラ51の結像面の一部に結像されると、その結像面の一部に対応する領域(正反射領域)内の画素の画素値が他の画素値よりも大幅に高くなる。そこで、この正反射領域を含むようにマスク領域が設定される。これにより、錠剤9上の光の強弱を欠陥と誤検出することを回避できる。
 ここでは照明用光源としてリング状の光源を想定しているので、図27の例では、マスク領域MR1~MR4が楕円状のリング領域で示されている。マスク領域MR1は例えば錠剤9の輪郭を示す関数に対応付けて予め設定されていてもよい。あるいは、制御部8は例えば画像IM11’内の画素の画素値がマスク閾値よりも大きい領域を特定し、その領域をマスク領域MR1に設定してもよい。マスク領域MR2~MR4も同様である。マスク閾値は例えば予め設定されて制御部8の記憶媒体に記憶されていてもよい。
 複数の撮像方向から錠剤9を撮像するので、各撮像方向に対応する正反射領域は錠剤9の表面上で互いに異なる。もちろん、2つの撮像方向に対応する正反射領域の一部どうしが錠剤9の表面上で重なる場合はある。しかし、3以上の正反射領域が錠剤9の表面上の同じ領域で互いに重なることは少ない。つまりマスク領域MR1~MR4を錠剤9の表面に投影した場合、マスク領域MR1~MR4の2つは錠剤9の表面上において重なり合うものの、3つが同じ領域で重なり合うことはまれである。4つが同じ領域で重なり合う可能性はさらに低い。もし仮にマスク領域MR1~MR4が同じ領域で重なり合えば、その領域は画像IM11’~IM14’においてマスク領域MR1~MR4内に含まれることになるので、画像IM11’~IM14’のいずれにおいても検査対象にならない。しかしそのような可能性は非常に低いのである。
 ここでは、マスク領域MR1~MR4の4つは同じ領域で重なり合わないものとする。この場合、錠剤9のうち画像IM11’~IM14’のいずれにも写る共通面は次の4種の領域に分割される。即ち、第1領域は、画像IM11’~IM14’の全てにおいて検査対象領域内に位置する領域であり、第2領域は、画像IM11’~IM14’の3つのみにおいて検査対象領域内に位置する領域であり、第3領域は、画像IM11’~IM14’の2つのみにおいて検査対象領域内に位置する領域であり、第4領域は、画像IM11’~IM14’の一つのみにおいて検査対象領域内に位置する領域である。
 <検査処理>
 次に糖衣錠たる錠剤9についての検査処理について説明する。この錠剤9は図2の錠剤9と違って主面と側面との明確な境界を有さない。よって、制御部8は主面領域と側面領域とを特定することは困難であるので、欠陥候補の位置を錠剤領域に対する位置で把握する。そこで制御部8は特定処理において錠剤領域の輪郭を特定する。
 図28は、検査処理の一例を示すフローチャートである。ステップSA211にて、制御部8はステップSA21と同様にしてエッジ画像を生成する。次にステップSA212にて、制御部8はステップSA22と同様にして錠剤エッジを特定する。次にステップSA213にて、楕円の関数に基づいて当該錠剤エッジに近似する近似線(楕円)を、錠剤領域の輪郭として特定する。より一般的に説明すると、IM11~IM14における錠剤9の輪郭を示す基準関数に基づいて錠剤エッジに近似する近似線を特定する。次にステップSA214にて、制御部8は例えば図27に示すようにマスク領域を設定する。
 次に制御部8は各画像IM11’~IM14’に対して候補検出処理を行う。候補検出処理は上述した通りである。これにより、各画像IM11’~IM14’において、欠陥候補が検出されて錠剤領域に対する欠陥候補の位置が特定される。
 制御部8は欠陥真偽処理において次にように動作する。即ち、制御部8は、第1領域から第3領域については、画像IM11’~IM14’のうち2以上の画像で共通の欠陥候補が検出されているときに、錠剤9に欠陥が生じていると判断する。制御部8は、第4領域については、画像IM11’~IM14’の1つにおいて欠陥候補が検出されたときに、錠剤9に欠陥が生じていると判断する。
 具体的な欠陥真偽処理の一例は、図26を参照して説明した側面領域に対する欠陥真偽処理と同様である。具体的には、「側面領域」および「錠剤の側面」をそれぞれ「錠剤領域」および「錠剤」に読み替えればよい。
 なお、第1から第3の実施の形態を第4の実施の形態に適用してもよい。例えば第2の実施の形態で説明したように、制御部8は、図12のフローチャートにより、境界エッジP3を特定してもよい。
 第5の実施の形態.
 例えば特許文献1~3のように錠剤の上面を垂直に撮像すれば、錠剤の上面の周縁に生じた欠けは錠剤の外周に位置する。なおここでいう錠剤の外周とは、撮像画像において錠剤が占める錠剤領域の輪郭をいう。このように錠剤の外周に位置する欠けは撮像画像から検出しやすい。当該欠けが撮像画像において錠剤領域と背景領域との境界に生じるからである。
 これに対して、例えば錠剤を上方斜めから撮像すれば、この一方向の撮像により、錠剤の上面および側面の両方が撮像される。この場合、撮像画像においては錠剤の上面および側面は互いに接することになる。つまりこの撮像画像において、錠剤の上面の周縁のうち側面と接する部分は錠剤の外周(錠剤領域の輪郭)ではなく、錠剤領域の内部に位置することになる。錠剤の欠けが当該部分に生じた場合、その欠けを撮像画像から検出することは困難であった。
 そこで、第5の実施の形態では、錠剤の主面および側面が互いに接する撮像画像において、主面および側面の境界上に生じた錠剤の欠けを検出できる錠剤検査方法および錠剤検査装置を提供することを企図とする。
 第5の実施の形態にかかる錠剤検査装置1の構成の一例は第1の実施の形態と同様である。なお、第4の実施の形態にかかる制御部8の機能および動作は、後に詳述するように、第1の実施の形態と相違する。
 以下では、説明の簡単のために、一方向から見た錠剤9の外観について説明を行う。図29は、欠陥が生じている錠剤9を一方向から撮像した撮像画像IM11の一例を概略的に示す図である。図29の例では、錠剤9の主面9aaと側面9caとの間の境界に欠けB1が存在している。
 制御部8は撮像画像IM11に対して画像処理を行って、錠剤9の欠けB1を検出する。以下、より具体的に説明する。
 図30は、錠剤検査装置1における動作の一例を示すフローチャートである。まずステップSB1にて、撮像ヘッド5は、図7のステップS1と同様に、錠剤9の主面9aおよび側面9cの両方が写る方向から搬送途中の錠剤9を撮像して、錠剤9の主面9aおよび側面9cの両方が写る撮像画像IM11を生成する。撮像ヘッド5はこの撮像画像IM11を制御部8へと出力する。
 次に制御部8は撮像画像IM11において錠剤9の主面9aaが占める主面領域Raの輪郭に対応する主面エッジを検出する。なお図29に示すように、欠けB1が主面領域Raと側面領域Rcとの間の境界に生じている場合、主面エッジは、欠けB1を含んだ主面9aaの輪郭に対応するエッジであると把握する。主面エッジの検出は例えば図30のステップSB2~SB5の一連の処理によって実行される。
 まずステップSB2にて、制御部8は、図7のステップS2と同様に、撮像画像IM11に対してエッジ検出処理を行ってエッジ画像を生成する。
 次にステップSB3にて、制御部8は、図7のステップS3と同様に、錠剤領域TRの輪郭に対応する錠剤エッジP0を特定する(図31も参照)。図31は、錠剤エッジP0の一例を模式的に示す図である。図31の例でも、図8と同様に、錠剤エッジP0が複数のエッジに分割して示されている。
 再び図30を参照して、ステップSB4にて、制御部8は、図7のステップS4と同様に、ステップSB3で特定した錠剤エッジP0から、側面外側エッジP1および主面外側エッジP2を抽出する。
 次にステップSB5にて、制御部8は、図7のステップS5と同様に、境界エッジP3をエッジ画像から特定する。境界エッジP3とは、撮像画像IM11において錠剤9の主面9aaと側面9caとの間の境界に対応するエッジである。言い換えれば、境界エッジP3は主面領域Raと側面領域Rcとの間の境界に対応するエッジである。なお図29に示されるように、欠けB1が存在する場合には、境界エッジP3は欠けB1の輪郭に対応するエッジの一部を含む。境界エッジP3の具体例は後述する。
 錠剤9に欠けB1が生じていない場合、境界エッジP3は上述のように、理想的には、主面外側エッジP2とは反対側に膨らむ半楕円形状を有する(図8も参照)。つまり、境界エッジP3は側面外側エッジP1と同様の形状を有する。またここでは錠剤9はさほど厚くないので、錠剤9に欠けB1が生じていなければ、境界エッジP3および側面外側エッジP1はほぼ同一形状を有している、と考えることができる。つまり、境界エッジP3は側面外側エッジP1を所定方向D1に沿って主面外側エッジP2側へと、側面稜線エッジP4の長さの分だけ平行移動させた領域に存在している。側面稜線エッジP4の長さは錠剤9の厚みおよび撮像ヘッド5の内部構成の配置に応じて予め決まっているので、側面外側エッジP1が特定されれば、境界エッジP3が存在する領域を推定することができる。
 そこで制御部8は、側面外側エッジP1から所定方向D1に沿って主面外側エッジP2側へと所定距離だけ離れた探索領域R1(図32も参照)内の画素を探索して境界エッジP3を特定する。図32は、探索領域R1の一例を模式的に示す図である。
 中心線L0は側面外側エッジP1を側面稜線エッジP4の長さの分だけ、所定方向D1に沿って主面外側エッジP2側へと移動させた線である。また図32の例では、境界エッジP3の一部と中心線L0の一部とを互いに一致させて示しているものの、実際にはこれらは互いに相違し得る。
 線L1,L2は、中心線L0を所定方向D1に沿って互いに反対側へと所定幅だけ移動させた線である。この所定幅は、想定される欠けB1の大きさに応じて予め設定される。図32では、線L1は線L2よりも側面外側エッジP1に近い。線L3,L4は所定方向D1に沿って延在しており、それぞれ線L1,L2の両端を連結する。探索領域R1はこれらの線L1~L4の一組によって囲まれた領域である。
 なお図32では、欠けB1の輪郭に対応する欠けエッジP’、および、割線91に対応する割線エッジP5の一部も示されている。
 制御部8による探索処理の一例は図10のフローチャートと同様であるので、ここでは繰り返しの説明を避ける。
 この探索処理によれば、欠けエッジP’上の画素は次のように境界エッジP3の構成要素として特定される。即ち、欠けエッジP’のうち線L1側(つまり側面外側エッジP1側)のエッジPc’上の画素が境界エッジP3の構成要素として特定される。図32では、境界エッジP3の構成要素として特定される画素のいくつかを模式的に黒丸で示している。
 制御部8は、ステップSB4で特定した主面外側エッジP2およびステップSB5で特定した境界エッジP3の一組を、主面エッジP23として特定する。欠けB1が生じている場合には、主面エッジP23は理想的な楕円形状を有さずに、その欠けB1に対応する部分において理想的な楕円形状から乖離する(後に説明する図33も参照)。よって、この理想的な楕円に近い近似線を算出すれば、その近似線と主面エッジP23とが乖離する部分に基づいて、欠けB1を検出することができる。
 そこで次にステップSB6にて、制御部8は、図7のステップ6と同様に、楕円の関数に基づいて、主面エッジP23に近似する近似線(楕円)を算出する。
 以上のように、主面領域Raの輪郭を示す基準関数に基づいて主面エッジP23の近似線を算出しているので、この近似線は主面領域Raの輪郭に近い線となる。また上述の具体例では、錠剤9が略円盤形状を有している。つまり、錠剤9の主面9aが略円形状を有している。よって、撮像画像IM11において主面9aaの周縁は理想的には楕円形状を有する。本実施の形態では、これに対応して、楕円の関数が基準関数として用いられている。したがって、適切に主面領域Raの輪郭に近い近似線を算出することができる。
 楕円E1をその長軸で分割して得られる2つの半楕円E11,E12はそれぞれ主面外側エッジP2および境界エッジP3の近似線に相当することになる。
 次にステップSB7にて、制御部8は、図7のステップS7と同様に、側面外側エッジP1に近似する近似線(半楕円)を楕円E1に基づいて算出する。
 図33は、欠けB1が生じた錠剤9についての各種エッジおよびその近似線の一例を概略的に示す図である。主面エッジP23は欠けB1の輪郭のうち側面9ca側の部分と主面9aaの周縁と沿って延在する。図33の例では、側面外側エッジP1と、その近似線たる半楕円E21とが互いに一致して示されているものの、実際にはこれらは互いに相違し得る。
 次にステップSB8にて、制御部8は検査処理を実行する。この検査処理は、錠剤9の主面9a,9bの周縁に生じた欠けを検出するための処理である。図34は、この検査処理の具体的な一例を示すフローチャートである。まずステップSB81にて、制御部8は主面エッジP23の近似線たる楕円E1から、それぞれ主面外側エッジP2および境界エッジP3の近似線たる半楕円E11,E12を抽出する。具体的には、制御部8は楕円E1をその長軸で分割して得られる半楕円をそれぞれ半楕円E11,E12として算出する。
 次にステップSB82にて、制御部8は、境界エッジP3上の各画素と半楕円E12との間の距離d(図33も参照)が所定の閾値(以下、距離閾値と呼ぶ)dthよりも長いか否かを判断する。距離閾値dthは例えば予め設定されて制御部8の記憶媒体に記憶されてもよい。図33の例では、境界エッジP3上のある画素と半楕円E12との間の距離dが示されている。ステップSB82において肯定的な判断がなされたときには、ステップSB83にて、制御部8は錠剤9の主面9aの周縁(より具体的には撮像画像IM11における主面9aaと側面9caとの間の境界)に欠けが生じていると判断する。否定的な判断がなされたときには、制御部8はステップSB83を実行しない。
 図35は、ステップSB82,SB83の処理のより具体的な一例を示すフローチャートである。まずステップSB801にて、制御部8は値nを1に初期化する。値nは境界エッジP3上の画素を示す番号である。境界エッジP3上の各画素には、その一端から他端に向けて順に連続した番号が付与される。
 次にステップSB802にて、制御部8は境界エッジP3上の第n番目の画素(以下、注目画素と呼ぶ)と、半楕円E12との間の距離dを算出する。例えば制御部8は注目画素と半楕円E12上の画素の各々との距離を算出し、そのうち最も小さい値を距離dとして選択する。
 次にステップSB803にて、制御部8は距離dが距離閾値dthよりも長いか否かを判断する。肯定的な判断がなされたときには、ステップSB804にて、制御部8はその注目画素が欠けの輪郭を示す画素であると判断し、錠剤9の主面9aの周縁に欠陥が生じていると判断する。次に制御部8は後述のステップSB805を実行する。一方で否定的な判断がなされたときには、制御部8はステップSB804を実行することなくステップSB805を実行する。
 ステップSB805では、制御部8は値nに1を加算して値nを更新する。次にステップSB806にて、制御部8は値nが基準値nrefよりも大きいか否かを判断する。基準値nrefは境界エッジP3を構成する画素の総数である。つまり、境界エッジP3上の全ての画素について判断が終了したか否かを判断する。ステップSB806にて否定的な判断がなされたときには、未だ全ての画素について判断が終了していないので、制御部8は再びステップSB802を実行する。一方で、ステップSB806にて肯定的な判断がなされたときには、制御部8は処理を終了する。
 上述の例では、境界エッジP3上の全ての画素について上記判断を行っている。しかしながら、欠けの個数およびその位置等を検出する必要がない場合には、欠けの輪郭を示す一つの画素を検出したときに、残りの画素についての上記判断を省略してもよい。この点は以下で述べる全ての検査処理についても同様である。
 再び図34を参照して、ステップSB84にて、制御部8は主面外側エッジP2上の各画素とその近似線たる半楕円E11との間の距離が距離閾値dthよりも長いか否かを判断する。肯定的な判断がなされたときには、ステップSB85にて、制御部8は錠剤9の主面9aの周縁(より具体的には撮像画像IM11において側面9caと接していない部分)に欠けが生じていると判断する。否定的な判断がなされたときには、制御部8はステップSB85を実行しない。
 次にステップSB86にて、制御部8は側面外側エッジP1上の各画素とその近似線たる半楕円E21との間の距離が距離閾値dthよりも長いか否かを判断する。肯定的な判断がなされたときには、ステップSB87にて、制御部8は錠剤9の主面9bの周縁(より具体的には撮像画像IM11に写っている部分)に欠けが生じていると判断する。否定的な判断がなされたときには、制御部8はステップSB87を実行しない。
 ステップSB84,SB85の具体的な方法の一例およびステップSB86,SB87の具体的な方法の一例はステップSB82,SB83の具体的な方法と同様である。
 以上のように、この錠剤検査装置1によれば、錠剤9の主面9a,9bの周縁に生じた欠けを検出することができる。
 なおステップSB82,SB83の一組、ステップSB84,SB85の一組およびステップSB86,SB87の一組の実行順序は適宜に変更してもよい。また欠けの個数および位置等を検出する必要がない場合には、制御部8は必ずしもステップSB82,SB84,SB86の判断の全てを実行する必要は無い。制御部8はいずれか一つにおいて肯定的な判断がなされたときに、残りの判断を省略してもよい。
 また上述の例では、制御部8は主面エッジP23に近似する近似線(楕円E1)を算出し、この楕円E1から半楕円E11,E12を抽出した。しかしながら、制御部8は撮像画像IM11における錠剤9の主面9aaと側面9caとの間の境界の形状として予め決められた基準関数に基づいて、境界エッジP3の近似線(半楕円E12)を算出してもよい。同様に制御部8は、撮像画像IM11における錠剤9の主面9aaの周縁のうち側面9caと接していない部分の形状として予め決められた基準関数に基づいて、主面外側エッジP2の近似線(半楕円E11)を算出してもよい。
 <検査処理>
 上記の例では、例えば境界エッジP3上の一つの画素と半楕円E12との間の距離dが距離閾値dthよりも長いときに、制御部8はその画素が欠けの輪郭を示すと判断した(ステップSB802~SB804)。つまり、当該一つの画素が距離閾値dthよりも長い距離で半楕円E12と離れているときに、その画素は欠けの輪郭を示すと判断される。しかしながら、欠けB1が生じたときには、図33も参照して、境界エッジP3上で連続する複数の画素が距離閾値dthよりも長い距離で半楕円E12と離れることになる。つまり、もし一つの画素のみが距離閾値dthよりも長い距離で半楕円E12と離れている場合には、その画素は欠けB1を示すのではなく、ノイズである可能性がある。そこでここでは、このようなノイズを欠けとして誤検出することを抑制する。
 具体的には、制御部8は距離閾値dthよりも長い距離dで半楕円E12と離れる複数の画素が境界エッジP3上において連続しているか否かを判断し、肯定的な判断がなされたときに、その連続する画素の一群が欠けB1の輪郭を示すと判断し、錠剤9の主面9aの周縁(より具体的には撮像画像IM11の主面9aaと側面9caとの間の境界)に欠けB1が生じていると判断する。
 図36は、このような検査処理の具体的な方法の一例を示すフローチャートである。まずステップSB811にて、制御部8は値n,mをそれぞれ1,0に初期化する。値mは、後の説明から明らかとなるように、距離閾値dthよりも長い距離で半楕円E12から離れた画素であって境界エッジP3上で連続する画素の数を示している。
 次に制御部8はステップSB812,SB813をこの順で実行する。ステップSB812,SB813はそれぞれステップSB802,SB803と同一である。ステップSB813において肯定的な判断がなされると、ステップSB814にて、制御部8は値mに1を加算して値mを更新する。
 次にステップSB815にて、制御部8は値nに1を加算して値nを更新する。次にステップSB816にて、制御部8は値nが基準値nrefよりも大きいか否かを判断する。つまり制御部8は境界エッジP3上の全ての画素について処理を行ったか否かを判断する。否定的な判断がなされると、次の画素についての判断を行うべく、制御部8は再びステップSB812を実行する。一方で肯定的な判断がなされると、制御部8は処理を終了する。
 ステップSB813において否定的な判断がなされると、ステップSB817にて、制御部8は値mが閾値(以下、連続閾値と呼ぶ)mthよりも大きいか否かを判断する。連続閾値mthは例えば予め設定されて制御部8の記憶媒体に記憶されていてもよい。
 ステップSB817にて肯定的な判断がなされると、ステップSB818にて、制御部8は第(n-m+1)番目の画素から第(n-1)番目の画素の一群が欠けの輪郭を示していると判断し、主面9aの周縁(より具体的には撮像画像IM11における主面9aaと側面9caとの間の境界)に欠けB1が生じていると判断する。次にステップSB819にて、制御部8は値mを0に初期化し、ステップSB815を実行する。ステップSB817にて否定的な判断がなされると、制御部8はステップSB818を実行せずにステップSB819を実行する。
 この検査処理によれば、値mは、距離dが距離閾値dthよりも短い画素が検出されたときに零に初期化され(ステップSB819)、距離dが距離閾値dthよりも長い画素が連続して検出される度にインクリメントされる(ステップSB815)。よって、値mは、距離dが距離閾値dthよりも長い画素が連続する数を示すことになる。そして、この値mが連続閾値mthよりも大きいときに、制御部8は欠けが生じていると判断している(ステップSB817,SB818)。これにより、欠けの誤検出を抑制して、より高い精度で欠けを検出することができる。
 この検査処理は側面外側エッジP1および主面外側エッジP2についても適用可能である。
 <境界エッジ>
 上述の例では、探索領域R1の各行の線L1から線L2へ向かう探索において、最初に検出されたエッジ画素を境界エッジP3の構成要素として把握した(図32参照)。したがって、欠けエッジP’のうち、線L1側のエッジPc’上の画素が境界エッジP3の構成要素として採用された。よって、境界エッジP3の構成要素は欠けエッジP’のうちエッジPc’に偏ることになる。これにより、主面エッジP23に近似する楕円E1(半楕円E11,E12の一組)は主面領域Raの輪郭からずれやすくなる。
 ここでは、第2の実施の形態を採用することにより、主面領域Raの輪郭により近い楕円E1を算出することを企図する。具体的には、撮像画像IM11における欠陥領域の画素値の分布に着目して、境界エッジP3の構成要素がエッジP’のうち線L1側のエッジPc’と線L2側のエッジPa’とに分散されるように、境界エッジP3を特定する。具体的な一例として、制御部8は、図12のフローチャートを実行することで、境界エッジP3を特定する。
 これによれば、境界エッジP3に近似する半楕円E11は錠剤9の主面9aaの周縁により近い半楕円となり、また、主面エッジP23に近似する楕円E1は錠剤9の主面9aaの周縁により近い楕円となる。
 図37は、欠けB1が生じた錠剤9についての各種エッジおよびその近似線の一例を概略的に示す図である。境界エッジP3の構成要素は欠けエッジP’においてエッジPa’,Pc’に分散されるので、図37の例では、欠けエッジP’が部分的に境界エッジP3の構成要素として特定されることを示すべく、欠けエッジP’を破線で示している。また図37の例では、主面外側エッジP2と半楕円E11が互いに一致して示され、側面外側エッジP1と半楕円E21が互いに一致して示されている。境界エッジP3は欠けエッジP’以外の部分において半楕円E12と一致して示されている。実際には、これらは互いに相違し得る。
 図33および図37の比較から理解できるように、境界エッジP3上の各画素と半楕円E12との間の距離dが欠けエッジP’において、より大きく算出される。したがって、欠けB1をより検出しやすい。言い換えれば、より高い精度で欠けB1を検出できる。
 しかも境界エッジP3の構成要素は欠けエッジP’で分散されるので、エッジPa’上の画素およびエッジPc’上の画素の両方を用いて欠けB1を検出できる。これにより、欠けB1が主面9aa側に偏って形成されている場合であっても、つまり、エッジPc’が側面9ca側にはあまり張り出しておらず、主面9aa側に張り出している場合であっても、欠けB1を検出できる。以下に、具体的に説明する。
 図38は、欠けB1が側面9ca側に張り出していないときの各種エッジおよびその近似線の一例を概略的に示す図である。欠けB1が側面9ca側にあまり張り出していない場合には、エッジPc’上の各画素と半楕円E12との間の距離dは短くなる。そして欠けB1の形状によっては、エッジPc’上の全ての画素についての距離dが距離閾値dthよりも短くなることがある。このとき図32の探索処理を採用して境界エッジP3の構成要素がエッジPc’に偏っていれば、その後の検査処理において、この欠けB1を検出できない。
 これに対して、欠けB1が主面9aa側に張り出していれば、図38に示すように、エッジPa’上の画素と半楕円E12との間の距離dは距離閾値dthよりも長くなる。よって、境界エッジP3の構成要素がエッジPa’,Pc’の両方に分散される図12の探索処理を用いれば、その後の検査処理において、この欠けB1を検出できる。なぜなら、この検査処理において、境界エッジP3のうちエッジPa’上の画素と半楕円E12との距離dと距離閾値dthとの大小判断を行うからである(ステップSB82,SB83)。
 なお、第1から第4の実施の形態を第5の実施の形態に適用してもよい。
 変形例.
 <錠剤の主面>
 上述の例では、主面9bが搬送ベルト41側を向く姿勢で搬送された錠剤9を検査対象として説明した。錠剤9の主面9aが搬送ベルト41を向く姿勢で錠剤9が搬送される場合には、錠剤検査装置1は錠剤9の主面9bおよび側面9cに対する外観検査を行うことになる。
 また例えば錠剤9に対する外観検査の後に、錠剤9の搬送姿勢を反転させ、その状態で錠剤9に対する外観検査を行ってもよい。これによれば、錠剤9の全面(主面9a,9bおよび側面9c)に対する外観検査を行うことができる。
 <錠剤の形状>
 上述の例では、錠剤9は略円盤形状を有していた。例えばこの円盤形状として、いわゆる平錠またはR付き錠を採用できる。ただし、錠剤9は必ずしも円盤形状に限らない。つまり、主面9a,9bは必ずしも円形状を有する必要は無い。主面9a,9bの形状は既知であるので、撮像画像IM11(あるいはIM11’、以下、同様)において現れるであろう主面9a(あるいは主面9b)の周縁の形状を予め基準関数で決めておくことができる。この基準関数は当該形状を示すものの、その大きさおよび位置が変数となる関数である。基準関数は例えば制御部8の記憶媒体に予め記憶されてもよい。制御部8は撮像画像IM11からエッジ画像を生成し、エッジ画像に含まれる主面エッジの近似線をその基準関数に基づいて求めればよい。これによって、撮像画像IM11における主面領域Raをより高い精度で算出することができる。
 以上のように、錠剤検査方法および錠剤検査装置は詳細に説明されたが、上記した説明は、全ての局面において例示であって、この開示がそれに限定されるものではない。また上述した各種実施の形態および各種変形例は、相互に矛盾しない限り組み合わせて適用可能である。そして、例示されていない多数の変形例が、この開示の範囲から外れることなく想定され得るものと解される。
 1 錠剤検査装置
 5 撮像部(撮像ヘッド)
 8 画像処理部(制御部)
 9 錠剤
 9a 第1主面(主面)
 9b 第2主面(主面)
 9c 側面
 d1,d2 欠陥
 dA1,dA2 欠陥候補
 E1 第2近似線(楕円)
 E11 第3近似線(半楕円)
 E12 第1近似線(半楕円)
 E21 第4近似線(半楕円) IM1,IM1’ 撮像画像
 MR1~MR4 マスク領域
 P0 錠剤エッジ
 P1 側面外側エッジ
 P2 主面外側エッジ
 P3 境界エッジ
 P23 主面エッジ
 R1 探索領域
 Ra 主面領域
 Rc 側面領域
 TR 錠剤領域

Claims (29)

  1.  一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査方法であって、
     錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する工程(a)と、
     前記撮像画像において前記第1主面および前記側面がそれぞれ占める主面領域および側面領域を特定する工程(b)と、
     前記主面領域および前記側面領域に対してそれぞれ検査処理を行う工程(c)と、
    を備え、
     前記工程(b)は、
     前記撮像画像において、前記第1主面の輪郭に対応した主面エッジを特定する工程(b1)と、
     前記撮像画像における前記主面領域の輪郭の形状を示す関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として算出する工程(b2)と
    を備える、錠剤検査方法。
  2.  請求項1に記載の錠剤検査方法であって、
     前記錠剤は略円盤形状を有しており、
     前記関数は楕円を示す関数であり、前記近似線は楕円である、錠剤検査方法。
  3.  請求項1または請求項2に記載の錠剤検査方法であって、
     前記主面領域および前記側面領域は、前記撮像画像において前記錠剤が占める錠剤領域を構成しており、
     前記工程(b1)は、
     前記撮像画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b11)と、
     前記錠剤領域の輪郭に対応する錠剤エッジを前記エッジ画像から特定する工程(b12)と、
     前記撮像画像における前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記撮像画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b13)と、
     前記エッジ画像において前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記主面領域と前記側面領域との間の境界に対応する境界エッジを特定する工程(b14)と、
     前記主面外側エッジおよび前記境界エッジの一組を前記主面エッジとして特定する工程(b14)と
    を備える、錠剤検査方法。
  4.  請求項3に記載の錠剤検査方法であって、
     前記工程(b14)では、
     前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記撮像画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  5.  請求項3または請求項4に記載の錠剤検査方法であって、
     前記工程(b14)では、
     前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  6.  請求項1から請求項5のいずれか一つに記載の錠剤検査方法であって、
     前記錠剤の前記第1主面および前記側面の一方の表面粗さは他方よりも小さく、
     前記工程(c)は、
     前記撮像画像の前記主面領域および前記側面領域の一方に対してエッジ強度処理を行って得られた各画素の値が第1閾値よりも大きいときに、前記錠剤の前記第1主面および前記側面の前記一方に欠陥が生じていると判断する工程(c1)と、
     前記主面領域および前記側面領域の他方に対してエッジ強度処理を行って得られた各画素の画素値が、前記第1閾値よりも大きな第2閾値よりも大きいときに、前記錠剤の前記第1主面および前記側面の前記他方に欠陥が生じていると判断する工程(c2)と
    を備える、錠剤検査方法。
  7.  請求項1から請求項6のいずれか一つに記載の錠剤検査方法であって、
     前記撮像画像において前記錠剤の前記第1主面および前記側面の一方は他方よりも明るく、
     前記工程(c)は、
     前記撮像画像の前記主面領域および前記側面領域の一方の各画素の画素値が第3閾値よりも小さいときに、前記錠剤の前記第1主面および前記側面の前記一方に欠陥が生じていると判断する工程(c1)と、
     前記撮像画像の前記主面領域および前記側面領域の他方の各画素の画素値が、前記第3閾値よりも小さな第4閾値より小さいときに、前記錠剤の前記第1主面および前記側面の前記他方に欠陥が生じていると判断する工程(c2)と
    を備える、錠剤検査方法。
  8.  請求項1から請求項7のいずれか一つに記載の錠剤検査方法であって、
     前記錠剤の前記第1主面には割線が形成されており、
     前記工程(b)は、
     前記撮像画像において前記主面領域のうち前記割線を含む割線領域と前記割線を含まない非割線領域とを特定する工程(b3)を含み、
     前記工程(c)において、
     前記撮像画像の前記割線領域に対してエッジ強度処理を行って得られた各画素の画素値が第5閾値よりも大きいときに、前記割線領域において欠陥が生じていると判断し、
     前記撮像画像の前記非割線領域に対してエッジ強度処理を行って得られた各画素の画素値が前記第5閾値よりも小さな第6閾値よりも大きいときに、前記非割線領域において欠陥が生じていると判断する、錠剤検査方法。
  9.  一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査装置であって、
     錠剤の前記第1主面および前記側面の両方が写る方向から前記錠剤を撮像して撮像画像を生成する撮像部と、
     前記撮像画像において前記第1主面および前記側面がそれぞれ占める主面領域および側面領域を特定し、前記主面領域および前記側面領域に対してそれぞれ検査処理を行う画像処理部と
    を備え、
     前記画像処理部は、前記撮像画像において、前記第1主面の輪郭に対応した主面エッジを特定し、前記撮像画像における前記主面領域の輪郭の形状として予め決められた関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として求める、錠剤検査装置。
  10.  錠剤の外観を検査する錠剤検査方法であって、
     錠剤を撮像して、複数の撮像方向から見た錠剤の外観がそれぞれ写る複数の画像を含む撮像画像を生成する工程(a)と、
     錠剤の欠陥候補を検出する検査処理を、前記撮像画像に対して行う工程(b)と、
     前記検査処理によって、前記複数の画像に写る前記錠剤の第1領域において、前記複数の画像のうち2以上の画像で共通の欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程(c)と
    を備える、錠剤検査方法。
  11.  請求項10に記載の錠剤検査方法であって、
     前記錠剤の第2領域は前記複数の画像のうちn(nは2以上の整数)個の画像のみに写っており、
     前記検査処理によって、前記n個の画像のうち2以上の画像で共通の欠陥候補が前記第2領域において検出されたときに、前記錠剤に欠陥が生じていると判断する工程(d)を更に備える、錠剤検査方法。
  12.  請求項10または請求項11に記載の錠剤検査方法であって、
     前記錠剤の第3領域は前記複数の画像のうち1つの画像のみに写っており、
     前記検査処理によって、前記1つの画像の前記第3領域において欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程(f)を更に備える、錠剤検査方法。
  13.  請求項10から請求項12のいずれか一つに記載の錠剤検査方法であって、
     前記検査処理の検査対象とならないマスク領域が前記複数の画像ごとに設定され、
     前記錠剤の第4領域は前記複数の画像のうちm(2以上の整数)個の画像のみにおいて前記マスク領域以外の検査対象領域に写っており、
     前記工程(c)において、
     前記検査処理によって、前記m個の画像のうち2以上の画像で共通の欠陥候補が前記第4領域において検出されたときに、前記錠剤に欠陥が生じていると判断する、錠剤検査方法。
  14.  請求項13に記載の錠剤検査方法であって、
     前記複数の画像のそれぞれにおいて、前記錠剤に対する光の正反射によって画素値が他の領域よりも所定値以上高くなる領域を含む領域が前記マスク領域に設定される、錠剤検査方法。
  15.  請求項13または請求項14に記載の錠剤検査方法であって、
     前記錠剤は、前記第1領域たる第1主面と、前記第1主面と対面する第2主面と、前記第1主面の周縁および前記第2主面の周縁を連結する側面とを有し、
     前記複数の画像のそれぞれにおいて前記錠剤の側面が占める側面領域の両側に位置する端領域が前記マスク領域に設定される、錠剤検査方法。
  16.  請求項10から請求項15のいずれか一つに記載の錠剤検査方法であって、
     前記錠剤は、前記第1領域たる第1主面と、前記第1主面と対面する第2主面と、前記第1主面の周縁および前記第2主面の周縁を連結する側面とを有し、
     前記工程(b)は、
     前記複数の画像の各々において、前記錠剤の前記第1主面が示す主面領域の輪郭に対応した主面エッジを特定する工程(b1)と、
     前記複数の画像の各々において、前記主面領域の輪郭の形状として予め決められた関数に基づいて、前記主面エッジの近似線を前記主面領域の輪郭として求める工程(b2)と、
     前記複数の画像の各々において欠陥候補を検出する工程(b3)と
    を有し、
     前記工程(c)において、前記主面領域に対する各画素の位置の前記複数の画像の相互間における対応関係に基づいて、前記工程(b3)で検出された欠陥候補が前記2以上の画像において共通するのか否かを判断する、錠剤検査方法。
  17.  請求項16に記載の錠剤検査方法であって、
     前記錠剤の前記第1主面は平面視で略円形状を有しており、
     前記関数は楕円を示す関数であり、前記近似線は楕円である、錠剤検査方法。
  18.  請求項16または請求項17に記載の錠剤検査方法であって、
     前記錠剤は略円盤形状を有しており、
     前記複数の画像の各々において、前記錠剤の側面が占める側面領域と、前記主面領域とは錠剤領域を構成しており、
     前記複数の画像の各々を検査画像と呼ぶと、
     前記工程(b1)は、
     前記検査画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b11)と、
     前記検査画像において前記錠剤領域の輪郭に対応する錠剤エッジを、前記エッジ画像から特定する工程(b12)と、
     前記検査画像において前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記検査画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b13)と、
     前記エッジ画像において、前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記主面領域と前記側面領域との間の境界に対応する境界エッジを特定する工程(b14)と、
     前記主面外側エッジおよび前記境界エッジの一組を前記主面エッジとして特定する工程(b14)と
    を備える、錠剤検査方法。
  19.  請求項18に記載の錠剤検査方法であって、
     前記工程(b14)では、
     前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記検査画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  20.  請求項18または請求項19に記載の錠剤検査方法であって、
     前記工程(b14)では、
     前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  21.  錠剤の外観を検査する錠剤検査装置であって、
     錠剤を撮像して、複数の撮像方向から見た錠剤の外観がそれぞれ写る複数の画像を含む撮像画像を生成する撮像部と、
     画像処理部と
    を備え、
     前記画像処理部は、
     錠剤の欠陥候補を検出する検査処理を、前記撮像画像に対して行う工程と、
     前記検査処理によって、前記複数の画像に写る前記錠剤の第1領域において、前記複数の画像のうち2以上の画像で共通の欠陥候補が検出されたときに、前記錠剤に欠陥が生じていると判断する工程と
    を実行する、錠剤検査装置。
  22.  一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査方法であって、
     錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する工程(a)と、
     前記撮像画像において前記錠剤の前記第1主面および前記側面がそれぞれ占める主面領域と側面領域との間の境界に対応する境界エッジを特定し、前記境界エッジに近似する第1近似線を、前記撮像画像での前記境界の形状を示す関数に基づいて算出する工程(b)と、
     前記境界エッジ上の各画素と前記第1近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する工程(c)と
    を備える、錠剤検査方法。
  23.  請求項22に記載の錠剤検査方法であって、
     前記主面領域および前記側面領域は、前記撮像画像において前記錠剤が占める錠剤領域を構成しており、
     前記工程(b)は、
     前記撮像画像に対してエッジ検出処理を行ってエッジ画像を生成する工程(b1)と、
     前記錠剤領域の輪郭に対応する錠剤エッジを前記エッジ画像から特定する工程(b2)と、
     前記撮像画像における前記第1主面の周縁のうち前記錠剤領域の輪郭の一部となる部分、および、前記撮像画像における前記第2主面の周縁にそれぞれ対応する主面外側エッジおよび側面外側エッジを、前記錠剤エッジから抽出する工程(b3)と、
     前記エッジ画像において前記側面外側エッジから所定方向に沿って所定距離はなれた探索領域内の画素を探索して、前記境界エッジを特定する工程(b4)と、
     前記撮像画像での前記主面領域の輪郭の形状を示す関数に基づいて、前記主面外側エッジおよび前記境界エッジの一組たる主面エッジの第2近似線を算出する工程(b5)と、
     前記第2近似線から前記境界エッジの前記第1近似線を抽出する工程(b6)と
    を備える、錠剤検査方法。
  24.  請求項23に記載の錠剤検査方法であって、
     前記錠剤は略円盤形状を有しており、
     前記関数は楕円を示す関数であり、前記第2近似線は楕円である、錠剤検査方法。
  25.  請求項23または請求項24に記載の錠剤検査方法であって、
     前記工程(b4)では、
     前記エッジ画像の前記探索領域内の画素であって、当該画素に対応する前記撮像画像の画素の画素値が所定閾値よりも大きな画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  26.  請求項24または請求項25に記載の錠剤検査方法であって、
     前記工程(b4)では、
     前記探索領域において、前記側面外側エッジから前記主面外側エッジへ向かって画素を探索して、前記境界エッジを特定する、錠剤検査方法。
  27.  請求項23から請求項26のいずれか一つに記載の錠剤検査方法であって、
     前記工程(b5)において算出した前記主面エッジの前記第2近似線から、前記主面外側エッジの第3近似線を抽出する工程と、
     前記主面外側エッジ上の各画素と前記第3近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する工程と
    を備える、錠剤検査方法。
  28.  請求項23から請求項27のいずれか一つに記載の錠剤検査方法であって、
     前記工程(b5)において算出した前記主面エッジの前記第2近似線から、前記側面外側エッジの第4近似線を抽出する工程と、
     前記側面外側エッジ上の各画素と前記第4近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第2主面の周縁に欠けが生じていると判断する工程と
    を備える、錠剤検査方法。
  29.  一対の第1主面および第2主面と側面とを有する錠剤の外観を検査する錠剤検査装置であって、
     錠剤を撮像して、前記第1主面および前記側面の両方が写る撮像画像を生成する撮像部と、
     画像処理部と
    を備え、
     前記画像処理部は、
     前記撮像画像において前記錠剤の前記第1主面および前記側面がそれぞれ占める主面領域と側面領域との間の境界に対応する境界エッジを特定し、
     前記境界エッジに近似する第1近似線を、前記撮像画像での前記境界の形状を示す関数に基づいて算出し、
     前記境界エッジ上の各画素と前記第1近似線との間の距離が所定の閾値よりも長いときに、前記錠剤の前記第1主面の周縁に欠けが生じていると判断する、錠剤検査装置。
PCT/JP2018/048426 2018-01-15 2018-12-28 錠剤検査方法および錠剤検査装置 WO2019138930A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202310949454.2A CN116973369A (zh) 2018-01-15 2018-12-28 片剂检查方法以及片剂检查装置
CN201880086537.0A CN111602047B (zh) 2018-01-15 2018-12-28 片剂检查方法以及片剂检查装置

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
JP2018004210A JP7075218B2 (ja) 2018-01-15 2018-01-15 錠剤検査方法および錠剤検査装置
JP2018-004206 2018-01-15
JP2018004206A JP7083646B2 (ja) 2018-01-15 2018-01-15 錠剤検査方法および錠剤検査装置
JP2018004211A JP6980538B2 (ja) 2018-01-15 2018-01-15 錠剤検査方法および錠剤検査装置
JP2018-004211 2018-01-15
JP2018-004210 2018-01-15

Publications (1)

Publication Number Publication Date
WO2019138930A1 true WO2019138930A1 (ja) 2019-07-18

Family

ID=67218667

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/048426 WO2019138930A1 (ja) 2018-01-15 2018-12-28 錠剤検査方法および錠剤検査装置

Country Status (2)

Country Link
CN (2) CN111602047B (ja)
WO (1) WO2019138930A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110930390A (zh) * 2019-11-22 2020-03-27 郑州智利信信息技术有限公司 基于半监督深度学习的芯片管脚缺失检测方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112781452B (zh) * 2021-03-25 2022-10-18 湘潭大学 一种子弹底火顶部外观缺陷检测方法

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0921755A (ja) * 1995-07-05 1997-01-21 Suinku:Kk 検査用搬送装置および検査装置
JPH10104166A (ja) * 1996-09-27 1998-04-24 Sumitomo Electric Ind Ltd 結晶体の品質評価方法および装置
JP2000242791A (ja) * 1999-02-23 2000-09-08 Mitsubishi Heavy Ind Ltd 画像処理方法
JP2005172608A (ja) * 2003-12-11 2005-06-30 Nichizou Imc:Kk 外観検査装置
JP2005241488A (ja) * 2004-02-27 2005-09-08 Sankyo:Kk 直視面と非直視面とを同時に撮影する撮像装置並びにこれを適用した錠剤検査用撮像システム
JP2007327751A (ja) * 2006-06-06 2007-12-20 Ckd Corp 外観検査装置及びptpシートの製造装置
JP2009031247A (ja) * 2007-12-28 2009-02-12 Lion Engineering Co Ltd 物品の外観検査装置および表面検査装置
JP2010261837A (ja) * 2009-05-08 2010-11-18 Ikegami Tsushinki Co Ltd 外観検査装置及び外観検査用の光学装置
JP2011137704A (ja) * 2009-12-28 2011-07-14 Lion Engineering Co Ltd 外観検査装置、表面検査装置、及び外観検査方法
US20120293623A1 (en) * 2011-05-17 2012-11-22 Gii Acquisition, Llc Dba General Inspection, Llc Method and system for inspecting small manufactured objects at a plurality of inspection stations and sorting the inspected objects
JP2017096821A (ja) * 2015-11-26 2017-06-01 Ckd株式会社 外観検査装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0587744A (ja) * 1991-03-01 1993-04-06 Fujisawa Pharmaceut Co Ltd 物品の表面検査方法およびそれに使用する装置
JP3989671B2 (ja) * 2000-07-27 2007-10-10 株式会社マキ製作所 農産物の外観検査装置
US8081818B2 (en) * 2004-09-15 2011-12-20 Adobe Systems Incorporated Locating a feature in a digital image
CN103760165B (zh) * 2013-12-31 2016-08-17 深圳市华星光电技术有限公司 显示面板的缺陷检测方法及缺陷检测装置
JP6370177B2 (ja) * 2014-09-05 2018-08-08 株式会社Screenホールディングス 検査装置および検査方法
DE102015204800B3 (de) * 2015-03-17 2016-12-01 MTU Aero Engines AG Verfahren und Vorrichtung zur Qualitätsbeurteilung eines mittels eines additiven Herstellungsverfahrens hergestellten Bauteils
JP6603709B2 (ja) * 2015-04-23 2019-11-06 オリンパス株式会社 画像処理装置、画像処理方法および画像処理プログラム
JP6585992B2 (ja) * 2015-10-16 2019-10-02 株式会社キーエンス 画像検査装置
JP2017217784A (ja) * 2016-06-06 2017-12-14 フロイント産業株式会社 固形製剤印刷機及び固形製剤印刷方法

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0921755A (ja) * 1995-07-05 1997-01-21 Suinku:Kk 検査用搬送装置および検査装置
JPH10104166A (ja) * 1996-09-27 1998-04-24 Sumitomo Electric Ind Ltd 結晶体の品質評価方法および装置
JP2000242791A (ja) * 1999-02-23 2000-09-08 Mitsubishi Heavy Ind Ltd 画像処理方法
JP2005172608A (ja) * 2003-12-11 2005-06-30 Nichizou Imc:Kk 外観検査装置
JP2005241488A (ja) * 2004-02-27 2005-09-08 Sankyo:Kk 直視面と非直視面とを同時に撮影する撮像装置並びにこれを適用した錠剤検査用撮像システム
JP2007327751A (ja) * 2006-06-06 2007-12-20 Ckd Corp 外観検査装置及びptpシートの製造装置
JP2009031247A (ja) * 2007-12-28 2009-02-12 Lion Engineering Co Ltd 物品の外観検査装置および表面検査装置
JP2010261837A (ja) * 2009-05-08 2010-11-18 Ikegami Tsushinki Co Ltd 外観検査装置及び外観検査用の光学装置
JP2011137704A (ja) * 2009-12-28 2011-07-14 Lion Engineering Co Ltd 外観検査装置、表面検査装置、及び外観検査方法
US20120293623A1 (en) * 2011-05-17 2012-11-22 Gii Acquisition, Llc Dba General Inspection, Llc Method and system for inspecting small manufactured objects at a plurality of inspection stations and sorting the inspected objects
JP2017096821A (ja) * 2015-11-26 2017-06-01 Ckd株式会社 外観検査装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110930390A (zh) * 2019-11-22 2020-03-27 郑州智利信信息技术有限公司 基于半监督深度学习的芯片管脚缺失检测方法

Also Published As

Publication number Publication date
CN111602047A (zh) 2020-08-28
CN116973369A (zh) 2023-10-31
CN111602047B (zh) 2023-08-18

Similar Documents

Publication Publication Date Title
KR100301976B1 (ko) 비접촉표면결함검출방법및장치
JP6576059B2 (ja) 情報処理、情報処理方法、プログラム
US7099002B2 (en) Defect detector and method of detecting defect
JP6922539B2 (ja) 表面欠陥判定方法および表面欠陥検査装置
TWI778078B (zh) 用於自動缺陷分類之方法及系統以及相關非暫時性電腦程式產品
WO2017141611A1 (ja) 欠陥検出装置、欠陥検出方法およびプログラム
US20070053580A1 (en) Image defect inspection apparatus, image defect inspection system, defect classifying apparatus, and image defect inspection method
KR101679650B1 (ko) 홀 내부의 결함 검출방법
JP5086970B2 (ja) 木材の外観検査装置、木材の外観検査方法
JP5109633B2 (ja) 測定方法及び検査方法並びに測定装置及び検査装置
JP4739044B2 (ja) 外観検査装置
JP2009293999A (ja) 木材欠陥検出装置
WO2017141813A1 (ja) 卵の表面検査装置
WO2019138930A1 (ja) 錠剤検査方法および錠剤検査装置
US20200408698A1 (en) Apparatus and method for inspecting a glass sheet
JP2000180382A (ja) 外観検査装置
JP7083646B2 (ja) 錠剤検査方法および錠剤検査装置
JP4910800B2 (ja) ネジ部品の検査装置および検査方法
JP6623545B2 (ja) 検査システム、検査方法、プログラムおよび記憶媒体
JP2012237585A (ja) 欠陥検査方法
JP7075218B2 (ja) 錠剤検査方法および錠剤検査装置
JP2002243655A (ja) 電子部品の外観検査方法および外観検査装置
JP6597469B2 (ja) 欠陥検査装置
JP6566903B2 (ja) 表面欠陥検出方法および表面欠陥検出装置
JP6980538B2 (ja) 錠剤検査方法および錠剤検査装置

Legal Events

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

Ref document number: 18899829

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18899829

Country of ref document: EP

Kind code of ref document: A1