Skip to content

A collection of resources to get started in image processing and data analysis in python

Notifications You must be signed in to change notification settings

Cryaaa/Python-Image-Analysis-Blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

Intorduction to Using Python for Image Analysis

Setting up your Enviroment

To get started using python the first step is the installation and there are several ways you can do it. To make it easier for your future self it's a good idea to set up a virtual environment. You can think of this as a virtual installation folder where you install all your python libraries (basically just functions that other people have written). One way to manage these environments is anaconda This will not only install anaconda, the software to manage your environments but also a lot of libraries commonly needed for scientific python programs.

Once installed you can manage your environments via the command line. Every operating system has one and they differ slightly. I'm using Windows and to open it you just need to search for 'cmd' and will find it. The basic functionality and use of conda in it can be found in this great explanation of command line and conda, created by my supervisor. Another nice explanation of the command line can be found by Sreeni here

You will also need an integrated development environment (in short IDE) is and why as well as what it is is explained here. If you go with anaconda like I have the environment will be preinstalled and is called spyder (it's the same as the one used by Sreeni).

To get Started with your first programs in python I would suggest you follow the tutorial on setting up an environment after installing anaconda. I can offer a bonus tip for creating conda environments and that is to install a specific python version (some libraries won't work with the newest python version but you may find that out yourself) and how to install all the essential scientific libraries included in anaconda. To do this you need to initialise a conda environment as follows:

C:\Users\yourusername> conda activate
C:\Users\yourusername> conda create -n your_environment_name python=3.8 anaconda 

You have to replace 'your_environment_name' with a name of your choosing and can choose any python version that works with your libraries. For now you can omit the line 'python=3.8' but if you run into problems you can use this line to install any python version you wish to. The command 'anaconda' at the end will install all the libraries that come preinstalled with anaconda to your new environment. It can happen that your environment breaks because you mess up an installation or a library is not compatible with another or incompatible with the installed python version. Don't panic that is normal and happens. Just go ahead and create a new environment and reinstall the libraries you need.

The Basics

To be frank I cannot teach all the basics of python anywhere near as well as the plethora of people on youtube and various blogs and sites across the internet. What I can do is give you some of the resources I have used to get into python, which you might also like. If you are starting completely from scratch I would advise you to watch this video

If you have some basic understanding of coding the introduction to pythonic programming by Sreeni might be more suited. The video series by Sreeni covers a large part of image analysis and python programming and is a resource I often like to come back to myself.

The third option is to watch the lectures I had introducing python programming here. This is also a series that I would advise on watching to get an understanding of image analysis (afterall it's what got me into image analysis) but it's focussed on another program used for image analysis called ImageJ. This years lecture can be found on github. It revolves around python and is another great resource to get started with programming and image analysis in python.

Some Tricks for Beginners

These are some links that I have found extremely useful for writing code more easily. Especially the enumerate looping and list comprehensions are things I wish I had discovered earlier:

Numpy

When we are performing image analysis in python we have to understand the basics of numpy, since almost all image analysis in python is based partly on numpy. Learning the basics of numpy and how it handles arrays is extremely important as pictures are handled as numpy arrays. If you are following the tutorials provided by Sreeni you will have noticed a fairly long video on numpy arrays already. This is a great video for understanding the importance of numpy for image processing and I advise you to familiarise yourself with it! I'm also still learning numpy and it's various functions and the best way to find out what functions you need for a task is Google. Numpy is a large library and learning each function in one go will be impossible so find solutions along the way and you will find yourself becoming familiar with its functions.

About

A collection of resources to get started in image processing and data analysis in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published