Version 8.9.0
 
Loading...
Searching...
No Matches
/platform/windows/examples/directbinding/irDirectBindingUSBShow.cpp

Windows example: This example shows the usage of the C-style interface to access a locally attached camera via USB.

Windows example: This example shows the usage of the C-style interface to access a locally attached camera via USB.

#include <iostream>
#include <vector>
#include <memory>
#include "direct_binding.h"
#include "VideoDisplay.h"
VideoDisplay* _display = NULL;
bool _run = true;
int _w;
int _h;
DWORD WINAPI camWorker(LPVOID lpParam)
{
std::vector<unsigned char> img(_w*_h * 3);
while(_run)
{
if(::evo_irimager_get_palette_image(&_w, &_h, &img[0])==0)
{
if (_display) _display->drawCapture(0, 0, _w, _h, 24, &img[0]);
}
}
return 0;
}
int main(int argc, char *argv[])
{
if(argc<2)
{
std::cout << "usage: " << argv[0] << " <configuration xml>" << std::endl;
return -1;
}
int ret = ::evo_irimager_usb_init(argv[1], 0, 0);
if (ret != 0)
{
std::cout << "error at init" << std::endl;
std::cin.ignore();
return -1;
}
{
HANDLE th = CreateThread(NULL, 0, camWorker, NULL, 0, NULL);
_display = new VideoDisplay(_w, _h);
_display->show();
_display->run();
_run = false;
WaitForSingleObject(th, INFINITE);
CloseHandle(th);
}
return 0;
}
Provides Easy API C-Library Interface.
__IRDIRECTSDK_API__ int evo_irimager_usb_init(const char *xml_config, const char *formats_def, const char *log_file)
Initializes an IRImager instance connected to this computer via USB.
__IRDIRECTSDK_API__ int evo_irimager_terminate()
Disconnects the camera, either connected via USB or TCP.
__IRDIRECTSDK_API__ int evo_irimager_get_palette_image(int *w, int *h, unsigned char *data)
Accessor to an RGB palette image by reference data format: unsigned char array (size 3 * w * h) r,...
__IRDIRECTSDK_API__ int evo_irimager_get_palette_image_size(int *w, int *h)
Accessor to width and height of false color coded palette image.