Hey folks,
I am taking a picture that is internally saved as Bitmap. It's not automatically saved to file system since it should be only tempoary. Currently I am saving that Bitmap as .png to the internal stoarage to pass it to opencv. Actually that step is kind of redundant and takes additional time. Is it possible to directly create a Mat from a byte array or bitmap?
Here is my code for the feature extraction:
public static String extractKeypoints(String location){
Mat image = Imgcodecs.imread(location);
DescriptorExtractor descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);
FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
MatOfKeyPoint keypoints = new MatOfKeyPoint();
detector.detect(image, keypoints);
Mat finalMatrix = new Mat();
descriptor.compute(image, keypoints, finalMatrix);
StringBuilder builder = new StringBuilder();
double[] temp;
for (int i = 0; i < finalMatrix.rows(); i++) {
for (int j = 0; j < finalMatrix.cols(); j++) {
temp = finalMatrix.get(i, j);
builder.append(String.valueOf(temp[0]) + " ");
}
}
return builder.toString();
}