[Up] [Strel] Data Types

Image
Toolbox image type

Synopsis

class Image
{
public:
    Image();
    Image(const Image& img);
    Image(int width, int height, int depth, const char *type, const char *raster);
    Image(int width, int height, int depth, const char *type = "uint8", double value = 0);
    Image(int pix);
    Image(double pix);
    Image(const IplImage *img);
    Image(const char *filename, int iscolor = -1);
    //
    ~Image();
    //
    Image& operator=(const Image& img);
    operator IplImage*() const;
    //
    int width() const;
    int height() const;
    int depth() const;
    char *raster() const;
    char ***pointers() const;
    const char *typestr() const;
    int pixsize() const;
    String str() const;
    //
    void putpixel(int x, int y, int z, double value);
    double getpixel(int x, int y, int z) const;
    //
    void save(char *filename) const;
    void show(int id = 0, char *title = "OpenCV Viewer") const;
    //
    Image slice(int x0, int x1, int y0, int y1, int z0, int z1) const;
    Image uint8() const;
    Image uint16() const;
    Image int32() const;
    //
    int isnull() const;
    int isbinary() const;
};

Image Data Types

The Morphology Toolbox mainly supports four types of images according to their pixel datatypes : binary, unsigned gray scale uint8 and uint16, and signed gray scale int32. Most functions work for 1D, 2D and 3D images.

Class Methods

The following public methods are intended for use by application programs:

Technical Notes

The class Image is a proxy for the internal toolbox image type. It takes care of chores like memory release and exception catching. When a toolbox function returns an image, an object of this class is created to be returned to the caller. The object constructor catches any error ocurred in the function implementation and, in case of error, throws a morphException .

To free your code of the memory allocation statements, keep your images created in local space, so the underlying C++ system will take care of the memory releasing. Only in the case of returning an image to another procedure, create the image in the heap with the new operator.

See the code of the demonstrations for examples of use of the Image class.

See also

mmBinary Convert a gray-scale image into a binary image
mmUint8 Convert an image to an uint8 image.
mmUint16 Convert an image to a uint16 image.
mmInt32 Convert an image to an int32 image.
mmShow Display binary or gray-scale images and optionally overlay it with binary images.
mmDatatype Return the image datatype string
mmLimits Get the possible minimum and maximum of an image.
[Up] [Strel]