Based on grating diffraction and machine vision, an experimental system for intuitively measuring quantized energy of matter is designed. It includes a blind box light source that excites luminescence of tested substances, a grating diffraction component,and a spectrum reading system. This novel system can measure energy levels or bands of different substances in different ways and achieve real-time data processing. Blind box light source utilizes the basic principles of photoluminescence or electroluminescence to stimulate electrons in tested substance to transition from valence band to conduction band, and emit the fingerprint signal of light of a specific wavelength. The diffraction spectrum is obtained by classical grating diffraction method. Besides, diffraction spectrum is collected in real time by digital camera, and the center position of diffraction spot is automatically obtained through image processing algorithms to reduce the spectrum reading error. This experimental system intuitively and conveniently demonstrates the quantized energy of matters.