Abstract: An image processing method and apparatus for a smart pen, and an electronic device where the method comprises: monitoring a working state of a second pressure switch provided at a pen tip of a smart pen after a first pressure switch of the smart pen is in a closed state; controlling an infrared transceiver circuit on the smart pen to send an infrared signal to an area where the smart pen writes; acquiring a lightweight network model preset in the smart pen, so as to perform feature extraction processing on an original image; performing classification processing on a feature matrix by using a fully connected layer in the lightweight network model, to obtain a trajectory classification result; and displaying a writing trajectory of the smart pen on a target object in real time.