Image processing device
The image processing device addresses dynamic range issues in workpiece inspection by optimizing tone conversion for each image, ensuring robust gradation and uniformity, enabling efficient inspection of moving workpieces with improved image quality.
Patent Information
- Application Number
- JP2023058153
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-15
AI Technical Summary
Existing image inspection methods for workpieces face challenges in dynamic range expansion due to varying material and size, leading to insufficient brightness uniformity and difficulty in handling moving workpieces, especially with one-shot HDR, which lacks robustness against posture changes and ambient light variations.
An image processing device that captures and converts workpiece images using tone conversion conditions tailored to each image, optimizing gradation ranges and suppressing high-frequency component attenuation, while combining multiple images for improved S/N ratio.
Enables highly robust gradation conversion across varying workpiece conditions, maintaining image quality and facilitating efficient inspection of moving workpieces without multiple captures, enhancing inspection responsiveness and uniformity.
Smart Images

Figure 2024145691000001_ABST
Abstract
Description
[Technical field]
[0001] The present disclosure relates to an image processing device that processes a workpiece image obtained by capturing an image of a workpiece. [Background technology]
[0002] In image inspection using workpiece images, the difference in brightness in the workpiece image is likely to be large depending on the material and size of the workpiece, and as a result, the dynamic range may be insufficient, making it impossible to perform image inspection. For example, in the case of a workpiece image of a metal workpiece, the light reflectance of the surface of the metal workpiece is high, so bright areas tend to appear on the workpiece image. In addition, in the case of a large workpiece, uneven lighting is likely to occur, and some parts of the workpiece image tend to be dark.
[0003] Known methods for expanding the dynamic range of a work image include multi-shot HDR, which expands the dynamic range by combining multiple images each captured with a different exposure time, and one-shot HDR, which determines a tone mapping curve for a work image in advance and performs gradation conversion of the work image in accordance with the determined tone mapping curve, as disclosed in Patent Document 1, for example. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] JP 2015-232478 A Summary of the Invention [Problem to be solved by the invention]
[0005] However, when trying to use multi-shot HDR for in-line inspection in which the same type of workpiece is inspected sequentially, there are issues such as a decrease in takt time as one workpiece is imaged multiple times, and it being difficult to inspect moving workpieces.
[0006] On the other hand, one-shot HDR can obtain images with a wide dynamic range with just one capture, so there is no decrease in tact time like with multi-shot HDR, and it is also superior to multi-shot HDR in that it can handle moving workpieces.
[0007] However, in in-line inspection, workpieces may be transported in different postures, and when the posture of the workpiece changes, the reflection of light changes, and the predetermined tone mapping may not be able to handle it. In addition, the influence of ambient light may also make the predetermined tone mapping unable to handle it. In other words, while applying one-shot HDR has the advantage of not causing a decrease in takt time and being able to handle the inspection of moving workpieces, it has the problem of low robustness.
[0008] The present disclosure has been made in consideration of these points, and has as its purpose to enable highly robust gradation conversion regardless of the gradation range of the input work image. [Means for solving the problem]
[0009] In order to achieve the above object, one aspect of the present disclosure can be based on an image processing device including an imaging unit that captures an image of a workpiece and generates a workpiece image, and an image generating unit that converts the workpiece images sequentially input from the imaging unit to generate an output image having a gradation value in a predetermined gradation range. The image generating unit generates, for each input workpiece image, a gradation conversion condition for converting a first gradation value in the input workpiece image to a minimum gradation value in the predetermined gradation range and converting a second gradation value in the workpiece image that is higher than the first gradation value to a maximum gradation value in the predetermined gradation range, and performs gradation conversion on each gradation value of the input workpiece image using the gradation conversion condition corresponding to the workpiece image, thereby generating an output image having a gradation value in the predetermined gradation range.
[0010] According to this configuration, when the workpiece images generated by the imaging unit are sequentially input to the image generating unit, gradation conversion conditions are generated for each workpiece image. For example, even if the degree of light reflection on the surface differs for each workpiece image, such as a metal workpiece, gradation conversion conditions suitable for each workpiece image are generated. Also, even if the influence of disturbance light differs for each workpiece image, gradation conversion conditions suitable for each workpiece image are generated. Then, the gradation of the workpiece image is converted using the gradation conversion conditions corresponding to the workpiece image, so that the gradation of the workpiece image is optimized without capturing images multiple times.
[0011] The image processing device may further include an input unit for receiving from a user a parameter designation related to the input image or the output image. In this case, the image generating unit can determine the predetermined gradation range according to the parameter received by the input unit, so that the user's intention regarding the gradation range of the output image can be reflected.
[0012] The parameters may include a parameter for changing the width of the predetermined gradation range by changing both the maximum gradation value and the minimum gradation value of the predetermined gradation range, a parameter for changing the position of the predetermined gradation range in the entire gradation range while maintaining the width of the predetermined gradation range, a parameter for changing a threshold value that is an upper limit value of the second gradation value, etc. Also, the first gradation value can be the minimum gradation value of an input work image. Also, the second gradation value can be the maximum gradation value of the input work image.
[0013] The image generating unit may extract low-frequency components of the workpiece image for each of the input workpiece images, generate tone conversion conditions based on the low-frequency components, convert the low-frequency components using the tone conversion conditions based on the low-frequency components, and generate the output image based on the low-frequency components after the tone conversion. That is, the high-frequency components of the workpiece image are areas where light and dark contrasts are finely arranged, and pixels with high tone values exist. If tone conversion conditions are generated including the high-frequency components of the workpiece image, there is a risk that the high-frequency components will be attenuated. In this configuration, by generating tone conversion conditions based on the low-frequency image of the workpiece image, it is possible to suppress attenuation of the high-frequency components due to tone conversion.
[0014] The image generating unit may further extract high-frequency components excluding the low-frequency components for each of the input workpiece images, apply a gain calculated from a tone conversion condition based on the low-frequency components to the high-frequency components, and generate the output image based on the low-frequency components after the tone conversion and the high-frequency components to which the gain has been applied. This allows tone conversion suitable for each of the low-frequency components and high-frequency components of the workpiece image to be performed.
[0015] The image processing device may further include an input unit that receives, from a user, parameter designation for when the image generating unit extracts the low-frequency components. In this case, the image generating unit can extract low-frequency components having magnitudes according to the parameters received by the input unit, so that the user's intention can be reflected when extracting the low-frequency components.
[0016] The image generating unit may generate the workpiece image by synthesizing a plurality of images obtained by sequentially capturing images of the same workpiece using the imaging unit. With this configuration, the gradation conversion conditions can be generated using an input image with a good S / N ratio obtained by synthesizing a plurality of images, so that the gradation conversion conditions become more appropriate.
[0017] When the input work image is a color image, the image generating unit can generate the output image by converting the saturation of pixels having a gradation value equal to or less than a first threshold in the work image to a predetermined value or less. For example, if the gradation value of a dark area with a poor S / N ratio is increased, false colors caused by noise may become noticeable in the work image. However, according to this configuration, when the gradation value of the input work image is quite low, the saturation of the pixels having a low gradation value can be reduced to remove the color. This makes the false colors less noticeable. For example, the saturation of pixels having a gradation value equal to or less than the first threshold may be set to 0.
[0018] When the input work image is a color image, the image generation unit may generate the output image by continuously converting the saturation of pixels in the work image having a gradation value greater than the first threshold value and less than or equal to a second threshold value in accordance with the gradation value. Effect of the Invention
[0019] As described above, gradation conversion conditions are generated for each work image for converting the first gradation value in the input work image to the minimum gradation value in a predetermined gradation range and converting the second gradation value higher than the first gradation value to the maximum gradation value in the predetermined gradation range, and gradation conversion is performed for each work image using the gradation conversion conditions corresponding to the work image, making it possible to achieve highly robust gradation conversion regardless of the gradation range of the input work image. [Brief description of the drawings]
[0020] [Figure 1] 1 is a schematic diagram illustrating a configuration of an image processing device according to an embodiment of the present invention. [Diagram 2] FIG. 1 is a block diagram of an image processing device. [Diagram 3] 13 is a flowchart showing an example of a processing procedure for tone conversion. [Figure 4] FIG. 4A is a screen for setting conditions, and FIG. 4B is a screen for setting a mapping range. [Diagram 5]FIG. 2 is a diagram showing a processing flow until an output image is generated from an input image. [Figure 6] FIG. 1 is a diagram illustrating a concept of tone conversion. [Figure 7] 7 is a diagram corresponding to FIG. 6 and illustrating a case where gains are applied to high-frequency components and low-frequency components in a workpiece image. [Figure 8A] 11 is a graph showing a difference in the slope of a linear transformation depending on a mapping range. [Figure 8B] 11A and 11B are diagrams showing differences in images obtained depending on the settings of the mapping range. [Figure 9A] 11 is a graph showing the difference in linear conversion depending on the brightness setting. [Figure 9B] FIG. 13 is a diagram showing differences in images obtained under different brightness setting conditions. [Figure 10A] 11 is a graph showing a difference in linear conversion depending on the setting of halation suppression. [Figure 10B] FIG. 11 is a diagram showing the difference in images obtained under each setting condition for halation suppression. [Figure 11] FIG. 6 is a diagram equivalent to FIG. 5 in the case where the input image is a color image. [Figure 12] 1 is a graph showing the relationship between α and V. [Figure 13] 11 is a graph showing a specific example during operation. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0021] Hereinafter, the embodiments of the present invention will be described in detail with reference to the drawings. Note that the following description of the preferred embodiments is merely illustrative in nature and is not intended to limit the present invention, its applications, or its uses.
[0022] Fig. 1 is a diagram showing a configuration of an image processing device 1 according to an embodiment of the present invention, and Fig. 2 is a block diagram of the image processing device 1. Fig. 1 shows the image processing device 1 during operation, and the image processing device 1 includes a camera 2 that captures an image of a workpiece W, and an image processing controller 3 that performs inspection and the like based on a workpiece image generated by the camera 2. The image processing device 1 may also include an external device 4 such as a PLC (Programmable Logic Controller), and the external device 4 may or may not be a component of the image processing device 1.
[0023] The image processing device 1 is used at a site where multiple workpieces W are transported in sequence. At such a site, the workpieces W are transported at a predetermined speed by a transport device such as a belt conveyor C. The camera 2 is controlled by, for example, an external device 4 or an image processing controller 3 so as to capture an image of the workpiece W transported by the belt conveyor C when the workpiece W enters the field of view of the camera 2. By repeating this process, the camera 2 sequentially captures images of the multiple workpieces W transported by the belt conveyor C.
[0024] The image processing device 1 also includes lighting 5 (shown in FIG. 2) that irradiates light onto the workpiece W when the workpiece W is imaged by the camera 2. In this embodiment, a case will be described in which the lighting 5 is provided in the camera 2, but the lighting 5 may be an external lighting separate from the camera 2.
[0025] Although not shown, the camera 2 can also capture an image of a stationary workpiece W. The camera 2 can also be operated in a state where it is attached to, for example, a robot arm, and the operation form of the image processing device 1 is not particularly limited.
[0026] The workpiece W may have any shape and size. The workpiece W includes, for example, a metallic workpiece having a glossy surface.
[0027] In addition to the illumination 5, the camera 2 includes an optical system 20 composed of multiple lenses, a sensor board 21, a main board 22, a storage unit 23, and an input / output terminal 24. Light irradiated onto the workpiece W by the illumination 5 and reflected by the surface of the workpiece W, natural light reflected by the surface of the workpiece W, and ambient light are incident on the optical system 20.
[0028] The sensor board 21 and the main board 22 are connected to each other so that they can communicate with each other. The sensor board 21 is provided with an image sensor 21A. The image sensor 21A has a light receiving surface composed of a number of light receiving elements, such as a CMOS image sensor or a CCD image sensor. The image sensor 21A is provided with an imaging control unit 21a and a photoelectric conversion unit 21b. The imaging control unit 21a is a unit that controls the exposure time and gain of the image sensor 21A. The photoelectric conversion unit 21b is a unit that converts the intensity of light emitted from the optical system 20 and received at the light receiving surface into an amount of charge and an electrical signal to generate a workpiece image by capturing an image of the workpiece W. Therefore, the image sensor 21A is a member corresponding to an example of the imaging unit of the present invention, and at a site where the workpieces W are transported sequentially as shown in FIG. 1, the image sensor 21A sequentially generates and outputs workpiece images.
[0029] The camera 2 outputs the generated workpiece image to the main board 22. The main board 22 is provided with a calculation unit 22A, an image sensor control unit 22B, and an output unit 22C. The calculation unit 22A, the image sensor control unit 22B, and the output unit 22C are configured with hardware such as a processor such as a CPU or an ASIC, a RAM, and a ROM, and the hardware executes a predetermined program, which enables the calculation unit 22A, the image sensor control unit 22B, and the output unit 22C to execute processing. The program is stored in the ROM, the storage unit 23, or the like.
[0030] The calculation unit 22A includes an image generation unit 22a to which the workpiece images generated by the camera 2 are input. The image generation unit 22a, which will be described in detail later, is a part that converts the workpiece images sequentially input from the camera 2 and generates an output image having a gradation value in a predetermined gradation range. In this example, a case where the image generation unit 22a is incorporated in the camera 2 will be described, but the image generation unit 22a may be incorporated in the image processing controller 3, or may be incorporated in a device separate from the camera 2 and the image processing controller 3.
[0031] The image sensor control unit 22B is a unit that outputs a control signal to the imaging control unit 21a of the image sensor 21A, and the imaging control unit 21a controls the exposure time and the gain so that the exposure time is a predetermined time and the gain is a predetermined gain based on the control signal output from the image sensor control unit 22B. The output unit 22C is a unit that outputs the output image generated by the image generation unit 22a to the storage unit 23, the input / output terminal 24, etc.
[0032] The storage unit 23 is configured, for example, with a storage device using an integrated circuit, and is connected to the main board 22 so as to be able to transmit and receive data to and from the main board 22. It is possible to store data (including image data, etc.) generated on the main board 22 side in the storage unit 23, and to read data stored in the storage unit 23 from the main board 22 side.
[0033] The input / output terminal 24 is connected to the main board 22, and is capable of transmitting and receiving various signals to and from the main board 22. The input / output terminal 24 may be configured to include, for example, a communication interface, and is a member that is communicatively connected to the image processing controller 3. The input / output terminal 24 of the camera 2 and the image processing controller 3 are connected by a communication line 6. Furthermore, when the external device 4 shown in FIG. 1 is installed, the external device 4 and the input / output terminal 24 of the camera 2 are connected by another communication line 7.
[0034] The image processing controller 3 includes a main body 30, a monitor 31, and an operation unit 32. As shown in Fig. 2, the main body 30 includes a control unit 30a, a storage unit 30b, and an input unit 30c. The control unit 30a and the input unit 30c are configured with hardware such as a processor, for example, a CPU or an ASIC, a RAM, and a ROM, and the hardware executes a predetermined program, whereby the control unit 30a executes various processes and the input unit 30c can accept various operations by the user.
[0035] The control unit 30a acquires a workpiece image via the input / output terminal 24 of the camera 2, and then inspects the workpiece W based on the acquired workpiece image. The inspection includes, for example, judging whether there is a scratch, whether the measured dimensions are within a tolerance range, and whether the workpiece W is a good or defective product. The control unit 30a outputs the inspection result to the memory unit 30b for storage. The control unit 30a can also output the inspection result to the monitor 31 and display it on the monitor 31. The monitor 31 is, for example, configured with a liquid crystal display device, an organic EL display device, or the like.
[0036] The operation unit 32 is composed of operation devices and the like for the user to perform various input operations. When the operation unit 32 is operated, the operation content is received by the input unit 30c. The operation unit 32 includes, for example, a keyboard 32a, a mouse 32b, and the like. Although not shown, the operation unit 32 may include a touch panel. The touch panel is configured to be able to detect a touch operation by the user. The touch panel and the monitor 31 may be integrated together, in which case, for example, a user interface displayed on the monitor 31 can be directly operated by the touch panel.
[0037] (Details of the image generation section) Next, the image generating unit 22a provided in the camera 2 will be described in detail. The image generating unit 22a is a part that generates a gradation conversion condition for gradation conversion of the input work image for each input work image, and converts each gradation value of the input work image for each input work image using the gradation conversion condition corresponding to the work image, thereby generating an output image having a gradation value in a predetermined gradation range. The gradation conversion condition is a conversion condition for converting a first gradation value in the input work image to a minimum gradation value in a predetermined gradation range, and converting a second gradation value higher than the first gradation value in the same work image to a maximum gradation value in a predetermined gradation range. Note that gradation conversion is also called tone mapping.
[0038] An example of the tone conversion process will be described below with reference to the flowchart shown in Fig. 3. By executing the process shown in this flowchart, highly robust tone conversion can be achieved regardless of the tone range of the input work image.
[0039] In step SA1 after the start, the input unit 30c accepts input of imaging conditions and parameters, which makes it possible to dynamically determine the mapping range, that is, the width of the tone distribution of the output image, based on the tone values of the input image.
[0040] Specifically, the input unit 30c generates a condition setting screen 100 shown in FIG. 4A in Fig. 4, and displays it on the monitor 31. The condition setting screen 100 is provided with a stack number input area 101 for setting the number of images to be captured, an edge enhancement setting area 102 for setting the degree of the edge enhancement effect, a mapping range designation area 103 for designating a mapping range, a moving object tracking setting area 104 for setting the moving object tracking function, and a disturbance light elimination setting area 105 for setting disturbance light elimination.
[0041] In the stack number input area 101, it is possible to input the number of times the same workpiece W is to be imaged by the camera 2. When the user operates the operation unit 32 to input a desired number in the stack number input area 101, the input number is accepted by the input unit 30c as the number of times images are to be taken by the camera 2. The number of times images are taken accepted by the input unit 30c is stored in the storage unit 30b or the like. The number of times images are taken may be an arbitrary number that the user can input, or may be set, for example, between 1 and 8 times. The number of times images are to be taken may be selectable using a pull-down menu or the like.
[0042] In the edge emphasis setting area 102, the degree of emphasis of the high frequency components of the workpiece image can be set. When the user operates the operation unit 32 to select the degree of emphasis of the high frequency components of the workpiece image from among "small," "medium," "large," etc., the selected degree of emphasis is accepted by the input unit 30c as the degree of emphasis of the high frequency components of the workpiece image. The degree of emphasis of the high frequency components accepted by the input unit 30c is stored in the memory unit 30b, etc. The degree of emphasis of the high frequency components is not limited to three levels, and may be two levels, or four or more levels.
[0043] When the mapping range designation area 103 is operated by the operation unit 32, the input unit 30c generates a mapping range setting screen 110 shown in FIG. 4B and displays it on the monitor 31. The mapping range setting screen 110 is provided with a distribution range setting area 111, a brightness setting area 112, and a halation suppression setting area 113.
[0044] In the distribution range setting area 111, the size of the mapping range can be set. The narrower the mapping range, the more the low gradation pixels can be emphasized. In the distribution range setting area 111, a range selected by the user from among options such as "full range", "medium", "small", and "flat" by operating the operation unit 32 is input as the mapping range. The input mapping range is accepted by the input unit 30c. The mapping range accepted by the input unit 30c is stored in the storage unit 30b or the like. The parameter that determines the mapping range is a parameter for changing the width of the predetermined gradation range by changing both the maximum gradation value and the minimum gradation value of the above-mentioned predetermined gradation range. The setting of the mapping range is not limited to three stages.
[0045] In the brightness setting area 112, the brightness level of the output image can be set, and the brightness of the output image is set to a brightness corresponding to a number selected by the user by operating the operation unit 32 from among options such as "1", "2", and "3". "3" indicates the brightest and "1" indicates the darkest. The above options are only examples, and options using other expressions may be used, or an area in which the user can set any brightness may be provided. When the brightness level is changed, the mapping range set in the distribution range setting area 111 is translated without changing the width of the mapping range. In other words, the brightness level is a parameter for changing the position of the predetermined gradation range in the entire gradation range while maintaining the width of the predetermined gradation range. The entire gradation range is, for example, a gradation value of 0 to 255.
[0046] In the halation suppression setting area 113, the user can select from options such as "large", "medium", and "small" by operating the operation unit 32 to set the desired halation suppression effect. "Large" indicates a high halation suppression effect, and "small" indicates a low halation suppression effect. The halation of the work image is suppressed so as to correspond to the halation suppression effect set by the user. Hashing refers to blown-out highlights in the output image. For example, if you want to increase the pixel value of the low gradation part even if you allow halation, set the halation suppression effect to "small". On the other hand, if you want to suppress blown-out highlights in the output image, set the halation suppression effect to "large". In other words, the maximum gradation value referenced by the gradation value of the input image is set by the halation suppression setting. The halation suppression setting is accepted by the input unit 30c and stored in the storage unit 30b or the like. The gradation threshold is determined by the halation suppression setting. The gradation threshold is a parameter for changing the threshold value that is the upper limit value of the second gradation value.
[0047] In the moving object tracking setting area 104 shown in FIG. 4A, a setting can be made for tracking the inspection area when the workpiece W is moving. In the disturbance light elimination setting area 105, a setting can be made for eliminating or reducing the influence of disturbance light when the influence of disturbance light is occurring on the workpiece image. The settings in the moving object tracking setting area 104 and the disturbance light elimination setting area 105 are accepted by the input unit 30c and stored in the memory unit 30b, etc.
[0048] In step SA1, since the filter size can be set as one of the parameters for the edge enhancement, the filter size set by the user operating the operation unit 32 is accepted by the input unit 30c and stored in the storage unit 30b or the like. The filter size setting can also be said to be a setting of the degree of blurring of the input image, and the degree of blurring of the input image can be changed by changing the filter size. In this manner, the input unit 30c can accept the specification of parameters related to the input image or output image from the user. The filter size is a parameter when the image generating unit 22a described later extracts low-frequency components from the work image, and the input unit 30c also accepts the specification of the parameters when extracting the low-frequency components from the user.
[0049] In step SA2, the imaging conditions and parameters input in step SA1 are transmitted to camera 2 via communication line 6, and the settings of the imaging conditions and parameters of camera 2 are changed to become the transmitted imaging conditions and parameters, and stored in memory unit 23 of camera 2. Thereafter, calculation unit 22A, image sensor control unit 22B, and output unit 22C execute each process according to the changed imaging conditions and parameters.
[0050] In step SA3, the camera 2 receives an input of a trigger to start imaging by the camera 2. The trigger is transmitted from the external device 4 or the image processing controller 3 and is received by the calculation unit 22A via the input / output terminal 24. When the calculation unit 22A receives the trigger, the image sensor 21A is controlled via the image sensor control unit 22B to image the workpiece W. As a result, a workpiece image is generated. The generated workpiece image is stored in the memory unit 23.
[0051] In step SA4, it is determined whether or not imaging has been completed the number of times set in step SA1. If step SA4 is determined as NO and imaging has not been completed the number of times set in step SA1, a new workpiece image is generated through step SA3, and then the process proceeds to step SA4. If step SA4 is determined as YES and imaging has been completed the number of times set in step SA1, the process proceeds to step SA5. When steps SA3 and SA4 are performed multiple times, the exposure time is not changed. This results in multiple workpiece images being generated with the same exposure time.
[0052] In step SA5, when a plurality of workpiece images are generated through steps SA3 and SA4, the image generating unit 22a synthesizes the plurality of workpiece images into one workpiece image. As shown in FIG. 5, when a plurality of workpiece images are generated through steps SA3 and SA4, a plurality of original images 200 are acquired, and a workpiece image is generated as an added image 202 by simply performing an addition process 201 on the original images 200. In other words, the image generating unit 22a is a part that synthesizes a plurality of images obtained by sequentially capturing the same workpiece W by the image sensor 21A to generate one workpiece image. By synthesizing a plurality of images, a workpiece image with a good S / N ratio can be obtained. Note that, when the number of times of capturing images is 1, the synthesis process is not executed and the process proceeds to step SA6.
[0053] In step SA6 shown in FIG. 3, the image generating unit 22a determines a predetermined gradation range according to the parameters received by the input unit 30c. When determining the predetermined gradation range, the image generating unit 22a acquires the maximum gradation value and the minimum gradation value of the workpiece image in a gradation range smaller than the gradation threshold in the workpiece image generated in step SA5 (the workpiece image generated in step SA3 if the number of times of imaging is 1). As described above, the gradation threshold is determined when setting the halation suppression, and as shown in FIG. 5, the image generating unit 22a acquires the maximum gradation value and the minimum gradation value 204, and stores them as Hmax and Hmin 205, respectively. At this time, the minimum gradation value of the inputted workpiece image can be set as the first gradation value, and the maximum gradation value of the inputted workpiece image can be set as the second gradation value.
[0054] In step SA7 shown in FIG. 3, the image generating unit 22a separates the low-frequency components and high-frequency components of the workpiece image. Specifically, the image generating unit 22a applies an averaging filter to the workpiece image to blur the workpiece image. At this time, as shown in FIG. 5, the image generating unit 22a reads the filter size 206 set as described above, and the strength of the averaging filter is set so as to provide a degree of blurring according to the read filter size and is applied to the workpiece image. Then, the image generating unit 22a executes low-frequency component calculation 207 to extract the low-frequency components of the workpiece image and generate a low-frequency image 208. That is, since the input unit 30c accepts the designation of the filter size as a parameter for extracting the low-frequency components of the workpiece image, the image generating unit 22a can extract low-frequency components having a magnitude according to this filter size.
[0055] Furthermore, the image generating unit 22a executes high frequency component calculation 209 to generate a high frequency image 210 which is a high frequency component of the workpiece image. In the high frequency component calculation 209, a calculation is performed to subtract the low frequency image 208 from the post-addition image 202. In this manner, the image generating unit 22a can further extract high frequency components excluding low frequency components for each input workpiece image.
[0056] In step SA8 in FIG. 3, the image generating unit 22a executes a gradation conversion process of the low-frequency components extracted in step SA7. As shown in FIG. 5, when the image generating unit 22a executes the gradation conversion 211, a mapping range (Lmax, Lmin) 212 is acquired. The gradation conversion 211 can be explained based on the conceptual diagram shown in FIG. 6, for example. The horizontal axis of the graph shown in FIG. 6 represents the gradation range of the input image, and the vertical axis represents the gradation range of the output image. If the minimum gradation value (Hmin) on the horizontal axis represents the minimum gradation value in the input image, and the maximum gradation value (Hmax) represents the maximum gradation value in the input image, an image after gradation conversion is generated for the image before gradation conversion. In FIG. 5, it becomes a low-frequency image after gradation conversion 213. During gradation conversion, the image generating unit 22a applies a gain to each pixel according to the gradation value before gradation conversion.
[0057] In this way, the image generating unit 22a extracts the low-frequency components of each input workpiece image, generates tone conversion conditions based on the low-frequency components, and performs tone conversion on the low-frequency components using the tone conversion conditions based on the extracted low-frequency components, and generates an output image based on the tone-converted low-frequency components.
[0058] In step SA8 shown in Fig. 3, the image generating unit 22a applies a gain to the high frequency components obtained in step SA7. Specifically, the image generating unit 22a applies the gain calculated from the tone conversion conditions based on the low frequency components to the high frequency components (high frequency image 210 shown in Fig. 5) (indicated by reference numeral 214 in Fig. 5). As a result, a post-gain application high frequency image 215 is generated.
[0059] 7 conceptually shows the case where high frequency components are emphasized, and the gain applied to the low frequency components can be applied to the high frequency components. This makes it possible to emphasize, for example, weakly irradiated areas from the lighting 5, or to emphasize the edges (high frequency components) of dark areas of a workpiece W with high contrast. An example of a workpiece W with high contrast is a workpiece made of a combination of metal and resin.
[0060] Here, the high-frequency components in the workpiece image are generally areas with high black-and-white contrast, and therefore have relatively high gradation values. For this reason, when determining the gain to be applied to the high-frequency image 210, if the gain is determined based on the post-addition image 202, there is a risk that the high-frequency components will be attenuated. In this example, when determining the gain to be applied to the high-frequency image 210, the gain is determined based on the low-frequency components in the workpiece image, so that attenuation of the high-frequency components in the workpiece image can be suppressed and the high-frequency components can be maintained.
[0061] FIG. 8A is a graph showing the difference in the slope of linear conversion depending on the mapping range. FIG. 8B is a diagram showing the difference in images obtained for each setting of the mapping range. The slope of linear conversion is the conversion characteristic applied during tone conversion in step SA8, and the horizontal axis of the graph shown in FIG. 8A is the tone value of the input image, and the vertical axis is the tone value of the output image. When the mapping range is set to "full range", the slope is the steepest. When the mapping range is set to "full range", gamma correction may be performed. When gamma correction is performed, the graph is curved upward.
[0062] When the mapping range is set to "flat", the slope is 0. The image obtained with "flat" is an image where only the edges are emphasized. When the mapping range is set to "medium", the slope is steeper than when it is set to "small".
[0063] FIG. 9A is a graph showing the difference in linear conversion depending on the brightness setting, and FIG. 9B is a diagram showing the difference in images obtained for each brightness setting. The horizontal axis of FIG. 9A is the gradation value of the input image, and the vertical axis is the gradation value of the output image. As shown in this graph, when the brightest "3" is selected, the entire mapping range is set in the direction of higher gradation values compared to when "2" or "1" is selected. On the other hand, when the darkest "1" is selected, the entire mapping range is set in the direction of lower gradation values compared to when "3" or "2" is selected.
[0064] Fig. 10A is a graph showing the difference in linear conversion depending on the halation suppression setting, and Fig. 10B is a graph showing the difference in images obtained for each halation suppression setting. The horizontal axis of Fig. 10A is the gradation value of the input image, and the vertical axis is the gradation value of the output image. As shown in this graph, the smaller the halation suppression effect, the steeper the slope becomes, and conversely, the greater the halation suppression effect, the gentler the slope becomes. Regardless of the halation suppression effect, the y-intercept is fixed to a specified value. Gradation thresholds are set for each of the halation suppression effects: "large," "medium," and "small."
[0065] In step SA10 of FIG. 3, the image generating unit 22a synthesizes the image of the low-frequency components (low-frequency image) after the tone conversion process in step SA8 and the image of the high-frequency components (high-frequency image) after the gain application in step SA9. As shown in FIG. 5, the image generating unit 22a executes an addition process 216 of adding the tone-converted low-frequency image 213 and the gain-applied high-frequency image 215. This generates an output image 217. In step SA11 of FIG. 3, the output unit 22C acquires the output image generated through step SA10, outputs it to the image processing controller 3 via the input / output terminal 24, and displays it on the monitor 31. In addition, the control unit 30a of the image processing controller 3 executes an inspection process based on the output image. The inspection result can also be displayed on the monitor 31.
[0066] (Color false color suppression) When the workpiece image is a color image, executing a gradation conversion process may result in, for example, increasing the gradation value of dark areas with poor S / N ratios. Increasing the gradation value of dark areas with poor S / N ratios may cause false colors caused by noise generated when the workpiece image was acquired to stand out in the workpiece image. This embodiment is equipped with a function to suppress false colors caused by such causes.
[0067] The function of suppressing false colors can be executed by the image generating unit 22a. When the input work image is a color image, the image generating unit 22a is configured to generate an output image by converting the saturation of pixels having a gradation value equal to or less than a first threshold in the work image to a predetermined value or less. In addition, when the input work image is a color image, the image generating unit 22a can also generate an output image by continuously converting the saturation of pixels having a gradation value greater than the first threshold and equal to or less than a second threshold in the work image according to the gradation value. In other words, when the gradation value of the input work image is quite low, the saturation of the pixels having the low gradation value can be lowered to eliminate the color, so that the false color becomes less noticeable. The saturation of pixels having a gradation value equal to or less than the first threshold may be set to 0, for example.
[0068] A specific description will be given below with reference to FIG. 11. The original image 300 is a color image, and may be an image in which a plurality of workpiece images are synthesized, or an image composed of one workpiece image. The image generating unit 22a executes a maximum value calculation 301 of RGB of the input original image 300. At this time, it executes HSV conversion to generate a V image 302. The image generating unit 22a executes an averaging filter 303 of a filter size designated by the user on the V image 302. As a result, a low-frequency image 304 is generated.
[0069] The image generating unit 22a executes calculation 305 of Hmin (minimum gradation value) and calculation 306 of Hmax (maximum gradation value) to generate Hmin 307 and Hmax 308, respectively. The image generating unit 22a acquires the low-frequency image 304, Hmin 307, and Hmax 308 extracted from the V image 302, and executes gradation conversion 309 to generate a gradation-converted low-frequency image 310. In high-frequency gain calculation 311, a gain is calculated based on the low-frequency image to acquire h_Gain 312.
[0070] The image generating unit 22a generates a high frequency image 314 of the workpiece image by executing a high frequency component calculation 313 based on the V image 302 and the low frequency image 304. The image generating unit 22a applies h_Gain 312 to the high frequency image 314 (indicated by reference numeral 315 in FIG. 11). This generates a gain-application high frequency image 316. The image generating unit 22a executes an addition process 317 that adds the tone-converted low frequency image 310 and the gain-application high frequency image 316, thereby generating a V' image 318. In a gain calculation process 319, V' / V is calculated using a method similar to that of the high frequency gain calculation 311. As a result, a calculation value (scale) 320 is acquired.
[0071] On the other hand, the image generating unit 22a executes a ratio calculation process 321 by applying V_Lim1 and V_Lim2 to the V image 302 to obtain α. The following formula is used for the ratio calculation: V_Lim1 and V_Lim2 are predetermined thresholds.
[0072] 0≦α≦1 α = (V_Lim2-V) / (V_Lim2-V_Lim1)
[0073] FIG. 12 shows the relationship between α and V. V on the horizontal axis is the gradation value. α is 0 when the gradation value of the V image before gradation conversion is equal to or greater than the threshold (V_Lim2), and is greater than 0 when it is equal to or less than the threshold (V_Lim2). When α=0, X'=X×scale, and the converted values of R, G, and B depend on their original gradation values. When α=1, X'=V', and the converted values of R, G, and B do not depend on the value (X) before conversion. In other words, they are grayed out.
[0074] In addition, by setting V_Lim1 and V_Lim2 as predetermined threshold values, it becomes possible to continuously transition between the mode where α=0 and the mode where α=1, and the saturation of pixels can be continuously converted according to the gradation value.
[0075] After acquiring α as described above, the image generating unit 22a executes the gain adjustment process 322 using the original image 300, scale, and α. In this manner, a color output image 323 in which false colors are suppressed is generated.
[0076] (Specific examples during operation) Figure 13 is a graph showing a specific example during operation, where the horizontal and vertical axes are gradation values. Below is a histogram of low-frequency components, and the vertical axis below is the number of pixels.
[0077] The solid line graph shows the gradation conversion when the halation suppression is set to "large," and the gradation threshold value is a large value. The maximum gradation value of the input image is indicated by "Hmax1."
[0078] The dashed line graph shows the gradation conversion when the halation suppression is set to "small," and the gradation threshold value is a small value. The maximum gradation value of the input image is indicated by "Hmax2."
[0079] In the histogram, the part indicated by the symbol H is a convexity caused by halation. In this embodiment, by ignoring the part indicated by the symbol H and setting Hmax2 as the maximum gradation value, it is possible to lift the dark areas while suppressing the halation of the input image.
[0080] (Effects of the embodiment) As described above, when images generated by capturing images of the workpiece W being transported during operation of the image processing device 1 are input sequentially to the image generating unit 22a, gradation conversion conditions are generated for each workpiece image. For example, even if the degree of light reflection on the surface differs for each workpiece image, such as in the case of metal workpieces, gradation conversion conditions suitable for each workpiece image can be generated. Also, even if the influence of ambient light differs for each workpiece image, gradation conversion conditions suitable for each workpiece image can be generated. Then, the gradation of the workpiece image is converted using the gradation conversion conditions corresponding to the workpiece image, so the gradation of the workpiece image is optimized without capturing the image multiple times.
[0081] Gradation conversion makes it possible to highlight edges (contour information) while lifting dark areas of the workpiece image, thereby improving search response capabilities when performing inspection processing.
[0082] Furthermore, during operation, there may be cases where lighting is not uniform, leaving some parts of the field of view dark and making it impossible to inspect the workpiece image. However, by performing the tone conversion of this embodiment, it is possible to generate an image that looks as if it were illuminated with pseudo-uniform lighting by lifting up the dark parts of the workpiece image, thereby improving inspection capabilities.
[0083] The above-described embodiment is merely illustrative in all respects and should not be construed as limiting. Furthermore, all modifications and variations within the scope of the claims are within the scope of the present invention. [Industrial Applicability]
[0084] As described above, the image processing device according to the present disclosure can be used when processing a workpiece image obtained by capturing an image of a workpiece. [Explanation of symbols]
[0085] 1 Image processing device 21A Image sensor (imaging section) 22a Image generation unit 30c Input section
Claims
1. An imaging unit that captures an image of a workpiece and generates a workpiece image; and an image generating unit that converts the workpiece images sequentially input from the imaging unit to generate an output image having a gradation value in a predetermined gradation range, The image generating unit includes: A gradation conversion condition is generated for each input work image for converting a first gradation value in the input work image to a minimum gradation value in the predetermined gradation range and converting a second gradation value in the input work image that is higher than the first gradation value to a maximum gradation value in the predetermined gradation range; An image processing device that generates an output image having tone values within the specified tone range by converting each tone value of the input work image using tone conversion conditions corresponding to the work image.
2. 2. The image processing device according to claim 1, An input unit for receiving a parameter designation relating to an input image or an output image from a user, The image generation unit determines the predetermined gradation range in accordance with parameters received by the input unit.
3. 3. The image processing device according to claim 2, The image processing device, wherein the parameters include a parameter for changing the width of the predetermined gradation range by changing both the maximum gradation value and the minimum gradation value of the predetermined gradation range.
4. 3. The image processing device according to claim 2, An image processing device, wherein the parameters include a parameter for changing a position of the predetermined gradation range within an entire gradation range while maintaining the width of the predetermined gradation range.
5. 3. The image processing device according to claim 2, The image processing device, wherein the parameters include a parameter for changing a threshold value that is an upper limit value of the second gradation value.
6. 3. The image processing device according to claim 2, The first gradation value is a minimum gradation value of the input workpiece image, An image processing device, wherein the second gradation value is a maximum gradation value of the input work image.
7. 2. The image processing device according to claim 1, The image generating unit includes: For each of the input workpiece images, extracting low-frequency components of the workpiece image and generating tone conversion conditions based on the low-frequency components; an image processing device that performs gradation conversion on the low-frequency components using a gradation conversion condition based on the low-frequency components, and generates the output image based on the low-frequency components after the gradation conversion.
8. 8. The image processing device according to claim 7, The image generating unit includes: For each of the input workpiece images, high-frequency components are further extracted from the low-frequency components, and a gain calculated from a gradation conversion condition based on the low-frequency components is applied to the high-frequency components; an image processing device that generates the output image based on the low-frequency components after the tone conversion and the high-frequency components to which the gain has been applied.
9. 8. The image processing device according to claim 7, An input unit that receives, from a user, a parameter designation when the image generating unit extracts the low-frequency component, The image processing device wherein the image generation unit extracts low-frequency components having a magnitude according to the parameters received by the input unit.
10. 2. The image processing device according to claim 1, The image generation unit generates the workpiece image by synthesizing multiple images obtained by sequentially imaging the same workpiece using the imaging unit.
11. 2. The image processing device according to claim 1, The image generating unit includes: When the input work image is a color image, an image processing device generates the output image by converting the saturation of pixels in the work image that have a gradation value below a first threshold value to a predetermined value or less.
12. 12. The image processing device according to claim 11, The image generating unit includes: When the input work image is a color image, an image processing device generates the output image by continuously converting the saturation of pixels in the work image having a gradation value greater than the first threshold value and less than or equal to a second threshold value in accordance with the gradation value.
Citation Information
Patent Citations
Image processor
JP1996056316A
Luminance corrected image display device
JP2000011168A
Image processing method and apparatus
JP2004030142A
Adaptive saturation adjusting device having noise reducing function, and method therefor
JP2008148308A
Image processor and image processing method
JP2010079552A
