Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » ELEC 301 Projects Fall 2008 » Give Your Digits!: Image Processing

Navigation

Table of Contents

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Rice University ELEC 301 Projects

    This collection is included inLens: Rice University ELEC 301 Project Lens
    By: Rice University ELEC 301

    Click the "Rice University ELEC 301 Projects" link to see all content affiliated with them.

Also in these lenses

  • Lens for Engineering

    This collection is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.
 

Give Your Digits!: Image Processing

Module by: Samuel Kim, Joel Khan, Yung-Seok Kevin Choi. E-mail the authors

Summary: Process of converting an image of handwritten digits into a standardized format.

Give Your Digits!: Image Processing

When an image is acquired, its size and dimensions will vary. Since the database we use is in grayscale and 28x28 pixels large, each input image must be processed so that it also has the same dimensions.

Figure 1: Acquired Image
Figure 1 (graphics1.jpg)

Convert to Grayscale

The acquired image is in RGB format, where each pixel in the image consists of 3 components: the intensity of red, green and blue. Grayscale consists of a single intensity value for each pixel. Therefore, to change each input image to grayscale, we will use the Matlab operator, rgb2gray().

Edge Detection

The only information of interest in the input image are the intensities of the actual digits, rather than the intensities of the background. Edge detection will remove background noise and filter the image so that only areas of high contrast (which is the shape of the handwritten digits) remain. The figure below shows the result of applying a simple Sobel edge detector using the edge() command with the threshold set to default.

Figure 2: Result of edge detection with sobel operator.
Figure 2 (fig2-sobel.png)

Dilation: Morphological Operator

A morphological operator such as dilation processes an image so that its shape is changed in some way. Dilation expands all the boundaries of objects in the image. Dilation in this case also serves to connect any disconnected regions of an outline together. Through the imdilate() command, we can specify how to expand the digit outlines by a structuring element. Depending on the shape of the structuring element, the appearance of the image will change. The ‘ball’ structuring element will be a good choice, since this uses a gradient to make the digits look smoother and rounded out, similar to the way the data is normalized. Depending on how large the digits are written, the size of the structuring element will need adjustment – larger images require a larger structuring element in order to fill more of the outline. In order to get consistent results from dilation, we made sure all writing samples were approximately the same size. The figure below shows the result of dilation.

Figure 3: Dilation of Digit Outlines
Figure 3 (graphics2.jpg)

Separating Individual Digits

Now that the only identifiable regions in the image are the digits themselves, the Matlab operator regionprops() with the ‘boundingbox’ option, we will be able to separate the digits into individual images.

Figure 4: Connected regions are identified by ‘boundingbox’
Figure 4 (graphics3.png)

Resize and Normalize Image

Most input images are much larger than needed and must be rescaled and centered to 28x28 pixels. Imresize() scales the image to 20x20 pixels. Afterwards, zero padding adds zeros to each side of the image, resulting in a 28x28 pixel image. The input image is now standardized and ready to be identified.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks