Method for measuring length of tobacco leaves

文档序号:8543 发布日期:2021-09-17 浏览:45次 中文

1. A method for measuring the length of tobacco leaves is characterized in that: comprises the following steps:

the method comprises the following steps that firstly, tobacco leaves are placed on a supporting plate made of transparent materials, auxiliary backlight is arranged at the bottom of the supporting plate, and light-transmitting images of the tobacco leaves are shot through a camera;

identifying and marking stems of the tobacco leaves in the light-transmitting image through a machine vision algorithm;

step three, calculating the outline of the stem by the image obtained in the step two;

step four, calculating half of the contour length as the measured stem length;

and step five, obtaining an empirical coefficient a through a test, and multiplying the stem length by the empirical coefficient a to obtain the actual tobacco leaf length.

2. The method for measuring the length of the tobacco leaves according to claim 1, wherein: the specific operation steps of the second step are as follows:

step 1.1, establishing a neural network model, and training the neural network model by using a light-transmitting image of a stem of a tobacco leaf identified by an artificial person as a training sample set to obtain a tobacco leaf identification model;

step 1.2, preprocessing the light-transmitting image collected in the step one and extracting image characteristics;

and step 1.3, inputting the image characteristics into the recognition model, outputting a recognition result by the recognition model, and marking the stems of the tobacco leaves in the light-transmitting image according to the recognition result.

3. The method for measuring the length of the tobacco leaves according to claim 1, wherein: in the third step, the region marked out and representing the stem of the tobacco leaf in the second step calls a function findContours for acquiring the contour in opencv to process.

4. The method for measuring the length of the tobacco leaves according to claim 1, wherein: the length of the contour is calculated by line integration in the fourth step.

5. The method for measuring the length of the tobacco leaves according to claim 1, wherein: in the fourth step, the length of the contour is calculated by calling a function arcLength for calculating the length of the curve in opencv.

Background

When the tobacco leaves are subjected to grade evaluation in the prior art, the length of the tobacco leaves is an important index, particularly for cigar tobacco leaves, the length of the tobacco leaves is measured only after the tobacco leaves are straightened (as shown in figure 1) no matter the length of the tobacco leaves is measured manually or automatically at present, and the accurate length cannot be obtained directly through visual estimation only because the tobacco leaves are obviously curled after being baked or aired. However, the tobacco leaves must be stretched first when the length is measured, the problem of low labor consumption and efficiency exists when a manual mode is adopted, the tobacco leaves are easy to damage when mechanical automatic stretching is adopted, and the measurement efficiency is reduced because of the stretching process, so that the measurement mode needs to be improved in the prior art to measure the tobacco leaves which are curled after being processed directly through the collected images under the condition that the tobacco leaves do not need to be straightened

Disclosure of Invention

The invention aims to provide a method for measuring the length of tobacco leaves, which aims to solve the technical problems that the length of the tobacco leaves can be measured only by straightening the tobacco leaves in the prior art, and the tobacco leaves with certain curliness can not be directly subjected to image processing and measurement to obtain more accurate length.

The method for measuring the length of the tobacco leaves comprises the following steps:

the method comprises the following steps that firstly, tobacco leaves are placed on a supporting plate made of transparent materials, auxiliary backlight is arranged at the bottom of the supporting plate, and light-transmitting images of the tobacco leaves are shot through a camera;

identifying and marking stems of the tobacco leaves in the light-transmitting image through a machine vision algorithm;

step three, calculating the outline of the stem by the image obtained in the step two;

step four, calculating half of the contour length as the measured stem length;

and step five, obtaining an empirical coefficient a through a test, and multiplying the stem length by the empirical coefficient a to obtain the actual tobacco leaf length.

Preferably, the specific operation steps of the second step are as follows:

step 1.1, establishing a neural network model, and training the neural network model by using a light-transmitting image of a stem of a tobacco leaf identified by an artificial person as a training sample set to obtain a tobacco leaf identification model;

step 1.2, preprocessing the light-transmitting image collected in the step one and extracting image characteristics;

and step 1.3, inputting the image characteristics into the recognition model, outputting a recognition result by the recognition model, and marking the stems of the tobacco leaves in the light-transmitting image according to the recognition result.

Preferably, in the third step, the region marked out in the second step and representing the stem of the tobacco leaf calls the function findContours for acquiring the contour in opencv to process.

Preferably, the length of the contour is calculated by line integration in the fourth step.

Preferably, in the fourth step, the length of the contour is calculated by calling a function arcLength for calculating the length of the curve in opencv.

The invention has the technical effects that: in order to accurately measure the length of the tobacco leaves without straightening the tobacco leaves, the length of stems in the tobacco leaves is measured by adopting a method of calculating the actual length of the tobacco leaves through empirical coefficients obtained through tests, and the curled tobacco leaves are used for obtaining the length of the outline of the area after the stems are identified and corresponding areas are marked, and half of the length is used as the stem length. Because the linear relation exists between the stem of the leaf and the length of the tobacco leaf, and the curves at the two sides of the central line of the stem of the tobacco leaf are approximately consistent with the shape length of the stem of the tobacco leaf even after the stem is curled, the stem length can be accurately obtained by calculating half of the length of the contour line, on the other hand, after the stem of the tobacco leaf is identified, the calculation of the curve length of the contour line of the corresponding image area is more convenient and reliable than the further identification and calculation of the central line of the curled stem, and the calculation amount is smaller, so the method for calculating the leaf length is more efficient and reliable.

Drawings

Fig. 1 is an image obtained by identifying and marking stems of tobacco leaves on an acquired tobacco leaf image in the method for measuring the length of the tobacco leaves according to the present invention.

Fig. 2 is a schematic diagram of the contour calculation of the identified and marked shadow region in the present invention, and the shadow portion is the region marked by the stem of the tobacco leaf.

Detailed Description

The following detailed description of the embodiments of the present invention will be given in order to provide those skilled in the art with a more complete, accurate and thorough understanding of the inventive concept and technical solutions of the present invention.

As shown in fig. 1-2, the present invention provides a method for measuring the length of tobacco leaves, comprising the steps of:

the method comprises the following steps that firstly, under the condition that the tobacco leaves are not straightened, the tobacco leaves are directly transversely placed on a supporting plate made of transparent materials from left to right, auxiliary backlight is arranged at the bottom of the supporting plate, and light-transmitting images of the tobacco leaves are shot through a camera.

And step two, identifying and marking the stems of the tobacco leaves in the light-transmitting image through a machine vision algorithm.

The specific operation steps are as follows.

Step 1.1, establishing a neural network model, and training the neural network model by using a light-transmitting image of a stem of the tobacco identified by manual work as a training sample set to obtain a tobacco recognition model.

And step 1.2, preprocessing the light-transmitting image collected in the step one and extracting image characteristics.

And step 1.3, inputting the image characteristics into the recognition model, outputting a recognition result by the recognition model, and marking the stems of the tobacco leaves in the light-transmitting image according to the recognition result.

And step three, calculating the contour of the marked stem, and calling a function findContours for acquiring the contour from opencv to process the region marked out of the stem of the tobacco leaf in the step two, so as to obtain the contour of the marked region.

And step four, calculating half of the contour length as the measured stem length. The length of the contour can be calculated by linear integration, or by calling the function arcLength of opencv for calculating the length of the curve.

And step five, obtaining an empirical coefficient a through a test, and multiplying the stem length by the empirical coefficient a to obtain the actual tobacco leaf length.

The invention is described above with reference to the accompanying drawings, it is obvious that the specific implementation of the invention is not limited by the above-mentioned manner, and it is within the scope of the invention to adopt various insubstantial modifications of the inventive concept and solution of the invention, or to apply the inventive concept and solution directly to other applications without modification.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:指针仪表读数的识别方法、系统、设备及计算机存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!