目的 在机器视觉的蚕茧分选研究中，完整的表面图像有利于提高蚕茧的识别准确度。由于蚕茧的形状呈长椭圆形，其在成像面上的投影存在信息压缩，需对其图像展开后才能进行拼接，基于此，提出了一种基于等效阶梯柱面模型的蚕茧表面图像展开方法。方法 首先对采集到的蚕茧图像预处理后进行椭圆拟合，根据拟合结果建立蚕茧的数学模型，基于微积分化曲为直的思想，将蚕茧模型转化为等效阶梯柱面模型，建立相应的坐标系，推导出阶梯柱面模型展开图与原图的像素坐标映射关系，进而实现蚕茧表面图像的展开。结果 实例1中分别给出了本文方法与采用蚕茧最大半径值的柱面展开方法对阶梯柱面模型表面图像的展开结果，对比两种展开方法方格左上角的坐标值与理论值之间的平均绝对误差，得到本文方法的平均误差为1.66像素，最大半径值展开方法的平均误差为3.06像素，相较于以最大半径值展开的等径展开方法，本文方法得到的坐标值与理论值的拟合程度更高，绝对误差范围和平均误差值更小；实例2中对展开的蚕茧表面图像进行重复部分拼接，拼接后图像重叠处及重叠区域边缘的蚕茧表面纹理连续性保持良好。结论 等效阶梯柱面展开方法可以有效的实现蚕茧表面图像展开，还原其表面原始信息，为后续蚕茧表面图像完整拼接提供良好的技术支撑。
Equivalent step cylinder unfolding of silkworm cocoon surface image
Sun Weihong,Liao Yizhen,Liang man,Shao tiefeng,Bi haizhong()
Objective: It is unfeasible to stitch two different angles of silkworm surface images directly even through there are some overlapping areas between them, because the shape of silkworm cocoon is long elliptic and some information is compressed in its projection on the imaging surface. However, most of the existing image unfolding methods are aimed at cylinder with uniform radius, which is not effective in the application of cocoon image unfolding. In this paper, the surface image unfolding method of silkworm cocoon based on the equivalent step cylindrical model of silkworm cocoon is proposed according to the shape characteristics of silkworm cocoon. Methods: In order to obtain the surface image of silkworm cocoon, a set of image acquisition device is designed, in which drives the cocoon rotation through the synchronous rotation of two rollers, which makes it convenient for the camera to collect the complete image of silkworm cocoon surface. Assume that the mathematical model of the silkworm cocoons is an ellipsoid of rotation, and the image is deal with gray scale, filter, binarization and edge extraction successively. After that, the extracted edges were an ellipse fitted to obtain the ideal mathematical model of the cocoon in the image. As known, a cylinder can be unfolded along one side to a rectangle, based on it, the ideal silkworm cocoon model is divided into n segments along the rotational axis according to the calculus. The height of each segment is . As is so small that the curve can be regarded as a straight line, so a small segment of the ellipse can be equal to a cylinder, and the cocoon model becomes a superposition of a series of cylindrical models, therefore an equivalent stepped cylinder model of the cocoon model is obtained. The diameter of each small segment of the cylinder is calculated by the diameters of the upper and lower surfaces of the ellipsoidal segment replaced by the cylinder. Since the diameter of the silkworm cocoon is so small (18mm) that the error brought by the camera aperture imaging model can be ignored, and the camera catches the parallel projection image of the silkworm cocoon. Set a coordinate system of as the world coordinates system, as the original imaging plane, as the unfolding plane. Based on the world coordinate system, the pixel coordinate mapping relationship between the unfolding plane of the stepped cylinder model and the original image is derived. The reverse mapping is performed by a linear interpolation algorithm, and each pixel in the unfolded image is traversed. Meanwhile, with the corresponding pixel values extracted from the original image by using the above mapping relationship, we can obtain a surface unfolding image of the silkworm cocoon based on the equivalent step cylindrical model. Results: The experiment was carried out by the 3D printed step cylindrical model and the cocoon. In the example 1, the surface of the step cylindrical model of 3D printing is pasted with a small black and white checkerboard which with a size of 1mm×1mm. After the images were acquired, the stepped cylinder image was unfolded using the unfolding method of this paper and the cylinder unfolding method with the maximum radius value of the cocoon as the unfolding value. Since the squares of the checkerboard used in the experiment has the same size, in the ideal state, the size of each square in the unfolded image should be the same. Therefore, based on the coordinates and size of the white grid in the center of the image, the theoretical value of the corner points of all the squares in the ideal unfolded image can be calculated. The unfolding effect is compared by the difference between the coordinate values of the upper left corners of the two unfolding methods and the theoretical values. Result shows that the coordinate values obtained by the equivalent step cylinder surface unfolding method are more than a match for the theoretical value compared to the equal-diameter unfolding method with the maximum radius value, and the average relative error is much smaller. In example 2, the equivalent step cylinder surface unfolding method is tested by a common silkworm cocoon image. When the cocoon image is got and preprocessed, according to the elliptical circumscribing rectangle, the image is obtained by the ellipse fitting to extract the region of interest, so that the long axis of the ellipse remains vertical and the excess background is removed. Then, the roller control motor of the image acquisition device starts. When the silkworm cocoons rotate a certain angle, the camera obtains another angle of cocoon image with overlapping area with the previous image, and the same pre-processing step on the image is performed to obtain the ROI area of the silkworm cocoon. The two images are unfolded by the unfolding method proposed in this paper. Manually splicing the two unfolded images, and then observing the silkworm cocoon texture of the overlap of the stitched image and the edge of the overlap region, it can be found that the texture continuity of the silkworm cocoon is better, and it is proved that the unfolded image has a better stitching effect. Conclusion: Result shows that the step cylinder unfolding method proposed in this paper has a better unfolding effect than the unfolding method with a single radius value, which can provide a good environmental basis for the mosaic subsequent research of silkworm cocoon surface images. In addition, the method can also be applied in the unfolding of other ellipsoidal surface images.