forked from karansiwach360/Image-Segmentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimgcmp.cpp
More file actions
42 lines (40 loc) · 1.14 KB
/
imgcmp.cpp
File metadata and controls
42 lines (40 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <omp.h>
#include <opencv/cv.h>
#include "opencv2/highgui/highgui.hpp"
#include <vector>
using namespace std;
using namespace cv;
int main()
{
Mat img1,img2,img3;
string name="edited_histp.png";
string name2="edited_hist.png";
img1=imread(name);
img2=imread(name2);
img3=imread(name2);
int y=img1.cols;
for(int i=0;i<img1.rows;i++)
{
#pragma omp parallel for schedule(dynamic,y/16)
for(int j=0;j<img1.cols;j++)
{
if(img1.at<Vec3b>(i,j)[0]==img2.at<Vec3b>(i,j)[0] && img1.at<Vec3b>(i,j)[1]==img2.at<Vec3b>(i,j)[1] && img1.at<Vec3b>(i,j)[2]==img2.at<Vec3b>(i,j)[2])
{
img3.at<Vec3b>(i,j)[0]=0;
img3.at<Vec3b>(i,j)[1]=0;
img3.at<Vec3b>(i,j)[2]=0;
}
else{
img3.at<Vec3b>(i,j)[0]=255;
img3.at<Vec3b>(i,j)[1]=255;
img3.at<Vec3b>(i,j)[2]=255;
}
}
}
imwrite("diff.png",img3);
resize(img3,img3,cvSize(500,700));
imshow("diff",img3);
waitKey(5000);
return 0;
}