ducdanganhit
Topic Author
Posts: 25
Joined: 18 May 2019, 10:46

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

19 Jun 2019, 11:44

It seems that the program could not find implementation of WrapTexture. does libNoesisApp.so or libNoesis.socontain WrapTexture implementation?
Thank you!
If you search inside the code you will find the implementation in the D3D11RenderDevice.cpp file.
Hi,
D3D11RenderDevice.cpp includes D3D11RenderDevice.h.
D3D11RenderDevice.h includes <d3d11_1.h> which does not exist on Ubuntu system, only available on Windows. I am using Ubuntu. How we can solve this problem?

Do we have another way to show image from byte array?
Last edited by ducdanganhit on 19 Jun 2019, 12:01, edited 1 time in total.
 
ducdanganhit
Topic Author
Posts: 25
Joined: 18 May 2019, 10:46

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

19 Jun 2019, 11:57

guess you would like to use cbimtmap ..
Do you have any example or more suggestion? Thanks you :)
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

20 Jun 2019, 11:12

D3D11RenderDevice.cpp includes D3D11RenderDevice.h.
D3D11RenderDevice.h includes <d3d11_1.h> which does not exist on Ubuntu system, only available on Windows. I am using Ubuntu. How we can solve this problem?
There is no D3D in Linux, you need to use OpenGL (GLRenderDevice). The functionality is the same.
Do we have another way to show image from byte array?
Going through textures is the only way to do this efficiently.
 
ducdanganhit
Topic Author
Posts: 25
Joined: 18 May 2019, 10:46

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

01 Jul 2019, 11:11

Do we have any example using OpenGL in Noesis?
I got some problems of integrating Noesis to use OpenGL :(
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

01 Jul 2019, 15:20

All our samples are multiplatorm, so they also work in OpenGL.

You can find a minimal sample integrating NoesisGUI + GLUT at Github.
 
ducdanganhit
Topic Author
Posts: 25
Joined: 18 May 2019, 10:46

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

03 Jul 2019, 05:16

On Ubuntu 16.04, I've tried to use WrapTexture to load an image to texture using code below:
But glGenerateMipmap(GL_TEXTURE_2D); is not found.
I include these headers:
#include <GL/gl.h>
#include <GL/glut.h>
	InitializeComponent();
            cv::Mat image = cv::imread("./1.jpg");
            _image = FindName<Image>("img1");
            GLuint TextureID;
            if (image.empty()) {
                std::cout << "image empty" << std::endl;
            } else {
                glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
                glGenTextures(1, &TextureID);
                glBindTexture(GL_TEXTURE_2D, TextureID);

                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

                // Set texture clamping method
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

                cv::cvtColor(image, image, CV_RGB2BGRA);

                glTexImage2D(GL_TEXTURE_2D,         // Type of texture
                             0,                   // Pyramid level (for mip-mapping) - 0 is the top level
                             GL_BGR,              // Internal colour format to convert to
                             image.cols,          // Image width  i.e. 640 for Kinect in standard mode
                             image.rows,          // Image height i.e. 480 for Kinect in standard mode
                             0,                   // Border width in pixels (can either be 1 or 0)
                             GL_BGR,              // Input image format (i.e. GL_RGB, GL_RGBA, GL_BGR etc.)
                             GL_UNSIGNED_BYTE,    // Image data type
                             image.ptr());        // The actual image data itself
            }
            Ptr<Texture> NsTexture = GLRenderDevice::WrapTexture(TextureID, 300, 450, 0, false);
            Ptr<TextureSource> NsTextureSource = MakePtr<TextureSource>(NsTexture);
            _image->SetSource(NsTextureSource);
Result:
Image

What is wrong here?
Many thanks
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: [C++, OpenCV] Display image CV::Mat queue as video in XAML

03 Jul 2019, 17:44

On Ubuntu 16.04, I've tried to use WrapTexture to load an image to texture using code below:
But glGenerateMipmap(GL_TEXTURE_2D); is not found.
I am sorry to say you need to get help somewhere else because this is a GL question, not related to Noesis.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], jgurien, Semrush [Bot] and 2 guests