Package org.robwork.sdurw_sensor
Class CameraPtr
- java.lang.Object
-
- org.robwork.sdurw_sensor.CameraPtr
-
public class CameraPtr 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 Camera
__ref__()
Dereferencing operator.void
acquire()
aquires an image from the camera.boolean
addListener(CameraListener listener)
adds a CameraListener to this cameraCameraCPtr
cptr()
void
delete()
Camera
deref()
The pointer stored in the object.boolean
equals(Camera p)
static long
getCPtr(CameraPtr obj)
Camera
getDeref()
Member access operator.java.lang.String
getDescription()
returns a description of this sensordouble
getFrameRate()
returns the framerate that this camera is setup withdouble
getGain()
Get actual gain value.
Note: If gain is not available then a dummy implementation
returning -1 is used and an error message is produced.long
getHeight()
get width of the captured imagesImage
getImage()
returns the last image acquired from the camera.java.lang.String
getModelInfo()
returns the camera model information (version, type, size, etc.)java.lang.String
getName()
returns the name of this sensorPropertyMap
getPropertyMap()
gets the propertymap of this sensorSensorModelPtr
getSensorModel()
The frame to which the sensor is attached.
The frame can be NULL.double
getShutter()
Get actual shutter value.
Note: If shutter is not available then a dummy implementation
will throw an error message.pair_d_d
getShutterBounds()
gets the shutter bounds.
Note: If shutter is not available then a dummy implementation
will throw an error message.long
getWidth()
get width of the captured imagesboolean
initialize()
initializes the camera to the current settings
(CaptureMode,ColorMode,etc.)boolean
isGainAvailable()
Check if gain is available.boolean
isImageReady()
tests whether a image has been acquiredboolean
isInitialized()
returns whether this camera is initialized or not.boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipboolean
isShutterAvailable()
Check if shutter is available.boolean
isStarted()
returns whether this camera is started or not.boolean
removeListener(CameraListener listener)
removes a CameraListener from this cameras listener list.void
setFrameRate(double framerate)
sets the framerate of this camera.double
setGain(double Value)
Set gain value.void
setSensorModel(SensorModelPtr smodel)
Sets the frame to which the sensor should be attached
void
setShutter(double Value)
Set shutter value.boolean
start()
starts this camera, if the camera has not been
initialized the initialize function will be called.void
stop()
stops this camera.
-
-
-
Constructor Detail
-
CameraPtr
public CameraPtr(long cPtr, boolean cMemoryOwn)
-
CameraPtr
public CameraPtr()
Default constructor yielding a NULL-pointer.
-
CameraPtr
public CameraPtr(Camera ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(CameraPtr obj)
-
delete
public void delete()
-
deref
public Camera deref()
The pointer stored in the object.
-
__ref__
public Camera __ref__()
Dereferencing operator.
-
getDeref
public Camera getDeref()
Member access operator.
-
equals
public boolean equals(Camera 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
-
cptr
public CameraCPtr cptr()
-
getModelInfo
public java.lang.String getModelInfo()
returns the camera model information (version, type, size, etc.)- Returns:
- camera model information
-
initialize
public boolean initialize()
initializes the camera to the current settings
(CaptureMode,ColorMode,etc.)- Returns:
- true if initialization is succesfully, false otherwise.
-
isInitialized
public boolean isInitialized()
returns whether this camera is initialized or not.- Returns:
- true if intialized, false otherwise
-
start
public boolean start()
starts this camera, if the camera has not been
initialized the initialize function will be called.- Returns:
- true if camera was successfully started, false
otherwise
-
isStarted
public boolean isStarted()
returns whether this camera is started or not.- Returns:
- true if started, false otherwise
-
stop
public void stop()
stops this camera. When the camera is stopped it can be
reinitialized using initialize()
-
acquire
public void acquire()
aquires an image from the camera. This method is not blocking.
Use isImageReady to poll for completion of acquire.
-
isImageReady
public boolean isImageReady()
tests whether a image has been acquired- Returns:
- true if an image has been acquired, false otherwise.
-
getImage
public Image getImage()
returns the last image acquired from the camera. This method
is not blocking, if no image has been acquired yet an empty image
is returned. The image returned can for some specific drivers be read
only.- Returns:
- last image captured from camera.
-
getFrameRate
public double getFrameRate()
returns the framerate that this camera is setup with- Returns:
- the framerate in frames per second
-
setFrameRate
public void setFrameRate(double framerate)
sets the framerate of this camera. If the framerate is not
supported the closest supported framerate is choosen.- Parameters:
framerate
- [in] the framerate
-
getWidth
public long getWidth()
get width of the captured images- Returns:
- width
-
getHeight
public long getHeight()
get width of the captured images- Returns:
- width
-
addListener
public boolean addListener(CameraListener listener)
adds a CameraListener to this camera- Parameters:
listener
- [in] the CameraListener that is to be added- Returns:
- true if listener was added succesfully, false otherwise
-
removeListener
public boolean removeListener(CameraListener listener)
removes a CameraListener from this cameras listener list.- Parameters:
listener
- [in] the listener that is to be removed- Returns:
- true if listener was removed succesfully, false otherwise.
-
isShutterAvailable
public boolean isShutterAvailable()
Check if shutter is available.- Returns:
- True if shutter is available
-
getShutter
public double getShutter()
Get actual shutter value.
Note: If shutter is not available then a dummy implementation
will throw an error message.- Returns:
- shutter value in micro-seconds.
-
setShutter
public void setShutter(double Value)
Set shutter value. If the given value is not possible the nearest
value are choosen.
Note: If shutter is not available then a dummy implementation
will throw an error message.- Parameters:
Value
- New shutter value.
-
getShutterBounds
public pair_d_d getShutterBounds()
gets the shutter bounds.
Note: If shutter is not available then a dummy implementation
will throw an error message.- Returns:
- first value is the min bound and second value is the max bound
-
isGainAvailable
public boolean isGainAvailable()
Check if gain is available.- Returns:
- True if zoom is available
-
getGain
public double getGain()
Get actual gain value.
Note: If gain is not available then a dummy implementation
returning -1 is used and an error message is produced.- Returns:
- Gain value.
-
setGain
public double setGain(double Value)
Set gain value. If the given value is not possible the nearest
value are choosen.
Note: If gain is not available then a dummy implementation
returning -1 is used and an error message is produced.- Parameters:
Value
- New gain value.- Returns:
- New nearest gain value.
-
getName
public java.lang.String getName()
returns the name of this sensor- Returns:
- name of sensor
-
getDescription
public java.lang.String getDescription()
returns a description of this sensor- Returns:
- reference to this sensors description
-
getSensorModel
public SensorModelPtr getSensorModel()
The frame to which the sensor is attached.
The frame can be NULL.
-
setSensorModel
public void setSensorModel(SensorModelPtr smodel)
Sets the frame to which the sensor should be attached
- Parameters:
smodel
-
-
getPropertyMap
public PropertyMap getPropertyMap()
gets the propertymap of this sensor
-
-