.. include:: names.rst .. toctree:: :maxdepth: 2 Usage examples ############## This section contains an assortment of common usage examples, taken from the real world. We will explain each example shortly and move on quickly. If certain details are unclear, :doc:`parameters_trex` or :doc:`parameters_tgrabs` might help! TGrabs examples *************** Some things that are good to know: - Converting/recording has to be done before (or at the same time) as tracking! - Everything that appears pink in |grabs| is considered to be noise. If |grabs| is too choosy in your opinion, consider lowering ``threshold``, change ``blob_size_range`` to include the objects that are considered noise, or enabling ``use_closing``! - You should not delete your AVI after converting it to PV. Objects that are not considered noise, are saved losslessly in PV, but the rest is removed (that's the compression here). Converting videos ================= Just open a movie file and convert it to the PV format (it will be saved to the default output location, and named after the input file). Just for fun, we also set a different (higher) threshold:: tgrabs -i -threshold 35 We can switch to a different method for generating the background that is used for background-subtraction (which is how the foreground objects are detected), by using :func:`averaging_method`:: tgrabs -i -threshold 35 -averaging_method mode -reset_average The background will be saved to a png file in the output folder. You can edit it manually, too (until you use use ``reset_average``). Record using a Basler camera ============================ Same options as above, but the input is different (note that you'll have to compile the software yourself in order to use this - with the Basler SDK enabled/installed on your system):: tgrabs -i basler Closed-loop =========== To enable closed-loop, edit the ``closed_loop.py`` file (it contains a few examples) and open tgrabs using:: tgrabs -i basler -enable_closed_loop -threshold 35 -track_threshold 35 .. NOTE:: Now you also have to attach ``track_`` parameters and set everything up properly for tracking (see next section)! Every frame that has been tracked will be forwarded to your python script. Be aware that if your script takes too long, frames might be dropped and the tracking might become less reliable. In cases like that, or with many individuals, it might be beneficial to change ``match_mode`` to ``approximate`` (if you don't need extremely good identity consistency, just general position information). TRex: general usage ******************* .. NOTE:: Keep in mind that all parameters specified here in the command-line can also be accessed if you're already within the graphical user interface. Just type into the textfield on the bottom left of the screen and it will auto-complete parameter names for you. See also :doc:`gui`. Open a video:: trex -i