Installation & Setup:
To get started with scikit-image
, follow these steps:
1. Install Python
Ensure you have Python installed. You can download the latest version from Python’s official website and follow the installation instructions for your operating system.
To verify the installation, run:
--version python
2. Create a Virtual Environment (Optional but Recommended)
Using a virtual environment helps manage dependencies effectively.
On macOS/Linux:
-m venv scikit_env
python /bin/activate source scikit_env
On Windows:
-m venv scikit_env
python scikit_env\Scripts\activate
3. Install scikit-image
Use pip to install scikit-image
:
-image pip install scikit
You may also need to install dependencies like numpy
, matplotlib
, and scipy
:
pip install numpy matplotlib scipy
4. Verify Installation
After installation, open a Python shell and run:
import skimage
print(skimage.__version__)
If no errors appear and a version number is printed, the installation was successful.
5. Installing Jupyter Notebook (For Interactive Development)
If you want an interactive development environment, install Jupyter Notebook:
pip install notebook
Then, launch it using:
jupyter notebook
6. Running Your First scikit-image
Program
Create a Python script or Jupyter Notebook and test loading an image:
import matplotlib.pyplot as plt
from skimage import io
= io.imread('https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png')
image
plt.imshow(image)'off')
plt.axis( plt.show()
If an image is displayed without errors, your setup is complete!