首页|基于计算机视觉与Canny算法的服装纸样轮廓提取

基于计算机视觉与Canny算法的服装纸样轮廓提取

扫码查看
为提高服装二维纸样轮廓信息采集转换的准确性及方便性,设计了一种基于计算机视觉的服装纸样轮廓提取方法.将手机相机作为图像采集设备,采用相机标定的方法进行图像畸变矫正,对图像灰度化处理后进行伽马变换.通过改进的Canny算法对纸样图像进行边缘信息的提取,使用自适应双边滤波保边去噪;在原Sobel算子上增加了 45°和135°方向的梯度模板计算梯度;采用自适应双阈值确定边缘;融合形态学算法处理轮廓;最后按需进行轮廓骨架提取.结果表明:本文方法适用于二维纸样的轮廓提取,其提取误差在0.15~1.50 cm之间,可实现单独对服装纸样的外轮廓、内轮廓及内外轮廓图的提取,完成轮廓的无差别提取,减少后期人工对轮廓图的编辑,提高二维纸样数字化录入效率.
Clothing pattern contour extraction based on computer vision and Canny algorithm
Objective In order to improve the accuracy and convenience in collecting and converting two-dimensional pattern contour information,a method for garment pattern contour extraction based on computer vision was proposed.This research aimed to extract digitally the clothing patterns based on the use of two-dimensional pattern contour obtained from scanners or cameras.It was expected that the original physical template in the form of pattern card would be accurately transformed into a computer pattern contour image.Method This method involved both hardware and software.The hardware part was composed of a bracket,a smart phone,a quadrupod,a background plate and a calibration plate.The smart phone's camera was used as the image acquisition device.The part of software consists of image processing and contour extraction.The distortion parameters were obtained using the chessboard camera calibration method for image correction,and the corrected image was gray-scale processed and the matrix was simplified.The contrast between the target image and the background was improved by gamma transform ation of the gray image.The improved Canny algorithm was applied to extract the edge information of paper pattern image,and adaptive bilateral filtering was used for better edge-preserving denoising.The gradient templates in the 45° and 135° directions were added to the original Sobel convolution to calculate the gradient so as to improve the accuracy of position weighting coefficient.Non-maximum suppression and adaptive double threshold selection were carried out to refine and determine the edge.Double edge filling,smoothing and reprocessing of contour map were carried out by morphology closing operation.Finally,the skeleton was extracted from the contour map.Results After multiple experiments,the accuracy and effect of contour extraction were verified.In order to verify the accuracy of the contours,the function cv2.findContours()in the python library was adopted to extract the contour information which was then drawn on a white screen using Matplotlib library.The contour image was vectorized and saved as a PDF format,and the contour length was measured by the tool included in the PDF.The measurement results showed that the error was 0.15-1.50 cm compared to the length measured in reality,and the overall error was in line with the clothing error standard.More optical distortions and aberrations may be introduced when the object was placed at the edge of the camera for imaging,resulting in a larger imaging error than the central position.Therefore,it was necessary to place the paper pattern in the center of the camera during the operation to reduce the extraction error.In order to verify the effect of contour extraction,the extracted outer contour map,inner contour map and inner-outer contour map were compared with the contour map extracted by the traditional Canny edge detection algorithm.Both the conventional algorithm and the algorithm in this paper were able to outline roughly the contour map of the paper pattern.For the extraction of the outer outline of the paper pattern,both algorithms could achieve the same extraction effect by changing the sigma value and the parameters of the high and low threshold.However,a big difference existed between the two algorithms in the extraction of inner and inner-outer contours of paper patterns.When extracting the local details of the image,the effect of the conventional algorithm was not ideal,because the extracted internal symbol contour was not smooth enough,causing some small burrs and information lost.The proposed algorithm obtained the extraction of internal symbols without distinction,and the extraction effect of details such as cut,buckle and connector was good.For the whole image extraction,the effect of the conventional algorithm was not satisfactory in causing a large number of breakpoints and a small amount of noise points,especially for the inner contour extraction of paper pattern.Compared with the conventional algorithms,the proposed algorithm was found more prominent in removing noise and preserving edges and in creating clear extraction of the outer contour,inner contour and inner-outer contour of the paper pattern.It was suitable for the contour extraction of two-dimensional paper pattern,offering improved extraction efficiency.Conclusion The proposed improved pattern extraction algorithm combining the knowledge of camera calibration and image processing,can conveniently and efficiently achieve digital extraction of clothing pattern.Computer vision detection technology and improved Canny edge detection technology were adopted to design a non-contact two-dimensional clothing pattern contour extraction method to extract the outer contour,inner contour and inner-outer contour of paper patterns.The two-dimensional pattern contour extraction was based on the use of scanner or camera,and this technology is applicable to the garment manufacturing industry,advanced customization industry,and individual studios,with high practical application value.

garment pattern extractioncomputer visioncamera calibrationimage processingCanny edge detection algorithmcontour post-processingtemplate transformation

庹武、杜聪、陈谦、吴超、魏新桥、张欣汝、刘思雨

展开 >

中原工学院服装学院,河南郑州 451191

河南工学院电气工程与自动化学院,河南新乡 453003

服装纸样提取 计算机视觉 相机标定 图像处理 Canny边缘检测算法 轮廓后处理 样板转化

河南省高等学校重点科研项目教育部产学协同育人项目

23A540007220900693082010

2024

纺织学报
中国纺织工程学会

纺织学报

CSTPCD北大核心
影响因子:0.699
ISSN:0253-9721
年,卷(期):2024.45(5)