source: pacpussensors/trunk/Vislab/VislabImageProcessor.cpp@ 130

Last change on this file since 130 was 127, checked in by ldecherf, 8 years ago

Version 1 du plugin Vislab testé sous linux

File size: 1.4 KB
Line 
1#include "VislabImageProcessor.h"
2
3
4 VislabImageProcessor::VislabImageProcessor(const QString& name, lib3dv::image::type::types imageType)
5 :mImageType(imageType), mName(name)
6 {
7 }
8
9 void VislabImageProcessor::image_callback(boost::shared_ptr< const lib3dv::image> image, unsigned int)
10 {
11 if(image->m_type == mImageType)
12 {
13 if(image->m_format == lib3dv::image::format::MONO8)
14 {
15 cv::Mat cvimage(image->m_height, image->m_width, CV_8UC1);
16 std::memcpy(cvimage.data,image->m_buffer.data(),image->m_height*image->m_width);
17 /*for(int i=0;i<image->m_height*image->m_width;i++)
18 {
19 cvimage.data[i] = image->m_buffer[i];
20 }*/
21 process(cvimage);
22 }
23
24 if(image->m_format == lib3dv::image::format::MONO16)
25 {
26 cv::Mat cvimage(image->m_height, image->m_width, CV_16UC1);
27 std::memcpy(cvimage.data,image->m_buffer.data(),image->m_height*image->m_width*2);
28 /**for(int i=0;i<image->m_height*image->m_width*2;i++)
29 {
30 cvimage.data[i] = image->m_buffer[i];
31 }*/
32 process(cvimage);
33 }
34 }
35 }
36
37 QString VislabImageProcessor::getName()
38 {
39 return mName;
40 }
41
42
43
44
Note: See TracBrowser for help on using the repository browser.