-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
221 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
#include "imgui.h" | ||
#include <opencv2/core.hpp> | ||
|
||
|
||
namespace ImmVision | ||
{ | ||
// GlTexture contains an OpenGL texture which can be created or updated from a cv::Mat (C++), or numpy array (Python) | ||
struct GlTexture | ||
{ | ||
// | ||
// Constructors | ||
// | ||
|
||
// Create an empty texture | ||
GlTexture(); | ||
// Create a texture from an image (cv::Mat in C++, numpy array in Python) | ||
GlTexture(const cv::Mat& image, bool isColorOrderBGR); | ||
// The destructor will delete the texture from the GPU | ||
~GlTexture(); | ||
|
||
// GlTextureCv is non copiable (since it holds a reference to a texture stored on the GPU), | ||
// but it is movable. | ||
GlTexture(const GlTexture& ) = delete; | ||
GlTexture& operator=(const GlTexture& ) = delete; | ||
GlTexture(GlTexture&& other) noexcept = default; | ||
GlTexture& operator=(GlTexture&& other) noexcept = default; | ||
|
||
|
||
// | ||
// Methods | ||
// | ||
|
||
// Update the texture from a new image (cv::Mat in C++, numpy array in Python). | ||
void UpdateFromImage(const cv::Mat& image, bool isColorOrderBGR); | ||
// Returns the size as ImVec2 | ||
ImVec2 SizeImVec2() const; | ||
|
||
|
||
// | ||
// Members | ||
// | ||
|
||
// OpenGL texture ID on the GPU | ||
ImTextureID TextureId; | ||
// Image size in pixels | ||
cv::Size Size; | ||
}; | ||
} // namespace ImmVision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#include "immvision/image.h" | ||
#include "immvision/inspector.h" | ||
#include "immvision/gl_texture.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.