Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
camera_design [2020/08/29 17:20] paul [Camera Design] |
camera_design [2020/08/31 03:24] (current) paul [Observer Pattern] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Camera Design ====== | ====== Camera Design ====== | ||
+ | ===== Android Binder ===== | ||
+ | |||
+ | Android uses an IPC framework called Binder that allows for inter process communication. Everyone in Android is connected together in Binder. | ||
+ | |||
+ | ===== Intents ===== | ||
+ | |||
+ | Android allows for processes to communicate with each other using Intents. You can send intents to other processes and then handle their callbacks. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Binder Structure ==== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Binder allows us to communicate to other process through a managed way. It's pretty much roscore in ROS. | ||
+ | |||
+ | Theres a bunch of different stuff that will happen to get messages from senders to receivers. No need to worry about it but here is how it looks. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Here is an interesting example of how this plays out when an app requests a location service. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== OOP ===== | ||
+ | |||
+ | Compositions: | ||
+ | |||
+ | Aggregation: | ||
+ | |||
+ | Association: | ||
+ | |||
+ | Reflexive association: | ||
+ | |||
+ | < | ||
+ | | Property | ||
+ | |------------------------------------------+----------------+----------------+---------------------------------| | ||
+ | | Relationship type | Whole/ | ||
+ | | Members can belong to multiple classes | ||
+ | | Members existence managed by class | Yes | No | No | | ||
+ | | Directionality | ||
+ | | Relationship verb | Part-of | ||
+ | </ | ||
+ | Abstract Class: Abstract classes contain pure virtual functions are cannot be | ||
+ | instantiated. They can however contain constructors, | ||
+ | inherited by derived classes. | ||
+ | |||
+ | Virtual Functions: in C++ a function marked virtual derives to the lowest | ||
+ | derived function of that class. If you have a pointer of base class type, but it | ||
+ | is a pointer to a derived class, the function will resolve to derived class. | ||
+ | |||
+ | Pure Virtual Function: A function marked with '' | ||
+ | implemented by a derived class. Having a pure virtual function in a class makes | ||
+ | the class abstract. | ||
+ | |||
+ | <code cpp> | ||
+ | class A{ | ||
+ | private: | ||
+ | int m_id; | ||
+ | public: | ||
+ | A(int id) : m_id{id} | ||
+ | { | ||
+ | } | ||
+ | |||
+ | virtual void printId() = 0; // this make the function pure virtual, and the | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | Interfaces are pure virtual functions that have no member variables and contain | ||
+ | all pure virtual functions. | ||
+ | |||
+ | <code cpp> | ||
+ | class ICameraDriver { | ||
+ | public: | ||
+ | virtual capture() = 0; | ||
+ | virtual stream() = 0; | ||
+ | virtual ~ICameraDriver() {} | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | ===== OOP Patterns ===== | ||
+ | |||
+ | The following are different design patterns that can be implemented. | ||
+ | |||
+ | ==== Strategy Pattern ==== | ||
+ | |||
+ | I've used this pattern a lot. It's when you define a set of functionality and encapsulate them and then make it interchangeable. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Here is some implemented C++ code. To see some code, check out ex4 of oop1 in | ||
+ | learn. Use the strategy pattern when you need to use one of several behaviors | ||
+ | dynamically. | ||
+ | |||
+ | ==== Observer Pattern ==== | ||
+ | |||
+ | This very similar to the publisher subscriber model. An Observer | ||
+ | |||
+ | {{: | ||
===== Video Compression ==== | ===== Video Compression ==== | ||
A 1920 x 1080 video at 30 fps with RGB8 (24 bits total) comes out to 1.5Gbits/s. | A 1920 x 1080 video at 30 fps with RGB8 (24 bits total) comes out to 1.5Gbits/s. | ||
- | {{: | + | {{: |
+ | |||
+ | Encoding and decoding. | ||
+ | |||
+ | {{: | ||
===== Camera Pipeline ===== | ===== Camera Pipeline ===== | ||
==== White Balance ==== | ==== White Balance ==== | ||
Line 42: | Line 145: | ||
{{: | {{: | ||
+ | |||
+ | Back Side Illumination | ||
+ | |||
+ | {{: | ||
Final Pipeline example. | Final Pipeline example. |