简体   繁体   中英

similarity percentage of two images by EMGU.CV

I work on x-ray images, and i want to get the similarity percentage between two monochrome images using emgu.cv library on c#. the attached file contain the two images which i need to find the similarity percentage.

any one help me to find the solution of that by machine learning or any another approch?

在此处输入图像描述

EMGU.CV is same library in C# for openCV in C++ and python

you can use matchtemplate

In openCV it is

Mat image1Img = imread("image1.png", IMREAD_COLOR);
Mat image2Img = imread("image2.png", IMREAD_COLOR);
Mat image3Img = imread("image3.png", IMREAD_COLOR);

Mat scoreImg;
double maxScore;

matchTemplate(image1Img, image2Img, scoreImg, TM_CCOEFF_NORMED);
minMaxLoc(scoreImg, 0, &maxScore);
wxLogMessage(wxString::Format("score <%.2f>", maxScore));

In C# you can use as

Image<Gray, Byte> sourceImage = new Image<Gray, Byte>(@"Images/Source.bmp");
Image<Gray, Byte> templateImage = new Image<Gray, Byte>(@"Images/Template.bmp");
Image<Gray, float> resultImage = sourceImage.MatchTemplate(templateImage, Emgu.CV.CvEnum.TM_TYPE.CV_TM_CCOEFF_NORMED);

Detail can be checked here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM