Skip to content

added camera support v1#435

Open
paradoxsyn wants to merge 3 commits intoultralytics:mainfrom
paradoxsyn:main
Open

added camera support v1#435
paradoxsyn wants to merge 3 commits intoultralytics:mainfrom
paradoxsyn:main

Conversation

@paradoxsyn
Copy link

@paradoxsyn paradoxsyn commented Jan 16, 2026

this is just a quick fix to add the flashlight. im using this personally figured I'd stick it here. I won't have time to check other submissions but this was quick so.

Best

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Adds cross-platform torch (flashlight) controls to the Flutter YOLO camera view via new MethodChannel APIs. 🔦

📊 Key Changes

  • Exposes new platform channel methods: toggleTorch, setTorchMode(enabled), isTorchAvailable, and isTorchEnabled (Android + iOS).
  • Implements torch control in Android YOLOView using CameraX (enableTorch, torchState, hasFlashUnit).
  • Implements torch control in iOS YOLOView via AVCaptureDevice torch configuration (lock/unlock + max torch level).
  • Adds matching Dart controller APIs in lib/widgets/yolo_controller.dart with basic error handling and null-safe query methods.

🎯 Purpose & Impact

  • Enables end-users to turn the flashlight on/off during live camera inference, improving low-light usability. 🌙
  • Provides feature parity across Android and iOS with a consistent Flutter API surface.
  • Helps apps gracefully adapt UI by checking torch availability/state before displaying a torch button.

@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@UltralyticsAssistant UltralyticsAssistant added enhancement New feature or request Feature labels Jan 16, 2026
@UltralyticsAssistant
Copy link
Member

👋 Hello @paradoxsyn, thank you for submitting a ultralytics/yolo-flutter-app 🚀 PR! This is an automated message—an Ultralytics engineer will review and assist soon. 🔦

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/yolo-flutter-app main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Looks clean overall. The new MethodChannel surface is wired consistently across Dart, Android (CameraX), and iOS (AVCaptureDevice), with reasonable null-safety and graceful fallbacks (e.g., returning false/null when unavailable). No clear bugs or failure cases introduced in the shown diff.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 7.48663% with 173 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/widgets/yolo_controller.dart 2.40% 81 Missing ⚠️
lib/tracking/iou_tracker.dart 0.00% 69 Missing ⚠️
lib/models/yolo_result.dart 7.14% 13 Missing ⚠️
lib/yolo_view.dart 52.38% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@asabri97
Copy link
Contributor

@paradoxsyn please sign the CLA

/**
* Locks the exposure at the current level.
*/
fun lockExposure() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we double check this method?

This approach isn't locking and the single path in setAutoFocusMode call cancelFocusAndMeterinng(), which resets metering back to default auto behavior. The method claims to lock but likely return to auto so the feature behaves opposite of its contract.

Adds opt-in greedy IoU tracker in Dart layer that assigns stable
integer trackId to each detection across frames. Useful for avoiding
re-scanning of mostly-stationary objects like cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants