org.cyberlab.support
Class ImageOps

java.lang.Object
  extended by org.cyberlab.support.ImageOps

public class ImageOps
extends java.lang.Object

Various image operations used by the framework and made available to the framework user.

Author:
Mats-Gøran Karlsen

Constructor Summary
ImageOps()
           
 
Method Summary
static Bitmap drawKeyPoints(Bitmap srcImg, java.util.ArrayList<org.opencv.features2d.KeyPoint> kps)
          Draws the keypoints onto the bitmap image
static float exifOrientationToDegrees(int exifOrientation)
           
static Bitmap loadImage(java.lang.String bitmapPath, int toWidth, int toHeight)
          Default function to load image from a file (without using the images EXIF data to rotate it according to the device orientation).
static Bitmap loadImage(java.lang.String bitmapPath, int toWidth, int toHeight, boolean preRotate)
          Function to load image from a file.
static org.opencv.core.Mat Mat_draw_KeyPoints(org.opencv.core.Mat srcMat, java.util.ArrayList<org.opencv.features2d.KeyPoint> kps)
          Draws the keypoints onto the Mat object.
static Bitmap matToBitmap(org.opencv.core.Mat image)
          Converts a Mat to a Bitmap wher the pixels are stored as ARGB_8888.
static Bitmap resize(Bitmap bitmap, int toWidth, int toHeight)
          Function to resize image to fit within the given height and width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageOps

public ImageOps()
Method Detail

drawKeyPoints

public static Bitmap drawKeyPoints(Bitmap srcImg,
                                   java.util.ArrayList<org.opencv.features2d.KeyPoint> kps)
Draws the keypoints onto the bitmap image

Parameters:
srcImg - The image of which the keypoints are to be drawn on.
kps - The keypoints
Returns:
The image with the keypoints drawn onto it.

exifOrientationToDegrees

public static float exifOrientationToDegrees(int exifOrientation)

Mat_draw_KeyPoints

public static org.opencv.core.Mat Mat_draw_KeyPoints(org.opencv.core.Mat srcMat,
                                                     java.util.ArrayList<org.opencv.features2d.KeyPoint> kps)
Draws the keypoints onto the Mat object.

Parameters:
srcMat - The input Mat
kps - The list of keypoints.
Returns:
The Mat with the keypoints drawn.

matToBitmap

public static Bitmap matToBitmap(org.opencv.core.Mat image)
Converts a Mat to a Bitmap wher the pixels are stored as ARGB_8888. See android Bitmap documentation for more info. Image is stored as ARGB_8888 because the OpenCV function Utils.bitmapToMat(Bitmap) currently only supports images of this kind.

Parameters:
image - The image as Mat
Returns:
The Mat converted to Bitmap

loadImage

public static Bitmap loadImage(java.lang.String bitmapPath,
                               int toWidth,
                               int toHeight)
Default function to load image from a file (without using the images EXIF data to rotate it according to the device orientation).

Parameters:
bitmapPath - The location of the image.
toWidth - The requested output image width.
toHeight - The requested output image height.
Returns:
See Also:
loadImage(String, int, int, boolean)

loadImage

public static Bitmap loadImage(java.lang.String bitmapPath,
                               int toWidth,
                               int toHeight,
                               boolean preRotate)
Function to load image from a file.

Parameters:
bitmapPath - The location of the image
toWidth - The requested output image width
toHeight - The requested output image height
preRotate - if true the image will be rotated using EXIF data to correspond to device rotation.
Returns:

resize

public static Bitmap resize(Bitmap bitmap,
                            int toWidth,
                            int toHeight)
Function to resize image to fit within the given height and width. The image will be scaled so it is size is within the parameters.

Parameters:
bitmap - The original bitmap.
toWidth - The requested output image width.
toHeight - The requested output image height.
Returns: