我需要将两个数组(int[1024][3]
,int[1024][4]
)和一个Mat*
(OpenCV矩阵)传递给回调函数。
我有这样的结构:
struct data_holder {
Mat* mat;
unsigned int* data[4];
unsigned int* tara[3];
//unsigned int tara[1024][3]; //Previous attempt
//unsigned int data[1024][4];
}
这是我的任务:
Opencv_Button pokus = Opencv_Button(20,40,50,20); //Creating button class instance
pokus.val("Tara"); //Button title
ui.addButton(&pokus); //Adding button to UI
data_holder but_data; //structure
but_data.data = &data; //!!Expression must be a modifiable lvalue!!
but_data.tara = &tara; //For unsigned int data[1024][4] in structure I did ... = data
but_data.mat = &UI_tara;//Matrix assigned with no problems
pokus.setCallback(taraButtonCallback, (void*)&but_data);
那么如何将两个数组和Mat对象传递给回调函数?
答案 0 :(得分:4)
此:
unsigned int* data[4];
是一个指针数组。数组不可分配。
假设RHS的类型是int [1024][4]
,那么我觉得你真的想要这个:
unsigned int (*data)[1024][4];