15 #ifndef OPENCVTEXTURE_H
16 #define OPENCVTEXTURE_H
18 #include "pandabase.h"
21 #include "videoTexture.h"
28 #include <opencv2/core/core.hpp>
30 #include <opencv2/highgui/highgui.hpp>
37 #endif // OPENCV_VER_23
48 OpenCVTexture(
const string &name =
string());
50 OpenCVTexture(
const OpenCVTexture ©);
52 virtual ~OpenCVTexture();
54 bool from_camera(
int camera_index = -1,
int z = 0,
55 int alpha_file_channel = 0,
59 static PT(
Texture) make_texture();
62 virtual
void consider_update();
63 virtual PT(
Texture) make_copy_impl();
64 void do_assign(
Texture::CData *cdata_tex, const OpenCVTexture *copy,
65 const
Texture::CData *cdata_copy_tex);
67 virtual
void do_update_frame(
Texture::CData *cdata_tex,
int frame);
68 virtual
void do_update_frame(
Texture::CData *cdata_tex,
int frame,
int z);
70 virtual
bool do_read_one(
Texture::CData *cdata,
72 int z,
int n,
int primary_file_num_channels,
int alpha_file_channel,
75 virtual
bool do_load_one(
Texture::CData *cdata,
76 const
PNMImage &pnmimage, const
string &name,
83 VideoPage &do_modify_page(const
Texture::CData *cdata,
int z);
84 bool do_reconsider_video_properties(
Texture::CData *cdata,
85 const VideoStream &stream,
86 int num_components,
int z,
93 VideoStream(
const VideoStream ©);
97 bool from_camera(
int camera_index);
99 INLINE
bool is_valid()
const;
100 INLINE
bool is_from_file()
const;
101 bool get_frame_data(
int frame,
102 const unsigned char *&r,
103 const unsigned char *&g,
104 const unsigned char *&b,
105 int &x_pitch,
int &y_pitch);
116 INLINE VideoPage(
const VideoPage ©);
119 VideoStream _color, _alpha;
132 static void init_type() {
133 VideoTexture::init_type();
134 register_type(_type_handle,
"OpenCVTexture",
135 VideoTexture::get_class_type());
138 return get_class_type();
140 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
146 #include "openCVTexture.I"
148 #endif // HAVE_OPENCV
void clear()
Reinitializes the texture to its default, empty state (except for the name).
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Specifies parameters that may be passed to the loader.
static void register_with_read_factory()
Factory method to generate a Texture object.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
The base class for a family of animated Textures that take their input from a video source...
This is our own Panda specialization on the default STL vector.
The name of a file, such as a texture file or an Egg file.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
bool read(const Filename &fullpath, const LoaderOptions &options=LoaderOptions())
Reads the named filename into the texture.
TypeHandle is the identifier used to differentiate C++ class types.