Student Projects



Automatic detection system of tobacco width based on machine vision

Sponsor: Hu Fen, AIMS
Team Members: Sun Jiawei, Deng Naihao, Zhou Ruqing, Wang Qipeng, Gao Yirui
Instructor: Prof. Bo Shouhang

Project Video

Team Members

Team Members:

Gao Yirui
Sun Jiawei
Wang Qipeng
Deng Naihao
Zhou Runqing


Prof. Bo Shouhang

Project Description

Problem Statement

Currently the width of tobacco is measured manually and inefficiently
The goal of this project is to first detect the width of tobacco automatically with camera and computer. Then set up standards of classifications and be able to categorize the tobacco strands into different piles of cigarette resource.


Fig. 1 Loosely Distributed Tobacco[1]

Fig. 1 Loosely Distributed Tobacco[1]

 Fig. 2 Densely Stacked Tobacco[1]

Fig. 2 Densely Stacked Tobacco[1]

Concept Generation

The project is divided into three sub-functions for both densely configured and loosely configured since different characteristic of image. First detect the contour of tobacco in the image. Since one strand of integrated tobacco may be divided into several areas, then merge pieces according to hybrid rule. Finally, detect width of tobacco with middle axis strategy.

Fig. 2 Concept Diagram

Fig. 2 Concept Diagram

Design Description

• Loosely Configured Scenario
First detect the contour of each tobacco strand with canny edge detector. The impure objects which has smaller area than thresholding value are eliminated. To increase the accuracy in this scenario, use the image erosion and dilation to remove Blur. Finally, use the medial axis transformation to measure the width.
• Densely Configured Scenario
First use the super-pixel segmentation to divide the image into small area while maintaining the contour information. Then merge the small area into a large area which covers a integrated tobacco according to RGB, HSV and some other image characteristic. Finally, measure the approximate width of tobacco using bounding box.

Implementation and Results

A python program, which take images of loosely configured and densely configured tobacco as input and output width of tobacco, is implemented. Also, a web is implemented to encapsulate all process.

Fig. 5 Result of Super-pixel segmentation and merging

Fig. 5 Result of Super-pixel
segmentation and merging

Fig. 5 Width of Tobacco in Unit Pixel

Fig. 5 Width of Tobacco in Unit Pixel


Validation Process:
For the correctness of width detection, and accuracy of classification, compare the results of program and the results measured manually.
For delay time, a timer in Python can be used to measure.
For percentage of recognized tobacco in densely configured situation, compare the number of output and the total number in the image counted manually.
Some other specifications can also be verified using easy experiments.
Validation Results:
According to validation part, most specifications can be met.
√ Average error <= 0.08mm
√ Average of classification >= 90
√ Variance <= 30
√ Percentage of recognized tobacco (Dense Configured) >= 5%
• Delay time <= 30s
√ means having been verified and · means to be determined.


Computer vision method including edge detection, super-pixel segmentation, bounding box and medial axis transformation can be used for width detection of tobacco. The key to achieve this goal is to detect the contour of each strand of tobacco. Also, a compromise between the accuracy and the speed has to be made.


Sponsor: Hu Fen from AMIS
Hongkun Lai and Xunjie Cai from UM-SJTU Joint Institute


[1] Figure from the sponsor

Project Video