[go: up one dir, main page]

CN110766702B - Agaricus bisporus grading judgment method - Google Patents

Agaricus bisporus grading judgment method Download PDF

Info

Publication number
CN110766702B
CN110766702B CN201910994655.8A CN201910994655A CN110766702B CN 110766702 B CN110766702 B CN 110766702B CN 201910994655 A CN201910994655 A CN 201910994655A CN 110766702 B CN110766702 B CN 110766702B
Authority
CN
China
Prior art keywords
image
mushroom
conveyor belt
agaricus bisporus
grading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910994655.8A
Other languages
Chinese (zh)
Other versions
CN110766702A (en
Inventor
姜凤利
杨鑫
孙炳新
柳想
马诗博
沈殿昭
王馨瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenyang Agricultural University
Original Assignee
Shenyang Agricultural University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenyang Agricultural University filed Critical Shenyang Agricultural University
Priority to CN201910994655.8A priority Critical patent/CN110766702B/en
Publication of CN110766702A publication Critical patent/CN110766702A/en
Application granted granted Critical
Publication of CN110766702B publication Critical patent/CN110766702B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Investigating Or Analysing Materials By Optical Means (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种双孢蘑菇分级判断方法,属于双孢蘑菇生产领域。该装置包括如下步骤:S1,获取蘑菇图像信息;S2,提取感兴趣区域S3,图像分割,其包括:S31,将待提取图像转化为灰度图像;S32,采用OSTU阈值分割算法处理;S33,进行形态学变换;S34,对形态学变换图进行膨胀操作;S35,进行距离变换;S36,以距离为阈值进行固定阈值二值化确定前景图像;S37,将背景图像和前景图像相减,提取图像轮廓;S38,根据不确定区域在markers中经过分水岭变化最终得到原始图像的边界;S4,根据获取的前景图像,计算前景图像的像素个数m;S5,按照预设规则,根据蘑菇菌盖的面积判定等级。本发明可以提高双孢蘑菇的分级判断的精准度,降低人工分级所带来的误差。

The invention discloses a method for grading and judging Agaricus bisporus, which belongs to the field of Agaricus bisporus production. The device includes the following steps: S1, acquiring mushroom image information; S2, extracting the region of interest S3, image segmentation, which includes: S31, converting the image to be extracted into a grayscale image; S32, using the OSTU threshold segmentation algorithm for processing; S33, Perform morphological transformation; S34, perform expansion operation on the morphological transformation map; S35, perform distance transformation; S36, perform fixed threshold binarization with distance as the threshold to determine the foreground image; S37, subtract the background image from the foreground image, extract Image outline; S38, according to the uncertainty region in the markers, the boundary of the original image is finally obtained; S4, according to the acquired foreground image, calculate the number of pixels m of the foreground image; S5, according to the preset rules, according to the mushroom cap area judgment level. The invention can improve the accuracy of grading judgment of Agaricus bisporus, and reduce errors caused by manual grading.

Description

一种双孢蘑菇分级判断方法A kind of grading judgment method of Agaricus bisporus

技术领域technical field

本发明涉及双孢蘑菇生产领域,特别涉及一种双孢蘑菇分级判断方法。The invention relates to the field of Agaricus bisporus production, in particular to a method for judging the classification of Agaricus bisporus.

背景技术Background technique

双孢蘑菇又称白蘑菇、蘑菇、洋蘑菇,欧美各国生产经营者常称之为普通栽培蘑菇或纽扣蘑菇。双孢蘑菇是世界性栽培和消费的菇类,有“世界菇”之称,可鲜销、罐藏、盐渍。双孢蘑菇的菌丝还作为制药的原料。中国双孢蘑菇栽培最多的有福建、山东、河南、浙江等省。栽培方式有菇房栽培、大棚架式栽培和大棚畦栽等。不同地区,不同气候条件和不同季节可采取适合自己的栽培方式。分布极广泛,中国普遍栽培。不过随着双孢菇栽培技术的不断发展,目前已经实现了双孢菇的工厂化生产,通过对蘑菇房的环境控制可以实现一年四季不间断地生产。工厂化生产双孢菇可以对蘑菇房的温度、湿度、CO2浓度及通风量等进行精确的控制,从而给双孢菇提供了非常适宜的生长环境。目前规模较大的双孢菇工厂日产量可以达到上百吨。Agaricus bisporus is also known as white mushroom, mushroom, and sea mushroom, and producers and operators in European and American countries often call it common cultivated mushroom or button mushroom. Agaricus bisporus is a mushroom that is cultivated and consumed worldwide. It is known as the "World Mushroom" and can be sold fresh, canned, or salted. The mycelium of Agaricus bisporus is also used as a raw material for medicine. China's Agaricus bisporus is most cultivated in Fujian, Shandong, Henan, Zhejiang and other provinces. Cultivation methods include mushroom house cultivation, greenhouse frame cultivation and greenhouse border cultivation. Different regions, different climatic conditions and different seasons can adopt their own cultivation methods. It is widely distributed and is widely cultivated in China. However, with the continuous development of Agaricus bisporus cultivation technology, factory production of Agaricus bisporus has been realized, and uninterrupted production can be realized throughout the year through the environmental control of the mushroom house. The factory production of Agaricus bisporus can precisely control the temperature, humidity, CO2 concentration and ventilation of the mushroom house, thus providing a very suitable growth environment for Agaricus bisporus. At present, the daily output of large-scale Agaricus bisporus factories can reach hundreds of tons.

双孢菇在进行生产销售时,一般需要根据菌盖大小、残缺情况、褐变程度等参数对双孢菇进行等级筛选,以便根据市场需求获得更高的市场价格。但是目前双孢蘑菇工厂化生产中仍然采用人工分级,而人工分级对工人的熟练度要求较高,不同工作水平的人员分级的精准度参差不齐,另外大量依靠人工进行分级筛选工作量较大、效率低。When Agaricus bisporus is produced and sold, it is generally necessary to grade Agaricus bisporus according to parameters such as cap size, incompleteness, and browning degree, so as to obtain a higher market price according to market demand. However, at present, manual grading is still used in the factory production of Agaricus bisporus, and manual grading requires high proficiency of workers, and the accuracy of grading by personnel of different working levels is uneven. ,low efficiency.

发明内容Contents of the invention

本发明提供一种双孢蘑菇分级判断方法,可以解决现有技术中对双孢蘑菇进行分级时存在误差大、效率低的问题。The invention provides a method for grading Agaricus bisporus, which can solve the problems of large errors and low efficiency in grading Agaricus bisporus in the prior art.

一种双孢蘑菇分级判断方法,包括如下步骤:A method for judging the classification of Agaricus bisporus, comprising the steps of:

S1,获取蘑菇图像信息;S1, acquiring mushroom image information;

S2,提取感兴趣区域:根据蘑菇图像拍摄环境,设定参数并截取具有单一底色的蘑菇图像,获得待提取图像;计算出蘑菇外轮廓的最小外接矩形的左上点的坐标值,以及最小外接矩形的宽度W和高度H;S2, extract the region of interest: according to the shooting environment of the mushroom image, set the parameters and intercept the mushroom image with a single background color to obtain the image to be extracted; calculate the coordinate value of the upper left point of the minimum circumscribing rectangle of the mushroom outer contour, and the minimum circumscribing The width W and height H of the rectangle;

S3,图像分割,其包括:S3, image segmentation, which includes:

S31,将待提取图像转化为灰度图像;S31, converting the image to be extracted into a grayscale image;

S32,采用OSTU阈值分割算法处理,得到二值化图像;S32, adopting the OSTU threshold segmentation algorithm to process to obtain a binarized image;

S33,进行形态学变换:使用3*3的矩阵作为模板进行闭运算,先膨胀,对图片的每一个像素x置于模板的中央,遍历所有被模板覆盖的其他元素,修改像素x的值为所有像素中最大的值,对膨胀后的图片进行腐蚀,对图像的每个像素做遍历修改像素为模板中的最小值,得到形态学变换图;S33, perform morphological transformation: use a 3*3 matrix as a template to perform a closed operation, expand first, place each pixel x of the image in the center of the template, traverse all other elements covered by the template, and modify the value of the pixel x The maximum value of all pixels, corroding the expanded image, traversing each pixel of the image to modify the pixel to the minimum value in the template, and obtaining the morphological transformation map;

S34,对形态学变换图进行膨胀操作,得到背景图像;S34, performing an expansion operation on the morphological transformation map to obtain a background image;

S35,进行距离变换:设置掩模大小为3*3,设前景图片的RBG值为(255,255,255),即白色;设背景图片的RBG值为(0,0,0),即黑色;将非零像素点作为前景目标,零像素点作为背景;计算前景图片和背景图片的所有像素距离,使用最小二乘法,用所述距离替换为像素,生成距离变换图;S35, perform distance transformation: set the mask size to 3*3, set the RBG value of the foreground picture to (255,255,255), i.e. white; set the RBG value of the background picture to (0,0,0), i.e. black ; Use non-zero pixels as the foreground target, and zero pixels as the background; calculate all pixel distances between the foreground image and the background image, and use the least squares method to replace the distance with pixels to generate a distance transformation map;

S36,以所述距离为阈值进行固定阈值二值化确定前景图像;S36, using the distance as a threshold to perform fixed threshold binarization to determine the foreground image;

S37,将背景图像和前景图像相减,确定前景图像和背景图像重合的不确定区域,提取图像轮廓,得到标记markers;S37, subtracting the background image and the foreground image, determining the uncertain area where the foreground image and the background image overlap, extracting the contour of the image, and obtaining markers;

S38,根据不确定区域在markers中经过分水岭变化最终得到原始图像的边界;S38, according to the uncertain region, the boundary of the original image is finally obtained through the watershed change in the markers;

S4,根据获取的前景图像,计算前景图像的像素个数m,则蘑菇菌盖的面积为:m*25.4/d平方毫米,其中,d为摄像头的分辨率;S4, according to the obtained foreground image, calculate the number of pixels m of the foreground image, then the area of the mushroom cap is: m*25.4/d square millimeter, wherein, d is the resolution of the camera;

S5,按照预设规则,根据蘑菇菌盖的面积判定等级。S5, according to the preset rules, the grade is determined according to the area of the mushroom cap.

更优地,在S2中,采用OpenCV中的库函数findContours和boundingRect来计算蘑菇的最小外接矩形的左上点的坐标值,以及矩形的宽度W和高度H。More preferably, in S2, the library functions findContours and boundingRect in OpenCV are used to calculate the coordinate value of the upper left point of the minimum circumscribed rectangle of the mushroom, and the width W and height H of the rectangle.

更优地,在S2中,还包括对所述最小外接矩形向外延伸13mm,得到扩展矩形。More preferably, in S2, further comprising extending the minimum circumscribed rectangle outward by 13 mm to obtain an extended rectangle.

更优地,S4中还包括分别计算蘑菇的正面和反面的面积,取二者最大值作为蘑菇的面积。More preferably, S4 also includes calculating the areas of the front and back sides of the mushroom respectively, and taking the maximum value of the two as the area of the mushroom.

更优地,还包括S41,其包括:More preferably, it also includes S41, which includes:

S411,提取特征点:构建Hessian矩阵,待提取图像中任意一个像素点X=(x,y)的Hessian矩阵H(X,σ)如下:S411, extracting feature points: constructing a Hessian matrix, the Hessian matrix H(X, σ) of any pixel point X=(x, y) in the image to be extracted is as follows:

其中,σ为尺度,Lxx(X,σ),Lxy(X,σ),Lyy(X,σ)分别为高斯滤波后待提取图像在各个方向上的二阶导数;Among them, σ is the scale, Lxx(X,σ), Lxy(X,σ), and Lyy(X,σ) are the second derivatives of the image to be extracted in each direction after Gaussian filtering;

将积分图像与方框滤波器的卷积近似表示为Dxx,Dxy,Dyy,则得到Hessian行列式近似计算为:The convolution of the integral image and the box filter is approximately expressed as Dxx, Dxy, Dyy, and the approximate calculation of the Hessian determinant is obtained as:

det(Hessian)=DxxDyy-(λDxy)2 (2)det(Hessian)=D xx D yy -(λD xy ) 2 (2)

其中,λ为权重系数,用来平衡使用方框滤波器近似带来的误差;Among them, λ is the weight coefficient, which is used to balance the error caused by using the box filter approximation;

将所有经过Hessian矩阵处理后的像素点与尺度空间中的点进行非极大值比较,找出图像的兴趣点;Compare all the pixels processed by the Hessian matrix with the points in the scale space for non-maximum values to find out the points of interest in the image;

在尺度空间和图像空间中进行线性插值运算获得最后稳定的特征点;Perform linear interpolation in scale space and image space to obtain the final stable feature points;

S412,将原始图像转换为灰度图像;S412, converting the original image into a grayscale image;

根据提取到的特征点,以特征点为圆心画圆;According to the extracted feature points, draw a circle with the feature points as the center;

取蘑菇正面阈值为5mm,反面阈值为13mm;Take the front threshold of the mushroom as 5mm, and the reverse threshold as 13mm;

如果圆的大小超过该阈值,则认为是残缺,反之,则不是残缺;If the size of the circle exceeds the threshold, it is considered incomplete, otherwise, it is not incomplete;

S5,按照预设规则,根据蘑菇菌盖的面积和残缺情况判定等级。S5. According to the preset rules, the grade is determined according to the area and incompleteness of the mushroom cap.

本发明提供一种双孢蘑菇分级判断方法,可以提高双孢蘑菇的分级判断的精准度,降低人工分级所带来的误差,同时可以有效降低劳动工作量,提高效率降低成本。The invention provides a method for grading and judging Agaricus bisporus, which can improve the accuracy of grading and judging Agaricus bisporus, reduce errors caused by manual grading, effectively reduce labor workload, improve efficiency and reduce costs.

附图说明Description of drawings

图1为双孢蘑菇分级系统的结构示意图;Fig. 1 is the structural representation of Agaricus bisporus classification system;

图2为图1的俯视图;Fig. 2 is the top view of Fig. 1;

图3为图1的主视图;Fig. 3 is the front view of Fig. 1;

图4为图1中翻面装置的结构示意图;Fig. 4 is the structural representation of turning over device in Fig. 1;

图5为图4的俯视图;Figure 5 is a top view of Figure 4;

图6为图4的主视图;Fig. 6 is the front view of Fig. 4;

图7为图1中分级装置的结构示意图;Fig. 7 is the structural representation of classifying device in Fig. 1;

图8为摄像头获取的原始图像;Figure 8 is the original image acquired by the camera;

图9为截取后的原始图像;Fig. 9 is the original image after interception;

图10为待提取图像;Figure 10 is the image to be extracted;

图11为图像分割的过程示例图;Figure 11 is an example diagram of the process of image segmentation;

图12为图像分割的流程图;Figure 12 is a flowchart of image segmentation;

图13为菌盖面积计算流程图;Fig. 13 is a flow chart of cap area calculation;

图14为S41的过程示例图;Fig. 14 is a process example diagram of S41;

图15为S41的流程图;Fig. 15 is a flowchart of S41;

图16为褐变筛选的过程示例图。Figure 16 is an example diagram of the process of browning screening.

具体实施方式Detailed ways

下面结合附图,对本发明的一个具体实施方式进行详细描述,但应当理解本发明的保护范围并不受具体实施方式的限制。A specific embodiment of the present invention will be described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific embodiment.

如图1至图3所示,本发明实施时提供的一种双孢蘑菇分级系统,包括:As shown in Figures 1 to 3, a kind of Agaricus bisporus grading system provided during the implementation of the present invention includes:

机架10;Rack 10;

离心式送料盘20,设置在机架10上,其中离心式送料盘20为现有技术中的送料盘,其利用离心力将物料顺序送出;The centrifugal feeding tray 20 is arranged on the frame 10, wherein the centrifugal feeding tray 20 is a feeding tray in the prior art, and it utilizes centrifugal force to send out the materials sequentially;

第一输送带11,固定安装在机架10上,其一端与离心式送料盘20相连接,用于输送从离心式送料盘20中送出的蘑菇;The first conveyer belt 11 is fixedly installed on the frame 10, and one end thereof is connected with the centrifugal feeding tray 20 for conveying the mushrooms sent out from the centrifugal feeding tray 20;

第二输送带12,固定安装在机架10上,位于第一输送带11下方;The second conveyor belt 12 is fixedly installed on the frame 10 and is located below the first conveyor belt 11;

过渡连筒13,连接在第一输送带11的末端和第二输送带12的前端,用于将第一输送带11上输送的蘑菇传送至第二输送带12,过渡连筒13为C形结构的圆弧连接筒,其具有贯通的空腔,空腔也成C形结构,第一输送带11输送的蘑菇运动至第一输送带11的末端时,落入过渡连筒13中,在重力作用下,蘑菇通过过渡连筒13滑落至第二输送带12上;The transition connecting cylinder 13 is connected to the end of the first conveyor belt 11 and the front end of the second conveyor belt 12, and is used to transfer the mushrooms conveyed on the first conveyor belt 11 to the second conveyor belt 12. The transition connecting cylinder 13 is C-shaped The arc connecting cylinder of the structure has a through cavity, and the cavity is also in a C-shaped structure. When the mushrooms transported by the first conveyor belt 11 move to the end of the first conveyor belt 11, they fall into the transition connecting cylinder 13, and then Under the action of gravity, the mushrooms slide down to the second conveyor belt 12 through the transition connecting cylinder 13;

图像采集系统,用于获取第一输送带11上的蘑菇的图像并判定蘑菇等级;Image acquisition system, for acquiring the image of the mushroom on the first conveyor belt 11 and determining the grade of the mushroom;

分级装置,用于对第二输送带12上的蘑菇进行分级剔除;A grading device, used for grading and removing the mushrooms on the second conveyor belt 12;

控制装置,用于获取蘑菇等级信息并控制分级装置动作。The control device is used to acquire mushroom grade information and control the action of the grader device.

具体地,分级装置包括光电传感器和分拣抓40,光电传感器设置在机架10上,用于检测第二输送带12上是否有蘑菇,光电传感器信号连接至控制装置;分拣抓40包括分拣电机41和若干拨杆42,若干拨杆42沿分拣电机41的输出轴周向均匀布置,若干拨杆42的一端固定连接至分拣电机41的输出端,分拣电机41的输出轴的轴心线与竖直方向具有一夹角A,拨杆42转动时用于将第二输送带12上的蘑菇剔除。其中,夹角A为60°,拨杆42与分拣电机41的输出轴的轴心线具有一夹角B,夹角B为120°。Specifically, the grading device includes a photoelectric sensor and a sorting grab 40, the photoelectric sensor is arranged on the frame 10, and is used to detect whether there are mushrooms on the second conveyor belt 12, and the photoelectric sensor signal is connected to the control device; the sorting grab 40 includes a sorting Sorting motor 41 and some driving rods 42, several driving rods 42 are arranged evenly along the circumference of the output shaft of sorting motor 41, one end of several driving rods 42 is fixedly connected to the output end of sorting motor 41, and the output shaft of sorting motor 41 There is an included angle A between the axis line and the vertical direction, and the driving lever 42 is used to remove the mushrooms on the second conveyor belt 12 when it rotates. Wherein, the included angle A is 60°, the driving lever 42 and the axis of the output shaft of the sorting motor 41 have an included angle B, and the included angle B is 120°.

蘑菇在离心式送料盘20的输送下,进入第一输送带11,在第一输送带11上输送的过程中,经过第一图像采集装置30时,第一图像采集装置30获取蘑菇的图像信息并发送至处理器,处理器根据预设的算法对蘑菇等级进行判断并发送至控制装置,控制装置接收信号,对分级装置进行控制。由于蘑菇是按顺序进行输送,因此第一图像采集装置30获取并判断等级的蘑菇会依次输送至第二输送带12上,根据顺序即可通过分级装置对蘑菇按照等级进行剔除。具体的,当经过第一图像采集装置30采集图像信息并判断等级的蘑菇运送至第二输送带12时,光电传感器检测到该蘑菇,发送信号至控制装置,控制装置根据接收到的等级信息,控制分级装置动作,需要剔除时,控制装置控制分拣电机41转动,分拣电机41带动拨杆42转动,拨杆42转动至第二输送带12正上方时恰好为竖直状态,可以方便地将蘑菇拨送至一侧的回收装置,其中,为了更好的将蘑菇剔除,在拨杆42远离分拣电机41的端部还设置有拨片43,拨片43和拨杆42垂直设置,拨片43可以增大拨杆42的工作面积,更易于将蘑菇剔除。与传统的气泵推离不同,本实施例中的分级装置没有所谓的回程,在蘑菇较为集中的情况下也不会对蘑菇分拣造成影响,避免漏检。Mushrooms enter the first conveyor belt 11 under the conveyance of the centrifugal feeding tray 20, and during the conveying process on the first conveyor belt 11, when passing through the first image acquisition device 30, the first image acquisition device 30 acquires the image information of the mushrooms And send it to the processor, the processor judges the grade of the mushroom according to the preset algorithm and sends it to the control device, the control device receives the signal and controls the grading device. Since the mushrooms are transported in sequence, the mushrooms acquired and judged by the first image acquisition device 30 will be sequentially transported to the second conveyor belt 12, and the mushrooms can be removed according to the grade by the grading device according to the order. Specifically, when the mushroom whose image information is collected by the first image acquisition device 30 and whose grade is judged is transported to the second conveyor belt 12, the photoelectric sensor detects the mushroom and sends a signal to the control device, and the control device, according to the received grade information, Control the action of the grading device. When it is necessary to reject, the control device controls the rotation of the sorting motor 41. The sorting motor 41 drives the driving lever 42 to rotate. The mushrooms are transferred to the recovery device on one side, wherein, in order to better remove the mushrooms, a paddle 43 is also provided at the end of the driving rod 42 away from the sorting motor 41, and the paddle 43 and the driving rod 42 are vertically arranged. The paddle 43 can increase the working area of the paddle 42, making it easier to remove mushrooms. Different from the traditional air pump push away, the grading device in this embodiment has no so-called return stroke, and it will not affect the sorting of mushrooms when the mushrooms are relatively concentrated, so as to avoid missed detection.

如图4至图6所示,本系统还包括翻面装置和固定架50,翻面装置包括红外传感器51、相对设置的两个气缸52和设置在气缸52的输出端的挡板53,固定架50设置在机架10上,两个挡板53呈八字形布置,挡板53开口较大的一端均固定连接至固定架50,气缸52动作时,用于控制两个挡板53的自由端的开口角度,红外传感器51信号连接至控制装置,用于检测蘑菇是否翻面;其中,图像采集系统包括第一图像采集装置30和第二图像采集装置31,第一图像采集装置30用于采集蘑菇一面的图像信息,第二图像采集装置31用于采集蘑菇另一面的图像信息;翻面装置位于第一图像采集装置30沿第一输送带11运动方向上的后侧,且位于第二图像采集装置31沿第一输送带11运动方向上的前侧。As shown in Figures 4 to 6, the system also includes a turning device and a fixed mount 50, the turning device includes an infrared sensor 51, two cylinders 52 oppositely arranged and a baffle plate 53 arranged at the output end of the cylinder 52, and the fixed mount 50 is arranged on the frame 10, two baffles 53 are arranged in a figure-eight shape, and one end with a larger opening of the baffle 53 is fixedly connected to the fixed frame 50, and when the cylinder 52 is in action, it is used to control the movement of the free ends of the two baffles 53 Opening angle, the infrared sensor 51 signal is connected to the control device, and is used to detect whether the mushroom has turned over; wherein, the image acquisition system includes a first image acquisition device 30 and a second image acquisition device 31, and the first image acquisition device 30 is used to collect mushrooms The image information on one side, the second image acquisition device 31 is used to collect the image information on the other side of the mushroom; The device 31 is along the front side in the direction of movement of the first conveyor belt 11 .

具体地,图像采集装置包括设置在机架10上的暗箱、摄像头和光源,摄像头和光源设置在暗箱内,摄像头信号连接至控制装置。Specifically, the image acquisition device includes a dark box arranged on the frame 10, a camera and a light source, the camera and the light source are arranged in the dark box, and the signal of the camera is connected to the control device.

当蘑菇在第一输送带11上运送时,先经过第一图像采集装置30,运动至第一图像采集装置30时,第一图像采集装置30对蘑菇一面的信息进行拍摄并判断蘑菇等级,而后蘑菇在第一输送带11的运送下继续动作,运动至翻面装置时,由于蘑菇的大小基本上在一个区间内,因此将两块挡板53较小的开口端的距离设置为比蘑菇的外径小,较大的开口端的距离比蘑菇的外径大,如此蘑菇可以顺利进入两块挡板53之间,然后运动至靠近较小的开口端的位置时,蘑菇部分接触挡板53,受到阻力,由于蘑菇的特殊形状,其上侧部分接触挡板53,而底部不会接触挡板53,且同时底部还收到第一输送带11的摩擦力,因此会对蘑菇形成一个斜向上的合力,促使蘑菇进行翻转,由于蘑菇的高度一般小于外径尺寸,因此当蘑菇翻转时,如图6所示,正常运送下红外传感器51不会检测到蘑菇,而当蘑菇翻转时,在竖直方向上变高,会进入红外传感器51的检测范围内,红外传感器51检测到蘑菇翻转,将信号发送至控制装置,控制装置控制气缸52回缩,带动挡板53打开。为了防止蘑菇还没有完全翻转时,挡板53已经打开,导致蘑菇又再次翻转回去,可以对气缸52回缩行程设置延时操作,如红外传感器51检测到蘑菇翻转后,发送信号至控制装置,控制装置设置延时操作,经过1-2S后,再控制气缸52回缩。经过翻转后的蘑菇再在第一输送带11的运送下进入第二图像采集装置31,进行另一面的图像信息的获取,并进一步判断等级。When the mushroom is transported on the first conveyor belt 11, it first passes through the first image acquisition device 30, and when it moves to the first image acquisition device 30, the first image acquisition device 30 takes pictures of the information on one side of the mushroom and judges the grade of the mushroom, and then The mushroom continues to move under the conveyance of the first conveyor belt 11. When moving to the turning device, because the size of the mushroom is basically in an interval, the distance between the smaller opening ends of the two baffle plates 53 is set to be smaller than the outer edge of the mushroom. The diameter is small, and the distance between the larger opening end is larger than the outer diameter of the mushroom, so that the mushroom can smoothly enter between the two baffles 53, and then when it moves to a position close to the smaller opening end, the mushroom part contacts the baffle 53 and is subjected to resistance , due to the special shape of the mushroom, its upper part contacts the baffle 53, but the bottom part does not touch the baffle 53, and at the same time, the bottom also receives the friction force of the first conveyor belt 11, so an oblique upward resultant force will be formed on the mushroom , prompting the mushroom to turn over, because the height of the mushroom is generally smaller than the outer diameter, so when the mushroom is turned over, as shown in Figure 6, the infrared sensor 51 will not detect the mushroom under normal transportation, and when the mushroom is turned over, in the vertical direction When it becomes higher, it will enter the detection range of the infrared sensor 51. The infrared sensor 51 detects that the mushroom has turned over and sends a signal to the control device. The control device controls the retraction of the cylinder 52 and drives the baffle 53 to open. In order to prevent that the baffle plate 53 has been opened before the mushroom is fully turned over, causing the mushroom to turn back again, a delay operation can be set for the retraction stroke of the cylinder 52, such as after the infrared sensor 51 detects that the mushroom is turned over, it sends a signal to the control device, The control device sets the delay operation, and after 1-2S, the cylinder 52 is controlled to retract. The overturned mushrooms enter the second image acquisition device 31 under the transport of the first conveyor belt 11 to acquire the image information of the other side and further judge the grade.

实施例一:Embodiment one:

具体判断时,系统根据双孢蘑菇的大小作为特征参数,将其分为四个等级分别为A级、B级、C级以及D级。When making a specific judgment, the system uses the size of Agaricus bisporus as a characteristic parameter, and divides it into four grades: A grade, B grade, C grade and D grade.

分级判断时,包括如下步骤:Grading judgments include the following steps:

S1,通过摄像头获取蘑菇图像信息;S1, acquiring mushroom image information through a camera;

S2,提取感兴趣区域:根据蘑菇图像拍摄环境,设定参数并截取具有单一底色的蘑菇图像,获得待提取图像;计算出蘑菇外轮廓的最小外接矩形的左上点的坐标值,以及最小外接矩形的宽度W和高度H。S2, extract the region of interest: according to the shooting environment of the mushroom image, set the parameters and intercept the mushroom image with a single background color to obtain the image to be extracted; calculate the coordinate value of the upper left point of the minimum circumscribing rectangle of the mushroom outer contour, and the minimum circumscribing The width W and height H of the rectangle.

具体地,本实施例以摄像头分辨率为96为例,系统获取到的蘑菇图像包括传送带及其边缘部分,为准确获取双孢蘑菇的特征参数,需要对蘑菇图像进行感兴趣区域提取,首先对摄像头拍到的图8左侧截取158个像素右侧截取150个像素,去除传送带侧边铝材,得到图9所示的图像,其中,具体截取的像素值根据传送带的宽度和摄像头的取景大小来具体设定,最终目的获取到单一背景色的图像即可;然后对图9中的图片采用OpenCV中的库函数findContours和boundingRect设定特定的参数计算出蘑菇的最小外接矩形的左上点位置(x,y)和矩形的宽度w和高度h,然后对这个矩形向外延伸50个像素点,得到矩形的位置:长:x-50~x+w+50,宽:y-50~y+h+50,根据矩形的位置截取得到图10所示的图像。Specifically, in this embodiment, the camera resolution is 96 as an example. The mushroom image acquired by the system includes the conveyor belt and its edge. In order to accurately obtain the characteristic parameters of Agaricus bisporus, it is necessary to extract the region of interest from the mushroom image. First, the In Figure 8 captured by the camera, 158 pixels are intercepted on the left and 150 pixels are intercepted on the right, and the aluminum material on the side of the conveyor belt is removed to obtain the image shown in Figure 9. The specific intercepted pixel values depend on the width of the conveyor belt and the viewfinder size of the camera To specifically set, the final goal is to obtain an image of a single background color; then use the library function findContours and boundingRect in OpenCV to set specific parameters for the picture in Figure 9 to calculate the upper left point position of the smallest circumscribed rectangle of the mushroom ( x, y) and the width w and height h of the rectangle, and then extend the rectangle outward by 50 pixels to obtain the position of the rectangle: length: x-50~x+w+50, width: y-50~y+ h+50, the image shown in Figure 10 is obtained according to the position of the rectangle.

感兴趣区域提取将双孢蘑菇的图像从整幅图像中分离出来,去除干扰,得到待提取图像,作为后续的图像处理使用。The region of interest extraction separates the image of Agaricus bisporus from the whole image, removes the interference, and obtains the image to be extracted, which is used for subsequent image processing.

如图11所示,S3,图像分割,其包括:As shown in Figure 11, S3, image segmentation, which includes:

S31,将待提取图像转化为灰度图像;S31, converting the image to be extracted into a grayscale image;

S32,采用OSTU阈值分割算法处理,得到二值化图像;S32, adopting the OSTU threshold segmentation algorithm to process to obtain a binarized image;

S33,进行形态学变换:使用3*3的矩阵作为模板进行闭运算,先膨胀,对图片的每一个像素x置于模板的中央,遍历所有被模板覆盖的其他元素,修改像素x的值为所有像素中最大的值,对膨胀后的图片进行腐蚀,对图像的每个像素做遍历修改像素为模板中的最小值,得到形态学变换图;S33, perform morphological transformation: use a 3*3 matrix as a template to perform a closed operation, expand first, place each pixel x of the image in the center of the template, traverse all other elements covered by the template, and modify the value of the pixel x The maximum value of all pixels, corroding the expanded image, traversing each pixel of the image to modify the pixel to the minimum value in the template, and obtaining the morphological transformation map;

S34,对形态学变换图进行膨胀操作,得到背景图像;S34, performing an expansion operation on the morphological transformation map to obtain a background image;

S35,进行距离变换:设置掩模大小为3*3,设前景图片的RBG值为(255,255,255),即白色;设背景图片的RBG值为(0,0,0),即黑色;将非零像素点作为前景目标,零像素点作为背景;计算前景图片和背景图片的所有像素距离,使用最小二乘法,用所述距离替换为像素,生成距离变换图;S35, perform distance transformation: set the mask size to 3*3, set the RBG value of the foreground picture to (255,255,255), i.e. white; set the RBG value of the background picture to (0,0,0), i.e. black ; Use non-zero pixels as the foreground target, and zero pixels as the background; calculate all pixel distances between the foreground image and the background image, and use the least squares method to replace the distance with pixels to generate a distance transformation map;

S36,以所述距离为阈值进行固定阈值二值化确定前景图像;S36, using the distance as a threshold to perform fixed threshold binarization to determine the foreground image;

S37,将背景图像和前景图像相减,确定前景图像和背景图像重合的不确定区域,提取图像轮廓,得到标记markers;S37, subtracting the background image and the foreground image, determining the uncertain area where the foreground image and the background image overlap, extracting the contour of the image, and obtaining markers;

S38,根据不确定区域在markers中经过分水岭变化最终得到原始图像的边界;S38, according to the uncertain region, the boundary of the original image is finally obtained through the watershed change in the markers;

S4,根据获取的前景图像,计算前景图像的像素个数m,则蘑菇菌盖的面积为:m*25.4/d平方毫米,其中,d为摄像头的分辨率;S4, according to the obtained foreground image, calculate the number of pixels m of the foreground image, then the area of the mushroom cap is: m*25.4/d square millimeter, wherein, d is the resolution of the camera;

具体地,如图12所示,首先将待提取图像,也即图11中(a)转化为图11中的灰度图像(b),采用OSTU阈值分割算法,得到图11中的二值化图像(c)。然后进行形态学变换,使用3*3的矩阵作为模板进行闭运算,先膨胀,对图片的每一个像素x置于模板的中央,遍历所有被模板覆盖的其他元素,修改像素x的值为所有像素中最大的值,然后在对膨胀后的图片进行腐蚀,对图像的每个像素做遍历修改像素为模板中的最小值,结果消除小型黑洞以及裂缝,去除噪声得到图11中的图像(d),对形态学变换得到的形态学变换图进行膨胀操作,得到图11中的背景图像(e)。接着进行距离变换,设置掩模大小为3*3,设前景图片RGB值为(255,255,255),即白色,背景RGB值为(0,0,0),即黑色,所以非零像素点即为前景目标,零像素点即为背景,前景目标中的像素距离背景越远,距离越大,使用最小二乘法,用这个距离替换为像素,生成图11中的图像(f),以这些距离为阈值进行固定阈值二值化确定得到图11中的前景图像(g),将图11中的背景图像(e)和图11中的前景图像(g)相减确定前景和背景重合的不确定区域,提取图像轮廓,得到标记markers。根据不确定区域在markers中经过分水岭变化最终得到图11中的待提取图像的边界(h)。算法流程图如图12所示。Specifically, as shown in Figure 12, first convert the image to be extracted, that is, (a) in Figure 11 into the grayscale image (b) in Figure 11, and use the OSTU threshold segmentation algorithm to obtain the binarization in Figure 11 Image (c). Then perform morphological transformation, use the 3*3 matrix as the template to perform the closing operation, expand first, place each pixel x of the image in the center of the template, traverse all other elements covered by the template, and modify the value of the pixel x to all The largest value in the pixel, and then corrode the expanded image, and traverse each pixel of the image to modify the pixel to the minimum value in the template. As a result, small black holes and cracks are eliminated, and noise is removed to obtain the image in Figure 11 (d ), the expansion operation is performed on the morphological transformation map obtained by the morphological transformation, and the background image (e) in Figure 11 is obtained. Then perform distance transformation, set the mask size to 3*3, set the RGB value of the foreground image to (255,255,255), which is white, and the background RGB value to (0,0,0), which is black, so non-zero pixels are the foreground The target, the zero pixel point is the background, the farther the pixel in the foreground target is from the background, the greater the distance, using the least squares method, replace the pixel with this distance, generate the image (f) in Figure 11, and use these distances as the threshold Perform fixed threshold binarization to determine the foreground image (g) in Figure 11, and subtract the background image (e) in Figure 11 from the foreground image (g) in Figure 11 to determine the uncertain area where the foreground and background overlap, Extract image contours to get markers. The boundary (h) of the image to be extracted in Figure 11 is finally obtained through the watershed change in the markers according to the uncertain region. The algorithm flow chart is shown in Figure 12.

S5,按照预设规则,根据蘑菇菌盖的面积判定等级。S5, according to the preset rules, the grade is determined according to the area of the mushroom cap.

具体地,如图13所示,系统根据双孢蘑菇行业标准NY/T1790-2009,选用双孢蘑菇菌盖面积作为大小分级的特征参数,分为“大、中、小”3级(直径>45mm为一级,25≤直径≤45mm为二级,直径<25mm为三级),本研究在此基础上将直径<10mm定义为四级。1英寸=2.54厘米,像素高/分辨率=图像高的尺寸,像素宽/分辨率=图像宽的尺寸装置选用的摄像头分辨率为96,根据前述步骤获取的前景图像,计算前景图像的像素个数m,则蘑菇的面积为:m*25.4/96平方毫米。分别计算蘑菇的正面和反面的面积,由于蘑菇柄部可能使蘑菇出现侧放现象,导致正面面积减小,因此取二者最大值作为蘑菇的面积。Specifically, as shown in Figure 13, according to the Agaricus bisporus industry standard NY/T1790-2009, the system selects the cap area of Agaricus bisporus as the characteristic parameter of size classification, and divides it into three grades of "large, medium and small" (diameter> 45mm is the first grade, 25≤diameter≤45mm is the second grade, and the diameter <25mm is the third grade). On this basis, this study defines the diameter <10mm as the fourth grade. 1 inch=2.54 cm, pixel height/resolution=image height size, pixel width/resolution=image width size The resolution of the camera selected by the device is 96, and the pixels of the foreground image are calculated according to the foreground image obtained in the preceding steps A few m, then the area of the mushroom is: m*25.4/96 square millimeters. Calculate the area of the front and back of the mushroom separately. Since the handle of the mushroom may cause the mushroom to appear sideways, resulting in a decrease in the front area, the maximum value of the two is taken as the area of the mushroom.

实施例二:Embodiment two:

SURF(Speeded-up Robust Features)算法是基于SIFT(Scale-invariantfeature transform)算法的改进算法,由Herbert Bay于2006年在欧洲计算机视觉国际会议上提出,该算法不依赖于像素值且受遮挡、角度等拍摄效果影响较小,具有计算速度快、稳定性高的特点。SURF算法主要包括两个部分:特征点的提取、特征点的描述。The SURF (Speeded-up Robust Features) algorithm is an improved algorithm based on the SIFT (Scale-invariant feature transform) algorithm, which was proposed by Herbert Bay at the European International Conference on Computer Vision in 2006. The algorithm does not depend on pixel values and is occluded, angled etc. The shooting effect is less affected, and it has the characteristics of fast calculation speed and high stability. The SURF algorithm mainly includes two parts: feature point extraction and feature point description.

在实施例一的基础上,如图14和图15所示,本实施例还包括S41,其包括:On the basis of Embodiment 1, as shown in Figure 14 and Figure 15, this embodiment also includes S41, which includes:

S411,提取特征点:构建Hessian矩阵,待提取图像中任意一个像素点X=(x,y)的Hessian矩阵H(X,σ)如下:S411, extracting feature points: constructing a Hessian matrix, the Hessian matrix H(X, σ) of any pixel point X=(x, y) in the image to be extracted is as follows:

其中,σ为尺度,Lxx(X,σ),Lxy(X,σ),Lyy(X,σ)分别为高斯滤波后待提取图像在各个方向上的二阶导数;Among them, σ is the scale, Lxx(X,σ), Lxy(X,σ), and Lyy(X,σ) are the second derivatives of the image to be extracted in each direction after Gaussian filtering;

将积分图像与方框滤波器的卷积近似表示为Dxx,Dxy,Dyy,则得到Hessian行列式近似计算为:The convolution of the integral image and the box filter is approximately expressed as Dxx, Dxy, Dyy, and the approximate calculation of the Hessian determinant is obtained as:

det(Hessian)=DxxDyy-(λDxy)2 (2)det(Hessian)=D xx D yy -(λD xy ) 2 (2)

其中,λ为权重系数,用来平衡使用方框滤波器近似带来的误差;Among them, λ is the weight coefficient, which is used to balance the error caused by using the box filter approximation;

将所有经过Hessian矩阵处理后的像素点与尺度空间中的点进行非极大值比较,找出图像的兴趣点;Compare all the pixels processed by the Hessian matrix with the points in the scale space for non-maximum values to find out the points of interest in the image;

在尺度空间和图像空间中进行线性插值运算获得最后稳定的特征点;Perform linear interpolation in scale space and image space to obtain the final stable feature points;

S412,将原始图像转换为灰度图像;S412, converting the original image into a grayscale image;

根据提取到的特征点,以特征点为圆心画圆;According to the extracted feature points, draw a circle with the feature points as the center;

取蘑菇正面阈值为5mm,反面阈值为13mm;在本实施例中,也即正面阈值为22像素,反面阈值为50像素。由于蘑菇反面菇柄的存在,因此反面阈值大于正面阈值。The front threshold of the mushroom is 5mm, and the back threshold is 13mm; in this embodiment, the front threshold is 22 pixels, and the back threshold is 50 pixels. Due to the presence of the reverse stalk of the mushroom, the negative threshold is greater than the positive threshold.

如果圆的大小超过该阈值,则认为是残缺,反之,则不是残缺;If the size of the circle exceeds the threshold, it is considered incomplete, otherwise, it is not incomplete;

其中,图14给出了几个具体实施时的图像示例。Among them, FIG. 14 shows several image examples during specific implementation.

S5,按照预设规则,根据蘑菇菌盖的面积和残缺情况判定等级。S5. According to the preset rules, the grade is determined according to the area and incompleteness of the mushroom cap.

实施例三:Embodiment three:

在实施例一或二的基础上,还包括根据褐变筛选的步骤。如图16所示,Lab格式图像中L值能够较好地反映蘑菇的亮度,从而反映蘑菇褐变程度,因此将摄像头获取的RGB格式图像转化为Lab格式图像。L=0为黑色,L=100为白色,L值大表示偏白,L值小表示偏黑;L值在86及以上为品质好的蘑菇,L值在80-85之间为较好的蘑菇,L值在70-79之间为较差蘑菇,L值低于69的蘑菇则没有食用价值,分别对应1、2、3、4四个等级。对菌盖的每个像素点进行遍历,统计每个等级对应的像素点个数,根据分水岭算法得到的菌盖像素个数,分别计算出1、2、3、4四个等级对应的像素个数占菌盖像素总数的比率为R1、R2、R3、R4,经过大量实验确定,R1≥0.65为1等级,0.58≤R2<0.65为2等级,0.53≤R3<0.58为3等级,R4<0.53为4等级。On the basis of embodiment one or two, the step of screening according to browning is also included. As shown in Figure 16, the L value in the Lab format image can better reflect the brightness of the mushroom, thereby reflecting the degree of mushroom browning, so the RGB format image acquired by the camera is converted into a Lab format image. L=0 means black, L=100 means white, large L value means white, small L value means black; L value 86 and above is good quality mushroom, L value between 80-85 is better Mushrooms, L value between 70-79 are poor mushrooms, and mushrooms with L value lower than 69 have no edible value, corresponding to four grades of 1, 2, 3, and 4 respectively. Traverse each pixel of the cap, count the number of pixels corresponding to each level, and calculate the number of pixels corresponding to the four levels of 1, 2, 3, and 4 according to the number of pixels of the cap obtained by the watershed algorithm The ratio of the number to the total number of cap pixels is R1, R2, R3, R4. After a large number of experiments, it is determined that R1≥0.65 is grade 1, 0.58≤R2<0.65 is grade 2, 0.53≤R3<0.58 is grade 3, and R4<0.53 for 4 grades.

目前,在实验室对样机进行了试验。从沈阳农业大学食用菌基地采摘蘑菇100个,采后直接运至实验室,使用样机进行测试并与人工分级结果进行对比,将人工分级结果作为标准。人工判别使用游标卡尺测量双孢蘑菇的菌盖直径作为大小参数,褐变、残缺特征参数找行业相关专家通过肉眼观察蘑菇外观进行判别。试验结果如表1所示。Currently, prototypes are being tested in the laboratory. 100 mushrooms were picked from the edible fungus base of Shenyang Agricultural University, and transported directly to the laboratory after harvesting. The prototype was used for testing and compared with the manual grading results, and the manual grading results were used as the standard. Manual identification uses a vernier caliper to measure the cap diameter of Agaricus bisporus as a size parameter, and the browning and incomplete characteristic parameters are identified by relevant industry experts by visually observing the appearance of the mushroom. The test results are shown in Table 1.

表1分级试验结果Table 1 Classification test results

Table2 Result of Agaricus bisporus gradingTable 2 Result of Agaricus bisporus grading

从表1可以看出,使用双孢蘑菇自动分级系统平均正确率约为96.45%,其中,检测错误主要是因为残缺和褐变出现在蘑菇的柄部或者侧面,摄像头无法拍到的部分。试验结果表明分级方法对双孢蘑菇大小、褐变、残缺检测有效。It can be seen from Table 1 that the average correct rate of using the Agaricus bisporus automatic grading system is about 96.45%. Among them, the detection errors are mainly due to the incompleteness and browning appearing on the stalk or side of the mushroom, which cannot be captured by the camera. The test results showed that the grading method was effective for the size, browning and incomplete detection of Agaricus bisporus.

以上公开的仅为本发明的几个具体实施例,但是,本发明实施例并非局限于此,任何本领域的技术人员能思之的变化都应落入本发明的保护范围。The above disclosures are only a few specific embodiments of the present invention, however, the embodiments of the present invention are not limited thereto, and any changes conceivable by those skilled in the art shall fall within the protection scope of the present invention.

Claims (5)

1.一种双孢蘑菇分级系统,其特征在于,所述系统包括:1. a Agaricus bisporus grading system, is characterized in that, described system comprises: 机架;frame; 离心式送料盘,设置在机架上,用于利用离心力将物料顺序送出;Centrifugal feeding tray, set on the frame, is used to send out the materials sequentially by centrifugal force; 第一输送带,固定安装在机架上,其一端与离心式送料盘相连接,用于输送从离心式送料盘中送出的蘑菇;The first conveyor belt is fixedly installed on the frame, and one end thereof is connected with the centrifugal feeding tray, and is used for conveying the mushrooms sent from the centrifugal feeding tray; 第二输送带,固定安装在机架上,位于第一输送带下方;The second conveyor belt is fixedly installed on the frame and is located below the first conveyor belt; 过渡连筒,连接在第一输送带的末端和第二输送带的前端,用于将第一输送带上输送的蘑菇传送至第二输送带,过渡连筒为C形结构的圆弧连接筒,其具有贯通的空腔,空腔也成C形结构,第一输送带输送的蘑菇运动至第一输送带的末端时,落入过渡连筒中,在重力作用下,蘑菇通过过渡连筒滑落至第二输送带上;The transition connecting cylinder is connected to the end of the first conveyor belt and the front end of the second conveyor belt, and is used to transfer the mushrooms conveyed on the first conveyor belt to the second conveyor belt. The transition connecting cylinder is a circular arc connecting cylinder with a C-shaped structure , which has a through cavity, and the cavity also has a C-shaped structure. When the mushrooms transported by the first conveyor belt move to the end of the first conveyor belt, they fall into the transition tube. Under the action of gravity, the mushrooms slide through the transition tube. onto the second conveyor belt; 图像采集系统,用于获取第一输送带上的蘑菇的图像并采用双孢蘑菇分级判断方法判定蘑菇等级;The image acquisition system is used to acquire the image of the mushrooms on the first conveyor belt and determine the grade of the mushrooms by using the Agaricus bisporus grading judgment method; 分级装置,用于对第二输送带上的蘑菇进行分级剔除;A grading device is used for grading and removing the mushrooms on the second conveyor belt; 控制装置,用于获取蘑菇等级信息并控制分级装置动作;The control device is used to obtain mushroom grade information and control the action of the grader device; 具体地,分级装置包括光电传感器和分拣抓,光电传感器设置在机架上,用于检测第二输送带上是否有蘑菇,光电传感器信号连接至控制装置;分拣抓包括分拣电机和若干拨杆,若干拨杆沿分拣电机的输出轴周向均匀布置,若干拨杆的一端固定连接至分拣电机的输出端,分拣电机的输出轴的轴心线与竖直方向具有一夹角,拨杆转动时用于将第二输送带上的蘑菇剔除;在拨杆远离分拣电机的端部还设置有拨片,拨片和拨杆垂直设置;Specifically, the grading device includes a photoelectric sensor and a sorting grab. The photoelectric sensor is arranged on the frame to detect whether there are mushrooms on the second conveyor belt. The signal of the photoelectric sensor is connected to the control device; the sorting grab includes a sorting motor and several Driving rods, several driving rods are evenly arranged along the circumference of the output shaft of the sorting motor, one end of several driving rods is fixedly connected to the output end of the sorting motor, and there is a clamp between the axis line of the output shaft of the sorting motor and the vertical direction Angle, used to remove the mushrooms on the second conveyor belt when the driving lever is rotated; a paddle is also provided at the end of the driving rod away from the sorting motor, and the paddle and the driving rod are vertically arranged; 本系统还包括翻面装置和固定架,翻面装置包括红外传感器、相对设置的两个气缸和设置在气缸的输出端的挡板,固定架设置在机架上,两个挡板呈八字形布置,挡板开口较大的一端均固定连接至固定架,气缸动作时,用于控制两个挡板的自由端的开口角度,红外传感器信号连接至控制装置,用于检测蘑菇是否翻面;其中,图像采集系统包括第一图像采集装置和第二图像采集装置,第一图像采集装置用于采集蘑菇一面的图像信息,第二图像采集装置用于采集蘑菇另一面的图像信息,第一图像采集装置获取蘑菇的图像信息翻面装置位于第一图像采集装置沿第一输送带运动方向上的后侧,且位于第二图像采集装置沿第一输送带运动方向上的前侧;The system also includes a turning device and a fixing frame. The turning device includes an infrared sensor, two opposite cylinders and a baffle set at the output end of the cylinder. The fixing frame is set on the frame, and the two baffles are arranged in a figure-eight shape. , the end with the larger opening of the baffle is fixedly connected to the fixed frame. When the cylinder is in motion, it is used to control the opening angle of the free ends of the two baffles. The signal of the infrared sensor is connected to the control device to detect whether the mushroom has turned over; among them, The image acquisition system includes a first image acquisition device and a second image acquisition device, the first image acquisition device is used to collect image information on one side of the mushroom, the second image acquisition device is used to collect image information on the other side of the mushroom, and the first image acquisition device The image information flipping device for obtaining mushrooms is located on the rear side of the first image acquisition device along the movement direction of the first conveyor belt, and is located on the front side of the second image acquisition device along the movement direction of the first conveyor belt; 双孢蘑菇分级判断方法包括如下步骤:The method for judging the classification of Agaricus bisporus includes the following steps: S1,获取蘑菇图像信息;S1, acquiring mushroom image information; S2,提取感兴趣区域:根据蘑菇图像拍摄环境,设定参数并截取具有单一底色的蘑菇图像,获得待提取图像;计算出蘑菇外轮廓的最小外接矩形的左上点的坐标值,以及最小外接矩形的宽度W和高度H;S2, extract the region of interest: according to the shooting environment of the mushroom image, set the parameters and intercept the mushroom image with a single background color to obtain the image to be extracted; calculate the coordinate value of the upper left point of the minimum circumscribing rectangle of the mushroom outer contour, and the minimum circumscribing The width W and height H of the rectangle; S3,图像分割,其包括:S3, image segmentation, which includes: S31,将待提取图像转化为灰度图像;S31, converting the image to be extracted into a grayscale image; S32,采用OSTU阈值分割算法处理,得到二值化图像;S32, adopting the OSTU threshold segmentation algorithm to process, and obtain the binarized image; S33,进行形态学变换:使用3*3的矩阵作为模板进行闭运算,先膨胀,对图片的每一个像素x置于模板的中央,遍历所有被模板覆盖的其他像素,修改像素x的值为所有像素中最大的值,对膨胀后的图片进行腐蚀,对图像的每个像素做遍历修改像素为模板中的最小值,得到形态学变换图;S33, perform morphological transformation: use a 3*3 matrix as a template to perform a closed operation, expand first, place each pixel x of the image in the center of the template, traverse all other pixels covered by the template, and modify the value of the pixel x The maximum value of all pixels, corroding the expanded image, traversing each pixel of the image to modify the pixel to the minimum value in the template, and obtaining the morphological transformation map; S34,对形态学变换图进行膨胀操作,得到背景图像;S34, performing an expansion operation on the morphological transformation map to obtain a background image; S35,进行距离变换:设置掩模大小为3*3,设前景图片的RBG值为(255,255,255),即白色;设背景图片的RBG值为(0,0,0),即黑色;将非零像素点作为前景目标,零像素点作为背景;计算前景图片和背景图片的所有像素距离,使用最小二乘法,用所述距离替换为像素,生成距离变换图;S35, perform distance transformation: set the mask size to 3*3, set the RBG value of the foreground picture to (255,255,255), i.e. white; set the RBG value of the background picture to (0,0,0), i.e. black ; Use non-zero pixels as the foreground target, and zero pixels as the background; calculate all pixel distances between the foreground image and the background image, and use the least squares method to replace the distance with pixels to generate a distance transformation map; S36,以所述距离为阈值进行固定阈值二值化确定前景图像;S36, using the distance as a threshold to perform fixed threshold binarization to determine the foreground image; S37,将背景图像和前景图像相减,确定前景图像和背景图像重合的不确定区域,提取图像轮廓,得到标记markers;S37, subtracting the background image and the foreground image, determining the uncertain area where the foreground image and the background image overlap, extracting the contour of the image, and obtaining markers; S38,根据不确定区域在markers中经过分水岭变化最终得到原始图像的边界;S38, according to the uncertain region, the boundary of the original image is finally obtained through the watershed change in the markers; S4,根据获取的前景图像,计算前景图像的像素个数m,则蘑菇菌盖的面积为:m*25.4/d平方毫米,其中,d为摄像头的分辨率;S4, according to the obtained foreground image, calculate the number of pixels m of the foreground image, then the area of the mushroom cap is: m*25.4/d square millimeter, wherein, d is the resolution of the camera; S5,按照预设规则,根据蘑菇菌盖的面积判定等级。S5, according to the preset rules, the grade is determined according to the area of the mushroom cap. 2.如权利要求1所述的一种双孢蘑菇分级系统,其特征在于,在S2中,采用OpenCV中的库函数findContours和boundingRect来计算蘑菇的最小外接矩形的左上点的坐标值,以及矩形的宽度W和高度H。2. a kind of Agaricus bisporus grading system as claimed in claim 1, is characterized in that, in S2, adopts library function findContours and boundingRect among the OpenCV to calculate the coordinate value of the upper left point of the minimum circumscribed rectangle of mushroom, and rectangle The width W and height H. 3.如权利要求1所述的一种双孢蘑菇分级系统,其特征在于,在S2中,还包括对所述最小外接矩形向外延伸13mm,得到扩展矩形。3. A kind of Agaricus bisporus grading system as claimed in claim 1, is characterized in that, in S2, also comprises outwardly extending 13mm to described minimum circumscribed rectangle, obtains expanded rectangle. 4.如权利要求1所述的一种双孢蘑菇分级系统,其特征在于,S4中还包括分别计算蘑菇的正面和反面的面积,取二者最大值作为蘑菇的面积。4. A kind of Agaricus bisporus grading system as claimed in claim 1, is characterized in that, also includes calculating the area of the front and back side of mushroom respectively in S4, gets both maximum value as the area of mushroom. 5.如权利要求1所述的一种双孢蘑菇分级系统,其特征在于,还包括S41,其包括:5. A kind of Agaricus bisporus grading system as claimed in claim 1, is characterized in that, also comprises S41, and it comprises: S411,提取特征点:构建Hessian矩阵,待提取图像中任意一个像素点X=(x,y)的Hessian矩阵H(X,σ)如下:S411, extracting feature points: constructing a Hessian matrix, the Hessian matrix H(X, σ) of any pixel point X=(x, y) in the image to be extracted is as follows: 其中,σ为尺度,Lxx(X,σ),Lxy(X,σ),Lyy(X,σ)分别为高斯滤波后待提取图像在各个方向上的二阶导数;Among them, σ is the scale, Lxx(X,σ), Lxy(X,σ), and Lyy(X,σ) are the second derivatives of the image to be extracted in each direction after Gaussian filtering; 将积分图像与方框滤波器的卷积近似表示为Dxx,Dxy,Dyy,则得到Hessian行列式近似计算为:The convolution of the integral image and the box filter is approximately expressed as Dxx, Dxy, Dyy, and the approximate calculation of the Hessian determinant is obtained as: det(Hessian)=DxxDyy-(λDxy)2 (2)det(Hessian)=D xx D yy -(λD xy ) 2 (2) 其中,λ为权重系数,用来平衡使用方框滤波器近似带来的误差;Among them, λ is the weight coefficient, which is used to balance the error caused by using the box filter approximation; 将所有经过Hessian矩阵处理后的像素点与尺度空间中的点进行非极大值比较,找出图像的兴趣点;Compare all the pixels processed by the Hessian matrix with the points in the scale space for non-maximum values to find out the points of interest in the image; 在尺度空间和图像空间中进行线性插值运算获得最后稳定的特征点;Perform linear interpolation in scale space and image space to obtain the final stable feature points; S412,将原始图像转换为灰度图像;S412, converting the original image into a grayscale image; 根据提取到的特征点,以特征点为圆心画圆;According to the extracted feature points, draw a circle with the feature points as the center; 取蘑菇正面阈值为5mm,反面阈值为13mm;Take the front threshold of the mushroom as 5mm, and the reverse threshold as 13mm; 如果圆的大小超过该阈值,则认为是残缺,反之,则不是残缺;If the size of the circle exceeds the threshold, it is considered incomplete, otherwise, it is not incomplete; S5,按照预设规则,根据蘑菇菌盖的面积和残缺情况判定等级。S5. According to the preset rules, the grade is determined according to the area and incompleteness of the mushroom cap.
CN201910994655.8A 2019-10-18 2019-10-18 Agaricus bisporus grading judgment method Active CN110766702B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910994655.8A CN110766702B (en) 2019-10-18 2019-10-18 Agaricus bisporus grading judgment method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910994655.8A CN110766702B (en) 2019-10-18 2019-10-18 Agaricus bisporus grading judgment method

Publications (2)

Publication Number Publication Date
CN110766702A CN110766702A (en) 2020-02-07
CN110766702B true CN110766702B (en) 2023-08-01

Family

ID=69332395

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910994655.8A Active CN110766702B (en) 2019-10-18 2019-10-18 Agaricus bisporus grading judgment method

Country Status (1)

Country Link
CN (1) CN110766702B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113191176A (en) * 2020-06-08 2021-07-30 阿里巴巴集团控股有限公司 Data processing method and device
CN113869294A (en) * 2021-12-03 2021-12-31 深圳竹云科技有限公司 Data protection method based on computer vision and related equipment
CN114800533B (en) * 2022-06-28 2022-09-02 诺伯特智能装备(山东)有限公司 Sorting control method and system for industrial robot
CN114838665B (en) * 2022-07-04 2022-09-02 江西农业大学 A kind of in-situ measurement method of size based on Gallicardia nigra
CN115082428B (en) * 2022-07-20 2023-05-02 江苏茂融智能科技有限公司 Metal spot detection method and system based on neural network
CN116912250B (en) * 2023-09-13 2023-11-28 山东众成菌业股份有限公司 Fungus bag production quality detection method based on machine vision
CN117689673B (en) * 2024-02-04 2024-04-23 湘潭大学 WC particle electron microscope image segmentation and particle size distribution calculation method based on watershed
CN118218263B (en) * 2024-04-22 2024-12-10 中国农业大学 A method and system for automatically grading stropharia

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107527343A (en) * 2017-08-31 2017-12-29 山东省农业科学院科技信息研究所 A kind of agaricus bisporus stage division based on image procossing
CN110059663A (en) * 2019-04-24 2019-07-26 扬州龙科信息科技有限公司 A kind of visual identity of adhesion mushroom and measurement method based on characteristic point detection

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10706535B2 (en) * 2017-09-08 2020-07-07 International Business Machines Corporation Tissue staining quality determination

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107527343A (en) * 2017-08-31 2017-12-29 山东省农业科学院科技信息研究所 A kind of agaricus bisporus stage division based on image procossing
CN110059663A (en) * 2019-04-24 2019-07-26 扬州龙科信息科技有限公司 A kind of visual identity of adhesion mushroom and measurement method based on characteristic point detection

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
刘国华.《HALCON数字图像处理》.西安电子科技大学出版社,2018,第200-201页. *
卢丹 等.基于图像处理的双孢蘑菇分级方法研究.《山东农业科学》.2017,第126-130页. *
王延江 等.《数字图像处理》.石油大学出版社,2016,第129-130页. *

Also Published As

Publication number Publication date
CN110766702A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
CN110766702B (en) Agaricus bisporus grading judgment method
CN109772733B (en) A vision-based defective bamboo block detection and sorting device and method
CN106093066B (en) A kind of magnetic tile surface defect detection method based on improved machine vision attention mechanism
CN108181316B (en) Bamboo strip defect detection method based on machine vision
CN111667475B (en) Machine vision-based Chinese date grading detection method
CN106845408A (en) A kind of street refuse recognition methods under complex environment
CN109785316A (en) A kind of chip surface defect detection method
CN108491892A (en) fruit sorting system based on machine vision
CN110246122A (en) Small size bearing quality determining method, apparatus and system based on machine vision
CN112149543B (en) Building dust recognition system and method based on computer vision
CN109848073A (en) A kind of equipment and method for sorting coal and coal gangue
CN111739003B (en) Machine vision method for appearance detection
CN106971393B (en) A kind of the phenotype measurement method and system of corn kernel
Deng et al. A carrot sorting system using machine vision technique
CN207238542U (en) A kind of thin bamboo strip defect on-line detecting system based on machine vision
CN110614232A (en) Agaricus bisporus grading system
CN101976350A (en) Grain storage pest detection and identification method based on video analytics and system thereof
CN109255757A (en) A kind of machine vision places grape cluster carpopodium region segmentation method naturally
CN110057828A (en) A kind of surface inspecting method and system based on machine vision
CN111583193B (en) Pistachio skeleton extraction device and algorithm based on geometric contour template matching
CN111398287A (en) A battery pole piece scratch detection system and detection method
CN114354628B (en) Rhizome agricultural product defect detection method based on machine vision
CN107016353A (en) A kind of method and system of variable resolution target detection and identification integration
CN113971681A (en) A method for edge detection of belt conveyor in complex environment
CN210847255U (en) A classification system of Agaricus bisporus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant