The fourth Industrial Revolution, well-known as "Industry 4.0", based on the integration of information and communication technologies, has introduced significant improvements in manufacturing. However, vision systems still experience various impracticalities in dealing with the effect of complex lighting on the systems platform. Therefore, a machine vision system for automatic identification of pen parts under varying lighting conditions at a digital learning factory is proposed. The developed vision system presented a straightforward approach by effectively minimizing the environmental lighting effect on the identification process. First, the obtained information of the designed vision framework is exported to a program, where a reduction of non-uniform illumination is achieved through the implementation of Retinex image enhancement techniques. Then, the color-based Fuzzy C-means (FCM) algorithm, including improved mark watershed segmentation, is employed for pen parts object classification. Finally, the position features of the selected pen part are reported. The process applied to a total number of 210 upper pen parts (caps) and 241 lower pen parts (tubes) images under different lighting scenarios. Results indicate that average parts identification precision for cap and tube parts is different and equals to 98.64% and 95.26%, respectively. The present methodology provides a promising scheme that can be feasibly adapted for other industrial Color-based object recognition applications.