The invention discloses a white granulated
sugar bag automatic counting device and method based on
machine vision. The device comprises a conveying belt frame body, a conveying belt, an equipment bracket, an industrial computer, a line
laser fixing head, an industrial camera fixing head, a line
laser and an industrial camera. The line
laser and the industrial camera are installed on the equipmentsupport through the line laser fixing head and the industrial camera fixing head respectively. The method is used for laser contour generation and acquisition, an industrial computer slices a plurality of frames of white granulated
sugar bags to segment the relative envelope area in a contour image, the number of the bags is calculated after comprehensive analysis, and the method comprises the steps of image preprocessing, laser stripe center line extraction, center line
breakpoint compensation, relative envelope area calculation and bag number comprehensive calculation. Automatic counting inthe white granulated
sugar bag conveying process is achieved, the problems that white granulated sugar bags are difficult to count in complex postures such as bag connection and bag stacking, and manpower consumption is large are effectively solved, the bag counting accuracy is effectively improved, and the labor cost of enterprises is reduced.