Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » ECE 301 Projects Fall 2003 » Length/Width Ratio Test for Fish Classification

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.

  • Rice Digital Scholarship

    This collection is included in aLens by: Digital Scholarship at Rice University

    Click the "Rice Digital Scholarship" link to see all content affiliated with them.

Also in these lenses

  • Lens for Engineering

    This module and collection are included inLens: Lens for Engineering
    By: Sidney Burrus

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

  • EW Public Lens display tagshide tags

    This collection is included inLens: Ed Woodward's Public Lens
    By: Ed Woodward

    Comments:

    "assafdf"

    Click the "EW Public Lens" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Length/Width Ratio Test for Fish Classification

Module by: Kyle Clarkson, Jason Sedano, Ian Clark. E-mail the authors

Summary: This test determines whether a fish is a salmon or a trout, or neither based on the length and width of the fish

One simple way to tell different fish apart is due to their ratio of length to width. For every species of fish, that ratio is essentially the same. On reason salmon are unique in that regard is because during spawning season, they grow wider and thus their length to width ratio becomes much smaller (approximately 2:1 or 3:1). Other fish, such as steelhead trout, which maintain a much more sleek, approximately 3:1 to 4:1 length to width ratio even during spawning season.

This test is done using primarily the Canny Edge Detection method which is performed by Matlab using the command edge. It takes the image of the fish and finds an outline of it.

Figure 1: The Fish image after the canny edge detection is run on it.
Canny edge detection Image
Canny edge detection Image (cannytest.jpg)

Canny Edge Detection

Image edges contain strong contrasts in intensity. The Canny Edge Detector tries to find only true edges by only selecting localized edge points and only responding once to a single real edge. The Canny method also filters noise with a convolution mask built through Canny's algorithm. The edge detector then uses the gradient of the image and summing along the x direction and y direction to obtain the edge value. Direction of the edge is easily determined by looking at each directions value and seeing which one is larger. However, it is important to test for errors when one direction is zero, so Canny looks at the angle between the x-direction and y-direction. Canny also uses suppression to connect values along the direction of the edge.

After the edge detection has been run, the image is binary and all the edges are represented by ones. The rows and columns are then each summed up. The algorithm then starts at each edge of the image and moves toward the center until it finds a row with a significant amount of values in it. This signals the edge of the fish closest to that side. Then, through simple calculations, the length, width, and ration can be calculated.

Example 1: Code for Length/Width Test

% This function uses canny edge detection to try to find an outline of the 
% fish in the grayscale image and then it calculates the length to width 
% ratio of the fish.
function [length,width,lwratio] = fishedge(image)

imagegray = rgb2gray(image);
imageedge = edge(imagegray,'canny');

l4rowedge = sum(imageedge);
l4coledge = sum(imageedge')';
l4size = size(imageedge);

j = 1;
% Find the top edge of the fish
while l4coledge(j)< 4
    top = j;
    j = j+1;
end
j = 1;
% Find the bottom edge of the fish
while l4coledge(l4size(1)-j+1)< 4
    bottom = l4size(1)-j+1;
    j = j+1;
end   

width = bottom - top; 

j = 1;
% Find the left edge of the fish
while l4rowedge(j)< 4
    left = j;
    j = j+1;
end
j = 1;
% Find the right edge of the fish
while l4rowedge(l4size(2)-j+1)%lt; 4 
    right = l4size(2)-j+1;
    j = j+1;
end   

length = right - left;

lwratio = length./width;
      

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