Optimization of Image Similarity Comparison Algorithm Using Cosine Function
DOI:
https://doi.org/10.54691/srf0cf11Keywords:
Cosine Function; Image Similarity; Feature Fusion; Mutual Information; Algorithm Optimization.Abstract
With the explosive growth of digital image data, image similarity comparison, as the core technology of image retrieval and management, faces challenges such as low accuracy and poor robustness of traditional algorithms. To solve these problems, this paper proposes an optimized image similarity comparison algorithm based on the cosine function. First, the algorithm preprocesses the input image through adaptive median filter denoising, histogram equalization, and bilinear interpolation size normalization to eliminate interference factors. Then, it fuses the color features extracted by color moments (converted from RGB to HSV space) and texture features extracted by Local Binary Pattern (LBP) to form a comprehensive feature vector, and optimizes the feature vector through mutual information feature selection. Finally, the cosine function is used to calculate the similarity between feature vectors, and parallel computing and precomputation strategies are adopted to improve the calculation efficiency of cosine similarity. Experimental comparisons on Corel-1000 and Oxford Flowers 17 datasets show that the optimized algorithm (Cosine-Opt) has an F1-score of 89.9% and 85.6% on the two datasets respectively, which is significantly higher than traditional algorithms such as SAD-based and LBP-based. Robustness tests on distorted datasets (translation, rotation, scaling, Gaussian noise) show that the algorithm maintains high accuracy, and its computational efficiency is balanced with accuracy. This study provides an effective solution for efficient and accurate image similarity comparison.
Downloads
References
[1] Zhang, L., Wang, H., & Li, X. (2022). Image similarity calculation based on improved cosine similarity and deep features. Journal of Image and Graphics, 27(3), 892-903. (In Chinese)
[2] Jain, A. K., Duin, R. P. W., & Mao, J. (2000). Statistical pattern recognition: A review. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(1), 4-37.
[3] Ojala, T., Pietikäinen, M., & Mäenpää, T. (2002). Multiresolution gray-scale and rotation invariant texture classification with local binary patterns. IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(7), 971-987.
[4] Haralick, R. M., Dinstein, I., & Shanmugam, K. (1973). Textural features for image classification. IEEE Transactions on Systems, Man, and Cybernetics, SMC-3(6), 610-621.
[5] Rubner, Y., Tomasi, C., & Guibas, L. J. (2000). The earth mover's distance as a metric for image retrieval. International Journal of Computer Vision, 40(2), 99-121.
[6] Li, Y., Zhang, D., & Wang, K. (2021). Optimization of image similarity algorithm based on feature fusion and cosine distance. Computer Engineering and Applications, 57(12), 183-189. (In Chinese)
[7] Vedaldi, A., & Fulkerson, B. (2010). VLFeat: An open and portable library of computer vision algorithms. In Proceedings of the 18th ACM International Conference on Multimedia (pp. 1469-1472).
[8] Zhou, Z., & Chellappa, R. (2018). Image similarity assessment using deep learning: A survey. Pattern Recognition, 75, 32-44.
[9] Russell, B. C., Torralba, A., Murphy, K. P., & Freeman, W. T. (2008). LabelMe: A database and web-based tool for image annotation. International Journal of Computer Vision, 77(1-3), 157-173.
[10] Wang, Z., Bovik, A. C., Sheikh, H. R., & Simoncelli, E. P. (2004). Image quality assessment: From error visibility to structural similarity.IEEE Transactions on Image Processing, 13(4), 600-612.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Scientific Journal of Intelligent Systems Research

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.




