-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.3.cpp
More file actions
36 lines (28 loc) · 846 Bytes
/
3.3.cpp
File metadata and controls
36 lines (28 loc) · 846 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
// Part2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <cxcore.h>
#include <_highgui.h>
int main()
{
// упражнение 3.3
int rows = 100;
int cols = 100;
int size = rows * cols;
float* data = new float[size];
for (int i = 0; i < size; i++)
data[i] = 0.0;
CvMat* Picture1 = new CvMat();
Picture1[0] = cvMat(rows, cols, CV_8UC1, data);
for (int row = 20; row < 40; row++)
{
for (int col = 5; col < 20; col++)
{
*cvPtr2D(Picture1, row, col) = 255;
}
}
cvNamedWindow("Square", CV_WINDOW_AUTOSIZE);
cvShowImage("Square", Picture1);
cvWaitKey(0);
cvDestroyWindow("Square");
}