1 | #include "VislabImageProcessor.h"
|
---|
2 |
|
---|
3 | #include <opencv2/opencv.hpp>
|
---|
4 | #include <opencv2/highgui.hpp>
|
---|
5 |
|
---|
6 |
|
---|
7 | VislabImageProcessor::VislabImageProcessor(const QString& name, lib3dv::image::type::types imageType)
|
---|
8 | :mImageType(imageType), mName(name)
|
---|
9 | {
|
---|
10 | }
|
---|
11 |
|
---|
12 | void VislabImageProcessor::image_callback(boost::shared_ptr< const lib3dv::image> image)
|
---|
13 | {
|
---|
14 | if(image->type() == mImageType)
|
---|
15 | {
|
---|
16 | /*! Type picture : Mono 8 */
|
---|
17 | if(image->format() == lib3dv::image::format::MONO8)
|
---|
18 | {
|
---|
19 | cv::Mat cvimage(image->height(), image->width(), CV_8UC1);
|
---|
20 | std::memcpy(cvimage.data,image->data(),image->height()*image->width());
|
---|
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 |
|
---|
28 | /*! Type picture : Mono 16 */
|
---|
29 | if(image->format() == lib3dv::image::format::MONO16)
|
---|
30 | {
|
---|
31 | cv::Mat cvimage(image->height(), image->width(), CV_16UC1);
|
---|
32 | std::memcpy(cvimage.data,image->data(),image->height()*image->width()*2);
|
---|
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 |
|
---|