- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我使用以下 C++ typedef 结构:
typedef struct TriclopsColorImage
{
// The number of rows in the image.
int nrows;
// The number of columns in the image.
int ncols;
// The row increment of the image.
int rowinc;
// The pixel data for red band of the image.
unsigned char* red;
// The pixel data for green band of the image.
unsigned char* green;
// The pixel data for blue band of the image.
unsigned char* blue;
} TriclopsColorImage;
我有一张图像作为 prhs[1]
传递给 mex
函数如何正确分配红色、绿色和蓝色的字段。我这里有
TriclopsColorImage colorImage;
我正在做这样的事情:
colorImage.nrows=(int) mxGetN(prhs[1]);
colorImage.ncols=(int) mxGetM(prhs[1]);
colorImage.rowinc=colorImage.ncols*2;
colorImage.red=?
colorImage.green=?
colorImage.blue=?
最佳答案
您必须将图像作为大小为 m
-by-n
-by-3 的 uint8
类型传递给您的 mex 函数。< br/>例如:
img = imread( 'football.jpg' );
myMeFunction( someArg, img ); % note that prhs[1] is the SECOND argument
现在在你的 mex 中:
colorImage.nrows=(int) mxGetM(prhs[1]); // M is number of rows!
colorImage.ncols=(int) mxGetN(prhs[1]) / 3; // assuming third dimension is three.
// for the colors:
unsigned char* p = (unsigned char*)mxGetData(prhs[1]);
colorImage.red = p;
colorImage.green = p + colorImage.nrows*colorImage.ncols;
colorImage.blue = p + 2*colorImage.nrows*colorImage.ncols;
请仔细阅读mxGetN的描述.
关于c++ - 如何从 matlab 将图像值分配给 Triclops 结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21760631/
还是完全依赖于 Bumblebee(或任何其他 Point Grey Imaging 传感器)?我正在尝试链接 bumblebee 2 stereo rig 附带的立体处理 API 来处理一些离线图像
我使用以下 C++ typedef 结构: typedef struct TriclopsColorImage { // The number of rows in the image. int
我使用的是 Point Grey Research BumbleBee 2 相机及其 SDK。我有这个循环来连续抓取帧,但它不起作用。它捕获了第一帧,但 triclopsGetImage() 似乎没有
我想使用 OpenCV 对来自 Bumblebee2 相机的校正图像进行一些处理。我正在使用 FlyCapture2 和 Triclops 从传感器抓取图像并进行校正。我想将 TriclopsColo
我有 BumbleBee 2 立体相机和两个提到的 SDK。 我已经设法在我的程序中从中捕获视频,校正立体图像并获得视差图。接下来我想要的是一张类似于 Kinect 提供的深度图。 Triclops
我是一名优秀的程序员,十分优秀!