第一个例子:
int main(){
using namespace std;
vector<int> v1{10, 20, 30, 40, 50};
vector<int> v2{10, 20, 30, 40, 50};
if(v1==v2)
cout<<"equal";
else
cout<<"unequal";
} // it returns equal
Run Code Online (Sandbox Code Playgroud)
第二个例子:
int main(){
using namespace std;
vector<int> v1{10, 20, 30, 40, 50};
vector<int> v2{10, 20, 100000, 40, 50};
if(v1==v2)
cout<<"equal";
else
cout<<"unequal";
} // it returns notequal
Run Code Online (Sandbox Code Playgroud) 我比较两个 std::set
#include <cstdlib>
#include <cstdio>
using namespace std;
#include <vector>
#include <set>
int main(int argc, char** argv)
{
int myints1[]= {10,20,30,40,50};
int myints2[]= {50,40,30,20,10};
std::set<int> s1 (myints1,myints1+5);
std::set<int> s2(myints2,myints2+5);
if(s1==s2){
printf("sets: true");
}else printf("sets: false");
std::set<int>::iterator it2=s2.begin();
for(std::set<int>::iterator it1=s1.begin();it1!=s1.end();it1++){
printf("\ns1: %d s2: %d",*it1,*it2);
it2++;
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
sets: true
s1: 10 s2: 10
s1: 20 s2: 20
s1: 30 s2: 30
s1: 40 s2: 40
s1: 50 s2: 50
Run Code Online (Sandbox Code Playgroud)
题:
这是正确的方法吗?或者是比较两组的任何其他(特殊)方式?
我正在开发一个应用程序,它可以在Surface视图的帮助下比较存储在SD卡中的面部和相机预览中显示的图像.我编写了代码来检测面部并创建了一个仅包含面部的位图.我需要比较这个位图和SD卡中的图像.我搜索过java库,并获得了一些像opencv,Eigenface这样的链接.哪个更好的图书馆?请给我一些很好的教程样本,如果它解释图像比较背后的过程会更好.
java android image-comparison image-processing face-detection