An engineering view scale and dimension checking method and device, computer equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- EBULENT OPTRONICS SHENZHEN
- Filing Date
- 2023-12-22
- Publication Date
- 2026-07-10
Smart Images

Figure CN118154666B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of engineering view inspection technology, and specifically to a method, apparatus, computer equipment, and storage medium for inspecting the scale and dimensions of engineering views. Background Technology
[0002] Images in a computer are composed of many pixels, each pixel being a mixture of the three primary colors RGB (red, green, blue). Therefore, an image can be represented by a three-dimensional matrix, where each pixel is determined by its X and Y coordinates and RGB channel values. Alternatively, a full-color image can be understood as a mixture of three RGB monochrome pixel images. The channel values of RGB range from 0 to 255, representing the brightness of the pixel in that channel. When red, green, and blue are mixed to the same degree, the result is grayscale. Based on this principle, we can define the essence of grayscale conversion for color images: Red = Green = Blue = Gray, meaning the pixel values of the three channels (red, green, and blue) are equal. In this case, the color image is represented as a grayscale image; this process is called grayscale conversion of a color image.
[0003] In a computer, a grayscale image is represented as an 8-bit unsigned integer matrix, transforming the RGB three channels into a single channel. This means a pixel on the canvas can be defined by its X and Y coordinates and its grayscale value (0-255). A binary black-and-white image, on the other hand, converts the grayscale value of a pixel into a binary value of only 0 and 255 by defining a specific threshold, where 0 is the darkest and 255 is the lightest. In other words, a pixel on the canvas can be defined by its X and Y coordinates and its black-and-white value (0 / 255).
[0004] In engineering design and manufacturing, drawings are an important tool for engineers to communicate information. Engineering drawings typically use front view, top view, bottom view, left view, right view, and rear view to fully describe the shape and dimensions of an object. Due to their projection relationships, these views have certain dimensional relationships. For example, the width of the front view and rear view should be the same as the width of the top view and bottom view; the height of the front view and rear view should be the same as the height of the left view and right view; and the height of the top view and bottom view should be the same as the width of the left view and right view.
[0005] In practical work, under professional engineering drawing software and corresponding drawing formats, based on the Cartesian coordinate system, the view scale has a fixed relationship. After being processed into images, the pixel points of each view also have a certain relationship with the original size. Typically, there exists a scaling factor α, such that the relationship between the pixel width Main_X and pixel height Main_Y of the main view and the original size can be expressed by formulas such as Main_X*α=X and Main_Y*α=Z. However, when processing individual drawings into JPG, PNG, or TIF image formats, due to various reasons, the scale and dimensions of each view may become distorted, preventing the views from accurately representing the original design.
[0006] Therefore, there is an urgent need to provide a method, apparatus, computer equipment, and storage medium for checking the scale and dimensions of engineering views in order to solve the above problems. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings and defects of the prior art and provide a method, device, computer equipment and storage medium for checking the scale and size of engineering views. It is easy to operate and can compare and judge the scale and size of multiple engineering view images so that each view can correctly express the original design.
[0008] The objective of this invention is achieved through the following technical solution:
[0009] A method for checking the scale and dimensions of engineering views, used to check the scale and relative dimensions between engineering view images, including:
[0010] S1. Obtain the engineering view image to be compared;
[0011] S2. Perform grayscale processing on the image;
[0012] S3. Then, perform black-and-white binarization on the grayscale image.
[0013] S4. Traverse the pixels of each row and column of the black and white binarized image to obtain the pixel width and pixel height of the image, as well as the ratio of pixel width to pixel height.
[0014] S5. Compare with the judgment criteria to determine whether there is any distortion in the size and proportion, and output the judgment result.
[0015] As a preferred technical solution of the present invention, when the original design dimensions are known, the engineering view image to be compared can be any one of the six views; when the original design dimensions are unknown, the engineering view image to be compared must be two view images with a relative relationship among the six views; when the original design dimensions are unknown, the engineering view image to be compared can be any three view images among the six views, and the three views can respectively construct the X, Y, and Z directions of the object.
[0016] As a preferred embodiment of the present invention, in the six views, two view images with relative relationships are the front view relative to the rear view, the left view relative to the right view, and the top view relative to the bottom view.
[0017] As a preferred embodiment of the present invention, step S2 specifically involves converting the RGB value of each pixel in the color image into a grayscale value, using the following formula:
[0018]
[0019] Next, in step S3, based on a preset threshold, the grayscale values are converted into black and white binary values containing only 0 and 255, resulting in a black and white binarized image. The formula is as follows:
[0020]
[0021] As a preferred technical solution of the present invention, step S4 specifically involves: traversing the pixels of each column of the black and white binarized image, incrementing the pixel width of each view by 1 when a column contains black pixels and jumping to the next column, thus obtaining the colored pixel width of each view; traversing the pixels of each row of the black and white binarized image, incrementing the pixel height of each view by 1 when a row contains black pixels and jumping to the next row, thus obtaining the colored pixel height of each view.
[0022] As a preferred technical solution of the present invention, the judgment basis in step S5 is specifically the relationship between the pixel width and pixel height of each independent view in the six views and the original design size. The judgment is made by comparing the pixel width and pixel height between different views and comparing the ratio between the pixel width and pixel height of each view itself. A fault tolerance coefficient is also provided. When the judgment result is within the range of the fault tolerance coefficient, it means that the size and proportion are within an acceptable range. When the judgment result exceeds the range of the fault tolerance coefficient, it means that the size and proportion are distorted.
[0023] The present invention also provides an engineering view scale and dimension checking device, comprising:
[0024] The image acquisition module is used to acquire engineering view images to be compared.
[0025] The image processing module is used to perform grayscale processing and black-and-white binarization on the images to be compared.
[0026] The image analysis module is used to analyze the pixel width and pixel height of a black and white binarized image, compare them, and output the results.
[0027] The present invention also provides a computer device, including a processor and a memory storing a computer program, wherein when the processor executes the computer program in the memory, it implements the method according to any one of claims 1 to 7.
[0028] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] This invention acquires engineering view images for comparison, performs grayscale and black-and-white binarization processing, and then calculates the image's pixel dimensions. Based on the relationship between the pixel dimensions of each independent view in the six views and the original design dimensions, the obtained pixel dimensions are compared and analyzed to determine whether the dimensions and proportions of each view are distorted during image processing, and provides prompts. This invention can compare and judge the proportions and dimensions of multiple engineering view images, ensuring that the proportion parameters of each view remain the same so that each view can correctly represent the original design. The operation process is simple and automates the checking of the proportions and dimensions of engineering views, improving the accuracy and efficiency of the check, thereby improving the overall quality of engineering design. Attached Figure Description
[0031] Figure 1 This is a flowchart of the inspection method of the present invention.
[0032] Figure 2 This is a schematic diagram of the software interface of the present invention.
[0033] Figure 3 This is a schematic diagram of another embodiment of the present invention.
[0034] Figure 4 This is a schematic diagram of the composition and structure of the inspection device of the present invention.
[0035] Figure 5 This is a schematic diagram of the composition structure of the electronic device of the present invention.
[0036] Figure 6 This describes the relationship between the pixel dimensions of each independent view in this invention and the original design dimensions. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0038] The specific implementation process of this invention is as follows:
[0039] Reference Figure 1 A method, apparatus, computer equipment, and storage medium for checking the scale and dimensions of engineering views, used to check the scale and relative dimensions between engineering view images, including:
[0040] S1. Obtain the engineering view images to be compared; for details, refer to... Figure 2 The processed engineering view images to be compared are uploaded to the corresponding view frames. If the original design dimensions are known, the original design dimensions X, Y, and Z are entered into the original dimension field in the upper right corner, and then an image of any one of the six views is uploaded. If the original design dimensions are unknown, two view images with relative relationships must be uploaded. The two view images with relative relationships are: front view relative to rear view, left view relative to right view, and top view relative to bottom view. For example, the engineering view images to be compared... Figure 1 If one image is a front view, the other must be a rear view; if one is a left view, the other must be a right view; if one is a top view, the other must be a bottom view. When the original design dimensions are unknown, the engineering view images to be compared can be any three views from the six views, and these three views must completely cover the object's X, Y, and Z directions. In another embodiment, all six images of the six views can be uploaded simultaneously, and multiple independent view images can be analyzed concurrently. Based on the view relationships of the six views, the calculated results are more accurate.
[0041] S2. Perform grayscale processing on the image. Click the Check button to convert the RGB values of each pixel in the color image to grayscale values. This grayscale processing converts the color image to a black and white image, preventing image noise from affecting the processing result. The formula is as follows:
[0042]
[0043] S3. Next, perform black-and-white binarization on the grayscale image; further convert the grayscale image into an image with only black and white. Based on a preset threshold (Threshold, which can be set according to actual needs), the grayscale values are converted into black and white binary values of only 0 and 255, further reducing the image data volume while highlighting key edges and lines, making the lines on the drawing more distinct, facilitating pixel analysis, and ensuring data accuracy. The formula is as follows:
[0044]
[0045] S4. After obtaining the black and white binarized image, iterate through the pixels of each row and column of the image to obtain the pixel width and pixel height, as well as the ratio of pixel width to pixel height. Specifically, iterate through the pixels of each column of the black and white binarized image. When a column contains a black pixel, the pixel width of each view is incremented by 1 and the process jumps to the next column, ultimately obtaining the colored pixel width of each view. Iterate through the pixels of each row of the black and white binarized image. When a row contains a black pixel, the pixel height of each view is incremented by 1 and the process jumps to the next row, ultimately obtaining the colored pixel height of each view. By iterating through the rows and columns of the black and white binarized image, the pixel dimensions of the image are obtained. The obtained pixel dimensions will be displayed in the corresponding boxes, such as the pixel dimensions (Main_X, Main_Y) obtained from the main view.
[0046] S5. Compare with the judgment criteria to determine if there is any distortion in the dimensions and proportions, and output the judgment result. Judgment criteria reference... Figure 6 , Figure 6 This relates the pixel width and pixel height of each independent view in the six-view diagram to the original design dimensions. Based on the view relationships, the values in the same row should be equal. Here, α is a scaling factor, and the original design dimension = pixel size * α. In embodiments of this invention, due to errors in pixel image processing and judgment, there will be a certain degree of accuracy loss. Therefore, a certain tolerance coefficient β can be set during judgment. Setting the tolerance coefficient β allows for a certain degree of error or deviation when there are inconsistencies in the scale or loss of dimensions in the views. The tolerance coefficient β can be set based on the accuracy of image analysis or adjusted according to actual needs to improve the accuracy of the judgment.
[0047] Given the original design dimensions X, Y, and Z, simply input an image of any one of the six views, such as the main view (Main). The pixel dimensions of the main view (Main_X, Main_Y) will be obtained according to step S5. Figure 6 Since X = Main_X * α, we can then calculate α, which = X / Main_X. Z should be equal to Main_Y * α, and X / Z should be equal to Main_X / Main_Y. If Z is not equal to Main_Y * α or Main_X / Main_Y is not equal to X / Z, then the dimensions and scale of the main view are distorted.
[0048] When the original design dimensions X, Y, and Z are unknown, images of two views with relative relationships from the six views must be input, such as the main view (Main) and the back view (Back). Based on the pixel dimensions of the main view (Main_X, Main_Y) and the back view (Back_X, Back_Y), the input should be... Figure 6Main_X / Main_Y and Back_X / Back_Y should be equal and equal to X / Z, that is, MainX / MainY=Back_X / Back_Y=X / Z; if the above values are not equal and are still not equal after taking into account the fault tolerance coefficient, then it is determined that the size and scale of the main view and the rear view are distorted.
[0049] If the original design dimensions (X, Y, Z) are unknown, you only need to input any three images from the six views, and these three views can respectively construct the object in the X, Y, and Z directions. For example, input the main view (Main), left view (Left), and top view (Top), based on... Figure 6 The values should be Main_X = Top_X, Main_Y = Left_Y, and Left_X = Top_Y. If the above values are not equal and are still not equal after considering the error tolerance coefficient, then the dimensions and scale of the main view, rear view, and top view are judged to be distorted.
[0050] The result of the judgment will be displayed in the Result column. If no tolerance factor β is set, the tolerance factor β is 100%, meaning no error or deviation is allowed. In this case, if the views have inconsistent scales or missing dimensions, the Result column will show a large size difference. Assumptions: Without setting a tolerance factor β, the original design dimensions X, Y, and Z are unknown. Input a left view (Left) and a right view (Right), with the left view's pixel dimensions (Left_X, Left_Y) and the right view's pixel dimensions (Right_X, Right_Y). Figure 6 If the calculation shows that Left_X / Left_Y equals Right_X / Right_Y, or Left_X equals Right_X and Left_Y equals Right_Y, then the Result column will display no significant difference in size. With a tolerance factor of 98%, if Left_X / Left_Y does not equal Right_X / Right_Y, and the ratio of Left_X / Right_X or Left_Y / Right_Y exceeds the 98% tolerance factor range, then the Result column will display a significant size difference. When the ratio is within the 98% tolerance factor range, the Result column will display no significant size difference, indicating that the size and scale of the view are basically consistent with the original design and are within an acceptable range.
[0051] In another embodiment, if the calculated values are each view scaled up or down proportionally from the original design dimensions, then the distortion of dimensions and proportions is not considered. (See also...) Figure 3For example, the original dimensions of an object are X = 1200mm and Z = 1500mm. The pixel dimensions of the front view are (120px, 150px), with a scaling factor α of 10 relative to the original dimensions. The pixel dimensions of the rear view are (108px, 135px), with a scaling factor α of 10 relative to the original dimensions. in accordance with Figure 6 The ratios Main_X / Back_X and Main_Y / Back_Y should ideally be equal, with a scale of 1. However, the ratio of Main_X / Back_X to Main_Y / Back_Y is 10:9. This means that the pixel scale ratios of the front view and back view are inconsistent with the original dimensions in both the X and Y axes. However, the scales of the front view and back view in both the X and Y axes are equal to the original design scale. In other words, Main_X / Main_Y and Back_X / Back_Y are both equal to the original design's X to Z dimension ratio of 4:5. This example shows that the scales of each drawing itself are not distorted, but the scales between drawings are inconsistent, indicating that the relationship between the front view and back view is one of proportional reduction or enlargement.
[0052] Reference Figure 4 The present invention also provides a device for checking the proportion and relative size between engineering view images, comprising:
[0053] The image acquisition module is used to acquire engineering view images to be compared.
[0054] The image processing module is used to perform grayscale processing and black-and-white binarization on the images to be compared.
[0055] The image analysis module is used to analyze the pixel width and pixel height of a black and white binarized image, compare them, and output the results.
[0056] Reference Figure 5 The present invention also provides a computer device, including a processor and a memory storing a computer program, wherein when the processor runs the computer program in the memory, the processor performs the above-described method.
[0057] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described above.
[0058] The embodiments described above are merely illustrative of implementation methods of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for checking the scale and dimensions of engineering views, used to check the scale and relative dimensions between engineering view images, characterized in that, include: S1. Obtain the engineering view image to be compared; S2. Perform grayscale processing on the image; S3. Then, perform black-and-white binarization on the grayscale image. S4. Traverse the pixels of each row and column of the black and white binarized image to obtain the pixel width and pixel height of the image, as well as the ratio of pixel width to pixel height. S5. Compare with the judgment criteria to determine whether the size and proportion are distorted, and output the judgment result. The judgment criteria are specifically the relationship between the pixel width and pixel height of each independent view in the six views and the original design size. The judgment is made by comparing the pixel width and pixel height between different views and comparing the ratio between the pixel width and pixel height of each view itself. A fault tolerance coefficient is also set. When the judgment result is within the fault tolerance coefficient range, it means that the size and proportion are within the acceptable range. When the judgment result exceeds the fault tolerance coefficient range, it means that the size and proportion are distorted.
2. The method for checking the scale and dimensions of an engineering view according to claim 1, characterized in that, When the original design dimensions are known, the engineering view image to be compared can be any one of the six views; when the original design dimensions are unknown, the engineering view image to be compared must be two view images that have a relative relationship among the six views. When the original design dimensions are unknown, the engineering view images to be compared can be any three of the six views, and the three views can respectively construct the X, Y, and Z directions of the object.
3. The method for checking the scale and dimensions of an engineering view according to claim 2, characterized in that, In the six views, two views with relative relationships are the main view relative to the rear view, the left view relative to the right view, and the top view relative to the bottom view.
4. The method for checking the scale and dimensions of an engineering view according to claim 1, characterized in that, Step S2 specifically involves converting the RGB value of each pixel in the color image to a grayscale value, using the following formula: ; Next, in step S3, based on a preset threshold, the grayscale values are converted into black and white binary values containing only 0 and 255, resulting in a black and white binarized image. The formula is as follows: 。 5. The method for checking the scale and dimensions of an engineering view according to claim 1, characterized in that, The S4 step is as follows: traverse the pixels of each column of the black and white binarized image. When a column has black pixels, the pixel width of each view is incremented by 1 and the process jumps to the next column, thus obtaining the colored pixel width of each view. Iterate through the pixels of each row of the black and white binarized image. When a row contains black pixels, increment the pixel height of each view by 1 and jump to the next row. Finally, obtain the colored pixel height of each view.
6. An apparatus for checking the scale and dimensions of an engineering view using the method of any one of claims 1-5, comprising: The image acquisition module is used to acquire engineering view images to be compared. The image processing module is used to perform grayscale processing and black-and-white binarization on the images to be compared. The image analysis module is used to analyze the pixel width and pixel height of a black and white binarized image, compare them, and output the results.
7. A computer device comprising a processor and a memory storing a computer program, wherein, when the processor executes the computer program in the memory, it implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 5.