বারকোড শনাক্ত ও ডিকোড করার জন্য আপনি ML Kit ব্যবহার করতে পারবেন।
| ফিচার | আনবান্ডেল করা হয়েছে | একত্রিত |
|---|---|---|
| প্রয়োগ | Google Play পরিষেবার মাধ্যমে মডেল ডায়নামিক ডাউনলোড করা হয়। | বিল্ড করার সময় মডেলটি আপনার অ্যাপের সাথে স্ট্যাটিক লিঙ্ক করা হয়। |
| অ্যাপ সাইজ | সাইজ প্রায় ২০০ কেবি বেড়ে যায়। | সাইজ প্রায় ২.৪ এমবি বেড়ে যায়। |
| ইনিশিয়ালাইজ করার সময় | প্রথমবার ব্যবহার করার আগে মডেল ডাউনলোড করার জন্য অপেক্ষা করতে হতে পারে। | মডেলটি সঙ্গে সঙ্গে উপলভ্য হয়ে যাবে। |
এটি ব্যবহার করে দেখুন
- এই API-এর ব্যবহার সংক্রান্ত উদাহরণ দেখতে, স্যাম্পেল অ্যাপ নিয়ে কাজ করুন।
- এই API-এর এন্ড-টু-এন্ড প্রয়োগের জন্য Material Design শোকেস অ্যাপ দেখুন।
শুরু করার আগে
আপনার প্রোজেক্ট-লেভেল
build.gradleফাইলে,buildscriptএবংallprojects, দুটি বিভাগেই Google-এর Maven রিপোজিটরি অন্তর্ভুক্ত করতে ভুলবেন না।আপনার মডিউলের অ্যাপ-লেভেল গ্রেডেল ফাইলে ML Kit Android লাইব্রেরির জন্য ডিপেন্ডেন্সি যোগ করুন, যা সাধারণত
app/build.gradleহয়। আপনার প্রয়োজন অনুযায়ী নিম্নলিখিত নির্ভরতাগুলির মধ্যে একটি বেছে নিন:আপনার অ্যাপের সাথে মডেল বান্ডেল করতে:
dependencies { // ... // Use this dependency to bundle the model with your app implementation 'com.google.mlkit:barcode-scanning:17.3.0' }Google Play পরিষেবায় মডেল ব্যবহার করার জন্য:
dependencies { // ... // Use this dependency to use the dynamically downloaded model in Google Play Services implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.1' }আপনি যদি Google Play Services-এ মডেলটি ব্যবহার করার সিদ্ধান্ত নেন, তাহলে Play Store থেকে আপনার অ্যাপ ইনস্টল করার পরে ডিভাইসে মডেলটি অটোমেটিক ডাউনলোড করার জন্য আপনার অ্যাপ কনফিগার করতে পারেন। এটি করতে, আপনার অ্যাপের
AndroidManifest.xmlফাইলে নিচের ঘোষণা যোগ করুন:<application ...> ... <meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="barcode" > <!-- To use multiple models: android:value="barcode,model2,model3" --> </application>এছাড়াও, আপনি Google Play পরিষেবা ModuleInstallClient API-এর মাধ্যমে মডেলের উপলভ্যতা স্পষ্টভাবে চেক করতে এবং ডাউনলোড করার অনুরোধ করতে পারবেন।
আপনি ইনস্টল-টাইম মডেল ডাউনলোড চালু না করলে বা এক্সপ্লিসিট ডাউনলোডের অনুরোধ না করলে, প্রথমবার স্ক্যানার চালানোর সময় মডেলটি ডাউনলোড করা হয়। ডাউনলোড সম্পূর্ণ হওয়ার আগে আপনি যে অনুরোধ করেন তার কোনও ফলাফল পাওয়া যায় না।
ইনপুট ছবি সংক্রান্ত নির্দেশিকা
-
ML Kit যাতে সঠিকভাবে বারকোড পড়তে পারে, তার জন্য ইনপুট ছবিতে অবশ্যই পর্যাপ্ত পিক্সেল ডেটা দ্বারা উপস্থাপিত বারকোড থাকতে হবে।
নির্দিষ্ট পিক্সেল ডেটা সংক্রান্ত প্রয়োজনীয়তা বারকোডের ধরন এবং সেটিতে এনকোড করা ডেটার পরিমাণের উপর নির্ভর করে, কারণ অনেক বারকোড পরিবর্তনযোগ্য সাইজের পে-লোড সাপোর্ট করে। সাধারণত, বারকোডের সবচেয়ে ছোট অর্থপূর্ণ ইউনিট অন্তত ২ পিক্সেল চওড়া হতে হবে এবং ২-ডাইমেনশনাল কোডের ক্ষেত্রে ২ পিক্সেল লম্বা হতে হবে।
যেমন, EAN-13 বারকোড, ১, ২, ৩ বা ৪ ইউনিট চওড়া বার ও স্পেস দিয়ে তৈরি হয়, তাই EAN-13 বারকোড ইমেজে আদর্শভাবে এমন বার ও স্পেস থাকে যেগুলি কমপক্ষে ২, ৪, ৬ ও ৮ পিক্সেল চওড়া হয়। EAN-13 বারকোড মোট ৯৫ ইউনিট চওড়া হয়, তাই বারকোডটি কমপক্ষে ১৯০ পিক্সেল চওড়া হতে হবে।
PDF417-এর মতো ঘন ফর্ম্যাটের ক্ষেত্রে, ML Kit যাতে নির্ভরযোগ্যভাবে সেগুলি পড়তে পারে তার জন্য আরও বেশি পিক্সেল ডাইমেনশন প্রয়োজন। যেমন, একটি PDF417 কোডে একটি সারিতে সর্বাধিক ৩৪টি ১৭-ইউনিট চওড়া "শব্দ" থাকতে পারে, যা আদর্শভাবে কমপক্ষে ১১৫৬ পিক্সেল চওড়া হবে।
-
ছবির ফোকাস খারাপ হলে স্ক্যানিংয়ের নির্ভুলতা প্রভাবিত হতে পারে। আপনার অ্যাপ গ্রহণযোগ্য ফলাফল না পেলে, ব্যবহারকারীকে আবার ছবি তুলতে বলুন।
-
সাধারণ অ্যাপ্লিকেশনের জন্য, আরও বেশি রেজোলিউশনের ছবি প্রদান করার সাজেশন দেওয়া হয়, যেমন ১২৮০x৭২০ বা ১৯২০x১০৮০, যা ক্যামেরা থেকে আরও বেশি দূরত্ব থেকে বারকোড স্ক্যান করার সুবিধা প্রদান করে।
তবে, যেসব অ্যাপ্লিকেশনে লেটেন্সি গুরুত্বপূর্ণ, সেখানে আপনি কম রেজোলিউশনে ছবি ক্যাপচার করে পারফর্ম্যান্স উন্নত করতে পারেন, তবে বারকোডটি যেন ইনপুট ছবির বেশিরভাগ অংশ জুড়ে থাকে। এছাড়াও, রিয়েল-টাইম পারফর্ম্যান্স উন্নত করার পরামর্শ দেখুন।
১. বারকোড স্ক্যানার কনফিগার করা
আপনি যদি জানেন যে কোন বারকোড ফর্ম্যাট পড়তে হবে, তাহলে আপনি শুধুমাত্র সেই ফর্ম্যাটগুলি শনাক্ত করার জন্য এটি কনফিগার করে বারকোড ডিটেক্টরের স্পিড উন্নত করতে পারবেন।যেমন, শুধুমাত্র Aztec কোড ও QR কোড শনাক্ত করতে, নিম্নলিখিত উদাহরণে দেখানো
BarcodeScannerOptions অবজেক্ট তৈরি করুন:
Kotlin
val options = BarcodeScannerOptions.Builder() .setBarcodeFormats( Barcode.FORMAT_QR_CODE, Barcode.FORMAT_AZTEC) .build()
Java
BarcodeScannerOptions options = new BarcodeScannerOptions.Builder() .setBarcodeFormats( Barcode.FORMAT_QR_CODE, Barcode.FORMAT_AZTEC) .build();
নিম্নলিখিত ফর্ম্যাট কাজ করে:
- Code 128 (
FORMAT_CODE_128) - Code 39 (
FORMAT_CODE_39) - কোড ৯৩ (
FORMAT_CODE_93) - Codabar (
FORMAT_CODABAR) - EAN-13 (
FORMAT_EAN_13) - EAN-8 (
FORMAT_EAN_8) - ITF (
FORMAT_ITF) - UPC-A (
FORMAT_UPC_A) - UPC-E (
FORMAT_UPC_E) - QR কোড (
FORMAT_QR_CODE) - PDF417 (
FORMAT_PDF417) - Aztec (
FORMAT_AZTEC) - Data Matrix (
FORMAT_DATA_MATRIX)
বান্ডেল করা মডেল 17.1.0 এবং আনবান্ডেল করা মডেল 18.2.0 থেকে শুরু করে, আপনি
enableAllPotentialBarcodes() কল করতে পারেন যাতে সব সম্ভাব্য বারকোড ফেরত পাওয়া যায়, এমনকি সেগুলি
ডিকোড করা না গেলেও। এটি আরও শনাক্তকরণের জন্য ব্যবহার করা যেতে পারে, যেমন
ফিরে আসা বাউন্ডিং বক্সে থাকা কোনও বারকোডের আরও স্পষ্ট ছবি পেতে
ক্যামেরা জুম-ইন করে।
Kotlin
val options = BarcodeScannerOptions.Builder() .setBarcodeFormats(...) .enableAllPotentialBarcodes() // Optional .build()
Java
BarcodeScannerOptions options = new BarcodeScannerOptions.Builder() .setBarcodeFormats(...) .enableAllPotentialBarcodes() // Optional .build();
Further on, starting from bundled library 17.2.0 and unbundled library 18.3.0, a new feature called auto-zoom has been introduced to further enhance the barcode scanning experience. With this feature enabled, the app is notified when all barcodes within the view are too distant for decoding. As a result, the app can effortlessly adjust the camera's zoom ratio to the recommended setting provided by the library, ensuring optimal focus and readability. This feature will significantly enhance the accuracy and success rate of barcode scanning, making it easier for apps to capture information precisely.
To enable auto-zooming and customize the experience, you can utilize the
setZoomSuggestionOptions() method along with your
own ZoomCallback handler and desired maximum zoom
ratio, as demonstrated in the code below.
Kotlin
val options = BarcodeScannerOptions.Builder() .setBarcodeFormats(...) .setZoomSuggestionOptions( new ZoomSuggestionOptions.Builder(zoomCallback) .setMaxSupportedZoomRatio(maxSupportedZoomRatio) .build()) // Optional .build()
Java
BarcodeScannerOptions options = new BarcodeScannerOptions.Builder() .setBarcodeFormats(...) .setZoomSuggestionOptions( new ZoomSuggestionOptions.Builder(zoomCallback) .setMaxSupportedZoomRatio(maxSupportedZoomRatio) .build()) // Optional .build();
zoomCallback is required to be provided to handle whenever the library
suggests a zoom should be performed and this callback will always be called on
the main thread.
The following code snippet shows an example of defining a simple callback.
Kotlin
fun setZoom(ZoomRatio: Float): Boolean { if (camera.isClosed()) return false camera.getCameraControl().setZoomRatio(zoomRatio) return true }
Java
boolean setZoom(float zoomRatio) { if (camera.isClosed()) { return false; } camera.getCameraControl().setZoomRatio(zoomRatio); return true; }
maxSupportedZoomRatio is related to the camera hardware, and different camera
libraries have different ways to fetch it (see the javadoc of the setter
method). In case this is not provided, an
unbounded zoom ratio might be produced by the library which might not be
supported. Refer to the
setMaxSupportedZoomRatio() method
introduction to see how to get the max supported zoom ratio with different
Camera libraries.
When auto-zooming is enabled and no barcodes are successfully decoded within
the view, BarcodeScanner triggers your zoomCallback with the requested
zoomRatio. If the callback correctly adjusts the camera to this zoomRatio,
it is highly probable that the most centered potential barcode will be decoded
and returned.
A barcode may remain undecodable even after a successful zoom-in. In such cases,
BarcodeScanner may either invoke the callback for another round of zoom-in
until the maxSupportedZoomRatio is reached, or provide an empty list (or a
list containing potential barcodes that were not decoded, if
enableAllPotentialBarcodes() was called) to the OnSuccessListener (which
will be defined in step 4. Process the image).
2. Prepare the input image
To recognize barcodes in an image, create anInputImage object
from either a Bitmap, media.Image, ByteBuffer, byte array, or a file on
the device. Then, pass the InputImage object to the
BarcodeScanner's process method.
You can create an InputImage
object from different sources, each is explained below.
Using a media.Image
To create an InputImage
object from a media.Image object, such as when you capture an image from a
device's camera, pass the media.Image object and the image's
rotation to InputImage.fromMediaImage().
If you use the
CameraX library, the OnImageCapturedListener and
ImageAnalysis.Analyzer classes calculate the rotation value
for you.
Kotlin
private class YourImageAnalyzer : ImageAnalysis.Analyzer { override fun analyze(imageProxy: ImageProxy) { val mediaImage = imageProxy.image if (mediaImage != null) { val image = InputImage.fromMediaImage(mediaImage, imageProxy.imageInfo.rotationDegrees) // Pass image to an ML Kit Vision API // ... } } }
Java
private class YourAnalyzer implements ImageAnalysis.Analyzer { @Override public void analyze(ImageProxy imageProxy) { Image mediaImage = imageProxy.getImage(); if (mediaImage != null) { InputImage image = InputImage.fromMediaImage(mediaImage, imageProxy.getImageInfo().getRotationDegrees()); // Pass image to an ML Kit Vision API // ... } } }
আপনি যদি এমন কোনও ক্যামেরা লাইব্রেরি ব্যবহার না করেন যা আপনাকে ছবির ঘূর্ণনের ডিগ্রি দেয়, তাহলে আপনি ডিভাইসের ঘূর্ণনের ডিগ্রি এবং ডিভাইসে ক্যামেরা সেন্সরের ওরিয়েন্টেশন থেকে এটি গণনা করতে পারেন:
Kotlin
private val ORIENTATIONS = SparseIntArray() init { ORIENTATIONS.append(Surface.ROTATION_0, 0) ORIENTATIONS.append(Surface.ROTATION_90, 90) ORIENTATIONS.append(Surface.ROTATION_180, 180) ORIENTATIONS.append(Surface.ROTATION_270, 270) } /** * 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, isFrontFacing: Boolean): 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) // Get the device's sensor orientation. val cameraManager = activity.getSystemService(CAMERA_SERVICE) as CameraManager val sensorOrientation = cameraManager .getCameraCharacteristics(cameraId) .get(CameraCharacteristics.SENSOR_ORIENTATION)!! if (isFrontFacing) { rotationCompensation = (sensorOrientation + rotationCompensation) % 360 } else { // back-facing rotationCompensation = (sensorOrientation - rotationCompensation + 360) % 360 } return rotationCompensation }
Java
private static final SparseIntArray ORIENTATIONS = new SparseIntArray(); static { ORIENTATIONS.append(Surface.ROTATION_0, 0); ORIENTATIONS.append(Surface.ROTATION_90, 90); ORIENTATIONS.append(Surface.ROTATION_180, 180); ORIENTATIONS.append(Surface.ROTATION_270, 270); } /** * 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, boolean isFrontFacing) 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); // Get the device's sensor orientation. CameraManager cameraManager = (CameraManager) activity.getSystemService(CAMERA_SERVICE); int sensorOrientation = cameraManager .getCameraCharacteristics(cameraId) .get(CameraCharacteristics.SENSOR_ORIENTATION); if (isFrontFacing) { rotationCompensation = (sensorOrientation + rotationCompensation) % 360; } else { // back-facing rotationCompensation = (sensorOrientation - rotationCompensation + 360) % 360; } return rotationCompensation; }
তারপরে, media.Image অবজেক্ট এবং
InputImage.fromMediaImage()-এ রোটেশন ডিগ্রি ভ্যালু পাস করুন:
Kotlin
val image = InputImage.fromMediaImage(mediaImage, rotation)
Java
InputImage image = InputImage.fromMediaImage(mediaImage, rotation);
ফাইল URI ব্যবহার করে
ফাইল URI থেকে InputImage
অবজেক্ট তৈরি করতে, অ্যাপ কনটেক্সট ও ফাইল URI-কে
InputImage.fromFilePath()-এ পাস করুন। এটি তখন কাজে লাগে যখন আপনি
ACTION_GET_CONTENT ইনটেন্ট ব্যবহার করে ব্যবহারকারীকে তার গ্যালারি অ্যাপ থেকে
কোনও ছবি বেছে নেওয়ার জন্য প্রম্পট করেন।
Kotlin
val image: InputImage try { image = InputImage.fromFilePath(context, uri) } catch (e: IOException) { e.printStackTrace() }
Java
InputImage image; try { image = InputImage.fromFilePath(context, uri); } catch (IOException e) { e.printStackTrace(); }
ByteBuffer বা ByteArray ব্যবহার করে
ByteBuffer বা ByteArray থেকে InputImage
অবজেক্ট তৈরি করতে, প্রথমে media.Image ইনপুটের জন্য আগে বর্ণনা করা পদ্ধতি অনুযায়ী ছবির
রোটেশন ডিগ্রি গণনা করুন।
তারপর, বাফার বা অ্যারে সহ InputImage অবজেক্ট তৈরি করুন, এর সাথে ছবির
উচ্চতা, প্রস্থ, কালার এনকোডিং ফর্ম্যাট এবং রোটেশন ডিগ্রি যোগ করুন:
Kotlin
val image = InputImage.fromByteBuffer( byteBuffer, /* image width */ 480, /* image height */ 360, rotationDegrees, InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12 ) // Or: val image = InputImage.fromByteArray( byteArray, /* image width */ 480, /* image height */ 360, rotationDegrees, InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12 )
Java
InputImage image = InputImage.fromByteBuffer(byteBuffer, /* image width */ 480, /* image height */ 360, rotationDegrees, InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12 ); // Or: InputImage image = InputImage.fromByteArray( byteArray, /* image width */480, /* image height */360, rotation, InputImage.IMAGE_FORMAT_NV21 // or IMAGE_FORMAT_YV12 );
Bitmap ব্যবহার করে
Bitmap অবজেক্ট থেকে InputImage
অবজেক্ট তৈরি করতে, নিম্নলিখিত ঘোষণা করুন:
Kotlin
val image = InputImage.fromBitmap(bitmap, 0)
Java
InputImage image = InputImage.fromBitmap(bitmap, rotationDegree);
ছবিটি Bitmap অবজেক্টের সাথে রোটেশন ডিগ্রির মাধ্যমে দেখানো হয়েছে।
৩. BarcodeScanner-এর একটি ইনস্ট্যান্স পাওয়া
Kotlin
val scanner = BarcodeScanning.getClient() // Or, to specify the formats to recognize: // val scanner = BarcodeScanning.getClient(options)
Java
BarcodeScanner scanner = BarcodeScanning.getClient(); // Or, to specify the formats to recognize: // BarcodeScanner scanner = BarcodeScanning.getClient(options);
৪. ছবি প্রসেস করা
process পদ্ধতিতে ছবিটি পাস করুন:
Kotlin
val result = scanner.process(image) .addOnSuccessListener { barcodes -> // Task completed successfully // ... } .addOnFailureListener { // Task failed with an exception // ... }
Java
Task<List<Barcode>> result = scanner.process(image) .addOnSuccessListener(new OnSuccessListener<List<Barcode>>() { @Override public void onSuccess(List<Barcode> barcodes) { // Task completed successfully // ... } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { // Task failed with an exception // ... } });
৫. বারকোড থেকে তথ্য পাওয়া
বারকোড শনাক্তকরণ অপারেশন সফল হলে,Barcode
অবজেক্টের একটি তালিকা সাকসেস লিসেনারের কাছে পাঠানো হয়। প্রতিটি Barcode অবজেক্ট
একটি বারকোডকে উপস্থাপন করে যা ছবিতে শনাক্ত করা হয়েছে। প্রতিটি বারকোডের জন্য, আপনি ইনপুট ছবিতে এর বাউন্ডিং কোঅর্ডিনেট এবং বারকোড দ্বারা এনকোড করা কাঁচা ডেটা পেতে পারেন। এছাড়াও, বারকোড স্ক্যানার যদি বারকোড দ্বারা এনকোড করা ডেটার ধরন নির্ধারণ করতে পারে, তাহলে আপনি পার্স করা ডেটা সহ একটি অবজেক্ট পেতে পারেন।
যেমন:
Kotlin
for (barcode in barcodes) { val bounds = barcode.boundingBox val corners = barcode.cornerPoints val rawValue = barcode.rawValue val valueType = barcode.valueType // See API reference for complete list of supported types when (valueType) { Barcode.TYPE_WIFI -> { val ssid = barcode.wifi!!.ssid val password = barcode.wifi!!.password val type = barcode.wifi!!.encryptionType } Barcode.TYPE_URL -> { val title = barcode.url!!.title val url = barcode.url!!.url } } }
Java
for (Barcode barcode: barcodes) { Rect bounds = barcode.getBoundingBox(); Point[] corners = barcode.getCornerPoints(); String rawValue = barcode.getRawValue(); int valueType = barcode.getValueType(); // See API reference for complete list of supported types switch (valueType) { case Barcode.TYPE_WIFI: String ssid = barcode.getWifi().getSsid(); String password = barcode.getWifi().getPassword(); int type = barcode.getWifi().getEncryptionType(); break; case Barcode.TYPE_URL: String title = barcode.getUrl().getTitle(); String url = barcode.getUrl().getUrl(); break; } }
রিয়েল-টাইম পারফর্ম্যান্স উন্নত করার পরামর্শ
আপনি যদি রিয়েল-টাইম অ্যাপ্লিকেশনে বারকোড স্ক্যান করতে চান, তাহলে সেরা ফ্রেমরেট পেতে এই নির্দেশিকাগুলি অনুসরণ করুন:
-
ক্যামেরার নেটিভ রেজোলিউশনে ইনপুট ক্যাপচার করবেন না। কিছু ডিভাইসে, নেটিভ রেজোলিউশনে ইনপুট ক্যাপচার করলে অত্যন্ত বড় (১০+ মেগাপিক্সেল) ছবি তৈরি হয়, যার ফলে খুব খারাপ লেটেন্সি হয় এবং নির্ভুলতার ক্ষেত্রে কোনও সুবিধা হয় না। এর পরিবর্তে, বারকোড ডিটেকশনের জন্য প্রয়োজনীয় ক্যামেরার সাইজই শুধু অনুরোধ করুন, যা সাধারণত ২ মেগাপিক্সেলের বেশি হয় না।
স্ক্যান করার স্পিড গুরুত্বপূর্ণ হলে, আপনি ছবি ক্যাপচার করার রেজোলিউশন আরও কমাতে পারেন। তবে, উপরে উল্লিখিত ন্যূনতম বারকোড সাইজ সংক্রান্ত প্রয়োজনীয়তা মনে রাখবেন।
আপনি যদি স্ট্রিমিং ভিডিও ফ্রেমের ক্রম থেকে বারকোড শনাক্ত করার চেষ্টা করেন, তাহলে শনাক্তকারী ফ্রেম থেকে ফ্রেম পর্যন্ত আলাদা আলাদা ফলাফল তৈরি করতে পারে। ভাল ফলাফল পাচ্ছেন কিনা তা নিশ্চিত করতে, একই ভ্যালুর একটি ধারাবাহিক সিরিজ না পাওয়া পর্যন্ত অপেক্ষা করুন।
ITF ও CODE-39-এর জন্য চেকম ডিজিট কাজ করে না।
- আপনি
Cameraঅথবাcamera2API ব্যবহার করলে, ডিটেক্টরে কল থ্রটল করুন। ডিটেক্টর চলাকালীন কোনও নতুন ভিডিও ফ্রেম উপলভ্য হলে, ফ্রেমটি বাদ দিন। উদাহরণ হিসেবে কুইকস্টার্ট স্যাম্পেল অ্যাপেVisionProcessorBaseক্লাস দেখুন। - আপনি
CameraXAPI ব্যবহার করলে, ব্যাকপ্রেশার স্ট্র্যাটেজি যাতে ডিফল্ট ভ্যালুতে সেট করা থাকে তা নিশ্চিত করুনImageAnalysis.STRATEGY_KEEP_ONLY_LATEST. এর ফলে, একবারে বিশ্লেষণের জন্য শুধুমাত্র একটি ছবিই ডেলিভার করা হবে। বিশ্লেষক ব্যস্ত থাকাকালীন আরও ছবি তৈরি হলে, সেগুলি অটোমেটিক বাদ দেওয়া হবে এবং ডেলিভারির জন্য সারিতে রাখা হবে না। ImageProxy.close() কল করে বিশ্লেষণ করা ছবি বন্ধ করে দিলে, পরবর্তী লেটেস্ট ছবি ডেলিভার করা হবে। - ইনপুট ইমেজে গ্রাফিক্স ওভারলে করার জন্য আপনি ডিটেক্টরের আউটপুট ব্যবহার করলে, প্রথমে ML Kit থেকে ফলাফল পান, তারপর ইমেজ রেন্ডার করুন
এবং একটি ধাপে ওভারলে করুন। এটি প্রতিটি ইনপুট ফ্রেমের জন্য শুধুমাত্র একবার
ডিসপ্লে সারফেসে রেন্ডার করে। উদাহরণ হিসেবে কুইকস্টার্ট স্যাম্পেল অ্যাপে
CameraSourcePreviewএবংGraphicOverlayক্লাস দেখুন। - আপনি Camera2 API ব্যবহার করলে,
ImageFormat.YUV_420_888ফর্ম্যাটে ছবি ক্যাপচার করুন। আপনি পুরনো Camera API ব্যবহার করলে,ImageFormat.NV21ফর্ম্যাটে ছবি ক্যাপচার করুন।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2026-10-15 UTC-তে শেষবার আপডেট করা হয়েছে।