Skip to content

Instantly share code, notes, and snippets.

@tomoaki0705
Last active September 6, 2020 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoaki0705/0cba401b570d0e9e2cda77017c7d0fec to your computer and use it in GitHub Desktop.
Save tomoaki0705/0cba401b570d0e9e2cda77017c7d0fec to your computer and use it in GitHub Desktop.
Allocater test
========= Type 32FC1 =============
data  :0xfd5600
data1 :0xfd57d4
stride:  1d4(468)
========= Type 32FC3 =============
data  :0xfd5600
data1 :0xfd5b7c
stride:  57c(1404)
========= Type 32FC3 =============
data  :0xfd5600
data1 :0xfd6200
stride:  c00(3072)
========= Type 32FC4 =============
data  :0xfd5600
data1 :0xfd5d50
stride:  750(1872)
========= Type 8UC4  =============
data  :0xfd5600
data1 :0xfd57d4
stride:  1d4(468)
========= Type 8UC4  =============
data  :0xfd5600
data1 :0xfd5a00
stride:  400(1024)
========= Type 8UC3  =============
data  :0xfd5600
data1 :0xfd575f
stride:  15f(351)
========= Type 8UC3  =============
data  :0xfd5600
data1 :0xfd5900
stride:  300(768)

#define ALLOCATE_TEST_Mat(Type, width, msg) \
{ \
using namespace std; \
Mat src(2, width, Type); \
cout << "========= Type " msg " ============= " << endl; \
cout << "data :0x" << hex << (intptr_t)src.data << dec << endl; \
cout << "data1 :0x" << hex << (intptr_t)src.row(1).data << dec << endl; \
cout << "stride: " << hex << src.step << dec << "(" << src.step << ")" << endl; \
}
int main(int argc, char** argv)
{
ALLOCATE_TEST_Mat(CV_32FC1, 117, "32FC1");
ALLOCATE_TEST_Mat(CV_32FC3, 117, "32FC3");
ALLOCATE_TEST_Mat(CV_32FC3, 256, "32FC3");
ALLOCATE_TEST_Mat(CV_32FC4, 117, "32FC4");
ALLOCATE_TEST_Mat(CV_8UC4 , 117, "8UC4 ");
ALLOCATE_TEST_Mat(CV_8UC4 , 256, "8UC4 ");
ALLOCATE_TEST_Mat(CV_8UC3 , 117, "8UC3 ");
ALLOCATE_TEST_Mat(CV_8UC3 , 256, "8UC3 ");
ALLOCATE_TEST_GpuMat(CV_8UC3 , 117, "8UC3 ");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment