当前位置:网站首页>Weishi camera display
Weishi camera display
2022-06-26 02:02:00 【ooolmf】
void MVCamra::showCam()
{
//if (r == MVST_SUCCESS) return;
MVSTATUS_CODES r;
r = MVInitLib();
if (r != MVST_SUCCESS)
{
::MessageBox(NULL, _T(" initialization failed "), _T(" error "), MB_OK);
return;
/*cout << " initialization failed " << " reason :" << MB_ICONWARNING << endl;*/
}
// Find the number of cameras connected to the computer
int numberofCams = 0;
MVGetNumOfCameras(&numberofCams);
//cout << numberofCams << endl;
if (numberofCams == 0)
{
::MessageBox(NULL, _T(" No camera found ! "), _T(" error "), MB_OK);
return;
}
else
{
//MessageBox(NULL, _T(" Discover camera ! "), _T(" correct "), MB_OK);
}
cam.hCam = NULL;
MVOpenCamByIndex(0, &cam.hCam);// Turn on camera , Return camera handle
if (cam.hCam != NULL)
{
/*cout << " The camera has been turned on !" << endl;*/
}
// Format image pixels
cam.pixelformat = PixelFormat_BayerRG8;
MVSetPixelFormat(cam.hCam, cam.pixelformat);
// Set the current frame rate
double fps = 40;
MVSetFrameRate(cam.hCam, fps);
// Set exposure time
MVSetAutoExposureTimeLowerLimit(cam.hCam, 10);
MVSetAutoExposureTimeUpperLimit(cam.hCam, 300000);
// Set the desired brightness
MVSetAutoTargetValue(cam.hCam, 128);
// Set the brightness tolerance
MVSetAutoThreshold(cam.hCam, 0.3);
// Set the trigger mode
MVSetTriggerMode(cam.hCam, TriggerMode_Off);
// Set and obtain image width and height
int ww = 1600, hh = 1200;
MVSetWidth(cam.hCam, ww);
MVSetHeight(cam.hCam, hh);
MVGetWidth(cam.hCam, &ww);
MVGetHeight(cam.hCam, &hh);
// Get image format
MVGetPixelFormat(cam.hCam, &cam.pixelformat);
cam.mvimage.CreateByPixelFormat(ww, hh, cam.pixelformat);
//MVSetExposureTime(cam.hCam, 24000);
while (1)
{
// The camera starts working to capture the video stream ( The transmission rate is too fast There will be frame loss No performance impact )
MVSTATUS_CODES y;
if (dt.index <= 12 && dt.index >= 0)
{
//DLPC350_SetLedCurrents(30, 30, 30);
DLPC350_LoadImageIndex(dt.index);
std::this_thread::sleep_for(std::chrono::milliseconds(200));
//cv::waitKey(10);
y = MVStartGrab(cam.hCam, StreamCB, (ULONG_PTR)this);
if (calib_button_flag/*&&dt.index >= 0*/)
{
grating.src_grating[dt.index] = cam.src.clone();
}
/*if (dt.index <= 9 && dt.index >= 0) cv::imwrite("F://cvs//image//0//0" + to_string(dt.index) + ".bmp", grating.src_grating[dt.index ]); else cv::imwrite("F://cvs//image//0//" + to_string(dt.index) + ".bmp", grating.src_grating[dt.index ]);*/
//cv::cvtColor(cam.src, grating.src_grating[dt.index - 1], CV_BGR2GRAY);
if (dt.index <= 9 && dt.index >= 0)
cv::imwrite("E://dlpcam//0" + to_string(dt.index) + ".bmp", grating.src_grating[dt.index ]);
else
cv::imwrite("E://dlpcam//" + to_string(dt.index) + ".bmp", grating.src_grating[dt.index ]);
//cv::waitKey(50);
dt.index++;
}
else
{
DLPC350_LoadImageIndex(0);
y = MVStartGrab(cam.hCam, StreamCB, (ULONG_PTR)this);
}
//if(dt.index >=13)DLPC350_LoadImageIndex(0);
//std::this_thread::sleep_for(std::chrono::milliseconds(60));
}
// Turn off video streaming
MVStopGrab(cam.hCam);
// Turn off camera
MVCloseCam(cam.hCam);
}
边栏推荐
- Show spirit chenzitong was invited to be the chief experience officer of the global finals of the sixth season perfect children's model
- xargs 的作用详解
- 连接投影仪
- Detailed explanation of WiFi related knowledge
- LeetCode 31 ~ 40
- vscode调试时提示更新到最新调试版本
- Redis-SDS
- General introduction to gun make (2)
- PTA class a simulated second bullet: 1136-1139
- The answer skills and examples of practical cases of the second construction company are full of essence
猜你喜欢

Exploring temporary information for dynamic network embedding

recvmsg & sendmsg

图形渲染管线

V4L2+QT视频优化策略

通俗易懂C语言关键字static

tos cos dscp 区别和作用

General introduction to gun make (2)

Playful girl wangyixuan was invited to serve as the Promotion Ambassador for the global finals of the sixth season perfect children's model

如何为政企移动办公加上一道“安全锁”?

Disruptor (I) sequence
随机推荐
PTA class a simulated seventh bomb: 1160-1163
Xiaomi tablet 5 Pro unlock bootloader
Pixel6 unlock bootloader
前置++,后置++与前置--与后置--(++a,a++与--a,a--)
Computer shortcut keys commonly used by experts
CyCa children's physical etiquette Yueqing City training results assessment successfully concluded
接口测试用例设计
Detailed explanation of memory leak check tools
socket demo01
17.11 std:: atomic continuation, std:: async in-depth discussion
Record a weird picture upload problem
Difference between app test and web test
安装了Visual Studio 2013 Redistributable,mysql还是安装失败
其他代码,,vt,,,k
PTA class a simulated 8th bomb: 1164-1167
Abnova CMV CISH probe solution
PTA class a simulated second bullet: 1136-1139
Introduction to gun make (1)
Data analysis - similarities and differences between C-end and b-end data analysis
buffer