PNMCodec Class |
Namespace: Accord.Imaging.Formats
[FormatDecoderAttribute("pbm")] [FormatDecoderAttribute("pgm")] [FormatDecoderAttribute("pnm")] [FormatDecoderAttribute("ppm")] public class PNMCodec : IImageDecoder
The PNMCodec type exposes the following members.
Name | Description | |
---|---|---|
Close |
Close decoding of previously opened stream.
| |
DecodeFrame |
Decode specified frame.
| |
DecodeSingleFrame |
Decode first frame of PNM image.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Open |
Open specified stream.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The PNM (an acronym derived from "Portable Any Map") format is an abstraction of the PBM, PGM and PPM formats. I.e. the name "PNM" refers collectively to PBM (binary images), PGM (grayscale images) and PPM (color image) image formats.
Image in PNM format can be found in different scientific databases and laboratories, for example Yale Face Database and AT&T Face Database.
Note |
---|
Only PNM images of P2 (ascii encoded PGM), P3 (ascii encoded ppm), P5 (binary encoded PGM) and P6 (binary encoded PPM) formats are supported at this point. |
Note |
---|
The maximum supported pixel value is 255 at this point. |
Note |
---|
The class supports only one-frame PNM images. As it is specified in format specification, the multi-frame PNM images has appeared starting from 2000. |
string filename = Path.Combine(basePath, "lena.pgm"); // One way to decode the image explicitly is to use Bitmap image1 = ImageDecoder.DecodeFromFile(filename); // However, you could also obtain the same effect using Bitmap image2 = Accord.Imaging.Image.FromFile(filename);