Image processing method and device based on optical flow algorithm

The embodiment of the invention discloses image processing method and device based on an optical flow algorithm. The method comprises the following steps of: acquiring a current frame image in a video sequence to be processed, and then acquiring the position of a group of pixel points of the current frame image in the next frame image according to the optical flow algorithm; sampling the group ofpixel points according to a global parameter model of two adjacent frame images established in advance, and screening out the pixel point of which the displacement distance is within the preset range; acquiring a global motion parameter from the current frame image to the next frame image with a least square method according to the position coordinates of the screened pixel point in the current frame image and the next frame image; and compensating the next frame image according to the smoothing result on the global motion parameter. In the invention, frame images are processed in a way of combining the optical flow algorithm with global motion model sampling, therefore, the calculation precision of the global motion parameter is ensured, the calculated amount is reduced, and meanwhile, the requirement for real-time stable correction of video is met.