मैं नए एंड्रॉइड चेहरे का पता लगाने मोबाइल दृष्टि एपीआई का उपयोग करते समय प्रक्रिया करने के लिए फ्रेम छवि प्राप्त करने की कोशिश कर रहा हूं।ग्रेस्केल बाइट बफर छवि से बिटमैप कैसे बनाएं?
इसलिए मैंने फ्रेम प्राप्त करने के लिए कस्टम डिटेक्टर बनाया है और getBitmap() विधि को कॉल करने का प्रयास किया है, लेकिन यह शून्य है इसलिए मैंने फ्रेम के ग्रेस्केल डेटा तक पहुंचाया। क्या इससे बिटमैप बनाने या समान छवि धारक वर्ग बनाने का कोई तरीका है?
public class CustomFaceDetector extends Detector<Face> {
private Detector<Face> mDelegate;
public CustomFaceDetector(Detector<Face> delegate) {
mDelegate = delegate;
}
public SparseArray<Face> detect(Frame frame) {
ByteBuffer byteBuffer = frame.getGrayscaleImageData();
byte[] bytes = byteBuffer.array();
int w = frame.getMetadata().getWidth();
int h = frame.getMetadata().getHeight();
// Byte array to Bitmap here
return mDelegate.detect(frame);
}
public boolean isOperational() {
return mDelegate.isOperational();
}
public boolean setFocus(int id) {
return mDelegate.setFocus(id);
}}
फ्रेम में बिटमैप डेटा नहीं है क्योंकि यह सीधे कैमरे से आता है। कैमरे से छवि प्रारूप एनवी 21 है: http://developer.android.com/reference/android/graphics/ImageFormat.html#NV21 – pm0733464