728x90
반응형
[Mat]
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(void)
{
//2행3열
Matx<int, 2, 3> m1(
1, 2, 3,
4, 5, 6);
printf("%d %d %d %d %d %d\n",
m1(0, 0), m1(0, 1), m1(0, 2),
m1(1, 0), m1(1, 1), m1(1, 2));
Matx23d m2(1, 2, 3, 4, 5, 6);
printf("%d %d %d %d %d %d\n",
m1(0, 0), m1(0, 1), m1(0, 2),
m1(1, 0), m1(1, 1), m1(1, 2));
// 2행 3열(CV_8U : 8bit Color)
Mat m3(2, 3, CV_8U);
cout << m1 << endl;
}
[gray, white 윈도우창 출력]
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(void)
{
// 8bit, 24bit, 32color
Mat image1(300, 400, CV_8U, Scalar(255));
Mat image2(300, 400, CV_8U, Scalar(128));
string title1 = "white window";
string title2 = "gray window";
namedWindow(title1, WINDOW_AUTOSIZE);
namedWindow(title2, WINDOW_NORMAL);
moveWindow(title1, 100, 200);
moveWindow(title2, 100, 200);
imshow(title1, image1);
imshow(title2, image2);
waitKey();
destroyAllWindows();
}
[white 윈도우창 출력]
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(void)
{
// 8bit, 24bit, 32color
Mat image(300, 400, CV_8U, Scalar(255));
namedWindow("white window", WINDOW_NORMAL);
imshow("white window", image);
waitKey();
destroyAllWindows();
}
[waitKeyEx() 키보드처리]
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(void)
{
// 8bit, 24bit, 32color
Mat image(300, 400, CV_8U, Scalar(255));
namedWindow("white window", WINDOW_NORMAL);
imshow("white window", image);
// delay time : 20ms
while(1)
{
int key = waitKeyEx(20);
if (key == 27) // ESC
{
cout << "종료" << endl;
break;
}
}
destroyAllWindows();
}
[waitKeyEx() 마우스처리]
728x90
반응형
'Education > Edu | .net' 카테고리의 다른 글
# 38) [OPENCV] 1.기본다지기 (0) | 2021.03.11 |
---|---|
# 37) [WPF] 기본다지기5 (0) | 2021.03.09 |
# 36.3) [C#] [Design Pattern] Command Pattern (0) | 2021.03.08 |
# 36.2) [WPF] 기본다지기4 (binding) (0) | 2021.03.08 |
# 36.1) [WPF] 기본다지기3 (binding) (0) | 2021.03.08 |