Compressed sensing takes advantage of the sparsity of data representation in the reciprocal space and achieves data compression. The performance of compressed sensing however depends on the measurement and basis matrices. To maximize the sparsity level of recovered coefficient vectors, dictionary learning has been developed to optimize the basis matrices for specific signals. Nevertheless, the theoretically optimal results from dictionary learning can be difficult to achieve in manufacturing process monitoring because the physical realization is restricted by the number of sensors, physical sizes of sensors, and sensor accessibility in the manufacturing environment. In this work, a physics-constrained dictionary learning (PCDL) approach is proposed to optimize the measurement and basis matrices separately with the considerations of these restrictions. The uniqueness of the PCDL is that there is only one non-zero entry in each row in the optimized measurement matrix so that the physical locations for the sensor placement are directly determined. Additional constraints of sensor accessibility are also incorporated. The proposed PCDL is demonstrated with thermal imaging for fused filament fabrication process monitoring. High-resolution thermal images are reconstructed with the optimized basis matrix and the limited pixel values at the optimized locations to allow for efficient monitoring.