Centering degree calculation method based on image analysis

By using camera and image processing technology in the compressor, combining median filtering, image differential and thresholding processing, the alignment between the compressor cylinder and the compressor punch is extracted and calculated, and the prior art comparison is solved. The problem of medium detection accuracy and low efficiency achieves moderate high-precision calculation and stable operation of equipment.

CN119399263AActive Publication Date: 2025-02-07NORTHWESTERN POLYTECHNICAL UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411646614.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-02-07
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

When dealing with complex backgrounds and noise, existing image analysis methods often face problems such as image quality degradation and difficulty in feature extraction, resulting in low center detection accuracy and efficiency.

Method used

Image information is obtained through the camera, combined with median filtering, image differential and thresholding processing, key features are accurately extracted and the matching is calculated. 该方法包括在压伸机控制台输入固定装置参数信息,使用两个摄像头拍摄轴径图像,进行绝对差分运算和阈值化处理,提取计算所需的矩形,并计算内部矩形相对于外部矩形中心的 Offset and moderate.

Benefits of technology

It effectively improves the centering accuracy, improves the stable operation and production efficiency of the equipment, and provides reliable technical support for the high-precision automatic detection of the compressor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399263A_ABST
    Figure CN119399263A_ABST
Patent Text Reader

Abstract

The invention discloses a centering degree calculation method based on image analysis, and the method comprises the steps: obtaining the image information through a camera, combining with an advanced image processing technology, carrying out the median filtering, image difference and thresholding processing, precisely extracting key features, and calculating the centering degree. According to the method, the centering precision can be effectively improved, and reliable technical support is provided for stable operation and production efficiency of equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a method for calculating centering degree based on image analysis. Background Art

[0002] As a key equipment in product production, the operation status of the press machine directly affects the quality and production efficiency of the product. In particular, the deviation in the centering accuracy between the medicine cylinder and the medicine pressing punch may lead to equipment failure and production stagnation. However, due to long-term operation under high load and complex working conditions, the centering accuracy of the equipment is easily affected by wear, thermal expansion and other external factors, resulting in centering errors.

[0003] Traditional alignment detection methods mainly rely on manual measurement and visual inspection to determine the alignment status of the equipment. This method is not only inefficient, but also easily affected by human factors, making it difficult to achieve high-precision automated detection. In recent years, with the development of image processing technology, automatic alignment detection methods based on image analysis have gradually attracted attention. These methods can improve the accuracy and efficiency of alignment detection through image recognition and analysis.

[0004] However, existing image analysis methods often face the problems of image quality degradation and difficulty in feature extraction when dealing with complex backgrounds and noise. Summary of the invention

[0005] In order to overcome the shortcomings of the prior art, the present invention provides a method for calculating the degree of alignment based on image analysis. The image information obtained by the camera is combined with advanced image processing technology, including median filtering, image difference and threshold processing, to accurately extract key features and calculate the degree of alignment. This method can effectively improve the alignment accuracy and provide reliable technical support for the stable operation and production efficiency of the equipment.

[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0007] Step 1: Enter the fixture parameter information on the press console;

[0008] Step 2: Use two cameras to capture images of the main axis of the pill pressing punch on the X-axis and Y-axis respectively, and generate an axis diameter image and a background image based on the image processing method, and pre-process the background image. Use absolute difference operation to calculate the pixel-by-pixel difference between the axis diameter image and the pre-processed background image, and then use software to perform threshold processing on the image to reduce environmental impact;

[0009] Step 3: Use software to extract the image and only extract the rectangles required for calculation;

[0010] Step 4: Calculate the offset and centering of the inner rectangle relative to the center of the outer rectangle and output them.

[0011] Preferably, the step 1 is specifically:

[0012] Step 1-1: Install two cameras on the device. The shooting directions of the cameras are perpendicular to each other, and ensure that the two cameras are located on the coordinate axis of the horizontal coordinate system;

[0013] Step 1-2: The horizontal cross section of the medicine cylinder of the press machine is a circle, and the center of the circle is the origin of the horizontal coordinate system; construct a horizontal coordinate system and a centering calculation model a according to the two camera coordinate points and the center of the medicine cylinder cross section;

[0014] Step 1-3: Use two cameras to collect images on the X-axis and Y-axis respectively; construct an external rectangle according to the image size ratio, and read the coordinate information of the medicine cylinder, generate the offset calculation model b and c, and add the center line of the external rectangle, that is, the center line of the medicine cylinder; define a matrix according to the resolution m×n of the photo taken by the camera, the size of the matrix is ​​m×n, and each element in the matrix corresponds to a pixel.

[0015] Preferably, the step 2 is specifically:

[0016] Step 2-1: Turn on two cameras and simultaneously capture the axis diameter image of the pill pressing punch main axis on the X-axis and Y-axis.

[0017] Step 2-2: Read the shaft diameter image taken this time and the previous background image, convert the background image and the second shot image into grayscale images; then use median filtering on them respectively;

[0018] Step 2-3: Use absolute difference operation to calculate the pixel-by-pixel difference between the new image and the background image. Each pixel value in the difference result matrix represents the brightness difference between the new image and the background image. If the background has not changed, the pixel difference is close to 0.

[0019] Step 2-4: Set a threshold, set pixels smaller than the threshold to 0, set pixels larger than the threshold to 1, and only keep the pixels set to 1.

[0020] Preferably, the step 3 is specifically:

[0021] Step 3-1: After completing preprocessing, image difference and thresholding, extract the changed part of the foreground area to obtain a matrix;

[0022] Step 3-2: Perform initialization matrix scan: start from the bottom row of the matrix and check upwards row by row;

[0023] Detect the lower boundary: traverse each row and count the number of elements with a value of 1 in the row. If the number of 1s in a row is greater than or equal to 100, the row is considered to be the lower boundary row of the inner rectangle. The row number of the lower boundary row is recorded and further upward search is stopped.

[0024] Determine the left and right boundaries: count 20 rows upward from the bottom boundary row to form a 20-row detection area; in this area, traverse row by row and find the first and last positions of 1 in each row, and record the positions of these left and right boundaries; the X-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 292 and 692, and the Y-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 322 and 722; take the average of the leftmost and rightmost boundary values ​​in these 20 rows as the coordinates of the left and right boundaries;

[0025] Calculate the center line: Use the average value of the left and right boundaries to calculate the coordinates of the inner rectangle on the X and Y axes. The pixel position of the center line of the main axis of the medicine pressing punch on the X axis is (292+692) / 2=492, and the pixel position of the center line of the main axis of the medicine pressing punch on the Y axis is (322+722) / 2=522; add it to the corresponding offset calculation models b and c.

[0026] Preferably, the step 4 is specifically:

[0027] Step 4-1: In the offset calculation models b and c, respectively calculate the offset pixels of the corresponding inner rectangle center relative to the outer rectangle center;

[0028] Step 4-2: Import the X and Y axis offsets into the alignment calculation model a, calculate the alignment coordinates and alignment values, and output them.

[0029] A computer program, which enables a computer to execute the above-mentioned centering degree calculation method.

[0030] An electronic device comprises: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned centering degree calculation method.

[0031] A computer-readable storage medium stores a computer program, which implements the above-mentioned centering degree calculation method when executed by a processor.

[0032] A chip includes: a processor, which is used to call and run a computer program from a memory, so that a device equipped with the chip executes the above-mentioned centering degree calculation method.

[0033] A computer program product comprises a computer storage medium storing a computer program, wherein the computer program comprises instructions executable by at least one processor, and the above-mentioned centering degree calculation method is implemented when the instructions are executed by the at least one processor.

[0034] The beneficial effects of the present invention are as follows:

[0035] The method of the present invention can effectively improve the centering accuracy and provide reliable technical support for the stable operation and production efficiency of the equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is an intuitive diagram of the X-axis offset calculation model b;

[0037] Figure 2 It is an intuitive diagram of the Y-axis offset calculation model c;

[0038] Figure 3 It is an intuitive diagram of the moderate computing model a. DETAILED DESCRIPTION

[0039] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0040] The purpose of the present invention is to propose a method for calculating the alignment between a medicine cylinder and a medicine pressing punch of a pressing machine based on image analysis, which method is simple and convenient to calculate.

[0041] To achieve the above-mentioned purpose, the present invention adopts the following technical scheme: a method for calculating the degree of alignment between the medicine cylinder and the medicine pressing punch of a press machine based on image analysis, comprising the following steps: a first step, inputting the parameter information of the fixing device into the press machine console; a second step, using two cameras to respectively shoot the axis diameter image of the medicine pressing punch on the X-axis and the Y-axis, and based on the image processing method, pre-processing the axis diameter image and the background image, using the absolute difference operation to perform pixel-by-pixel difference calculation on the new image and the pre-processed background image, and then thresholding the image through software to reduce environmental impact; a third step, using software to extract the image, and only extracting the rectangle required for calculation; a fourth step, respectively calculating the offset and the degree of alignment of the inner rectangle relative to the center of the outer rectangle and outputting them. Specific embodiment:

[0043] 1. Enter the fixture parameter information on the press console:

[0044] (1) Install two cameras on the device with their shooting directions perpendicular to each other to ensure that the two cameras are located on the coordinate axes of the horizontal coordinate system.

[0045] (2) The horizontal cross section of the medicine tank is a circle. The center of the circle is the origin of the horizontal coordinate system, which is the red origin (0, 0) in the view. The horizontal coordinate system and the centering calculation model a are constructed based on the two camera coordinate points and the center of the cross section of the medicine tank.

[0046] (3) Use two cameras to collect images on the X-axis and Y-axis respectively. The background image captured and saved at this time is used for the subsequent differential operation. The external rectangle is constructed according to the image size ratio, and the coordinate information of the medicine tank is read. The center line of the external rectangle (i.e., the center line of the medicine tank) is added to the offset calculation model b and c. The matrix is ​​defined according to the resolution m×n of the photos taken by the camera. The size of the matrix is ​​m×n, and each element in the matrix corresponds to a pixel point. Since the camera pixel used this time is 1024×1024, the values ​​of m and n are both 1024.

[0047] 2. Use two cameras on the same horizontal plane to take images of the axis diameter of the pill punch on the X-axis and Y-axis respectively, and pre-process the images:

[0048] (1) Turn on two cameras and simultaneously capture the axis diameter image of the pill punch on the X-axis and Y-axis.

[0049] (2) Read the image and the previous background image, and convert both the background image and the new image into grayscale images. This can reduce the amount of calculation, improve the processing speed, and avoid the interference of color on the difference result; then use median filtering on them respectively to reduce the impact of noise.

[0050] (3) Use absolute difference operation to calculate the pixel difference between the new image and the background image. Each pixel value in the difference result matrix represents the brightness difference between the new image and the background image. If the background has not changed, the pixel difference should be close to 0. The area where the foreground has changed will show obvious difference values.

[0051] (4) Since the working environment of the press machine is relatively complex, with illumination changes, mechanical vibrations, and other noise sources, the threshold is set to a pixel value of 10. This setting is intended to filter out small differences caused by environmental factors to cope with the effects of illumination changes and tiny noise. At the same time, pixels less than the threshold (approximate background) are set to 0, and pixels greater than the threshold (the required shaft diameter part) are set to 1, and only the 1 part is retained.

[0052] 3. Use software to extract the image and only extract the rectangle required for calculation:

[0053] (1) After completing the preprocessing, image difference and thresholding, the background area of ​​the difference result matrix is ​​close to 0, and only the significant change part of the foreground area is retained. The significant change part is extracted to obtain the required matrix.

[0054] (2) Perform initialization matrix scan: start from the bottom row of the matrix and check upwards row by row; detect the lower boundary: traverse each row and count the number of elements with a value of 1 in the row. If the number of 1s in a row is greater than or equal to 100, the row is considered to be the lower boundary row of the inner rectangle, record the row number of the lower boundary row, and stop further upward search; determine the left and right boundaries: count 20 rows upward from the lower boundary row to form a 20-row detection area. In this area, traverse row by row and find the first and last positions of 1 in each row, and record the positions of these left and right boundaries. The X-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 292 and 692. The Y-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 322 and 722. The leftmost and rightmost boundary values ​​in these 20 lines are averaged as the coordinates of the left and right boundaries; calculate the center line: use the average value of the left and right boundaries to calculate the coordinates of the inner rectangle on the X and Y axes, then the pixel position of the center line of the main axis of the medicine pressing punch on the X axis is (292+692) / 2=492, and the pixel position of the center line of the main axis of the medicine pressing punch on the Y axis is (322+722) / 2=522. And add it to the corresponding offset calculation model b, c.

[0055] 4. Calculate the offset and centering of the inner rectangle relative to the center of the outer rectangle and output:

[0056] (1) In the offset calculation models b and c, the offset pixels of the corresponding inner rectangle center relative to the outer rectangle center are calculated respectively. Figure 1 In the figure, the red dotted line is the center line of the medicine cylinder, and the blue dotted line is the center line of the rectangle inside the X-axis; the offset of the X-axis is -20 pixels; because the main axis diameter of the medicine pressing punch is 400mm, the photo pixel is 1024×1024, and c=1 / m=0.39mm is calculated, so the offset of the X-axis is 20c=20×0.39=7.8mm; Figure 2 In the figure, the red dotted line is the center line of the medicine cylinder, the blue dotted line is the center line of the inner rectangle of the Y-axis, the offset of the Y-axis is 10, and the offset of the Y-axis is 10c=10×0.39=3.9mm.

[0057] (2) Import the X and Y axis offsets into the centering calculation model a, calculate the centering coordinates to be (-20, 10), and output the centering value to be 8.72 mm. Figure 3 , where the red origin is the center point of the medicine cylinder; the two yellow dots on the two axes are the Y-axis offset recording camera and the X-axis offset recording camera respectively. The two yellow dots and the red origin form a horizontal coordinate system; the blue dot represents the center point of the main axis of the medicine pressing punch.

Claims

1. A method for calculating the degree of centering based on image analysis, characterized in that: The steps include: Step 1: Enter the fixture parameter information on the press console; Step 2: Use two cameras to capture images of the main axis of the pill pressing punch on the X-axis and Y-axis respectively, and generate an axis diameter image and a background image based on the image processing method, and pre-process the background image. Use absolute difference operation to calculate the pixel-by-pixel difference between the axis diameter image and the pre-processed background image, and then use software to perform threshold processing on the image to reduce environmental impact; Step 3: Use software to extract the image and only extract the rectangles required for calculation; Step 4: Calculate the offset and centering of the inner rectangle relative to the center of the outer rectangle and output them.

2. The method for calculating the degree of centering based on image analysis according to claim 1, characterized in that: The step 1 is specifically as follows: Step 1-1: Install two cameras on the device. The shooting directions of the cameras are perpendicular to each other, and ensure that the two cameras are located on the coordinate axis of the horizontal coordinate system; Step 1-2: The horizontal cross section of the medicine cylinder of the press machine is a circle, and the center of the circle is the origin of the horizontal coordinate system; construct a horizontal coordinate system and a centering calculation model a according to the two camera coordinate points and the center of the medicine cylinder cross section; Step 1-3: Use two cameras to collect images on the X-axis and Y-axis respectively; construct an external rectangle according to the image size ratio, and read the coordinate information of the medicine cylinder, generate the offset calculation model b and c, and add the center line of the external rectangle, that is, the center line of the medicine cylinder; define a matrix according to the resolution m×n of the photo taken by the camera, the size of the matrix is ​​m×n, and each element in the matrix corresponds to a pixel.

3. The method for calculating the degree of centering based on image analysis according to claim 2, characterized in that: The step 2 is specifically as follows: Step 2-1: Turn on two cameras and simultaneously capture the axis diameter image of the pill pressing punch main axis on the X-axis and Y-axis; Step 2-2: Read the shaft diameter image taken this time and the previous background image, convert the background image and the second shot image into grayscale images; then use median filtering on them respectively; Step 2-3: Use absolute difference operation to calculate the pixel-by-pixel difference between the new image and the background image. Each pixel value in the difference result matrix represents the brightness difference between the new image and the background image. If the background has not changed, the pixel difference is close to 0. Step 2-4: Set a threshold, set pixels smaller than the threshold to 0, set pixels larger than the threshold to 1, and only keep the pixels set to 1.

4. The method for calculating the degree of centering based on image analysis according to claim 3, characterized in that: The step 3 is specifically as follows: Step 3-1: After completing preprocessing, image difference and thresholding, extract the changed part of the foreground area to obtain a matrix; Step 3-2: Perform initialization matrix scan: start from the bottom row of the matrix and check upwards row by row; Detect the lower boundary: traverse each row and count the number of elements with a value of 1 in the row. If the number of 1s in a row is greater than or equal to 100, the row is considered to be the lower boundary row of the inner rectangle. The row number of the lower boundary row is recorded and further upward search is stopped. Determine the left and right boundaries: Count 20 rows upward from the bottom boundary row to form a 20-row detection area; in this area, traverse row by row and find the first and last 1 positions in each row, and record the positions of these left and right boundaries; The X-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 292 and 692. The Y-axis offset records the rectangle generated after the camera image is processed, and the average positions of the first and last 1 in each row are 322 and 722. The leftmost and rightmost boundary values ​​in these 20 rows are averaged as the coordinates of the left and right boundaries. Calculate the center line: Use the average value of the left and right boundaries to calculate the coordinates of the inner rectangle on the X and Y axes. The pixel position of the center line of the main axis of the medicine pressing punch on the X axis is (292+692) / 2=492, and the pixel position of the center line of the main axis of the medicine pressing punch on the Y axis is (322+722) / 2=522; add it to the corresponding offset calculation models b and c.

5. The method for calculating the degree of centering based on image analysis according to claim 4, characterized in that: The step 4 is specifically as follows: Step 4-1: Calculate the offset pixels of the corresponding inner rectangle center relative to the outer rectangle center in the offset calculation models b and c respectively; Step 4-2: Import the X and Y axis offsets into the alignment calculation model a, calculate the alignment coordinates and alignment values, and output them.

6. A computer program, characterized in that The computer program enables a computer to execute the method according to any one of claims 1 to 5.

7. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as claimed in any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

9. A chip, characterized in that: include: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as claimed in any one of claims 1 to 5.

10. A computer program product, characterized in that The computer program product comprises a computer storage medium storing a computer program, wherein the computer program comprises instructions executable by at least one processor, and when the instructions are executed by the at least one processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Image median filtering detection method and device, equipment and storage medium

    CN117237262A

  • Camera coordinate conversion parameter calibration method and system and camera

    CN118279410A

  • Method for determining center point of lens and imagepickup apparatus having function of correcting centerpoint of lens

    KR1020060116569A