Package de.swa.fuh.aws.awsrekognition
Class RekognitionImageLabler_JavaV1
java.lang.Object
de.swa.fuh.aws.awsrekognition.RekognitionImageLabler_JavaV1
public class RekognitionImageLabler_JavaV1
extends java.lang.Object
Helper Class to call image labeling.
-
Constructor Summary
Constructors Constructor Description RekognitionImageLabler_JavaV1(java.io.File file)
Uses default threshold and maxLabels ParameterRekognitionImageLabler_JavaV1(java.io.File file, float threshold, int maxLabels)
-
Method Summary
Modifier and Type Method Description boolean
checkImageSize(java.io.File file)
Checks if image size is to big for labeling.java.util.List<com.amazonaws.services.rekognition.model.Label>
detectLabels()
Sends query for labeling and detects labels.java.nio.ByteBuffer
getImageBytes()
Return ImageBytesint
getMaxLabels()
Returns current maxLabels amount.float
getThreshold()
Returns current set threshold for label to be processed.void
setImageBytes(java.io.File file)
Sets bytestreeam for upload to labeling.void
setMaxLabels(int maxLabels)
Setter for maxLabels.void
setThreshold(float threshold)
Setter for threshold.
-
Constructor Details
-
RekognitionImageLabler_JavaV1
public RekognitionImageLabler_JavaV1(java.io.File file, float threshold, int maxLabels)- Parameters:
file
- Image filethreshold
- Set threshold for confidence of label. By default 50f.maxLabels
- Set amount of labels per query. by default 20.
-
RekognitionImageLabler_JavaV1
public RekognitionImageLabler_JavaV1(java.io.File file)Uses default threshold and maxLabels Parameter- Parameters:
file
- Imagefile
-
-
Method Details
-
checkImageSize
public boolean checkImageSize(java.io.File file)Checks if image size is to big for labeling.- Parameters:
file
- Imagefile.- Returns:
- boolean wheter size is ok.
-
setImageBytes
public void setImageBytes(java.io.File file)Sets bytestreeam for upload to labeling.- Parameters:
file
- Image file
-
detectLabels
public java.util.List<com.amazonaws.services.rekognition.model.Label> detectLabels()Sends query for labeling and detects labels.- Returns:
- List of Labels. Or Empty list if request goes wrong.
-
setMaxLabels
public void setMaxLabels(int maxLabels)Setter for maxLabels. By default 20.- Parameters:
maxLabels
-
-
getMaxLabels
public int getMaxLabels()Returns current maxLabels amount.- Returns:
- int of maxLabels per query.
-
setThreshold
public void setThreshold(float threshold)Setter for threshold. Which minimum confidence should a label have to be processed. By defualt 50f.- Parameters:
threshold
- float variable
-
getThreshold
public float getThreshold()Returns current set threshold for label to be processed.- Returns:
- float
-
getImageBytes
public java.nio.ByteBuffer getImageBytes()Return ImageBytes- Returns:
-