-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_histogram2d.cpp
More file actions
44 lines (38 loc) · 912 Bytes
/
test_histogram2d.cpp
File metadata and controls
44 lines (38 loc) · 912 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
#include "histogram2do1.cpp"
#include <cstdlib>
#include <stdio.h>
int main()
{
int numRows=3;
int numColumns=4;
int window_size=3;
unsigned char * array=(unsigned char *)malloc(numRows*numColumns*sizeof(unsigned char));
for (int i=0;i<numRows*numColumns;i++)
{
array[i]=rand()%256;
}
printf("original array is : \n");
for (int i=0;i<numRows;i++)
{
for(int j=0;j<numColumns;j++)
{
printf("%u ",array[i*numColumns+j]);
}
printf("\n");
}
unsigned char * out_array=(unsigned char *)malloc(numRows*numColumns*sizeof(unsigned char));
for (int i=0;i<numRows*numColumns;i++)
{
out_array[i]=0;
}
histogram2d(array,out_array,numRows,numColumns,window_size);
printf("histogram array is : \n");
for (int i=0;i<numRows;i++)
{
for(int j=0;j<numColumns;j++)
{
printf("%u ",out_array[i*numColumns+j]);
}
printf("\n");
}
}