  The quantum image segmentation algorithm is to divide a quantum image into
several parts, but most of the existing algorithms use more quantum
resource(qubit) or cannot process the complex image. In this paper, an improved
two-threshold quantum segmentation algorithm for NEQR image is proposed, which
can segment the complex gray-scale image into a clear ternary image by using
fewer qubits and can be scaled to use n thresholds for n + 1 segmentations. In
addition, a feasible quantum comparator is designed to distinguish the
gray-scale values with two thresholds, and then a scalable quantum circuit is
designed to segment the NEQR image. For a 2^(n)*2^(n) image with q gray-scale
levels, the quantum cost of our algorithm can be reduced to 60q-6, which is
lower than other existing quantum algorithms and does not increase with the
image's size increases. The experiment on IBM Q demonstrates that our algorithm
can effectively segment the image.
