AutoML Vision Edge का इस्तेमाल करके, अपने मॉडल को ट्रेन करने के बाद, ऐप्लिकेशन में इमेज को लेबल करने के लिए इसका इस्तेमाल किया जा सकता है.
शुरू करने से पहले
- अगर आपने पहले से ऐसा नहीं किया है, तो अपने Android प्रोजेक्ट में Firebase जोड़ें.
- अपने मॉड्यूल (ऐप्लिकेशन-लेवल) की Gradle फ़ाइल (आम तौर पर
app/build.gradle
) में, ML Kit की Android लाइब्रेरी के लिए डिपेंडेंसी जोड़ें:apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' dependencies { // ... implementation 'com.google.firebase:firebase-ml-vision:24.0.3' implementation 'com.google.firebase:firebase-ml-vision-automl:18.0.5' }
1. मॉडल लोड करना
ML Kit, AutoML से जनरेट किए गए मॉडल को डिवाइस पर चलाता है. हालांकि, आपके पास ML Kit को कॉन्फ़िगर करने का विकल्प है, ताकि आपका मॉडल, Firebase से रिमोट तरीके से, लोकल स्टोरेज से या फिर दोनों से लोड हो सके.
Firebase पर मॉडल को होस्ट करके, ऐप्लिकेशन का नया वर्शन रिलीज़ किए बिना ही मॉडल को अपडेट किया जा सकता है. साथ ही, Remote Config और A/B Testing का इस्तेमाल करके, उपयोगकर्ताओं के अलग-अलग ग्रुप को डाइनैमिक तौर पर अलग-अलग मॉडल दिखाए जा सकते हैं.
अगर आपने मॉडल को Firebase पर होस्ट करके, उसे अपने ऐप्लिकेशन के साथ बंडल नहीं किया है, तो अपने ऐप्लिकेशन के डाउनलोड किए जाने के शुरुआती साइज़ को कम किया जा सकता है. हालांकि, ध्यान रखें कि अगर मॉडल को आपके ऐप्लिकेशन के साथ बंडल नहीं किया गया है, तो मॉडल से जुड़ी कोई भी सुविधा तब तक उपलब्ध नहीं होगी, जब तक आपका ऐप्लिकेशन पहली बार मॉडल को डाउनलोड नहीं कर लेता.
अपने मॉडल को ऐप्लिकेशन के साथ बंडल करके, यह पक्का किया जा सकता है कि Firebase पर होस्ट किया गया मॉडल उपलब्ध न होने पर भी, आपके ऐप्लिकेशन की एमएल सुविधाएं काम करती रहें.
Firebase पर होस्ट किए गए मॉडल सोर्स को कॉन्फ़िगर करना
रिमोट तौर पर होस्ट किए गए मॉडल का इस्तेमाल करने के लिए, FirebaseAutoMLRemoteModel
ऑब्जेक्ट बनाएं. इसमें, मॉडल को पब्लिश करते समय असाइन किया गया नाम डालें:
// Specify the name you assigned in the Firebase console.
FirebaseAutoMLRemoteModel remoteModel =
new FirebaseAutoMLRemoteModel.Builder("your_remote_model").build();
// Specify the name you assigned in the Firebase console.
val remoteModel = FirebaseAutoMLRemoteModel.Builder("your_remote_model").build()
इसके बाद, मॉडल डाउनलोड करने का टास्क शुरू करें. साथ ही, उन शर्तों के बारे में बताएं जिनके तहत आपको डाउनलोड करने की अनुमति देनी है. अगर मॉडल डिवाइस पर मौजूद नहीं है या मॉडल का नया वर्शन उपलब्ध है, तो टास्क, Firebase से मॉडल को असिंक्रोनस तरीके से डाउनलोड करेगा:
FirebaseModelDownloadConditions conditions = new FirebaseModelDownloadConditions.Builder()
.requireWifi()
.build();
FirebaseModelManager.getInstance().download(remoteModel, conditions)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
// Success.
}
});
val conditions = FirebaseModelDownloadConditions.Builder()
.requireWifi()
.build()
FirebaseModelManager.getInstance().download(remoteModel, conditions)
.addOnCompleteListener {
// Success.
}
कई ऐप्लिकेशन, अपने शुरुआती कोड में डाउनलोड करने का टास्क शुरू करते हैं. हालांकि, मॉडल का इस्तेमाल करने से पहले, आपके पास किसी भी समय ऐसा करने का विकल्प होता है.
लोकल मॉडल सोर्स कॉन्फ़िगर करना
अपने ऐप्लिकेशन के साथ मॉडल को बंडल करने के लिए:
- Firebase कंसोल से डाउनलोड किए गए ज़िप संग्रह से, मॉडल और उसके मेटाडेटा को निकालें. हमारा सुझाव है कि आप फ़ाइलों को वैसे ही इस्तेमाल करें जैसे आपने उन्हें डाउनलोड किया है.
-
अपने ऐप्लिकेशन पैकेज में अपना मॉडल और उसकी मेटाडेटा फ़ाइलें शामिल करें:
- अगर आपके प्रोजेक्ट में एसेट फ़ोल्डर नहीं है, तो एक फ़ोल्डर बनाएं. इसके लिए,
app/
फ़ोल्डर पर राइट क्लिक करें. इसके बाद, नया > फ़ोल्डर > एसेट फ़ोल्डर पर क्लिक करें. - मॉडल फ़ाइलों को शामिल करने के लिए, एसेट फ़ोल्डर में एक सब-फ़ोल्डर बनाएं.
- फ़ाइलों
model.tflite
,dict.txt
, औरmanifest.json
को सब-फ़ोल्डर में कॉपी करें. यह ज़रूरी है कि तीनों फ़ाइलें एक ही फ़ोल्डर में हों.
- अगर आपके प्रोजेक्ट में एसेट फ़ोल्डर नहीं है, तो एक फ़ोल्डर बनाएं. इसके लिए,
- अपने ऐप्लिकेशन की
build.gradle
फ़ाइल में यह जानकारी जोड़ें, ताकि यह पक्का किया जा सके कि ऐप्लिकेशन बनाते समय, Gradle मॉडल फ़ाइल को कंप्रेस न करे: मॉडल फ़ाइल को ऐप्लिकेशन पैकेज में शामिल किया जाएगा. साथ ही, यह ML Kit के लिए रॉ ऐसेट के तौर पर उपलब्ध होगी.android { // ... aaptOptions { noCompress "tflite" } }
- मॉडल मेनिफ़ेस्ट फ़ाइल के पाथ की जानकारी देने वाला
FirebaseAutoMLLocalModel
ऑब्जेक्ट बनाएं:FirebaseAutoMLLocalModel localModel = new FirebaseAutoMLLocalModel.Builder() .setAssetFilePath("manifest.json") .build();
val localModel = FirebaseAutoMLLocalModel.Builder() .setAssetFilePath("manifest.json") .build()
अपने मॉडल से इमेज लेबल करने वाला टूल बनाना
अपने मॉडल सोर्स कॉन्फ़िगर करने के बाद, उनमें से किसी एक से FirebaseVisionImageLabeler
ऑब्जेक्ट बनाएं.
अगर आपके पास सिर्फ़ स्थानीय तौर पर बंडल किया गया मॉडल है, तो अपने FirebaseAutoMLLocalModel
ऑब्जेक्ट से लेबलर बनाएं और भरोसे के उस स्कोर के थ्रेशोल्ड को कॉन्फ़िगर करें जिसकी आपको ज़रूरत है (अपने मॉडल का आकलन करें देखें):
FirebaseVisionImageLabeler labeler;
try {
FirebaseVisionOnDeviceAutoMLImageLabelerOptions options =
new FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(localModel)
.setConfidenceThreshold(0.0f) // Evaluate your model in the Firebase console
// to determine an appropriate value.
.build();
labeler = FirebaseVision.getInstance().getOnDeviceAutoMLImageLabeler(options);
} catch (FirebaseMLException e) {
// ...
}
val options = FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(localModel)
.setConfidenceThreshold(0) // Evaluate your model in the Firebase console
// to determine an appropriate value.
.build()
val labeler = FirebaseVision.getInstance().getOnDeviceAutoMLImageLabeler(options)
अगर आपके पास किसी दूसरे डिवाइस पर होस्ट किया गया मॉडल है, तो उसे चलाने से पहले आपको यह देखना होगा कि वह डाउनलोड हो गया है या नहीं. मॉडल मैनेजर के isModelDownloaded()
तरीके का इस्तेमाल करके, मॉडल डाउनलोड करने के टास्क की स्थिति देखी जा सकती है.
लेबलर को चलाने से पहले ही इसकी पुष्टि कर ली जा सकती है. हालांकि, अगर आपके पास रिमोट से होस्ट किया गया मॉडल और स्थानीय तौर पर बंडल किया गया मॉडल, दोनों मौजूद हैं, तो इमेज लेबलर को इंस्टैंशिएट करते समय यह जांच करना सही रहेगा: अगर रिमोट मॉडल डाउनलोड किया गया है, तो उससे लेबलर बनाएं. अगर नहीं, तो स्थानीय मॉडल से बनाएं.
FirebaseModelManager.getInstance().isModelDownloaded(remoteModel)
.addOnSuccessListener(new OnSuccessListener<Boolean>() {
@Override
public void onSuccess(Boolean isDownloaded) {
FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder optionsBuilder;
if (isDownloaded) {
optionsBuilder = new FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(remoteModel);
} else {
optionsBuilder = new FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(localModel);
}
FirebaseVisionOnDeviceAutoMLImageLabelerOptions options = optionsBuilder
.setConfidenceThreshold(0.0f) // Evaluate your model in the Firebase console
// to determine an appropriate threshold.
.build();
FirebaseVisionImageLabeler labeler;
try {
labeler = FirebaseVision.getInstance().getOnDeviceAutoMLImageLabeler(options);
} catch (FirebaseMLException e) {
// Error.
}
}
});
FirebaseModelManager.getInstance().isModelDownloaded(remoteModel)
.addOnSuccessListener { isDownloaded ->
val optionsBuilder =
if (isDownloaded) {
FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(remoteModel)
} else {
FirebaseVisionOnDeviceAutoMLImageLabelerOptions.Builder(localModel)
}
// Evaluate your model in the Firebase console to determine an appropriate threshold.
val options = optionsBuilder.setConfidenceThreshold(0.0f).build()
val labeler = FirebaseVision.getInstance().getOnDeviceAutoMLImageLabeler(options)
}
अगर आपके पास सिर्फ़ रिमोटली होस्ट किया गया मॉडल है, तो आपको मॉडल से जुड़ी सुविधाओं को बंद कर देना चाहिए. उदाहरण के लिए, अपने यूज़र इंटरफ़ेस (यूआई) के कुछ हिस्से को धूसर कर दें या छिपा दें. ऐसा तब तक करें, जब तक मॉडल डाउनलोड होने की पुष्टि न हो जाए. ऐसा करने के लिए, मॉडल मैनेजर के download()
तरीके में एक लिसनर अटैच करें:
FirebaseModelManager.getInstance().download(remoteModel, conditions)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void v) {
// Download complete. Depending on your app, you could enable
// the ML feature, or switch from the local model to the remote
// model, etc.
}
});
FirebaseModelManager.getInstance().download(remoteModel, conditions)
.addOnCompleteListener {
// Download complete. Depending on your app, you could enable the ML
// feature, or switch from the local model to the remote model, etc.
}
2. इनपुट इमेज तैयार करना
इसके बाद, आपको जिस इमेज को लेबल करना है उसके लिए, इस सेक्शन में बताए गए किसी विकल्प का इस्तेमाल करके एक FirebaseVisionImage
ऑब्जेक्ट बनाएं. इसके बाद, उसे FirebaseVisionImageLabeler
के किसी इंस्टेंस (अगले सेक्शन में बताया गया है) को पास करें.
media.Image
ऑब्जेक्ट, डिवाइस पर मौजूद फ़ाइल, बाइट कलेक्शन या Bitmap
ऑब्जेक्ट से FirebaseVisionImage
ऑब्जेक्ट बनाया जा सकता है:
-
media.Image
ऑब्जेक्ट सेFirebaseVisionImage
ऑब्जेक्ट बनाने के लिए,media.Image
ऑब्जेक्ट और इमेज के रोटेशन कोFirebaseVisionImage.fromMediaImage()
में पास करें. जैसे, डिवाइस के कैमरे से इमेज कैप्चर करते समय.अगर CameraX लाइब्रेरी का इस्तेमाल किया जाता है, तो
OnImageCapturedListener
औरImageAnalysis.Analyzer
क्लास आपके लिए रोटेशन वैल्यू का हिसाब लगाती हैं. इसलिए,FirebaseVisionImage.fromMediaImage()
को कॉल करने से पहले, आपको रोटेशन को ML Kit केROTATION_
कॉन्स्टेंट में बदलना होगा:private class YourAnalyzer implements ImageAnalysis.Analyzer { private int degreesToFirebaseRotation(int degrees) { switch (degrees) { case 0: return FirebaseVisionImageMetadata.ROTATION_0; case 90: return FirebaseVisionImageMetadata.ROTATION_90; case 180: return FirebaseVisionImageMetadata.ROTATION_180; case 270: return FirebaseVisionImageMetadata.ROTATION_270; default: throw new IllegalArgumentException( "Rotation must be 0, 90, 180, or 270."); } } @Override public void analyze(ImageProxy imageProxy, int degrees) { if (imageProxy == null || imageProxy.getImage() == null) { return; } Image mediaImage = imageProxy.getImage(); int rotation = degreesToFirebaseRotation(degrees); FirebaseVisionImage image = FirebaseVisionImage.fromMediaImage(mediaImage, rotation); // Pass image to an ML Kit Vision API // ... } }
private class YourImageAnalyzer : ImageAnalysis.Analyzer { private fun degreesToFirebaseRotation(degrees: Int): Int = when(degrees) { 0 -> FirebaseVisionImageMetadata.ROTATION_0 90 -> FirebaseVisionImageMetadata.ROTATION_90 180 -> FirebaseVisionImageMetadata.ROTATION_180 270 -> FirebaseVisionImageMetadata.ROTATION_270 else -> throw Exception("Rotation must be 0, 90, 180, or 270.") } override fun analyze(imageProxy: ImageProxy?, degrees: Int) { val mediaImage = imageProxy?.image val imageRotation = degreesToFirebaseRotation(degrees) if (mediaImage != null) { val image = FirebaseVisionImage.fromMediaImage(mediaImage, imageRotation) // Pass image to an ML Kit Vision API // ... } } }
अगर आपने ऐसी कैमरा लाइब्रेरी का इस्तेमाल नहीं किया है जो इमेज के रोटेशन की जानकारी देती है, तो डिवाइस के रोटेशन और डिवाइस में मौजूद कैमरा सेंसर के ओरिएंटेशन से इसका हिसाब लगाया जा सकता है:
private static final SparseIntArray ORIENTATIONS = new SparseIntArray(); static { ORIENTATIONS.append(Surface.ROTATION_0, 90); ORIENTATIONS.append(Surface.ROTATION_90, 0); ORIENTATIONS.append(Surface.ROTATION_180, 270); ORIENTATIONS.append(Surface.ROTATION_270, 180); } /** * Get the angle by which an image must be rotated given the device's current * orientation. */ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private int getRotationCompensation(String cameraId, Activity activity, Context context) throws CameraAccessException { // Get the device's current rotation relative to its "native" orientation. // Then, from the ORIENTATIONS table, look up the angle the image must be // rotated to compensate for the device's rotation. int deviceRotation = activity.getWindowManager().getDefaultDisplay().getRotation(); int rotationCompensation = ORIENTATIONS.get(deviceRotation); // On most devices, the sensor orientation is 90 degrees, but for some // devices it is 270 degrees. For devices with a sensor orientation of // 270, rotate the image an additional 180 ((270 + 270) % 360) degrees. CameraManager cameraManager = (CameraManager) context.getSystemService(CAMERA_SERVICE); int sensorOrientation = cameraManager .getCameraCharacteristics(cameraId) .get(CameraCharacteristics.SENSOR_ORIENTATION); rotationCompensation = (rotationCompensation + sensorOrientation + 270) % 360; // Return the corresponding FirebaseVisionImageMetadata rotation value. int result; switch (rotationCompensation) { case 0: result = FirebaseVisionImageMetadata.ROTATION_0; break; case 90: result = FirebaseVisionImageMetadata.ROTATION_90; break; case 180: result = FirebaseVisionImageMetadata.ROTATION_180; break; case 270: result = FirebaseVisionImageMetadata.ROTATION_270; break; default: result = FirebaseVisionImageMetadata.ROTATION_0; Log.e(TAG, "Bad rotation value: " + rotationCompensation); } return result; }
private val ORIENTATIONS = SparseIntArray() init { ORIENTATIONS.append(Surface.ROTATION_0, 90) ORIENTATIONS.append(Surface.ROTATION_90, 0) ORIENTATIONS.append(Surface.ROTATION_180, 270) ORIENTATIONS.append(Surface.ROTATION_270, 180) } /** * Get the angle by which an image must be rotated given the device's current * orientation. */ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Throws(CameraAccessException::class) private fun getRotationCompensation(cameraId: String, activity: Activity, context: Context): Int { // Get the device's current rotation relative to its "native" orientation. // Then, from the ORIENTATIONS table, look up the angle the image must be // rotated to compensate for the device's rotation. val deviceRotation = activity.windowManager.defaultDisplay.rotation var rotationCompensation = ORIENTATIONS.get(deviceRotation) // On most devices, the sensor orientation is 90 degrees, but for some // devices it is 270 degrees. For devices with a sensor orientation of // 270, rotate the image an additional 180 ((270 + 270) % 360) degrees. val cameraManager = context.getSystemService(CAMERA_SERVICE) as CameraManager val sensorOrientation = cameraManager .getCameraCharacteristics(cameraId) .get(CameraCharacteristics.SENSOR_ORIENTATION)!! rotationCompensation = (rotationCompensation + sensorOrientation + 270) % 360 // Return the corresponding FirebaseVisionImageMetadata rotation value. val result: Int when (rotationCompensation) { 0 -> result = FirebaseVisionImageMetadata.ROTATION_0 90 -> result = FirebaseVisionImageMetadata.ROTATION_90 180 -> result = FirebaseVisionImageMetadata.ROTATION_180 270 -> result = FirebaseVisionImageMetadata.ROTATION_270 else -> { result = FirebaseVisionImageMetadata.ROTATION_0 Log.e(TAG, "Bad rotation value: $rotationCompensation") } } return result }
इसके बाद,
media.Image
ऑब्जेक्ट औरFirebaseVisionImage.fromMediaImage()
में रोटेशन की वैल्यू पास करें:FirebaseVisionImage image = FirebaseVisionImage.fromMediaImage(mediaImage, rotation);
val image = FirebaseVisionImage.fromMediaImage(mediaImage, rotation)
- फ़ाइल यूआरआई से
FirebaseVisionImage
ऑब्जेक्ट बनाने के लिए, ऐप्लिकेशन कॉन्टेक्स्ट और फ़ाइल यूआरआई कोFirebaseVisionImage.fromFilePath()
में पास करें. यह तब काम आता है, जब उपयोगकर्ता को अपने गैलरी ऐप्लिकेशन से कोई इमेज चुनने के लिए कहने के लिए,ACTION_GET_CONTENT
इंटेंट का इस्तेमाल किया जाता है.FirebaseVisionImage image; try { image = FirebaseVisionImage.fromFilePath(context, uri); } catch (IOException e) { e.printStackTrace(); }
val image: FirebaseVisionImage try { image = FirebaseVisionImage.fromFilePath(context, uri) } catch (e: IOException) { e.printStackTrace() }
ByteBuffer
या बाइट कलेक्शन सेFirebaseVisionImage
ऑब्जेक्ट बनाने के लिए, सबसे पहलेmedia.Image
इनपुट के लिए ऊपर बताए गए तरीके से इमेज के रोटेशन का हिसाब लगाएं.इसके बाद, एक
FirebaseVisionImageMetadata
ऑब्जेक्ट बनाएं, जिसमें इमेज की ऊंचाई, चौड़ाई, रंग कोडिंग फ़ॉर्मैट, और घुमाव की जानकारी हो:FirebaseVisionImageMetadata metadata = new FirebaseVisionImageMetadata.Builder() .setWidth(480) // 480x360 is typically sufficient for .setHeight(360) // image recognition .setFormat(FirebaseVisionImageMetadata.IMAGE_FORMAT_NV21) .setRotation(rotation) .build();
val metadata = FirebaseVisionImageMetadata.Builder() .setWidth(480) // 480x360 is typically sufficient for .setHeight(360) // image recognition .setFormat(FirebaseVisionImageMetadata.IMAGE_FORMAT_NV21) .setRotation(rotation) .build()
FirebaseVisionImage
ऑब्जेक्ट बनाने के लिए, बफ़र या कलेक्शन और मेटाडेटा ऑब्जेक्ट का इस्तेमाल करें:FirebaseVisionImage image = FirebaseVisionImage.fromByteBuffer(buffer, metadata); // Or: FirebaseVisionImage image = FirebaseVisionImage.fromByteArray(byteArray, metadata);
val image = FirebaseVisionImage.fromByteBuffer(buffer, metadata) // Or: val image = FirebaseVisionImage.fromByteArray(byteArray, metadata)
Bitmap
ऑब्जेक्ट सेFirebaseVisionImage
ऑब्जेक्ट बनाने के लिए:FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
val image = FirebaseVisionImage.fromBitmap(bitmap)
Bitmap
ऑब्जेक्ट से दिखाई गई इमेज, सीधी होनी चाहिए. इसे किसी और दिशा में घुमाने की ज़रूरत नहीं है.
3. इमेज लेबलर को चलाना
किसी इमेज में ऑब्जेक्ट लेबल करने के लिए, FirebaseVisionImage
ऑब्जेक्ट को FirebaseVisionImageLabeler
के processImage()
तरीके में पास करें.
labeler.processImage(image)
.addOnSuccessListener(new OnSuccessListener<List<FirebaseVisionImageLabel>>() {
@Override
public void onSuccess(List<FirebaseVisionImageLabel> labels) {
// Task completed successfully
// ...
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Task failed with an exception
// ...
}
});
labeler.processImage(image)
.addOnSuccessListener { labels ->
// Task completed successfully
// ...
}
.addOnFailureListener { e ->
// Task failed with an exception
// ...
}
अगर इमेज लेबल हो जाती है, तो सक्सेस ऑब्जेक्ट को FirebaseVisionImageLabel
ऑब्जेक्ट के कलेक्शन में पास कर दिया जाएगा. हर ऑब्जेक्ट से, इमेज में पहचानी गई किसी सुविधा के बारे में जानकारी मिल सकती है.
उदाहरण के लिए:
for (FirebaseVisionImageLabel label: labels) {
String text = label.getText();
float confidence = label.getConfidence();
}
for (label in labels) {
val text = label.text
val confidence = label.confidence
}
रीयल-टाइम परफ़ॉर्मेंस को बेहतर बनाने के लिए सलाह
- डिटेक्टर को कॉल को कम करता है. अगर डिटेक्टर चालू होने के दौरान कोई नया वीडियो फ़्रेम उपलब्ध हो जाता है, तो फ़्रेम को छोड़ दें.
- अगर इनपुट इमेज पर ग्राफ़िक ओवरले करने के लिए, डिटेक्टर के आउटपुट का इस्तेमाल किया जा रहा है, तो सबसे पहले ML Kit से नतीजा पाएं. इसके बाद, एक ही चरण में इमेज को रेंडर करें और ओवरले करें. ऐसा करने पर, हर इनपुट फ़्रेम के लिए डिसप्ले प्लैटफ़ॉर्म पर सिर्फ़ एक बार रेंडर किया जाता है.
-
अगर Camera2 API का इस्तेमाल किया जा रहा है, तो इमेज को
ImageFormat.YUV_420_888
फ़ॉर्मैट में कैप्चर करें.अगर पुराने Camera API का इस्तेमाल किया जा रहा है, तो इमेज को
ImageFormat.NV21
फ़ॉर्मैट में कैप्चर करें.