当前位置:网站首页>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);
}
边栏推荐
- How to efficiently complete daily tasks?
- Sunshine boy chenhaotian was invited to be the spokesperson for the global finals of the sixth season perfect children's model
- PTA class a simulated 8th bomb: 1164-1167
- 将lua print输出到cocos2d控制台输出窗口中
- 连接投影仪
- Record a weird picture upload problem
- Make a row of the dataframe a column name
- tos cos dscp 区别和作用
- 元气少女王钰洁 受邀担任第六季完美童模全球总决赛代言人
- cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network
猜你喜欢

Exploring temporary information for dynamic network embedding

jenkins汉化及汉化无效解决方案

Make a row of the dataframe a column name

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

Dataframe to list

recvmsg & sendmsg

The answer skills and examples of practical cases of the second construction company are full of essence

recv & send

biggan:large scale gan training for high fidelity natural image synthesis

Pixel6 unlock bootloader
随机推荐
Difference between app test and web test
论文阅读 Exploring Temporal Information for Dynamic Network Embedding
Three factors affecting personal growth
A lost note for konjaku beginner
初识Opengl
easyexcel读取文件
PTA class a simulated second bullet: 1136-1139
cv==biaoding---open----cv001
regular expression
Xiaomi tablet 5 Pro unlock bootloader
Abnova anti GBA monoclonal antibody solution
xargs 的作用详解
如何高效的完成每日的任务?
Dataframe converts the data type of a column
Introduction to gun make (1)
V4L2+QT视频优化策略
其他代码,,vt,,,k
图形渲染管线
元气少女王钰洁 受邀担任第六季完美童模全球总决赛代言人
UN make (6) conditional execution of makefile