  The moving target segmentation (MTS) aims to segment out moving targets in
the video, however, the classical algorithm faces the huge challenge of
real-time processing in the current video era. Some scholars have successfully
demonstrated the quantum advantages in some video processing tasks, but not
concerning moving target segmentation. In this paper, a quantum moving target
segmentation algorithm for grayscale video is proposed, which can use quantum
mechanism to simultaneously calculate the difference of all pixels in all
adjacent frames and then quickly segment out the moving target. In addition, a
feasible quantum comparator is designed to distinguish the grayscale values
with the threshold. Then several quantum circuit units, including three-frame
difference, binarization and AND operation, are designed in detail, and then
are combined together to construct the complete quantum circuits for segmenting
the moving target. For a quantum video with $2^m$ frames (every frame is a
$2^n\times 2^n$ image with $q$ grayscale levels), the complexity of our
algorithm can be reduced to O$(n^2 + q)$. Compared with the classic
counterpart, it is an exponential speedup, while its complexity is also
superior to the existing quantum algorithms. Finally, the experiment is
conducted on IBM Q to show the feasibility of our algorithm in the noisy
intermediate-scale quantum (NISQ) era.
