First, Long Rui vision software overview Long Rui is a comprehensive visual processing standard software system for configurable tasks independently developed by Shenzhen Vision Dragon Technology Co., Ltd. It supports a variety of Gigabit network cameras, detection task free configuration, multi-tasking, multi-station detection; toolkit coverage positioning, measurement, detection, search, logic judgment, and support for strings, multiple results, parallel output and image operations, etc. , has been applied in multiple visual positioning, dimensional measurement, defect detection projects. Second, the project solution 1, hardware solutions: A, light source selection Common light source Ring light source strip light source coaxial light source The role of light source and selection method The first function of machine vision application illumination is to create the maximum contrast between the features that need to be observed and the image features that need to be ignored, so that the features can be distinguished easily. The second is to maintain sufficient brightness to eliminate the interference of external light. To ensure the stability of the map. Choose a light source from the following two aspects. The color of the light source: We see an object in a certain color because it reflects the corresponding spectrum. If we want to color a certain color when shooting an object, we must use the same or similar light source (the wavelength of light is the same or close), and if it is to be black, we need to choose the wavelength difference from the target color. Larger light source. Since the background of the case is blue and the detection device is white, the background needs to be black, so the color of the light source is red, and the red LED has a long life, stability, and low price. More importantly, the wavelength of the red LED is closer to the sensitivity peak of the sensor. . The shape of the light source: the light source commonly used for machine vision includes a ring light source, a strip light source, a backlight source, a coaxial light source, etc., in view of the convenience of the installation of the mechanism and the uniform illumination of the illumination, the red hole backlight is selected in this case. B, camera selection Industrial cameras can be divided into black and white cameras and color cameras according to the color division of the phase. They can be divided into line array cameras and area array cameras according to the scanning method. They can be divided into CCD cameras and CMOS cameras according to the chip type. Camera selection should first clarify the project requirements, determine the accuracy requirements of the test product, determine the size of the field of view to be viewed by the camera, determine the speed of the object to be detected, and determine whether it is dynamic or static. Secondly determine the hardware type, select the camera data transmission interface: 1394, Gige (Gigabit network), USB, camera link. Then select the appropriate camera chip size according to the combination with the lens (the maximum compatible chip size of the lens is greater than or equal to the chip size of the camera) and the interface type (C or CS) with the lens. The error of the vision system hardware is unavoidable, generally guarantees the error between one and two pixels, so by calculating the formula: accuracy = field of view (length or width) ÷ camera pixels (length or width) For example: assume the field of view is 100*60, the accuracy requirement is 0.1. Considering the hardware error, the accuracy is 0.05 when the model is selected, then the pixel of the long side of the camera is 100÷0.05=2000, and the pixel of the short side is 60÷0.05=1200, then only the theoretical resolution is needed. A camera with a rate greater than or equal to 2000*1200 pixels can meet the demand. This project selects a camera with a resolution of 500 (2500pix*2000pix), a frame rate of 14 frames, a communication interface of Gige (Gigabit), and a C interface with a lens interface, depending on the field of view and accuracy. C, lens selection Do you need a telecentric lens? Telecentric lenses are generally considered for precision dimensional measurements. The telecentric lens is mainly designed to correct the parallax of traditional industrial lenses. It can be used within a certain object distance range, so that the image magnification will not change. It is divided into object telecentric, image telecentric and bilateral Telecentricity, where optical magnification = camera chip size / field of view size = chip (V) or (H) size / field of view (V) or (H), the larger the field of view, the smaller the magnification. In general, telecentric lenses have a fixed focal length and working distance, and some telecentric lenses are large and heavy, so you need to know in detail the customer's requirements for field of view, working distance, space constraints, and motion control. In order to determine the lens model to be selected. Depth of field of the lens The spatial distance that the camera can clearly image in the vertical direction is called the depth of field. The shorter the focal length, the larger the depth of field; the smaller the aperture, the greater the depth of field; the farther the lens is from the object, the greater the depth of field; the larger the depth of the camera chip, the greater the depth of field. Maximum compatible chip size for the lens The maximum compatible chip size of a machine vision lens must be greater than or equal to the camera's chip size, otherwise it will cause severe distortion and phase difference. Machine vision lens interface Machine vision lens interfaces and camera interfaces are divided into C, CS, F and other larger interface types. The camera and lens are complementary, that is, the C interface camera can only use the C interface lens, the CS interface camera can use the CS interface lens and the 5 mm ring C interface lens. Focal length of machine vision lens The lens focal length is selected according to the formula focal length f = working distance × CCD chip size (H or V) / FOV (H or V) to select the lens with the appropriate focal length. According to the formula for calculating the focal length, this project selects a fixed-focus lens with a focal length of 8mm, an interface of C port and a maximum compatible chip size of 2/3. Project visual installation structure 2, software solutions: The software uses Longrui standard vision software for defect detection tasks, and requires the presence or absence of missing or misplaced medical devices in the cartridge. The software uses a combination of the Blob Analyzer tool and the Locator positioning tool for defect detection. The Locator positioning tool is used to locate the device that is suitable for the template and the search box that defines the Blob Analyzer tool. The Blob Analyzer tool is used to detect smaller instruments and some local missing. Finally, the evaluation tool is used to evaluate the used test tool to determine OK or NG and then send the result to the PLC for processing. A, plaque analysis tools: Blob Analyzer concept The Blob Analyzer uses the image segmentation algorithm to process the pixel information in the selected rectangular search box, and can find valid blobs according to user-defined conditions. Image segmentation A blob represents a particular region within an image characterized by a grayscale value within a particular range. For each new image, the Blob Analyzer generates a histogram that represents the distribution of pixel values ​​in the rectangular search box. The image segmentation algorithm provides a threshold function that allows the Blob Analyzer to divide the image into two categories: spots and background. Histogram The histogram provides a distribution of all pixel values ​​in the rectangular search box selected by the Blob Analyzer. The histogram has pixel values ​​ranging from 0 (black) to 255 (white). Images that are well suited for Blob detection typically exhibit a bimodal histogram with two sharp points. Threshold The threshold is used to split the image into two pixels, a background pixel and a spot pixel. Depending on the segmentation mode selected, one or two thresholds can be selected, in addition to two threshold functions, a hard threshold and a soft threshold. The hard threshold is also called the binary threshold because it divides the pixel into two states, the background pixel is 0, and the Blob pixel is 1. The result is a binary image. The soft threshold provides flexibility in processing the pixels of the boundary spot area, the soft threshold covering all pixel values, and once processed, the pixels within the threshold range are output as weighted pixels. The weighted pixels are used to calculate the speckle results in proportion to their values ​​within the threshold range. The range of values ​​within the soft threshold is user defined and corresponds to the difference between the maximum and minimum thresholds. Third, the test results camera offline simulation Fourth, the conclusion Long Rui standard vision software has a friendly interface and simple operation. In addition to defect detection, it can also be used for color search, presence determination, shape determination, recognition detection, appearance inspection, 3D online detection, line sweep detection, positioning, geometric measurement, intelligent learning, robot guidance, etc. Author: Mr. Zhu Solid State Relay,Relayrelay Electrical,Motor Overload Relay,Dc Coil Contactor NanJing QUANNING electric Co.,Ltd , https://www.quanningtrading.com