Skip to content

Instantly share code, notes, and snippets.

@githubharald
githubharald / ctc_score.py
Created August 2, 2018 10:08
Compute confidence score for CTC-decoded text using TensorFlow
"""
Compute score for decoded text in a CTC-trained neural network using TensorFlow:
1. decode text with best path decoding (or some other decoder)
2. feed decoded text into loss function
3. loss is negative logarithm of probability
Example data: two time-steps, 2 labels (0, 1) and the blank label (2).
Decoding results in [0] (i.e. string containing one entry for label 0).
The probability is the sum over all paths yielding [0], these are: [0, 0], [0, 2], [2, 0]
with probability
@tolland
tolland / example.c
Last active September 10, 2023 12:22
code to generate png from XGetImage of windows in _NET_CLIENT_LIST
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <libpng16/png.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xcomposite.h>

Structured light with sinusoidal patterns and phase unwrapping

This project was about adding structured light methods, based on sinusoidal patterns, along with phase unwrapping to OpenCV. Our work was based on the following reference papers:

  • [1] Cong, Pengyu, et al. "Accurate dynamic 3D sensing with Fourier-assisted phase shifting." IEEE Journal of Selected Topics in Signal Processing 9.3 (2015): 396-408.
  • [2] Lei, Hai, et al. "A novel algorithm based on histogram processing of reliability for two-dimensional phase unwrapping." Optik-International Journal for Light and Electron Optics 126.18 (2015): 1640-1644.

The code can be found here and some data were also added here. Examples of wrapped phase maps stored in yml files can be found in opencv_extra/cv/testdata. They can be used with the sample created f

@christopherlovell
christopherlovell / display.py
Last active November 18, 2023 22:22
display youtube video in jupyter notebook
from IPython.display import HTML
# Youtube
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/S_f2qV2_U00?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>')
# Vimeo
HTML('<iframe src="https://player.vimeo.com/video/26763844?title=0&byline=0&portrait=0" width="700" height="394" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><p><a href="https://vimeo.com/26763844">BAXTER DURY - CLAIRE (Dir Cut)</a> from <a href="https://vimeo.com/dannysangra">Danny Sangra</a> on <a href="https://vimeo.com">Vimeo</a>.</p>')
@bo0ts
bo0ts / Includes
Last active August 29, 2015 14:18
Explicit boost includes of CGAL
#include <boost/any.hpp>
#include <boost/array.hpp>
#include <boost/assert.hpp>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/bind.hpp>
#include <boost/call_traits.hpp>
#include <boost/concept/assert.hpp>
@somada141
somada141 / ct2hu.md
Last active March 7, 2023 21:43
Converting CT Data to Hounsfield Units #medical #CT #imagedata #dicom #hounsfield #math

Converting CT Data to Hounsfield Units

The formula is:

hu = pixel_value * slope + intercept

Normally, these values are stored in the DICOM file itself. The tags are generally called the Rescale Slope and Rescale Intercept, and typically have values of 1 and -1024, respectively.