Wilson Mar bio photo

Wilson Mar


Email me Calendar Skype call

LinkedIn Twitter Gitter Instagram Youtube

Github Stackoverflow Pinterest

Manage photos and Python Scikit Learn

US (English)   Norsk (Norwegian)   Español (Spanish)   Français (French)   Deutsch (German)   Italiano   Português   Estonian   اَلْعَرَبِيَّةُ (Egypt Arabic)   中文 (简体) Chinese (Simplified)   日本語 Japanese   한국어 Korean


If you need to convert images, use the popular free open-source https://imagemagick.org

NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.


  1. Install using HomeBrew (instead of downloading, gunzip, variables, etc.):

    brew install imagemagick
  2. Because ImageMagick depends on Ghostscript fonts, install them as well:

    brew install ghostscript

Scikit Learn

https://www.pluralsight.com/courses/building-features-image-data Building Features from Image Data Aug 13, 2019 by Janani Ravi

In a Jupyter Notebook:

  1. Install (within venv) from https://scikit-image.org/

    pip3 install -U scikit-image


To improve CNN network performance:

  • Crop for uniform Aspect Ratio (square, 16:9 HD)
  • uniform Image size (downscaling to smaller image or upscaling to larger image)
  • Mean and Perturbed images (detect faces and put them in the center of the image)
  • Dimenionality reduction
  • Data augmentation (scaling, rotation, affine transforms to preserve collinearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation). Also called an affinity.

  • Normalized impage outputs around mean
  1. To convert a file (such as a pdf) into a high-resolution image, use Imagemagick’s convert command:

    convert -density 300 test.pdf -depth 8 -strip -background white -alpha off out.tiff

    The last parameter is the output file.

    This also takes off Alpha channels and outputs to a TIFF format file.

    Alternative parameters are “-monochrome” to convert to black-and-white. These have a single “channel” whereas color images have 3 channels (Red, Green, Blue).

Flip image


Images seen reflected on a mirror or on a traditional letterpress need to be flipped (left to right). Sample scikit-learn code:

    image_mirror_fliplr = np.fliplr(img_mirror)


Denoising Images


This is one of a series on AI, Machine Learning, Deep Learning, Robotics, and Analytics:

  1. AI Ecosystem
  2. Machine Learning
  3. Testing AI

  4. Microsoft’s AI
  5. Microsoft’s Azure Machine Learning Algorithms
  6. Microsoft’s Azure Machine Learning tutorial
  7. Microsoft’s Azure Machine Learning certification

  8. Python installation
  9. Juypter notebooks processing Python for humans

  10. Image Processing
  11. Tessaract OCR using OpenCV
  12. Amazon Lex text to speech

  13. Code Generation

  14. Multiple Regression calculation and visualization using Excel and Machine Learning
  15. Tableau Data Visualization