With the rapid development of emerging technologies, intelligent agriculture is incorporating techniques such as the Internet of Things, big data, cloud computing, artificial intelligence, blockchains, and fifth-generation mobile communication to improve work efficiency, prevent various disasters, and change the sales mode of agricultural products. Ornamental fishery is a part of agriculture and accounts for a significant proportion of commercial trade. This paper introduces image processing technology to help ornamental fisheries calculate the number of shrimps quickly. To solve the problem of overlapping live shrimps when counting, K-means unsupervised machine learning is adopted to determine the area of one shrimp. In addition, the proposed method using unsupervised machine learning is able to count different types of shrimp with high accuracy, such as crystal red shrimps, fire red shrimps, and Takashi Amano shrimps.We also analyze two background subtraction techniques, hue/saturation/value (HSV) histogrambased detection and Sobel edge detection, to compare the accuracy and calculation time of this application.