Page 2 of 2

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

Posted: 19 Jun 2019, 11:44
by ducdanganhit
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?

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

Posted: 19 Jun 2019, 11:57
by ducdanganhit
guess you would like to use cbimtmap ..
Do you have any example or more suggestion? Thanks you :)

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

Posted: 20 Jun 2019, 11:12
by jsantos
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.

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

Posted: 01 Jul 2019, 11:11
by ducdanganhit
Do we have any example using OpenGL in Noesis?
I got some problems of integrating Noesis to use OpenGL :(

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

Posted: 01 Jul 2019, 15:20
by jsantos
All our samples are multiplatorm, so they also work in OpenGL.

You can find a minimal sample integrating NoesisGUI + GLUT at Github.

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

Posted: 03 Jul 2019, 05:16
by ducdanganhit
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

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

Posted: 03 Jul 2019, 17:44
by jsantos
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.