Creating RAW file

A RAW file is a file containing minimally processed data from an image sensor. We can create this file using the tofile() method of the scipy package.

Example: Creating RAW file using SciPy

Python3




from scipy import misc
import imageio
import matplotlib.pyplot as plt
 
# reads a raccoon face
face = misc.face()
 
face.tofile("raccoon.raw")


This will create a .raw file in our current working directory.

Image Processing with SciPy and NumPy in Python

In this tutorial, we will discuss Image Processing in Python using the core scientific modules like NumPy and SciPy. The images are made up of NumPy ndarrays so we can process and manipulate images and SciPy provides the submodule scipy.ndimage that provides functions that can operate on the NumPy arrays.

 We will discuss how to open and write to images, and will also cover different manipulation and filtering techniques. So before getting started let’s see how to install both modules.

Similar Reads

Installation

Numpy: To install numpy type the below command in the terminal....

Opening and Writing Images

The misc package of SciPy comes with some preloaded images. We will use those images to learn about image processing. One such image is provided by the face() function. The face() function will get a colored image of a raccoon face....

Creating RAW file

...

Opening RAW File

...

Getting Statistical Information

A RAW file is a file containing minimally processed data from an image sensor. We can create this file using the tofile() method of the scipy package....

Cropping Image

...

Flipping Images

For opening .raw file we will be needing the NumPy module that will use the fromfile() method. This function is an efficient way of reading binary data with known data type as well as parsing simply formatted text....

Rotating Images

...

Filtering Images

We can use the max() and min() functions to get the maximum and minimum along the given axis. And to find the mean we can use the mean() function....

Edge Detection

...