This paper proposed a detecting method based on Canny operator for detecting the defect of transparent capsules correctly and effectively. To solve the problem of detecting the curved edges at both ends of transparent capsule, the algorithm set different thresholds to achieve the purpose of getting edge of the capsule. At the same time, interferences are eliminated and defects are magnified with the help of corrosion. Finally, the defect regions are detected by using the difference of the gray values between the defect regions and the surroundings. The experimental results show that the algorithm can effectively improve the efficiency and accuracy of transparent capsule detection.