-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (21 loc) · 740 Bytes
/
main.cpp
File metadata and controls
31 lines (21 loc) · 740 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
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
int main(int argc, const char** argv) {
Mat color = imread("../eyes.jpg");
Mat gray = imread("../eyes.jpg", IMREAD_GRAYSCALE);
if (!color.data) {
cout << "Could not open or find the image" << endl;
return -1;
}
imwrite("eyes.jpg", gray);
int myRow = color.cols -1;
int myCol = color.rows - 1;
cout << "myRow, myCol: " << myRow << " - " << myCol << endl;
Vec3b pixel = color.at<Vec3b>(myRow, myCol);
cout << "Pixel value (B, G, R): (" << (int)pixel[0] << "," << (int)pixel[1] << "," << (int)pixel[2] << ")" << endl;
}