Method for measuring logs using a log measuring instrument
The log measuring instrument uses lasers and cameras to automatically measure logs, solving the problem of low efficiency in manual measurement and achieving efficient and accurate log measurement and data uploading.
Patent Information
- Application Number
- CN202210046439.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-01-14
AI Technical Summary
In existing technologies, manually measuring logs with a measuring tape is inefficient, time-consuming, and labor-intensive, and it is difficult to accurately measure the diameter of the log end face.
Using a log measuring instrument, by turning on the power switch and operating the touch screen, the instrument automatically measures the log using a laser and a camera, calculates and announces the measurement results via voice, and uploads the data to a cloud server. Combining adaptive image grayscale adjustment algorithms and laser light pattern processing technology, the instrument calculates the major and minor diameters of the log.
It achieves efficient and convenient log measurement, with simple operation, accurate measurement results, and automatic data upload, simplifying the tedious process of manual measurement.
Smart Images

Figure CN115540747B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of measurement technology, and in particular to a method for measuring logs using a log measuring instrument. Background Technology
[0002] Log processing has a wide range of applications, and measuring logs is a rather cumbersome process. Log diameter is determined by measuring the long and short diameters of the log's end face, and then using the difference between the long and short diameters and the grading standard. Currently, log grading mainly relies on manual measurement. Since log end faces are often irregularly shaped, manual measurement is difficult to accurately measure the grading diameter. Existing technologies use measuring tapes for manual measurement, which is inefficient, time-consuming, and labor-intensive. Therefore, there is a need to provide a method for measuring logs using a log measuring instrument to solve the above technical problems. Summary of the Invention
[0003] This invention provides a method for measuring logs using a log measuring instrument, thereby solving the problem that manual measurement using a measuring tape is inefficient, time-consuming, and labor-intensive in the prior art.
[0004] To solve the above-mentioned technical problems, the technical solution of the present invention is: a method for measuring logs using a log measuring instrument, comprising the following steps:
[0005] S101, turn on the power switch, and the user operates the touch screen;
[0006] S102, the user aligns the log measuring instrument with the log to be measured, and initially adjusts the distance between the measuring device and the log according to the size of the log to be measured;
[0007] S103, press and hold the camera button. At this time, you can see the laser light up and emit a quadrilateral pattern. Adjust the position of the log measuring instrument and adjust the quadrilateral pattern into the area of the log being measured, and ensure that the four corners of the quadrilateral are within the cross-section of the log.
[0008] S104, release the camera button and wait for the log measuring instrument to calculate the measurement;
[0009] The S105 displays the measurement results via voice broadcast, showing the diameter of the logs and displaying the results on a touchscreen. Simultaneously, the measurement data is uploaded to a cloud server for storage, completing the measurement process.
[0010] In the method for measuring logs using a log measuring instrument according to the present invention, step S104, in which the log measuring instrument calculates the measurement, includes the following steps:
[0011] S106, the operation controller collects the brightness of the ambient light and calculates the camera's shutter speed, LED light source brightness PWM value, and infrared laser brightness PWM value through an adaptive image grayscale adjustment algorithm;
[0012] S107, the operational controller outputs PWM signals for light source control and infrared laser control via the GPIO interface;
[0013] S108, the arithmetic controller drives the camera to open the shutter and take a picture;
[0014] The S109 camera's built-in GPIO interface automatically outputs an enable signal to light up the LED light source and infrared laser.
[0015] S110, the arithmetic controller reads the image of the log;
[0016] S111, perform laser ripple image processing to calculate the pose of the plane of the object under test;
[0017] S112, extract the log outline and map the log outline onto the plane of the object being measured, and at the same time fit an ellipse to obtain the major and minor axes of the log being measured.
[0018] In the method for measuring logs using a log measuring instrument described in this invention, step S110 further includes calculating the grayscale value of the log image. If the grayscale value meets the requirements, the photo is successfully taken and step S111 is executed; otherwise, after adjusting the three parameters of shutter speed, brightness of infrared LED light source, and brightness of infrared laser, the process returns to step S106.
[0019] In the method for measuring logs using a log measuring instrument described in this invention, step S111 further includes determining the angle between the plane of the object being measured and the optical axis of the camera. If the angle is greater than a set value, a voice prompt will be given saying "the tilt angle is too large," and the process will return to S103. Otherwise, S112 will be executed.
[0020] In the method for measuring logs using a log measuring instrument described in this invention, the step S111 of calculating the pose of the plane of the object being measured includes the following steps:
[0021] S115, when the log being tested is projected by the laser beam of an infrared laser, an image of the log being tested is captured by a camera; wherein, the image includes laser patterns, and the laser patterns are the image area of the laser projection area projected by the infrared laser onto the log being tested;
[0022] S116, Based on the laser ripple and the structured light plane calibration algorithm, calibrate the light plane calibration equation of the infrared laser in the camera coordinate system;
[0023] S117, Determine the transformation relationship between the image coordinates and camera coordinates of the laser ripple based on the camera perspective imaging model;
[0024] S118, Calculate the plane equation of the log under test in the camera coordinate system based on the transformation relationship and the light plane calibration equation;
[0025] S119, Calculate the distance between the log being measured and the camera imaging surface based on the plane equation, and use it as the working distance;
[0026] S120 calculates the angle between the normal of the log being measured and the optical axis of the camera, which is used as the working tilt angle.
[0027] In the method for measuring logs using a log measuring instrument described in this invention, determining the transformation relationship between the image coordinates and camera coordinates of the laser ripple based on a camera perspective imaging model includes:
[0028] S121, the laser pattern is divided into sections based on a preset width;
[0029] S122, Obtain the distance between each partition and the center of the image;
[0030] S123, Based on the distance between each partition and the center of the image, and the preset relationship between the distance and the cross-sectional area, determine the division area of the cross section corresponding to each partition;
[0031] S124, determine the length of each section based on the area of each section and the preset width;
[0032] S125 divides the cross-sections into rectangular shapes based on the length and preset width of each cross-section.
[0033] S126, The center line is determined based on the connection of the gray-scale centroids of each cross section.
[0034] S127, Based on the image coordinates of the center line and the camera perspective imaging model, determine the transformation relationship between the image coordinates and camera coordinates of the laser ripple.
[0035] In the method for measuring logs using a log measuring instrument described in this invention, the step of calculating the plane equation of the log in the camera coordinate system based on the transformation relationship and the optical plane calibration equation includes:
[0036] S128, Calculate the laser projection equation of the laser projection area in the camera coordinate system based on the transformation relationship and the light plane calibration equation;
[0037] S129, Calculate the plane equation based on the least squares surface fitting method and the point coordinates of different laser projection equations.
[0038] In the method for measuring logs using a log measuring instrument described in this invention, step S112, extracting the log outline, includes the following steps:
[0039] S130, an LED light source projects light onto the end face of the log, a camera acquires an image of the log based on the projected light source, and generates a target image based on the log image; the area of the low grayscale region is acquired based on the target image, and the average grayscale value of the low grayscale region is calculated based on the area of the low grayscale region.
[0040] S131, obtain a first lower limit value; when the average gray value of the low gray area is less than the first lower limit value, increase the output energy of the LED light source, thereby increasing the gray value of the target image, and return to step S130; until the average gray value of the low gray area is greater than the first lower limit value;
[0041] S132, obtain the first upper limit value; when the average gray value of the low gray area is greater than the second upper limit value, reduce the output energy of the LED light source, thereby reducing the gray value of the target image, and return to step S130; until the average gray value of the low gray area is less than the first upper limit value;
[0042] S133, the LED light source is based on the adjusted output energy of the LED light source and the infrared laser simultaneously project the light source onto the end face of the log.
[0043] The camera acquires an image of the log based on the projected light source, generates the target image based on the log image, and obtains the area of the target image, which includes all high grayscale points;
[0044] The area of the high grayscale region is obtained based on all the high grayscale points, and the proportion of the high grayscale region area is calculated based on the area of the high grayscale region and the area of the target image.
[0045] S134, obtain the second lower limit value. When the area ratio of the high grayscale region is less than the second lower limit value, increase the output energy of the infrared laser, thereby increasing the number of high grayscale points, and return to step S133; until the area ratio of the high grayscale region is greater than the second lower limit value.
[0046] S135, obtain the second upper limit value. When the area ratio of the high grayscale region is greater than the second upper limit value, reduce the output energy of the infrared laser, thereby reducing the number of high grayscale points, and return to step S133; until the area ratio of the high grayscale region is less than the second upper limit value; and,
[0047] S136, the camera acquires an image of the log based on the output energy of the LED light source and the infrared laser after adjustment.
[0048] In the method for measuring logs using a log measuring instrument described in this invention, the step of increasing the output energy of the LED light source in step S131 includes:
[0049] S137, obtain the current light source pulse width of the LED light source, use a preset light source pulse width single adjustment amount to increase the current light source pulse width, and generate the adjusted light source pulse width;
[0050] S138, set the adjusted lamp source pulse width to the current lamp source pulse width, and return to step S130; until the average grayscale value of the low grayscale area is greater than the first lower limit value; and,
[0051] The step of reducing the output energy of the LED light source in step S132 includes:
[0052] S139, obtain the current lamp source pulse width of the LED light source, use a preset lamp source pulse width single adjustment amount to reduce the current lamp source pulse width, and generate the adjusted lamp source pulse width;
[0053] S140, set the adjusted lamp source pulse width to the current lamp source pulse width, and return to step S130; until the average gray value of the low gray area is less than the first upper limit value.
[0054] In the method for measuring logs using a log measuring instrument according to the present invention, step S105 further includes parameter detection, which includes the following steps:
[0055] S141, controls the LED light source to turn on;
[0056] S142, Acquire the initial image of the log under LED light source illumination;
[0057] S143, Perform texture filtering on the initial image to obtain a first image;
[0058] S144, Perform adaptive threshold segmentation on the first image to obtain the second image;
[0059] S145, The second image is processed based on the morphological opening operation algorithm to obtain the third image;
[0060] S146, Extract the candidate target region of the third image;
[0061] S147, Perform watershed segmentation on the candidate target region to obtain candidate target region partitions;
[0062] S148, Extract the target outline of the log under test from the candidate target region partition;
[0063] S149, Calculate the fitting equation for the target contour;
[0064] S150, Calculate the target parameters of the tested log based on the fitted equation.
[0065] Compared with the prior art, the beneficial effects of this invention are as follows: The method of measuring logs using a log measuring instrument of this invention allows the user to operate the log measuring instrument by pressing and holding the photo button on the touch screen. The laser is then aimed at the log for easy measurement. After releasing the photo button, the user waits for the log measuring instrument to calculate the measurement. The measurement result is announced by voice, and the measurement result of the captured log image can be seen on the touch screen. At the same time, the measurement data is uploaded to the cloud server for storage. The operation is simple, the measurement is convenient, and the measurement efficiency is high. Attached Figure Description
[0066] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments are briefly introduced below. The drawings described below are only the corresponding drawings of some embodiments of the present invention.
[0067] Figure 1 This is a schematic diagram of the camera end of a log measuring instrument.
[0068] Figure 2 This is a schematic diagram of the touch screen end of the log measuring instrument.
[0069] Figure 3 This is a flowchart illustrating the method for measuring logs using a log measuring instrument according to the present invention.
[0070] Figure 4 This is a schematic diagram of the log measuring instrument calculation process of the method for measuring logs using a log measuring instrument according to the present invention.
[0071] Figure 5 This is a flowchart illustrating the calculation of the orientation of the plane of the object being measured using a log measuring instrument, according to the present invention.
[0072] Figure 6 A schematic diagram illustrating the process of determining the transformation relationship between the image coordinates and camera coordinates of the laser ripple in calculating the pose of the plane of the object under test using a camera perspective imaging model.
[0073] Figure 7 This is a schematic flowchart illustrating the method for extracting the log outline using a log measuring instrument according to the present invention.
[0074] Figure 8 This is a schematic flowchart illustrating the parameter detection process of the method for measuring logs using a log measuring instrument according to the present invention.
[0075] Among them, 11, connecting shell, 12, handle, 13, rear main shell, 14, front main shell, 21, camera, 22, LED light source, 23, visible laser, 24, infrared laser, 25, photo button, 26, touch screen, and 27, power switch. Detailed Implementation
[0076] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0077] The directional terms mentioned in this invention, such as "up", "down", "front", "back", "left", "right", "inner", "outer", "side", "top" and "bottom", are only for reference to the orientation of the accompanying drawings. The directional terms used are for the purpose of explaining and understanding this invention, and are not intended to limit this invention.
[0078] The terms "first" and "second" used in the terminology of this invention are for descriptive purposes only and should not be construed as indicating or implying relative importance, nor as limiting the order of events.
[0079] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0080] In existing technologies, manual measurement using a measuring tape is inefficient, time-consuming, and labor-intensive.
[0081] The following is a preferred embodiment of a method for measuring logs using a log measuring instrument, which can solve the above-mentioned technical problems provided by the present invention.
[0082] In the diagram, units with similar structures are represented by the same labels.
[0083] Reference Figure 1 and Figure 2 ,in Figure 1 This is a schematic diagram of the camera end of a log measuring instrument. Figure 2 This is a schematic diagram of the touch screen end of the log measuring instrument.
[0084] The log measuring instrument includes a connecting shell 11, a handle 12, a rear main shell 13, and a front main shell 14. The connecting shell 11 is hollow inside and open at both ends. The connecting shell 11 is square in shape. The rear main shell 13 and the front main shell 14 are connected to the two ends of the connecting shell 11. The handle 12 is connected to the lower end of the connecting shell 11. The LED light source 22 is ring-shaped and connected to the rear main shell. A camera hole is set in the middle of the rear main shell 13. The camera 21 is located inside the connecting shell 11 and takes pictures along the camera hole in the middle of the rear main shell 13. The rear main shell 13 is square in shape. The visible laser 23 and the infrared laser 24 are located at the four corners of the rear main shell 13, outside the camera 21. The power switch 27 is located on the side wall of the connecting shell 11. The photo button 25 is located on the handle 12. The touch screen 26 is connected to the front main shell 14.
[0085] The LED light source 22 is connected to the rear main housing 13 and is used to provide supplemental lighting for the camera 21. The LED light source 22 includes an LED board, which is ring-shaped and has multiple LED beads arranged in a ring on one side. The rear main housing 13 has an LED slot, and the LED board is connected to the LED slot.
[0086] Two visible lasers 23 are provided to emit cross-shaped visible laser lines. The two visible lasers 23 are located on both sides of the camera 21. The two visible lasers 23 are used to emit parallelogram-shaped laser lines to aim at the log being measured. Two infrared lasers 24 are provided to emit cross-shaped infrared laser lines. The two infrared lasers 24 are located on both sides of the camera. The two infrared lasers 24 are used to calculate the pose of the plane of the object being measured, fit the end face of the log into an ellipse, and then calculate the major and minor axes of the log being measured.
[0087] It can be seen that the angle between the axis of the visible laser 23 and the axis of the camera 21 is 30 degrees, and the angle between the axis of the infrared laser 24 and the axis of the camera 21 is also 30 degrees.
[0088] The brightness adjustment and on / off logic control of the infrared laser are handled by the operational controller. Located inside the connecting housing 11, the operational controller calculates the laser brightness based on the distance from the log measuring instrument to the log being measured and the ambient brightness during image capture. It adjusts the laser brightness by emitting PWM signals of fixed frequency and different duty cycles. The laser's on / off time is driven by the programmable I / O interface of the camera 21, ensuring that the laser's on / off state is synchronized with the camera 21's shutter speed, thereby maximizing energy savings and preventing overheating from prolonged laser operation.
[0089] The connecting shell 11 houses a computing control board, which comprises a core board and a carrier board. The core board contains a computing controller and a memory containing pose determination and parameter detection programs. The carrier board connects to the core board and includes a USB interface, a Wi-Fi + Bluetooth interface, a 4G module interface, a GPS interface, and 40 GPIO interfaces. The computing control board is the core component of the log measuring instrument, primarily responsible for driving the touchscreen 26, driving the camera 21 to acquire image data, image processing (laser line extraction, log contour extraction), controlling the brightness of the LED light source 22, controlling the brightness of the infrared laser 24, responding to button actions, and driving the speaker to emit sound.
[0090] This invention provides a method for measuring logs using a log measuring instrument, referring to... Figure 3 , Figure 3 This is a flowchart illustrating the method for measuring logs using a log measuring instrument according to the present invention, including the following steps:
[0091] S101, turn on the power switch, and the user operates the touch screen.
[0092] Powering on: The instrument is powered off when the touchscreen is black and the power button is not illuminated. Press the silver power button on the side of the instrument; the button will emit a blue light, the touchscreen will light up, the cooling fan will start, and the device will begin operating. If any abnormal conditions occur, please refer to the equipment malfunction instructions.
[0093] Power off: The device is in operation. Press the silver power button on the side of the instrument; the button will pop up, the blue light will disappear, the touchscreen will go black, and the cooling fan will stop.
[0094] Users can operate the touchscreen, including setting up WiFi, operator login, and outbound / inbound operations.
[0095] To set up WiFi: Click the "WiFi" icon in the top menu. In the pop-up WiFi selection interface, select the WiFi name you want to connect to (it is recommended to set an open, password-free WiFi signal). Enter the WiFi password to connect successfully.
[0096] Operator Login: With a successful network connection, select the corresponding operator on the login screen, enter the password, and click "Confirm Login". After successful login, you can enter the operation homepage.
[0097] Outbound / Inbound: The homepage includes functions such as inbound, outbound, testing, calibration, power off, and no data upload prompts. No data upload occurs when the device is offline; data is not uploaded, but the device can still perform measurement operations normally. The device will automatically upload the data when the network is restored.
[0098] Click the "Inbound" or "Outbound" icon on the homepage to enter the basic information selection interface for inbound / outbound operations. Select and fill in the corresponding inbound / outbound information. After completing the information, click the "Confirm" button to begin the measurement operation.
[0099] S102, the user aligns the log measuring instrument with the log to be measured, and initially adjusts the distance between the measuring device and the log according to the size of the log to be measured;
[0100] S103, press and hold the camera button. At this time, you can see the laser light up and emit a quadrilateral pattern. Adjust the position of the log measuring instrument and adjust the quadrilateral pattern into the area of the log being measured, and ensure that the four corners of the quadrilateral are within the cross-section of the log.
[0101] S104, release the camera button and wait for the log measuring instrument to calculate the measurement;
[0102] The S105 displays the measurement results via voice broadcast, showing the diameter of the logs and displaying the results on a touchscreen. Simultaneously, the measurement data is uploaded to a cloud server for storage, completing the measurement process.
[0103] Reference Figure 4 , Figure 4 This is a schematic flowchart of the log measuring instrument calculation measurement process of the method for measuring logs using a log measuring instrument according to the present invention. In step S104, the log measuring instrument calculation measurement includes the following steps:
[0104] S106, the operation controller collects the brightness of the ambient light and calculates the camera's shutter speed, LED light source brightness PWM value, and infrared laser brightness PWM value through an adaptive image grayscale adjustment algorithm;
[0105] S107, the operational controller outputs PWM signals for light source control and infrared laser control via the GPIO interface;
[0106] S108, the arithmetic controller drives the camera to open the shutter and take a picture;
[0107] The S109 camera's built-in GPIO interface automatically outputs an enable signal to light up the LED light source and infrared laser.
[0108] S110, the arithmetic controller reads the image of the log;
[0109] S113: Calculate the grayscale value of the log image. If the grayscale value meets the requirements, the photo is taken successfully, and proceed to S111. Otherwise, adjust the three parameters of shutter speed, brightness of infrared LED light source, and brightness of infrared laser, and return to S106.
[0110] S111, perform laser ripple image processing to calculate the pose of the plane of the object under test;
[0111] S114: Determine the angle between the plane of the object being measured and the optical axis of the camera. If the angle is greater than the set value, a voice prompt will be given saying "tilt angle is too large" and the process will return to S103. Otherwise, execute S112.
[0112] S112, extract the log outline and map the log outline onto the plane of the object being measured, and at the same time fit an ellipse to obtain the major and minor axes of the log being measured.
[0113] Under normal circumstances: The measurement results will be announced via voice, and the measurement results of the captured log image will be displayed on the screen. The blue line is the log outline, the green circle is the fitted circle of the log surface, the red line is the shortest diameter of the fitted circle (i.e., the shortest diameter of the log), and the yellow line is the longest diameter of the fitted circle (i.e., the longest diameter of the log).
[0114] Abnormal situation:
[0115] 1. If no original wood surface is captured or the surface is severely damaged and cannot be identified, the measurement and recognition voice and interface will prompt "No original wood".
[0116] 2. If the edges of the captured log image extend beyond the frame, the system will measure and recognize the data, and the interface will prompt "Logs are being transported."
[0117] 3. The equipment's shooting angle is too large, causing the laser lines to form a trapezoidal shape, resulting in a "tilt angle too large" prompt on the measurement and recognition voice and interface.
[0118] Reference Figure 5 , Figure 5 The flowchart of the method for measuring logs using a log measuring instrument according to the present invention is shown in the figure. Step S111, calculating the pose of the plane of the measured object (calculated by the pose determination program in the memory on the arithmetic control board), includes the following steps:
[0119] S115, When the log being tested is projected by the laser beam of an infrared laser, an image of the log being tested is captured by a camera; wherein, the image includes laser light patterns, and the laser light patterns are the image areas of the laser projection area projected by the infrared laser onto the log being tested.
[0120] S116, Calibrates the light plane calibration equation of an infrared laser in the camera coordinate system based on laser ripple and structured light plane calibration algorithms;
[0121] S117, Determine the transformation relationship between the image coordinates and camera coordinates of the laser ripple based on the camera perspective imaging model;
[0122] S118, Calculate the plane equation of the measured log in the camera coordinate system based on the transformation relationship and the light plane calibration equation;
[0123] S119, calculates the distance between the log being measured and the camera imaging surface based on the plane equation, and uses it as the working distance;
[0124] S120 calculates the angle between the normal of the log being measured and the optical axis of the camera, which is used as the working tilt angle.
[0125] Reference Figure 6 , Figure 6 A flowchart illustrating the process of determining the transformation relationship between the image coordinates and camera coordinates of the laser ripple based on a camera perspective imaging model in calculating the pose of the object plane is shown. Step S117 includes the following steps:
[0126] S121, the laser pattern is divided into sections based on a preset width;
[0127] S122, obtain the distance between each partition and the image center;
[0128] S123, Based on the distance between each partition and the image center, and the preset relationship between distance and cross-sectional area, determine the division area of the cross section corresponding to each partition;
[0129] S124, determine the length of each section based on the area of each section and the preset width;
[0130] S125 divides the cross-sections into rectangular shapes based on the length and preset width of each cross-section.
[0131] S126, determine the center line based on the connection of the gray-scale centroids of each section.
[0132] S127, Based on the image coordinates of the centerline and the camera perspective imaging model, determine the transformation relationship between the image coordinates and camera coordinates of the laser ripple.
[0133] The calculation of the plane equation of the measured log in the camera coordinate system based on the transformation relationship and the light plane calibration equation includes:
[0134] S128, Calculate the laser projection equation of the laser projection area in the camera coordinate system based on the transformation relationship and the light plane calibration equation;
[0135] S129, Calculate the plane equation based on the least squares surface fitting method and the point coordinates of different laser projection equations.
[0136] Reference Figure 7 , Figure 7 This is a flowchart illustrating the method for extracting the log outline using a log measuring instrument according to the present invention. In step S112, extracting the log outline includes the following steps:
[0137] S130, the LED light source projects light onto the end face of the log, the camera acquires the log image based on the projected light source, and generates the target image based on the log image; the low grayscale area is obtained based on the target image, and the average grayscale value of the low grayscale area is calculated based on the low grayscale area.
[0138] S131, obtain the first lower limit value; when the average gray value of the low gray area is less than the first lower limit value, increase the output energy of the LED light source, thereby increasing the gray value of the target image, and return to step S130; until the average gray value of the low gray area is greater than the first lower limit value;
[0139] S132, obtain the first upper limit value; when the average gray value of the low gray area is greater than the second upper limit value, reduce the output energy of the LED light source, thereby reducing the gray value of the target image, and return to step S130; until the average gray value of the low gray area is less than the first upper limit value.
[0140] S133, the LED light source is based on the adjusted output energy of the LED light source and the infrared laser simultaneously project the light source onto the end face of the log.
[0141] The camera acquires images of the logs based on the projected light source, generates a target image based on the log images, and obtains the area of the target image, which includes all high grayscale points;
[0142] The area of the high grayscale region is obtained based on all the high grayscale points, and the proportion of the high grayscale region area is calculated based on the area of the high grayscale region and the area of the target image.
[0143] S134, obtain the second lower limit value. When the area ratio of high grayscale region is less than the second lower limit value, increase the output energy of infrared laser, thereby increasing the number of high grayscale points, and return to step S133; until the area ratio of high grayscale region is greater than the second lower limit value.
[0144] S135, obtain the second upper limit value. When the proportion of the high grayscale area is greater than the second upper limit value, reduce the output energy of the infrared laser, thereby reducing the number of high grayscale points, and return to step S133; until the proportion of the high grayscale area is less than the second upper limit value; and...
[0145] The S136 camera acquires images of logs based on the output energy of an LED light source and an infrared laser after adjustment.
[0146] The step of increasing the output energy of the LED light source in step S131 includes:
[0147] S137, obtain the current lamp source pulse width of the LED light source, use the preset lamp source pulse width single adjustment amount to increase the current lamp source pulse width, and generate the adjusted lamp source pulse width;
[0148] S138, set the adjusted lamp source pulse width to the current lamp source pulse width, and return to step S130; until the average grayscale value of the low grayscale area is greater than the first lower limit value; and,
[0149] The step of reducing the output energy of the LED light source in step S132 includes:
[0150] S139, obtain the current lamp source pulse width of the LED light source, use the preset lamp source pulse width single adjustment amount to reduce the current lamp source pulse width, and generate the adjusted lamp source pulse width;
[0151] S140, set the adjusted lamp source pulse width to the current lamp source pulse width, and return to step S130; until the average gray value of the low gray area is less than the first upper limit value.
[0152] The process of acquiring log images in this embodiment is described in detail below.
[0153] In step S130, the infrared laser is turned off, and only the LED light source is turned on, illuminating the end face of the log. Simultaneously, the camera is aimed at the end face of the log and the shutter is opened to capture an image of the log. The control system analyzes the log image transmitted from the camera and extracts the high grayscale points. Then, the control system generates a target image based on the distribution of all high grayscale points. This target image is circular, and all high grayscale points are located within the target image. The control system extracts the area of the target image and the area occupied by all high grayscale points, then calculates the grayscale area to obtain the average grayscale value of the low grayscale area. The low grayscale area refers to the area remaining after removing the high grayscale areas from the target image. The average grayscale value of the low grayscale area is compared with a preset limit range in the control system to ensure that the brightness of the log image captured by the camera is neither too dark nor too bright.
[0154] The methods for calculating the average gray value of low grayscale areas include:
[0155] The pixels in the target image can be represented as a two-dimensional array f(i,j), which contains M rows and N columns, where (i,j) are discrete coordinates, and i = 0, 1, 2, ..., M-1, j = 0, 1, 2, ..., N-1. Let R represent the area occupied by all pixels in the target image, (i,j) represent a pixel in R, and g(i,j) represent the gray value of the pixel. Then, the area H of the high gray-level region in the target image can be obtained by the image thresholding algorithm:
[0156] H = {(i,j)∈R / g(i,j)>T}
[0157] In the formula, H is the area of the high grayscale region; T is a certain segmentation threshold.
[0158] Let L represent the area of the low grayscale region, then
[0159] L=RH
[0160] The average gray value of the low grayscale area can be calculated by the following formula:
[0161]
[0162] In the formula, m represents the average gray value of the low gray area.
[0163] In this embodiment, the preset grayscale target range is denoted as [G1, G2], where G1 is the first lower limit of the grayscale target range and G2 is the first upper limit of the grayscale target range. The control system needs to adjust the brightness of the LED light source so that the average grayscale value m of the low grayscale area of the acquired target image is within the grayscale target range [G1, G2]. When the average grayscale value m of the low grayscale area is within [G1, G2], the original image of the target image is output. If m is outside [G1, G2], m is compared with the first lower limit value G1 or the first upper limit value G2.
[0164] In step S131, when the average gray value m of the low grayscale area is less than the first lower limit G1, it indicates that the brightness of the image light source on the end face of the log is insufficient, which is not conducive to identifying the end face of the log in the log image. Then, the control system generates an adjustment command to increase the brightness of the LED light source. By increasing the output energy of the LED light source, the gray value of the target image is increased, so that the average gray value of the low grayscale area is greater than the first lower limit G1.
[0165] The following section elaborates on methods to increase the output energy of LED light sources.
[0166] The control system first obtains the current pulse width P of the LED light source. led当 The preset single-time adjustment amount ΔP of the lamp source pulse width is used. led To increase the current lamp pulse width P led当 This increases the brightness of the LED light source, allowing more output energy to enter the camera within the same exposure time, thus improving the brightness of the original wood image. This is achieved by adjusting the single pulse width ΔP of the light source. led The LED light source can be adjusted in stages, avoiding excessive or insufficient adjustments at once, thus improving adjustment efficiency. The adjusted lamp source pulse width P led调 =P led当 +ΔP led Adjust the pulse width P of the lamp source. led调 Set to the current lamp source pulse width Pled当 Then return to step S110 and repeat the operation until the average gray value m of the low gray area is greater than the first lower limit value G1.
[0167] When the current lamp source pulse width P led当 Greater than the maximum pulse width P of the LED light source ledMax When the brightness of the LED light source is adjusted to its maximum value, the brightness of the image light source on the end face of the log is still insufficient. At this time, the brightness of the image on the end face of the log can be improved by adjusting the camera's exposure time so that the camera can absorb more output energy from the LED light source. Obtain the current exposure time t1 of the camera, use the preset exposure time single time adjustment amount Δt to increase the current exposure time, and generate the adjusted exposure time t2. Where, t2 = t1 + Δt. Set the adjusted exposure time t2 as the current exposure time t1, and return to step S130 until the average gray value m in the low gray area is greater than the first lower limit value G1.
[0168] In step S132, when the average gray value m in the low grayscale area is greater than the second upper limit value G2, it indicates that the brightness of the image light source on the log end face is too bright, which is not conducive to identifying the log end face on the log image. Then, the control system generates an adjustment command to reduce the output energy of the LED light source. By reducing the output energy of the LED light source, the gray value of the target image is reduced, so that the average gray value m in the low grayscale area is less than the first upper limit value G2.
[0169] The following section elaborates on methods to reduce the output energy of LED light sources.
[0170] The control system obtains the current pulse width P of the LED light source. led当 The preset single-time adjustment amount ΔP of the lamp source pulse width is used. led To reduce the current lamp pulse width P led当 This can reduce the brightness of the LED light source, decrease the output energy absorbed by the camera within the same exposure time, and thus reduce the brightness of the original wood image. The adjusted lamp source pulse width P led调 =P led当 -ΔP led Adjust the pulse width P of the lamp source. led调 Set to the current lamp source pulse width P led当 Then return to step S110. Repeat the operation until the average gray value m of the low gray area is less than the first upper limit value G2.
[0171] If the brightness of the LED light source is continuously decreased until the current light source pulse width is equal to the preset minimum light source pulse width and the light source brightness cannot be adjusted by reducing the light source pulse width of the LED light source anymore, the brightness of the light source can be adjusted by adjusting the exposure time of the camera. At this time, it also indicates that the external environment is brighter, and in this case, the LED light source can be not used. The control system obtains the current exposure time t1 of the camera and uses the preset single - time exposure time adjustment amount Δt to reduce the current exposure time t1, so that the camera reduces the absorption of the output energy of the LED light source, thereby reducing the brightness of the log end face image. The adjusted exposure time t2 is generated from the current exposure time t1, where t2 = t1+Δt. The adjusted exposure time t2 is set as the current exposure time t1, and the process returns to step S110 until the average gray value m of the low - gray - level area is less than the first upper limit value G2.
[0172] After debugging, the average gray value m of the low - gray - level area is between the first lower limit value G1 and the second lower limit value G2. Briefly speaking, it can be summarized as follows:
[0173] The gray - level mean value m of the low - gray - level area of the current image is compared with the upper and lower limits G1, G2 of the gray - level mean value. If m < G1, the light source pulse width of the LED light source is increased, that is, the new light source pulse width value is P led调 =P led当 +ΔP led until m ∈ [G1, G2]. When P led > P ledMax , if m < G1, at this time, the camera exposure time value is increased, that is, the new exposure time is t = t+Δt until m ∈ [G1, G2]. Similarly, when m > G2, the light source pulse width of the LED light source is decreased, that is, the new light source pulse width value is P led调 =P led当 -ΔP led until m ∈ [G1, G2]. When P led =0, if m > G2, the camera exposure time value is decreased, that is, the new exposure time is t = t - Δt until m ∈ [G1, G2].
[0174] So far, the debugging work of the LED light source is completed. Next is to confirm whether the light source of the infrared laser meets the requirements.
[0175] In this embodiment, in step S120, the positions of the two sets of infrared lasers are set up so that the structured beams emitted by the two sets of infrared lasers are parallel. The structured beams emitted by each set of infrared lasers are cross-shaped, and the lines emitted by the two sets of infrared lasers intersect each other, so that the structured beams can better cover the end face of the log to be tested. After setting up the LED light source, infrared lasers, and camera, the trigger is pulled to trigger the simultaneous lighting of the laser light source and LED light source, and the light source is projected onto the end face of the log. At the same time, the camera shutter is opened to capture the image. The infrared laser uses a preset laser pulse width, the LED light source uses the adjusted lamp source pulse width mentioned above, and the camera exposure time is based on the exposure time during the LED light source debugging. If the camera exposure time was adjusted during the LED light source debugging, the camera uses the adjusted exposure time; otherwise, the preset exposure time is used for image acquisition. The camera transmits the acquired log image to the control system, which analyzes it and extracts all high grayscale points on the log image. Then, a target image is generated based on all the high grayscale points, and the area of the target image is obtained. The target image includes all the high grayscale points. The area H of the high grayscale region is calculated based on all the high grayscale points, and the proportion δ of the high grayscale region area is calculated based on the area H of the high grayscale region and the area of the target image.
[0176] The calculation method for the area ratio δ of high grayscale regions is as follows:
[0177] Let R represent the area occupied by all pixels in the target image, (i,j) represent a pixel in R, and g(i,j) represent the gray value of the pixel; then the area of the high gray-level region in the target image can be obtained by the image thresholding segmentation algorithm:
[0178] H = {(i,j)∈R / g(i,j)>T}
[0179] In the formula, H is the area of the high grayscale region; T is a certain segmentation threshold; then the areas of R and H can be expressed as follows:
[0180]
[0181]
[0182] The proportion of high grayscale area in the target image is:
[0183]
[0184] In the formula, δ represents the proportion of high grayscale area in the target image.
[0185] In this embodiment, the preset range of the proportion of high grayscale area δ in the target image is denoted as [δ1, δ2], where δ1 is the second lower limit of the proportion of high grayscale area in the target image, and δ2 is the second upper limit of the proportion of high grayscale area in the target image. One of the goals of grayscale adaptive adjustment is to ensure that the proportion of high grayscale value δ in the target image ∈ [δ1, δ2]. The control system needs to adjust the brightness of the infrared laser source so that the proportion of high grayscale area δ in the acquired target image is within the grayscale target range [δ1, δ2]. When the proportion of high grayscale area δ is within [δ1, δ2], the log image containing the target image is output. If δ is outside [δ1, δ2], δ is compared with the second lower limit δ1 or the second upper limit δ2.
[0186] In step S134, when the proportion of high grayscale area δ is less than the second lower limit δ1, it indicates that the brightness of the infrared laser source is insufficient and the proportion of high grayscale area is too small. This will negatively impact the subsequent extraction of the log end face and area calculation, increasing the measurement and calculation error. Therefore, it is necessary to increase the output energy of the infrared laser to ensure that the camera absorbs more output energy within the same exposure time while keeping the LED light source brightness constant. This will increase the number of high grayscale points on the log image, making the proportion of high grayscale area δ greater than the second lower limit δ1.
[0187] The following section elaborates on methods to increase the output energy of infrared lasers.
[0188] The control system first obtains the current laser pulse width P of the infrared laser. laser当 Using the preset laser pulse width single adjustment amount ΔP laser To increase the current laser pulse width P laser当 This increases the brightness of the infrared laser emitted, allowing the camera to absorb more output energy from the infrared laser within the same exposure time, increasing the number of high-grayscale points and thus increasing the area ratio of high-grayscale regions. The adjusted laser pulse width is P. laser调 =P laser当 +ΔP laser The adjusted laser pulse width P laser调 Set to the current laser pulse width P laser当 Then return to step S120. Repeat the adjustment until the area ratio of high grayscale regions δ is greater than the second lower limit value δ1.
[0189] The brightness of the infrared laser source is continuously increased until the current laser pulse width exceeds the maximum pulse width of the infrared laser. However, the proportion of high grayscale area δ remains less than the second lower limit δ1. This indicates that the brightness of the infrared laser source has reached its maximum value, but the number of high grayscale points on the log image is still insufficient. At this point, the number of high grayscale points on the log image can be increased by adjusting the camera's exposure time, allowing the camera to absorb more output energy from the infrared laser. The control system obtains the camera's current exposure time t1, uses a preset single-time adjustment amount Δt to increase the current exposure time t1, and generates an adjusted exposure time t2. Here, t2 = t1 + Δt. The adjusted exposure time t2 is set as the current exposure time t1, and the process returns to step S120. This adjustment is repeated until the proportion of high grayscale area δ exceeds the second lower limit δ1.
[0190] In step S134, when the area ratio δ of the high grayscale region is greater than the second upper limit δ2, it indicates that there are too many high grayscale points, occupying too large an area. This will cause the two cross-shaped lines formed by the infrared laser light source on the log image to be unclear, affecting the extraction of the log end face contour and the calculation of the area in the next step. Therefore, the control system generates an adjustment command to reduce the output energy of the infrared laser. By reducing the output energy of the infrared laser, the number of high grayscale points is reduced, so that the area ratio δ of the high grayscale region is less than the second upper limit δ2.
[0191] The following section elaborates on methods for reducing the output energy of infrared lasers.
[0192] First, adjust the laser pulse width of the infrared laser. The control system obtains the current laser pulse width P of the infrared laser. laser当 Using the preset laser pulse width single adjustment amount ΔP laser To reduce the current laser pulse width P laser当 This reduces the brightness of the infrared laser emitted, causing the camera to absorb less output energy from the infrared laser within the same exposure time, thus reducing the number of high-grayscale points and consequently decreasing the area ratio of high-grayscale regions. The adjusted laser pulse width is P. laser调 =P laser当 -ΔP laser The adjusted laser pulse width P laser调 Set to the current laser pulse width P laser当 Then return to step S120. Repeat the adjustment until the area ratio of high grayscale regions δ is less than the second upper limit value δ2.
[0193] The laser pulse width of the infrared laser is continuously reduced until it equals the preset minimum laser pulse width. At this point, the area ratio δ of the high grayscale region is greater than the second upper limit δ2, but the brightness of the infrared laser source is still too bright. In this case, the brightness of the source can be adjusted by changing the camera's exposure time. The control system obtains the camera's current exposure time t1 and uses a preset single-time adjustment amount Δt to reduce the current exposure time t1, causing the camera to absorb less output energy from the infrared laser, thereby reducing the brightness of the log end face image. An adjusted exposure time t2 is generated from the current exposure time t1, where t2 = t1 - Δt. The adjusted exposure time t2 is set as the current exposure time t1, and the process returns to step S110 until the area ratio δ of the high grayscale region is less than the second upper limit δ2. At this point, the adjusted exposure time t2 should satisfy the condition that the average grayscale value m of the low grayscale region is between the first lower limit G1 and the second lower limit G2, and the area ratio δ of the high grayscale region is between the second lower limit δ1 and the second upper limit δ2.
[0194] In short, the method for adjusting the output energy of an infrared laser can be briefly summarized as follows:
[0195] Calculate the value of δ and compare it with the upper and lower limits δ1 and δ2. If δ < δ1, increase the laser pulse width of the infrared laser, i.e., the new laser pulse width is P. laser调 =P laser当 +ΔP laser until δ∈[δ1, δ2]. When P laser >P laserMax If δ < δ1, the camera exposure time is increased, i.e., the new exposure time is t2 = t1 + Δt, until δ ∈ [δ1, δ2]. When δ > δ2, the laser pulse width is decreased, i.e., the new laser pulse width is P. laser调 =P laser当 -ΔP laser until δ∈[δ1,δ2]. When P laser When δ = 0, if δ > δ2, then decrease the camera exposure time value, that is, the new exposure time is t2 = t1 - Δt, until δ ∈ [δ1, δ2].
[0196] At this point, the debugging of the infrared laser was also completed.
[0197] The control system replaces the adjusted parameters with the current parameters. Specifically, the LED light source projects light onto the log end face based on the adjusted lamp pulse width, the infrared laser projects light based on the adjusted laser pulse width, and the camera acquires an image of the log end face based on the adjusted exposure time. This acquired image is then transmitted to the control system for further processing. If any of these three parameters do not require adjustment, the original settings are used directly. Furthermore, after acquiring an image of one log, the adjusted parameters can be directly applied to the next log, significantly improving operational efficiency.
[0198] Reference Figure 8 , Figure 8 This is a schematic flowchart of the parameter detection process for the method of measuring logs using a log measuring instrument according to the present invention. Step S105 further includes parameter detection, which includes the following steps:
[0199] S141, controls the LED light source to turn on;
[0200] S142, Acquire the initial image of the log under LED light source illumination;
[0201] S143, Perform texture filtering on the initial image to obtain the first image;
[0202] S144, Perform adaptive threshold segmentation on the first image to obtain the second image;
[0203] S145, The second image is processed based on the morphological opening operation algorithm to obtain the third image;
[0204] S146, Extract candidate target regions from the third image;
[0205] S147, perform watershed segmentation on the candidate target region to obtain candidate target region partitions;
[0206] S148, Extract the target outline of the log under test from the candidate target region partition;
[0207] S149, Calculate the fitting equation for the target contour;
[0208] S150 calculates the target parameters of the tested log based on the fitted equation.
[0209] Furthermore, the arithmetic controller can call the parameter detection program stored in memory and perform the following operations:
[0210] A two-dimensional convolution kernel template is generated by multiplying a one-dimensional convolution kernel and its transpose in the Laws texture energy method.
[0211] The initial image is filtered using a filtering formula to obtain the first image. The filtering formula is:
[0212]
[0213] Wherein, G(i,j) is the first image, K(i,j) is the two-dimensional convolution kernel template, is the convolution symbol, F(i,j) is the initial image, and a is the convolution template size.
[0214] Furthermore, the arithmetic controller can call the parameter detection program stored in memory and perform the following operations:
[0215] The filtering formula is modified based on the correction factor σ to obtain the modified formula;
[0216] The initial image is filtered based on the correction formula to obtain the first image; wherein the correction formula is:
[0217]
[0218] G'(i,j) is the corrected first image.
[0219] Furthermore, the arithmetic controller can call the parameter detection program stored in memory and perform the following operations:
[0220] The second image is subjected to erosion processing based on the erosion formula to obtain a second eroded image;
[0221] The second erosion image is dilated using the dilation formula to obtain the third image;
[0222] The corrosion formula is:
[0223] g1Θs=min{g(i+m,j+n)-b(m,n)|(i+m,j+n)∈D g ,(m,n)∈D s};
[0224] The expansion formula is:
[0225] g2⊕s=min{g(i+m,j+n)-b(m,n)|(i+m,j+n)∈D g ,(m,n)∈D s};
[0226] Where g1(i,j) is the second image of the input image, g2(i,j) is the second eroded image of the input image, s(m,n) is the structuring element, and Dg and Ds represent the domains of the input image and the structuring element, respectively.
[0227] Furthermore, the processor 1001 can call the parameter detection program stored in the memory 1005 and also perform the following operations:
[0228] Perform connected component labeling on the third image;
[0229] Calculate the area of each connected component. The formula for calculating the area of a connected component is:
[0230]
[0231] Wherein, Ri is the i-th connected region in the third image, (r, c) are the coordinates, and Ai is the area of the i-th connected region;
[0232] The candidate target region is determined based on the connected component with the largest area.
[0233] Furthermore, the arithmetic controller can call the parameter detection program stored in memory and perform the following operations:
[0234] The candidate target region is subjected to distance transformation processing based on the distance transformation formula to obtain a distance-transformed image; the distance transformation formula is:
[0235]
[0236] Where dist(p,q) is the distance calculation function, O represents the candidate target region, B represents the background region, and p and q are points in the candidate target region and the background region, respectively;
[0237] Watershed segmentation is performed on the distance-transformed image to obtain candidate target region partitions.
[0238] Furthermore, the arithmetic controller can call the parameter detection program stored in the memory and also perform the following operations:
[0239] Define the equation of the ellipse:
[0240] ax 2 +bxy+cy 2 +dx+ey+f=0
[0241] st4ac-b 2 >0
[0242] Where a, b, c, d, e, and f are equation parameters; x and y are the coordinates of the target region partition;
[0243] Let M = [a,b,c,d,e,f], X = [x 2 ,xy,y 2 [x,y,1] T The objective function for ellipse fitting least squares optimization is:
[0244] min||MX|| 2 =MXX T M T
[0245] stMQM T >0
[0246] in,
[0247]
[0248] Solving the optimal solution M of the objective function based on the penalty function * = [a,b,c,d,e,f], determine the fitting equation.
[0249] Furthermore, the processor 1001 can call the parameter detection program stored in the memory 1005 and also perform the following operations:
[0250] The center coordinates (x0, y0) are determined based on the fitted equation.
[0251] The semi-major axis r1 is calculated based on the fitted equation and the formula for calculating the semi-major axis; the formula for calculating the semi-major axis is:
[0252]
[0253] The minor semi-axis r2 is calculated based on the fitted equation and the formula for calculating the minor semi-axis. The formula for calculating the minor semi-axis is as follows:
[0254]
[0255] The major diameter and minor diameter are determined based on the major semi-axis and the minor semi-axis, respectively. Then, the measuring diameter is determined based on the major diameter and the minor diameter. Finally, the measuring diameter grade is determined based on the measuring diameter.
[0256] The method for measuring logs using a log measuring instrument of the present invention begins with turning on the power switch. The user operates the touch screen to connect to the network, log in, and handle log storage and retrieval. The log measuring instrument is aligned with the log to be measured, and the distance between the measuring device and the log is initially adjusted according to the size of the log. The user presses and holds the photo button, and the laser is illuminated, emitting a quadrilateral pattern. The position of the log measuring instrument is adjusted so that the quadrilateral pattern is within the area of the log to be measured, ensuring that all four corners of the quadrilateral are within the cross-section of the log. The user releases the photo button and waits for the log measuring instrument to calculate the measurement. The log measuring instrument's measurement calculation includes adaptive adjustment of image grayscale values, calculation of the pose of the measured surface, extraction of the log contour, and calculation of the measuring diameter.
[0257] The measurement results, including the diameter grade, are announced via voice broadcast, and the measurement results, including images of the logs captured, are displayed on a touchscreen. Simultaneously, the measurement data is uploaded to a cloud server for storage, completing the measurement process. This invention provides a method for measuring logs using a log measuring instrument that is simple to operate, convenient to measure, and highly efficient.
[0258] In summary, although the present invention has been disclosed above with reference to preferred embodiments, the above preferred embodiments are not intended to limit the present invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the scope defined in the claims.
Claims
1. A method of measuring logs using a log measuring instrument, characterized by, The method comprises the following steps: S101, starting the power switch, the user operating the touch screen; S102, the user aligns the log measuring instrument to the measured log, and preliminarily adjusts the distance between the measuring equipment and the log according to the size of the measured log; S103, long-pressing the shooting button, at this time, the laser can be seen to be lit and emit a quadrilateral pattern, the position of the log measuring instrument is adjusted, the quadrilateral pattern is adjusted into the measured log area, and it is ensured that the four corners of the quadrilateral are located in the cross section of the log; S104, releasing the shooting button, waiting for the log measuring instrument to calculate the measurement; S105, the measurement result is obtained by voice broadcast, the measurement result of the photographed log picture can be seen on the touch screen, the measurement data is uploaded to the cloud server for saving, and the measurement is completed; In the step S104, the log measuring instrument calculating the measurement comprises the following steps: S106, the operation controller collects the brightness of the ambient light, and calculates the shutter time of the camera, the PWM value of the LED light source brightness and the PWM value of the infrared laser brightness through the adaptive image grayscale adjustment algorithm; S107, the operation controller outputs the LED light source control PWM signal and the infrared laser control PWM signal through the GPIO interface; S108, the operation controller drives the camera to open the shutter and take a picture; S109, the GPIO interface of the camera automatically outputs the enable signal, and the LED light source and the infrared laser are lit; S110, the operation controller reads the log picture; S111, laser fringe image processing is performed, and the pose of the measured object plane is calculated; S112, the log profile is extracted, and the log profile is mapped to the measured object plane, and an ellipse is fitted to obtain the long diameter and the short diameter of the measured log; In the step S111, the pose of the measured object plane comprises the following steps: S115, when the measured log is under the laser ray projection of the infrared laser, the image of the measured log is collected by the camera; wherein, the image comprises a laser fringe, and the laser fringe is an image area of a laser projection area projected on the measured log by the infrared laser; S116, the light plane calibration equation of the light plane of the infrared laser in the camera coordinate system is calibrated based on the laser fringe and the structured light light plane calibration algorithm; S117, the transformation relationship between the image coordinates of the laser fringe and the camera coordinates is determined based on the camera perspective imaging model; S118, the plane equation of the measured log in the camera coordinate system is calculated based on the transformation relationship and the light plane calibration equation; S119, the distance between the measured log and the camera imaging plane is calculated as the working distance based on the plane equation; S120, the angle between the normal line of the measured log and the camera optical axis is calculated as the working inclination angle; In the step S112, the log profile extraction comprises the following steps: S130, the LED light source projects a light source to the end surface of the log, the camera obtains a log image based on the projected light source, generates a target image based on the log image, obtains a low gray area based on the target image, and calculates a low gray area average gray value based on the low gray area. S131, obtaining a first lower limit value; when the average gray value of the low gray area is less than the first lower limit value, increasing the output energy of the LED light source, thereby increasing the gray value of the target image, and returning to step S130; until the average gray value of the low gray area is greater than the first lower limit value; S132, obtaining a first upper limit value; when the average gray value of the low gray area is greater than the first upper limit value, reducing the output energy of the LED light source, thereby reducing the gray value of the target image, and returning to step S130; until the average gray value of the low gray area is less than the first upper limit value; S133, the LED light source projects light source to the end face of the log based on the adjusted output energy of the LED light source and the infrared laser; The camera obtains a log image based on the projected light source, generates the target image based on the log image, and obtains the area of the target image, the target image including all high gray points; Based on all the high gray points, the high gray area is obtained, and the high gray area ratio is calculated based on the high gray area and the area of the target image; S134, obtaining a second lower limit value; when the high gray area ratio is less than the second lower limit value, increasing the output energy of the infrared laser, thereby increasing the number of high gray points, and returning to step S133; until the high gray area ratio is greater than the second lower limit value; S135, obtaining a second upper limit value; when the high gray area ratio is greater than the second upper limit value, reducing the output energy of the infrared laser, thereby reducing the number of high gray points, and returning to step S133; until the high gray area ratio is less than the second upper limit value; and S136, the camera obtains the log image based on the adjusted output energy of the LED light source and the infrared laser.
2. The method of measuring logs using a log measuring instrument according to claim 1, wherein, The step S110 further includes calculating the gray value of the log picture. If the gray value meets the requirement, the photographing is successful, S111 is executed, otherwise, after adjusting the shutter time, the brightness of the infrared LED light source, and the brightness of the infrared laser, the process returns to S106.
3. The method of measuring logs using a log measuring instrument as defined in claim 1, wherein, The step S111 further includes judging the included angle between the measured object plane and the camera optical axis. If the included angle is greater than a set value, the voice prompt "inclination is too large" is given, and the process returns to S103, otherwise, S112 is executed.
4. The method of measuring logs using a log measuring instrument as defined in claim 1, wherein, The step S117 includes the following steps: S121, dividing the laser fringe based on a preset width; S122, obtaining the distance of each division from the image center; S123, determining the division area of each division corresponding section based on the distance of each division from the image center and a preset relationship between the distance and the cross-sectional area; S124, determining the length of each section based on the division area of each section and the preset width; S125, dividing the section in a rectangular shape based on the length of each section and the preset width; S126, determining the center line based on the connection line of the gray centroids of each section; S127, determining the transformation relationship between the image coordinates and the camera coordinates of the laser fringe based on the image coordinates of the center line and the camera perspective imaging model.
5. The method of measuring logs using a log measuring instrument as defined in claim 1, wherein, The step S118 includes the following steps: S128, calculating a laser projection equation of the laser projection region in the camera coordinate system based on the transformation relationship and the light plane calibration equation; S129, calculating the plane equation based on a least square plane fitting method and point coordinates of different laser projection equations.
6. The method of measuring logs using a log measuring instrument as defined in claim 1, wherein, The step of increasing the output energy of the LED light source in the step S131 includes: S137, obtaining a current light source pulse width of the LED light source, increasing the current light source pulse width by using a preset single light source pulse width adjustment amount, and generating an adjusted light source pulse width; S138, setting the adjusted light source pulse width as the current light source pulse width, and returning to the step S130; until the average gray value of the low gray area is greater than the first lower limit value; and The step of decreasing the output energy of the LED light source in the step S132 includes: S139, obtaining a current light source pulse width of the LED light source, decreasing the current light source pulse width by using a preset single light source pulse width adjustment amount, and generating an adjusted light source pulse width; S140, setting the adjusted light source pulse width as the current light source pulse width, and returning to the step S130; until the average gray value of the low gray area is less than the first upper limit value.
7. The method of measuring logs using a log measuring instrument as defined in claim 1, wherein, The step S105 further includes parameter detection, and the parameter detection includes the following steps: S141, controlling the LED light source to be turned on; S142, collecting an initial image of the measured log under the irradiation of the LED light source; S143, performing texture filtering processing on the initial image to obtain a first image; S144, performing adaptive threshold segmentation processing on the first image to obtain a second image; S145, processing the second image based on a morphological opening operation algorithm to obtain a third image; S146, extracting a candidate target region of the third image; S147, performing watershed segmentation on the candidate target region to obtain a candidate target region partition; S148, extracting a target contour of the measured log from the candidate target region partition; S149, calculating a fitting equation of the target contour; S150, calculating a target parameter of the measured log based on the fitting equation.
Citation Information
Patent Citations
Laser scanning type global calibration device and method for vision measurement system
CN108344360A
Image processing method for log end face measurement
CN112750127A