本文整理汇总了C++中Video::initFromMxArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::initFromMxArray方法的具体用法?C++ Video::initFromMxArray怎么用?C++ Video::initFromMxArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::initFromMxArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: knnfield
/* The computational routine */
void knnfield(const mwSize *dimsA, const mwSize *dimsB, nnf_data_t* videoA, nnf_data_t* videoB, NNFieldParams params, int32_t *outMatrix, nnf_data_t * distMatrix)
{
Video<nnf_data_t> A;
int dA[4];
for (int i = 0; i < 4; ++i) {
dA[i] = dimsA[i];
}
A.initFromMxArray(4, dA, videoA);
Video<nnf_data_t> B;
int dB[4];
for (int i = 0; i < 4; ++i) {
dB[i] = dimsB[i];
}
B.initFromMxArray(4, dB, videoB);
NNField field(&A,&B, params);
NNFieldOutput output = field.compute();
Video<int32_t> &nnf = output.nnf;
Video<nnf_data_t> &cost = output.error;
const int32_t* pData = nnf.dataReader();
const nnf_data_t* pCost = cost.dataReader();
int channel_stride = nnf.voxelCount();
int in_nn_stride = 3*channel_stride;
int out_nn_stride = 3*channel_stride;
for (unsigned int idx = 0; idx < dimsA[0]*dimsA[1]*dimsA[2]; ++idx) // each voxel
{
for(int k = 0; k < params.knn; ++ k) { // each NN
for (unsigned int c = 0; c < 3; ++c) { // each warp channel
outMatrix[idx + c*channel_stride + k*out_nn_stride] = pData[idx + c*channel_stride + k*in_nn_stride];
}
assert(outMatrix[idx + 0*channel_stride + k*out_nn_stride] < B.getWidth()-params.patch_size_space+1);
assert(outMatrix[idx + 1*channel_stride + k*out_nn_stride] < B.getHeight()-params.patch_size_space+1);
assert(outMatrix[idx + 2*channel_stride + k*out_nn_stride] < B.frameCount()-params.patch_size_time+1);
}
}
if(distMatrix != nullptr) {
for (unsigned int idx = 0; idx < dimsA[0]*dimsA[1]*dimsA[2]; ++idx) // each voxel
{
for(int k = 0; k < params.knn; ++ k) { // each NN
distMatrix[idx + k*channel_stride] = pCost[idx + k*channel_stride];
}
}
}
}
示例2: stwarp
/* The computational routine */
void stwarp(const mwSize *dimsA, const mwSize *dimsB, stwarp_video_t * videoA, stwarp_video_t *videoB, float *outMatrix, STWarpParams params, const float* initWarp)
{
WarpingField<precision_t> uvw;
STWarp<precision_t> warper = STWarp<precision_t>();
warper.setParams(params);
Video<stwarp_video_t> A;
int dA[4];
for (int i = 0; i < 4; ++i) {
dA[i] = dimsA[i];
}
A.initFromMxArray(4, dA, videoA);
Video<stwarp_video_t> B;
int dB[4];
for (int i = 0; i < 4; ++i) {
dB[i] = dimsB[i];
}
B.initFromMxArray(4, dB, videoB);
warper.setVideos(A,B);
if(initWarp) {
WarpingField<float> warp;
int dWF[4];
for (int i = 0; i < 3; ++i) {
dWF[i] = dimsA[i];
}
dWF[3] = 3;
warp.initFromMxArray(4, dWF, initWarp);
warper.setInitialWarpField(warp);
}
uvw = warper.computeWarp();
uvw.copyToMxArray(dimsA[0]*dimsA[1]*dimsA[2]*dimsA[3],outMatrix);
}