<< Chapter < Page Chapter >> Page >
This test determines whether a fish is a salmon or a trout based on different color features that are detected using the 2-D DWT

One of the most important features of different fish are the colors of their heads, tails, and bodies. This test breaks downthe different color matricies into blocks of similar colors and uses them to detect what color the different parts of the fish'sbody are.

The first part of the process is to run the 2-D DWT on each of the color matricies. It is run 3 times so that the resulting picture is 1/8 of theresolution of the original matricies, and there are only high values where the color is relatively constant for a largearea. This essentially provides a method for Low-Pass filtering the picture and finding only large blocks of color.

Next, the picture is filtered by dropping any values that are lower than a threshold and setting any values over thatthreshold to 1. This drops all areas in the picture that are not very intense, or where the values are not constant for alarge area. Now, the picture has only ones whereever the large blocks of color are.

The next step is to count all the different blocks of ones, which is done by using the Matlab command, bwlabel . Next, each block is examined one by one to see what size it is, and where in the picture itslocated. From this, it can be determined what color the body, head, and tail of the fish is. If they match the pattern foreither type of fish, then the test classifies it as that type. Because this is the hardest test to satisfy, it is also the mostheavily weighted test in the entire process.

Feature testing image

The features for each of the colors(red, green, then blue) for a sample sockeye salmon picture.

Code for feature detection

% This function takes in a 3D image matrix of three colors, red, green, and blue and uses the % 2-D DWT to low poss filter them and decrease their resolution. It then looks for blocks of% color and outputs a matrix with the size, and location of each of the different features of % each color. These can then be analyzed to see if they show evidence of a specific fish type.function [rfeats,gfeats,bfeats] = featuredet(image)redimage = image(:,:,1); greenimage = image(:,:,2);blueimage = image(:,:,3); rfeats = [0 0 0 0 0 0 0 0]; gfeats = [0 0 0 0 0 0 0 0]; bfeats = [0 0 0 0 0 0 0 0]; % Run the 2-D DWT on the different colors to reduce the resolution of the picture and% effectively low-pass filter the image. dwtr = dwt2(redimage, 'haar');dwtr2 = dwt2(dwtr, 'haar'); dwtr3 = dwt2(dwtr2, 'haar');%dwtr3feat = (dwtr3 > 6) dwtr4 = dwt2(dwtr3, 'haar');%dwtr4feat = (dwtr4 > 13); dwtg = dwt2(greenimage, 'haar');dwtg2 = dwt2(dwtg, 'haar'); dwtg3 = dwt2(dwtg2, 'haar');dwtg4 = dwt2(dwtg3, 'haar'); dwtb = dwt2(blueimage, 'haar');dwtb2 = dwt2(dwtb, 'haar'); dwtb3 = dwt2(dwtb2, 'haar');dwtb4 = dwt2(dwtb3, 'haar'); % Set everything below a threshold to 0 and everything above to 1 and then% number every group of ones in the binary image [redfeatures, numred]= bwlabel(dwtr3>5); [greenfeatures, numgreen]= bwlabel(dwtg3>5); [bluefeatures, numblue]= bwlabel(dwtb3>5); % Cycle through each different feature and find its location and sizefor a = 1:numred rowval = sum(redfeatures==a);colval = sum((redfeatures==a)')'; sizeval = size(redfeatures);j = 1; left = 0;while rowval(j)<1 left = j;j = j+1; endj = 1; right = sizeval(2);while rowval(sizeval(2)-j+1)<1 right = sizeval(2)-j+1;j = j+1; endj = 1; top = 0;while colval(j)<1 top = j;j = j+1; endj = 1; bottom = sizeval(1);while colval(sizeval(1)-j+1)<1 bottom = sizeval(1)-j+1;j = j+1; endsumval = sum(rowval); rfeats(a,:) = [top bottom bottom-top left right right-left (right-left)./(bottom-top) sumval]; endfor b = 1:numgreen rowval = sum(greenfeatures==b);colval = sum((greenfeatures==b)')'; sizeval = size(greenfeatures);j = 1; while rowval(j)<1 left = j;j = j+1; endj = 1; while rowval(sizeval(2)-j+1)<1 right = sizeval(2)-j+1;j = j+1; endj = 1; while colval(j)<1 top = j;j = j+1; endj = 1; while colval(sizeval(1)-j+1)<1 bottom = sizeval(1)-j+1;j = j+1; endsumval = sum(rowval); gfeats(b,:) = [top bottom bottom-top left right right-left (right-left)./(bottom-top) sumval]; endfor c = 1:numblue rowval = sum(bluefeatures==c);colval = sum((bluefeatures==c)')'; sizeval = size(bluefeatures);j = 1; while rowval(j)<1 left = j;j = j+1; endj = 1; while rowval(sizeval(2)-j+1)<1 right = sizeval(2)-j+1;j = j+1; endj = 1; while colval(j)<1 top = j;j = j+1; endj = 1; while colval(sizeval(1)-j+1)<1 bottom = sizeval(1)-j+1;j = j+1; endsumval = sum(rowval); bfeats(c,:) = [top bottom bottom-top left right right-left (right-left)./(bottom-top) sumval]; end

Code for feature analysis

% This function takes a 3D image and runs the feature detector on it, which gives matricies% containing the sizes and shapes of the different features. It then decides what color the % fish's body, head, and tail are, or whether the can't be determined by the features.function [body,head,tail] = featureanalyzer(fishimage);[rfeats,gfeats,bfeats] = featuredet(fishimage);impfeats = [0 0 0; 0 0 0; 0 0 0];% This section takes each feature located by the feature detector and decides if they % are evidence or a body, head, or tail of the fish being that color.for a = 1:size(rfeats,1) % If the feature is extremely long, it is a bodyif and(rfeats(a,6)>30, rfeats(a,8)>30) impfeats(1,1) = 1;end % If the feature is far to the right, it is a headif and(rfeats(a,4)>38, rfeats(a,8)>20) impfeats(1,2) = 1;end % If the features is far to the left, it is a tailif and(rfeats(a,5)<25, rfeats(a,8)>6) impfeats(1,3) = 1;end endfor b = 1:size(gfeats,1) if and(gfeats(b,6)>30, gfeats(b,8)>30)impfeats(2,1) = 1; endif and(gfeats(b,4)>38, gfeats(b,8)>10) impfeats(2,2) = 1;end if and(gfeats(b,5)<25, gfeats(b,8)>6) impfeats(2,3) = 1;end endfor c = 1:size(bfeats,1) if and(bfeats(c,6)>30, bfeats(c,8)>30)impfeats(3,1) = 1; endif and(bfeats(c,4)>38, bfeats(c,8)>10) impfeats(3,2) = 1;end if and(bfeats(c,5)<25, bfeats(c,8)>6) impfeats(3,3) = 1;end end% This section looks at each of the columns of the feature matrix and then % outputs which color pattern they are.if and(impfeats(1,1) == 1, and(impfeats (2,1) == 1, impfeats (3,1) == 1)) body = 'rgb';end if and(impfeats(1,1) == 1, and(impfeats (2,1) == 1, impfeats (3,1) == 0))body = 'rg '; endif and(impfeats(1,1) == 1, and(impfeats (2,1) == 0, impfeats (3,1) == 1)) body = 'rb ';end if and(impfeats(1,1) == 1, and(impfeats (2,1) == 0, impfeats (3,1) == 0))body = 'r '; endif and(impfeats(1,1) == 0, and(impfeats (2,1) == 1, impfeats (3,1) == 1)) body = 'gb ';end if and(impfeats(1,1) == 0, and(impfeats (2,1) == 1, impfeats (3,1) == 0))body = 'g '; endif and(impfeats(1,1) == 0, and(impfeats (2,1) == 0, impfeats (3,1) == 1)) body = 'b ';end if and(impfeats(1,1) == 0, and(impfeats (2,1) == 0, impfeats (3,1) == 0))body = 'cbd'; endif and(impfeats(1,2) == 1, and(impfeats (2,2) == 1, impfeats (3,2) == 1))head = 'rgb'; endif and(impfeats(1,2) == 1, and(impfeats (2,2) == 1, impfeats (3,2) == 0)) head = 'rg ';end if and(impfeats(1,2) == 1, and(impfeats (2,2) == 0, impfeats (3,2) == 1))head = 'rb '; endif and(impfeats(1,2) == 1, and(impfeats (2,2) == 0, impfeats (3,2) == 0)) head = 'r ';end if and(impfeats(1,2) == 0, and(impfeats (2,2) == 1, impfeats (3,2) == 1))head = 'gb '; endif and(impfeats(1,2) == 0, and(impfeats (2,2) == 1, impfeats (3,2) == 0)) head = 'g ';end if and(impfeats(1,2) == 0, and(impfeats (2,2) == 0, impfeats (3,2) == 1))head = 'b '; endif and(impfeats(1,2) == 0, and(impfeats (2,2) == 0, impfeats (3,2) == 0)) head = 'cbd';endif and(impfeats(1,3) == 1, and(impfeats (2,3) == 1, impfeats (3,3) == 1)) tail = 'rgb';end if and(impfeats(1,3) == 1, and(impfeats (2,3) == 1, impfeats (3,3) == 0))tail = 'rg '; endif and(impfeats(1,3) == 1, and(impfeats (2,3) == 0, impfeats (3,3) == 1)) tail = 'rb ';end if and(impfeats(1,3) == 1, and(impfeats (2,3) == 0, impfeats (3,3) == 0))tail = 'r '; endif and(impfeats(1,3) == 0, and(impfeats (2,3) == 1, impfeats (3,3) == 1)) tail = 'gb ';end if and(impfeats(1,3) == 0, and(impfeats (2,3) == 1, impfeats (3,3) == 0))tail = 'g '; endif and(impfeats(1,3) == 0, and(impfeats (2,3) == 0, impfeats (3,3) == 1)) tail = 'b ';end if and(impfeats(1,3) == 0, and(impfeats (2,3) == 0, impfeats (3,3) == 0))tail = 'cbd'; end

Questions & Answers

Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Ece 301 projects fall 2003. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10223/1.5
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 301 projects fall 2003' conversation and receive update notifications?

Ask