Braille#
This style uses the characters of the Braille writing system.
Example
Consider the following image:
  
 
Apple Computer [Rob Janoff, 1977]
Here's what it should look like:
 
 Encoding
Traditional Braille characters are made up of 6 dots (⠿). Since each dot could be in one of 2 states (raised or lowered), there are a total of 64 unique combinations.
In Unicode, braille is represented in a block, the Braille Patterns. There are 256 unique characters each in its own 8-dot cell (⣿).
Procedure#
This style is implemented using the BrailleDrawer.
Styling
Refer to the procedure outlined in the Styles documentation for an overview of the steps common to all styles.
Initialization#
Threshold#
The threshold parameter filters out pixels of the input image whose grayscale intensities are lesser than it.
Consider the following image:
  
 
Tiles ressembling GitHub contributions
Here's what it should look like:
 
  
  
  
  
 Matrices#
The kernel attribute holds a NumPy ndarray containing the following matrix:
The Unicode encoding of the 8-dot cell Braille system is done by assigning each of the dots a power of 2. Each character in the Braille Patterns block has a unique Unicode value that is obtained by summing these powers.
The charset_array attribute holds another NumPy ndarray containing all 256 Braille characters.
Conversion#
Resizing#
Assuming the output text should have the dimensions text_height and text_width, the image must be resized according to the following criteria:
- image_height = 4 * text_height.
- image_width = 2 * text_width.
- If either image_heightorimage_widthis0, it is derived from the other by preserving the aspect ratio of the original image.
Following the above algorithm, each pixel of the resized image will be assigned to one dot (Braille character dot) in the output text.
Source
Refer to the calculate_size function for more information.
Processing#
- The resized imageis first converted to its grayscale.
- Each pixel is set to either 0or1based on whether its grayscale intensity is below or above thethreshold.
- A convolution operation is performed on this filtered image using the kernelmatrix. The resultant matrix has the ofsetted Unicode values for the corresponding Braille character.
- The charset_arrayis indexed with the resultant "indices" matrix, giving the finaltext_matrix.
 
 Source
Refer to the process function for more information.