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

Last change on this file since 145 was 142, checked in by ldecherf, 7 years ago

Ajout de la classe outputter et modification d'openCV

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