-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplayImage.cpp
More file actions
47 lines (37 loc) · 932 Bytes
/
DisplayImage.cpp
File metadata and controls
47 lines (37 loc) · 932 Bytes
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
43
44
45
46
47
#include <stdio.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2/core/core.hpp>
using namespace cv;
using namespace std;
int main()
{
Mat var1(100,100,CV_8UC3,Scalar(0,0,0));
for(int i=0;i<var1.rows/2;i++){//rows
for(int j=0;j<var1.cols/2;j++){//cols
var1.at<Vec3b>(i,j)[3]=255;
}
}
/*2*/
for(int i=0;i<var1.rows/2;i++){//rows
for(int j=var1.cols/2;j<var1.cols;j++){//cols
var1.at<Vec3b>(i,j)[1]=255;
}
}
/*3*/
for(int i=var1.rows/2;i<var1.rows;i++){//rows
for(int j=0;j<var1.cols/2;j++){//cols
var1.at<Vec3b>(i,j)[2]=255;
}
}
/*4*/
for(int i=var1.rows/2;i<var1.rows;i++){//rows
for(int j=var1.cols/2;j<var1.cols;j++){//cols
var1.at<Vec3b>(i,j)[1]=var1.at<Vec3b>(i,j)[2]=255/2;
}
}
namedWindow( "Display window", WINDOW_NORMAL );
imshow( "Display window", var1 );
waitKey();
return 0;
}