有没有温和的解决方案? (例如现有的Mat.proto文件。)

最佳答案

那是一个棘手的问题。问题是您是否需要cv::Mat的所有数据和属性?如果是的话,我表示慰问,因为您需要将所有内容映射到新的protobuf结构。

如果您想要这样的东西:

// make a 7x7 complex matrix filled with 1+3j.
Mat M(7,7,CV_32FC2,Scalar(1,3));

您需要以下内容:
message Mat {
  required uint32 xSize = 1; //7
  required uint32 ySize = 2; //7
  required string encoding = 3; //CV_32FC2

  message Scalar { // this is optional
    required uint32 x = 1;
    required uint32 y = 2;
    required uint32 z = 3;
  }

  repeated Scalar matrix = 4; // 49 elements
  //note here that the Scalar is a 4-element vector derived from Vec
  //and the matrix should consist of scalars
}

10-08 09:17