Skip to content

Instantly share code, notes, and snippets.

View bobetocalo's full-sized avatar

Roberto Valle bobetocalo

View GitHub Profile
@bobetocalo
bobetocalo / tutorial.md
Created July 25, 2014 12:30
¿Qué es Markdown?

Markdown is a lightweight and easy-to-use syntax for styling all forms of writing on the GitHub platform.

It's very easy to make some words bold and other words italic with Markdown. You can even link to Google!.

Sometimes you want bullet points:

  • Start a line with a star
  • Profit!

If you want to embed images, this is how you do it:

@bobetocalo
bobetocalo / opencv.md
Last active September 25, 2020 18:55
Install OpenCV

Compile OpenCV

Documentation.

Required Packages

Installed via terminal apt-get or Synaptic Manager (Linux) and terminal brew by Homebrew Science (Mac OS X).

$ brew info opencv
opencv: stable 2.4.9, HEAD
@bobetocalo
bobetocalo / avconv.md
Last active October 1, 2021 07:09
Downsample video to a lower resolution

Video and audio converter

Tutorial avconv.

Very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter.

Example

avconv -i input.mp4 -vf "transpose=1, scale=iw/2:-1" -r 30.30 -an output.mp4
@bobetocalo
bobetocalo / valgrind.md
Last active August 29, 2015 14:05
Profile C++ application with Callgrind and Memcheck

Profiling the application with Valgrind

Quick course in using tools for Valgrind. These tools will analyze your program's execution and tell you what parts are running slow. The results are accurate because of the way Valgrind works and help you spot problems such as lines of code that execute too much, hot spots, memory access problems, and even CPU cache misses.

[Callgrind documentation] (http://valgrind.org/docs/manual/cl-manual.html).

Callgrind is a tool in part of the Valgrind toolchain. It is running in Valgrind framework. The principle is not the same. When you use Callgrind to profile an application, your application is transformed in an intermediate language and then ran in a virtual processor emulated by valgrind. This has a huge run-time overhead, but the precision is really good and your profiling data is complete. An application running in Callgrind can be 10 to 50 times slower than normally.

valgrind --tool=callgrind ./HelloC++
kcachegrind
@bobetocalo
bobetocalo / doxygen.md
Last active August 29, 2015 14:05
Doxywizard is a GUI front-end for configuring and running doxygen
@bobetocalo
bobetocalo / datatypes.md
Last active August 29, 2015 14:05
Primitive C++ Built-in Types

C++ Data Types

C++ offer the programmer a rich assortment of built-in as well as user defined data types. Following table lists down seven basic C++ data types.

Type Keyword
Boolean bool
Character char
Integer int
Floating point float
@bobetocalo
bobetocalo / eclipse.md
Last active November 4, 2022 15:10
Eclipse CDT configuration

Import Eclipse CDT4 project via CMake

Using the Eclipse CDT project generator isn't different than using any other CMake generator

cd build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..

Wait for a succesfull compiler generation:

-- Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
@bobetocalo
bobetocalo / openmp.md
Last active August 16, 2023 23:19
OpenMP for Parallel Programming

OpenMP

Open Multi-Processing es la API (biblioteca que define solo la interfaz) que aporta paralelismo multihilo en sistemas de memoria compartida en C/C++. Image of shared memory

OpenMP se basa en el modelo fork-join, paradigma que proviene de los sistemas Unix, donde una tarea muy pesada se divide en X hilos (fork) con menor peso, para luego "recolectar" sus resultados al final y unirlos en un solo resultado (join). Image of fork/join

La sintaxis básica disponible para informar al compilador dónde optimizar código es la directiva de OpenMP:

@bobetocalo
bobetocalo / gaussian.md
Last active December 14, 2024 01:24
Distribución Gaussiana

Función Gaussiana

En estadística, la función gaussiana (en honor a Carl Friedrich Gauss) es una función definida por la siguiente expresión, donde a, b y c son constantes.

Generic gaussian

Así pues, la distribución gaussiana actúa como la función de densidad de una variable aleatoria x con distribución normal:

@bobetocalo
bobetocalo / android_camera.md
Last active August 29, 2015 14:06
Android Camera

Portrait and Landscape Android Camera

The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications.

¿Cómo funciona cada clase de la aplicación?

  • MainActivity: Actividad principal que hereda de la clase Activity, donde cabe crear una instancia de la clase MySurface. Al implementar el método @onCreate() la idea es hacer uso de un Layout que defina la estructura visual de la interfaz de usuario.

    • Activity: This class takes care of creating a window for you in which you can place your UI with setContentView.
  • MySurface: Clase que permite crear una instancia de Camera y procede a asignarle una superficie SurfaceView donde dibujar. Implementa cada método de la clase SurfaceHolder.Callback que recibe información de algún posible cambio en la superficie. Además implementa el método @onPreviewFrame() de la clase Camera.PreviewCallback que entrega los frames del preview para trabajar