-
Notifications
You must be signed in to change notification settings - Fork 1
/
MatrixG.cpp
38 lines (34 loc) · 951 Bytes
/
MatrixG.cpp
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
#include <iostream>
#include <cmath>
#include "MatrixG.hpp"
MatrixG::MatrixG(int h, int w) : Matrix(h, w) {
this->screen = cv::Mat::zeros(h, w, CV_8UC3);
cv::imshow("test", this->screen);
cv::moveWindow("test", 0, 20);
cv::waitKey(1);
}
void MatrixG::print() const{
// int h = this->h;
// int w = this->w;
//
// for (int i = 0; i < h; i++) {
// for (int j = 0; j < w; j++) {
// if (this->read[i][j] == 1) {
// this->screen.at<cv::Vec3b>(cv::Point(i, j)) = cv::Vec3b(255, 255, 255);
// } else {
// this->screen.at<cv::Vec3b>(cv::Point(i, j)) = cv::Vec3b(0, 0, 0);
// }
// }
// }
cv::imshow("test", this->screen);
cv::waitKey(1);
}
void MatrixG::set(int i, int j, unsigned short v){
Matrix::set(i,j,v);
if (v==1){
this->screen.at<cv::Vec3b>(cv::Point(j, i)) = cv::Vec3b(255, 255, 255);
}
if (v==0){
this->screen.at<cv::Vec3b>(cv::Point(j, i)) = cv::Vec3b(0,0,0);
}
}