当前位置:网站首页>将weishi相机图片进行转换
将weishi相机图片进行转换
2022-06-26 00:26:00 【ooolmf】
//将相机的图像,转变为投影仪用的
int Cmy3DScanMFCDlg::OnStreamCB(MV_IMAGE_INFO *pInfo)
{
/*! * \brief 将回调函数收到的图像信息转换为图像。 * \param [in] hCam 相机句柄 * \param [in] pInfo 采集Callback函数中传来的图像信息指针 * \param [out] pImage 转换结果图像的指针 * \retval MVST_SUCCESS : 成功 */
//MVCamra类cam
MVInfo2Image(cam.hCam, pInfo, &cam.mvimage);
//获取图像宽
int w = cam.mvimage.GetWidth();
//获取图像宽
int h = cam.mvimage.GetHeight();
//CV_8UC3 8位深度,无符号,3通道,就是RGB相机
cam.src.create(h, w, CV_8UC3);
//将彩色图像数据转换为OpenCV的Mat数据格式
MVSTATUS_CODES r;//错误枚举对象,在相机的头文件中MVSTATUS_CODES
/*!MVBayerToBGR * \brief 将Bayer格式的8bit单通道图转换为BGR格式的8Bit三通道图 * \param [in] hCam 相机句柄 * \param [in] psrc 单通道图像的指针 * \param [out] pdst 三通道图像指针 * \param [in] dststep 三通道图像一行图像的字节数。通常为图像宽度*3,但是会为了4字节对齐会补几个字节。 * \param [in] width 图像宽度 * \param [in] height 图像高度 * \param [in] pixelformat 像素格式,由MVGetPixelFormat取得 * \param [in] bMultiCores 是否使用CPU多核计算 * \retval MVST_SUCCESS : 成功 */
r = MVBayerToBGR(cam.hCam, pInfo->pImageBuffer, cam.src.data, w * 3, w, h, cam.pixelformat);
if (r != MVST_SUCCESS)
{
::MessageBox(NULL, _T("转换失败 "), _T("错误"), MB_OK);
/*cout << "转换失败 " << "原因:" << r << endl;*/
}
else /*cout << "转换成功" << endl*/;
//利用cv的进行显示图片
showCamInCall(cam.src);
/*cv::namedWindow("src", 0); cv::resizeWindow("src", cv::Size(800, 600)); cv::imshow("src", cam.src);*/
//cv::waitKey(50);
return 0;
}
边栏推荐
猜你喜欢

pixel 6 root

Abnova CMV CISH probe solution

Exploring temporary information for dynamic network embedding

关于VS scanf出现‘scanf‘: This function or variable may be unsafe. Consider usi问题的解决方法

Xiaomi tablet 5 Pro unlock bootloader

Pointnet/Pointnet++学习

shell学习记录(四)

A lost note for konjaku beginner

Tengwenze, a hot-blooded boy, was invited to serve as the image ambassador of the global finals of the sixth season perfect children's model

Abnova actn4 DNA probe solution
随机推荐
CyCa children's physical etiquette Yueqing City training results assessment successfully concluded
easyexcel读取文件
接口测试用例设计
安装了Visual Studio 2013 Redistributable,mysql还是安装失败
Differences and functions of TOS cos DSCP
如何高效的完成每日的任务?
17.11 std::atomic续谈、std::async深入谈
Disruptor(一)Sequence
Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Hangzhou
Sweet cool girl jinshuyi was invited to be the spokesperson for the global finals of the sixth season perfect children's model
反向输出一个整数
阳光男孩陈颢天 受邀担任第六季完美童模全球总决赛代言人
vscode调试时提示更新到最新调试版本
shell学习记录(四)
UN make (6) conditional execution of makefile
元气少女王钰洁 受邀担任第六季完美童模全球总决赛代言人
Tengwenze, a hot-blooded boy, was invited to serve as the image ambassador of the global finals of the sixth season perfect children's model
A solution to cross domain problems
-- EGFR FISH probe solution
About vs scanf, 'scanf' appears: this function or variable may be unsafe Solutions to the problem of consumer usi