Package org.robwork.sdurw_sensor
Class ImageCPtr
- java.lang.Object
-
- org.robwork.sdurw_sensor.ImageCPtr
-
public class ImageCPtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Image
__ref__()
Dereferencing operator.ImagePtr
copyFlip(boolean horizontal, boolean vertical)
copies this image and flips it around horizontal or vertical axis or both.void
delete()
Image
deref()
The pointer stored in the object.boolean
equals(Image p)
long
getBitsPerPixel()
returns the number of bits per pixel.Image.ColorCode
getColorEncoding()
returns color encoding/type of this imagestatic long
getCPtr(ImageCPtr obj)
long
getDataSize()
returns the size of the char data arrayImage
getDeref()
Member access operator.long
getHeight()
returns the height of this imagelong
getNrOfChannels()
The number of channels that this image has.Pixel4f
getPixel(long x, long y)
generic but inefficient access to pixel information.void
getPixel(long x, long y, Image.Pixel4i dst)
generic access to pixel information, however user must take care of the pixel
depth himself.void
getPixel(long x, long y, Pixel4f dst)
generic but inefficient access to pixel information.Image.PixelDepth
getPixelDepth()
bits per pixel encoded as a PixelDepth type.Pixel4f
getPixelf(long x, long y)
Image.Pixel4i
getPixeli(long x, long y)
generic access to pixel information, however user must take care of the pixel
depth himself.float
getPixelValue(long x, long y, long channel)
generic but inefficient access to a specific channel of
a pixel.float
getPixelValuef(long x, long y, long channel)
int
getPixelValuei(long x, long y, long channel)
long
getWidth()
returns the width of this imagelong
getWidthStep()
the size of an aligned image row in bytes.boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipboolean
saveAsPGM(java.lang.String fileName)
saves this image to a file in the PGM (grayscale) formatboolean
saveAsPGMAscii(java.lang.String fileName)
saves this image to a file in the ascii PGM (grayscale) formatboolean
saveAsPPM(java.lang.String fileName)
saves this image to a file in the PPM (color) format
-
-
-
Constructor Detail
-
ImageCPtr
public ImageCPtr(long cPtr, boolean cMemoryOwn)
-
ImageCPtr
public ImageCPtr()
Default constructor yielding a NULL-pointer.
-
ImageCPtr
public ImageCPtr(Image ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(ImageCPtr obj)
-
delete
public void delete()
-
deref
public Image deref()
The pointer stored in the object.
-
__ref__
public Image __ref__()
Dereferencing operator.
-
getDeref
public Image getDeref()
Member access operator.
-
equals
public boolean equals(Image p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
getDataSize
public long getDataSize()
returns the size of the char data array- Returns:
- size of char data array
-
getWidth
public long getWidth()
returns the width of this image- Returns:
- image width
-
getHeight
public long getHeight()
returns the height of this image- Returns:
- image height
-
getColorEncoding
public Image.ColorCode getColorEncoding()
returns color encoding/type of this image- Returns:
- ColorCode of this image
-
getBitsPerPixel
public long getBitsPerPixel()
returns the number of bits per pixel. This is the number
of bits used per pixel per channel.- Returns:
- number of bits per pixel
-
saveAsPGM
public boolean saveAsPGM(java.lang.String fileName)
saves this image to a file in the PGM (grayscale) format- Parameters:
fileName
- [in] the name of the file that is to be created
- Returns:
- true if save was succesfull, false otherwise
-
saveAsPGMAscii
public boolean saveAsPGMAscii(java.lang.String fileName)
saves this image to a file in the ascii PGM (grayscale) format- Parameters:
fileName
- [in] the name of the file that is to be created- Returns:
- true if save was succesfull, false otherwise
-
saveAsPPM
public boolean saveAsPPM(java.lang.String fileName)
saves this image to a file in the PPM (color) format- Parameters:
fileName
- [in] the name of the file that is to be created- Returns:
- true if save was succesfull, false otherwise
-
getWidthStep
public long getWidthStep()
the size of an aligned image row in bytes. This may not be
the same as the width if extra bytes are padded to each row for
alignment purposes.- Returns:
- size of aligned image row
-
getPixelDepth
public Image.PixelDepth getPixelDepth()
bits per pixel encoded as a PixelDepth type.- Returns:
- the pixel depth
-
getNrOfChannels
public long getNrOfChannels()
The number of channels that this image has.- Returns:
- nr of channels
-
getPixel
public Pixel4f getPixel(long x, long y)
generic but inefficient access to pixel information. The float
value is between [0;1] which means non float images are scaled according to
their pixel depth (bits per pixel).- Parameters:
x
- [in] x coordinatey
- [in] y coordinate- Returns:
- up to 4 pixels (depends on nr of channels) in a float format
-
getPixel
public void getPixel(long x, long y, Pixel4f dst)
generic but inefficient access to pixel information. The float
value is between [0;1] which means non float images are scaled according to
their pixel depth (bits per pixel).- Parameters:
x
- [in] x coordinatey
- [in] y coordinatedst
- [out] up to 4 pixels (depends on nr of channels) in a float format
-
getPixel
public void getPixel(long x, long y, Image.Pixel4i dst)
generic access to pixel information, however user must take care of the pixel
depth himself. If image is a Depth8U then the maximum value is 254. Also float images
are scaled accordingly.- Parameters:
x
- [in] x coordinatey
- [in] y coordinatedst
- [out] up to 4 pixels (depends on nr of channels) in a float format
-
getPixelf
public Pixel4f getPixelf(long x, long y)
-
getPixeli
public Image.Pixel4i getPixeli(long x, long y)
generic access to pixel information, however user must take care of the pixel
depth himself. If image is a Depth8U then the maximum value is 254. Also float images
are scaled accordingly.- Parameters:
x
- [in] x coordinatey
- [in] y coordinate- Returns:
- up to 4 pixels (depends on nr of channels) as ints
-
getPixelValue
public float getPixelValue(long x, long y, long channel)
generic but inefficient access to a specific channel of
a pixel.- Parameters:
x
- [in]y
- [in]channel
- documentation missing !- Returns:
- the pixel value.
-
getPixelValuef
public float getPixelValuef(long x, long y, long channel)
-
getPixelValuei
public int getPixelValuei(long x, long y, long channel)
-
copyFlip
public ImagePtr copyFlip(boolean horizontal, boolean vertical)
copies this image and flips it around horizontal or vertical axis or both.- Returns:
- new image.
-
-