Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Camera

Multimodal AI: camera to structured data in Flutter — hướng dẫn Flutter

Photos → structured fields is a high-value mobile AI pattern. Bài này chuyển quan sát đó thành một mô hình nhỏ để bạn có thể kiểm thử, đo lường và giữ cho code dễ bảo trì khi app lớn lên. Vấn đề cốt lõi Image sizing, privacy, and latency budgets for vision tasks. Câu hỏi hữu ích không phải API hay pattern có đẹp riêng lẻ hay không, mà là state nằm ở đâu, boundary nào chịu trách nhiệm khi lỗi xảy ra, và người dùng phục hồi thế nào khi happy path biến mất. Mô hình thực tế Downscale before upload; never send 48MP when 1024px will do. Hãy bắt đầu bằng một owner rõ ràng cho behavior. Widget chỉ nên render và phát intent; IO, persistence, permission và retry nên nằm sau một interface nhỏ. Nhờ vậy bạn có seam để fake trong test và một chỗ ghi lại các dữ kiện cần theo dõi ở production. Trong app Flutter, boundary thường có dạng: Widget phát intent như load, submit, refresh hoặc retry. Controller hoặc use case validate intent rồi gọi boundary. Boundary trả về data có kiểu hoặc failur...

On-device vision with Camera and ML Kit in Flutter — hướng dẫn Flutter

On-device vision keeps frames private and works offline. Bài này chuyển quan sát đó thành một mô hình nhỏ để bạn có thể kiểm thử, đo lường và giữ cho code dễ bảo trì khi app lớn lên. Vấn đề cốt lõi Live barcode scan, face detect, and frame throttling. Câu hỏi hữu ích không phải API hay pattern có đẹp riêng lẻ hay không, mà là state nằm ở đâu, boundary nào chịu trách nhiệm khi lỗi xảy ra, và người dùng phục hồi thế nào khi happy path biến mất. Mô hình thực tế Throttle frame processing; do not run detectors on every camera frame. Hãy bắt đầu bằng một owner rõ ràng cho behavior. Widget chỉ nên render và phát intent; IO, persistence, permission và retry nên nằm sau một interface nhỏ. Nhờ vậy bạn có seam để fake trong test và một chỗ ghi lại các dữ kiện cần theo dõi ở production. Trong app Flutter, boundary thường có dạng: Widget phát intent như load, submit, refresh hoặc retry. Controller hoặc use case validate intent rồi gọi boundary. Boundary trả về data có kiểu hoặc failure c...

On-device vision with Camera and ML Kit in Flutter

On-device vision keeps frames private and works offline. This article turns that observation into a small implementation model you can test, measure, and keep boring when the app grows. The problem in one sentence Live barcode scan, face detect, and frame throttling. The useful question is not whether the API or pattern looks elegant in isolation. It is where state lives, which boundary owns failure, and how a user recovers when the happy path disappears. A practical model Throttle frame processing; do not run detectors on every camera frame. Start with one explicit owner for the behavior. Keep widgets responsible for rendering and user intent; keep IO, persistence, permissions, and retries behind a small interface. That gives you a seam for a fake in tests and a place to record the facts that matter in production. For a Flutter app, the boundary usually looks like this: The widget emits an intent such as load, submit, refresh, or retry. A controller or use case validates the...

camera: a real capture pipeline, not just a preview

camera: a real capture pipeline, not just a preview camera is useful because it focuses on controller lifecycle, image streams, permissions, and orientation. The important engineering move is to place the package behind a clear boundary, so your Flutter UI depends on a stable capability rather than a vendor-shaped API. What the library should own Keep package calls inside a named adapter or feature boundary. Make lifecycle, errors, and loading state part of a testable contract. Expose only the capability the app needs; hide implementation details from the whole tree. A focused starting point final cameras = await availableCameras (); final controller = CameraController ( cameras.first, ResolutionPreset .high, enableAudio : false , ); await controller. initialize (); final file = await controller. takePicture (); Production checklist Read the README and changelog for the exact version you pin. Add one test for lifecycle, failure, and app background/...

Multimodal AI: camera to structured data in Flutter

Photos → structured fields is a high-value mobile AI pattern. This article turns that observation into a small implementation model you can test, measure, and keep boring when the app grows. The problem in one sentence Image sizing, privacy, and latency budgets for vision tasks. The useful question is not whether the API or pattern looks elegant in isolation. It is where state lives, which boundary owns failure, and how a user recovers when the happy path disappears. A practical model Downscale before upload; never send 48MP when 1024px will do. Start with one explicit owner for the behavior. Keep widgets responsible for rendering and user intent; keep IO, persistence, permissions, and retries behind a small interface. That gives you a seam for a fake in tests and a place to record the facts that matter in production. For a Flutter app, the boundary usually looks like this: The widget emits an intent such as load, submit, refresh, or retry. A controller or use case validates ...

On-device vision with Camera and ML Kit in Flutter — hướng dẫn Flutter

On-device vision keeps frames private and works offline. Bài này chuyển quan sát đó thành một mô hình nhỏ để bạn có thể kiểm thử, đo lường và giữ cho code dễ bảo trì khi app lớn lên. Vấn đề cốt lõi Live barcode scan, face detect, and frame throttling. Câu hỏi hữu ích không phải API hay pattern có đẹp riêng lẻ hay không, mà là state nằm ở đâu, boundary nào chịu trách nhiệm khi lỗi xảy ra, và người dùng phục hồi thế nào khi happy path biến mất. Mô hình thực tế Throttle frame processing; do not run detectors on every camera frame. Hãy bắt đầu bằng một owner rõ ràng cho behavior. Widget chỉ nên render và phát intent; IO, persistence, permission và retry nên nằm sau một interface nhỏ. Nhờ vậy bạn có seam để fake trong test và một chỗ ghi lại các dữ kiện cần theo dõi ở production. Trong app Flutter, boundary thường có dạng: Widget phát intent như load, submit, refresh hoặc retry. Controller hoặc use case validate intent rồi gọi boundary. Boundary trả về data có kiểu hoặc failure c...

On-device vision with Camera and ML Kit in Flutter

On-device vision keeps frames private and works offline. This article turns that observation into a small implementation model you can test, measure, and keep boring when the app grows. The problem in one sentence Live barcode scan, face detect, and frame throttling. The useful question is not whether the API or pattern looks elegant in isolation. It is where state lives, which boundary owns failure, and how a user recovers when the happy path disappears. A practical model Throttle frame processing; do not run detectors on every camera frame. Start with one explicit owner for the behavior. Keep widgets responsible for rendering and user intent; keep IO, persistence, permissions, and retries behind a small interface. That gives you a seam for a fake in tests and a place to record the facts that matter in production. For a Flutter app, the boundary usually looks like this: The widget emits an intent such as load, submit, refresh, or retry. A controller or use case validates the...