Added new functionalities to viz module

- load OBJ file
- set offscreen rendering
- set roll angle of the camera
- get Mat screenshot of the current scene
- remove all lights from the scene
- add a custom light in the scene
- modify the size of the WImage3D widget
- added ambient property for the widget

Changed Vec3d in cv::viz::Color

Renamed method getMatScreenshotin getScreenshot

Modified showWidget

Fixed on viz::Color and reverted fix on vtkProp3D

Removed cameraRoll method

Merged load mesh method (for ply and obj file)

Fixed doc

Fixed cv::viz::WImage3D::setSize for vtk5.8

Fixed enum for cv::viz::Mesh::load
This commit is contained in:
Antonella Cascitelli
2015-07-10 10:57:53 +02:00
committed by antonella
parent 424c2bddb3
commit 079ceea616
10 changed files with 175 additions and 8 deletions

View File

@@ -119,6 +119,12 @@ namespace cv
class CV_EXPORTS Mesh
{
public:
enum {
LOAD_AUTO = 0,
LOAD_PLY = 1,
LOAD_OBJ = 2
};
Mat cloud, colors, normals;
//! Raw integer list of the form: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
@@ -127,11 +133,17 @@ namespace cv
Mat texture, tcoords;
/** @brief Loads a mesh from a ply file.
/** @brief Loads a mesh from a ply or a obj file.
@param file File name (for now only PLY is supported)
@param file File name
@param type File type (for now only PLY and OBJ are supported)
**File type** can be one of the following:
- **LOAD_PLY**
- **LOAD_OBJ**
*/
static Mesh load(const String& file);
static Mesh load(const String& file, int type = LOAD_PLY);
};
/** @brief This class wraps intrinsic parameters of a camera.

View File

@@ -189,6 +189,10 @@ namespace cv
*/
String getWindowName() const;
/** @brief Returns the Mat screenshot of the current scene.
*/
cv::Mat getScreenshot() const;
/** @brief Saves screenshot of the current scene.
@param file Name of the file.
@@ -224,6 +228,26 @@ namespace cv
*/
void spinOnce(int time = 1, bool force_redraw = false);
/** @brief Create a window in memory instead of on the screen.
*/
void setOffScreenRendering();
/** @brief Remove all lights from the current scene.
*/
void removeAllLights();
/** @brief Add a light in the scene.
@param position The position of the light.
@param focalPoint The point at which the light is shining
@param color The color of the light
@param diffuseColor The diffuse color of the light
@param ambientColor The ambient color of the light
@param specularColor The specular color of the light
*/
void addLight(Vec3d position, Vec3d focalPoint = Vec3d(0, 0, 0), Color color = Color::white(),
Color diffuseColor = Color::white(), Color ambientColor = Color::black(), Color specularColor = Color::white());
/** @brief Returns whether the event loop has been stopped.
*/
bool wasStopped() const;

View File

@@ -66,7 +66,8 @@ namespace cv
FONT_SIZE,
REPRESENTATION,
IMMEDIATE_RENDERING,
SHADING
SHADING,
AMBIENT
};
enum RepresentationValues
@@ -136,6 +137,7 @@ namespace cv
- **OPACITY**
- **LINE_WIDTH**
- **FONT_SIZE**
- **AMBIENT**
-
**REPRESENTATION**: Expected values are
: - **REPRESENTATION_POINTS**
@@ -494,6 +496,12 @@ namespace cv
@param image BGR or Gray-Scale image.
*/
void setImage(InputArray image);
/** @brief Sets the image size of the widget.
@param size the new size of the image.
*/
void setSize(const Size& size);
};
/////////////////////////////////////////////////////////////////////////////