You are on page 1of 53

FISH SEGREGATION

BY :ANKIT KUMAR AMRENDRA KUMAR SINGH KULDEEP KUMAR MANISH

PROJECT AT A GLANCE
Breeding centers find difficult to sort fishes in different tanks, depending upon the length, health, etc . This project proposes a unique method to differentiate and sort healthy and unhealthy fishes and according to their length . During all these processes we study the motion of fishes. depending on the swimming pattern we decide the health of the fish and by calculating total number of pixel we can measure length .By mesuring length we can send fishes according to their category into corresponding tanks.

BASIC BLOCK DIAGRAM

ALGORITHM
THE SNAP OF THE MAIN TANK (WITHOUT FISH) IS

TAKEN

AND IS STORED AS THE REFERENCE IMAGE.


SUBSEQUENT IMAGES OF THE MAIN TANK IS TAKEN. THE REFERENCE IMAGE IS SUBTRACTED FROM THE

SUBEQUENT IMAGES TO DETERMINE WHETHER THE FISH IS PRESENT IN THE IMAGE.


IF THE DIFFERENCIAL IMAGE (acquired image minus

background image) YIELDS A POSITIVE RESULT,THEN CLOSE THE SHUTTER OF THE MAIN TANK.

Contd..
AFTER THAT IT IS ALLOWED TO GO IN THE OPERATING TANK

THROUGH PVC PIPE CONNECTED FROM MAIN TANK TO OPERATING TANK.


THE SNAP OF THE OPERATING TANK (WITHOUT FISH) IS TAKEN

AND IS STORED AS THE REFERENCE IMAGE.


SUBSEQUENT IMAGES OF THE OPERATINGTANK IS TAKEN.

Contd
THE REFERENCE IMAGE IS SUBTRACTED FROM THE

SUBEQUENT IMAGES TO DETERMINE WHETHER THE FISH IS PRESENT IN THE IMAGE.


THE CENTROID OF THE FISH IS CALCULATED IN DIFFERENT

FRAMES.
THE TOTAL DISPLACEMENT OF FISH IS CALCULATED.

Contd..
. IF THE DISPLACEMENT EXCEED THE THRESHOLD THEN THE

FISH IS ASSUMED HEALTHY ELSE UNHEALTHY.


IF THE FISH IS UNHEALTHY CORRESPONDING SHUTTER

WILLOPEN AND IT WILL GO TO THE CORRESPONDING TANK.


IF THE FISH IS HEALTHY,THEN COUNT THE TOTAL NO. OF PIXEL

TO DETERMINE LENGTH.

Contd.
WE FIX THE THRESHOLD LENGTH OFTHE FISHES AND WE

COMPARE THIS THRESHOLD VALUE TO THE CALCULATED LENGTH. ACCORDING TO THEIR LENGTH IT WILL SEND TO THE CORRESPONDING TANK . TANK OPENINGS ARE CONTROLLED BY PIC MICROCOTROLLER WHICH IS INTERFACED WITH THE SERVOMOTORS. 16.CONTINUOUS SUPPLY OF WATER IS MAINTAINED IN THE SYSTEM USING FEED PUMP. .

IMAGE CAPTURE

CAPTURING PROCESS
As fish goes inside, it starts moving. During her motion we take

her snaps by using video input and video capturing process of camera.
During her motion we take 20 snaps for each fish which also

called as TRACES.
The rate of traces is about .5, means camera takes snaps from

video input in .5 second each.

IMAGE PROCESSING

IMAGE DESCRIPTION
Images are produced by a variety of physical devices, including still and

video cameras, x-ray devices, electron, microscopes, radar, ultrasound and used for a variety of purposes including entertainment, medical, business (e.g. documents), industrial, military, civil (e.g. traffic), security, and scientific. The goal in each case is for an observer, human or machine, to extract useful information about the scene being imaged.

Lights
All image processing applications start with some form of illumination,

typically light but more generally some form of energy. Generally one can choose illumination intensity, direction, spectrum (color) and continuous or strobe. Intensity is easiest to choose and least important while Direction is harder to choose and more important, as any professional photographer knows. Illumination color can sometimes be used as form of image enhancement. Its primary value is that its cheap and adds zero processing time. High speed image acquisition for rapidly moving or vibrating objects may require a strobe.

Camera
camera is any device that converts a pattern of radiated energy into a digital

image stored in a random-access memory.


the operation of camera is divided into two pieces: conversion of energy to

electrical signal, and conversion and storage of the signal in digital form, performed by a digitizer
typical visible light monochrome camera would have a resolution of 640 x

480 pixels, produce 30 frames per second, and support electronic shuttering. It would be based on CCD sensor technology, which produces good image quality

TYPES OF IMAGES
1. 2. 3.

RGB format Binary format Gray scale format

RGB FORMAT
Although it is possible to scan a color image in grayscale or take a B&W

digital photograph thus skipping the color stage, most of the time images we work with start in color. Color scans and digital camera photographs are typically in RGB format. If not, it is often customary to convert to RGB and work with the image (editing in a graphics software program) in that format. RGB images store values of red, green, and blue that would normally make up a color image. Each color is made up of varying amounts of red, green, and blue.

Contd..

BLACK & WHITE(GRAY SCALE)


Sometimes it is necessary or desirable to print or display Black & White

(grayscale) photographs. If the original image is in color, a graphics software program such as Adobe Photoshop or Corel Photo-Paint can be used to convert the color image to some form of black & white. . There are a number of methods available for getting a B&W photograph from a color photo. The most widely used methods are using the "convert to grayscale" option or the "dessaturation" (or "remove color") option in the image editing software.

Contd.

Contd..

Contd
In photography, Black & White photographs are actually shades of gray.

A typical grayscale image is 256 shades of gray ranging from 0 (black) to


255 (white). When converting an RGB color image to grayscale all the color is replaced with shades of gray. Corel Photo-Paint: Image > Convert to... > Grayscale (8-bit). Adobe Photoshop: Image > Mode > Grayscale. Adobe Photoshop Elements: Image > Mode > Grayscale (say OK when asked "Discard Color Information?"). A desaturated image may be slightly darker and can lose some detail compared to the same image in true grayscale.

BINARY IMAGE FORMAT

Contd
A binary file (.bin) is a computer file which may contain any type of data,
encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text. Many binary file formats contain parts that can be interpreted as text; binary files that contain only textual data - without, for example, any formatting information - are called plain text files. In many cases, plain text files are considered to be different from binary files because binary files are made up of more than just plain text. When downloading, a completely functional program without any installer is also often called program binary, or binaries.

CONVERSION CODES
is very difficult to process the picture in RGB or BINARY format. For that

purpose we use several different methods to process the particular image.


Usually we use often the black and white format for processing purpose.

For that purpose we use several conversion algorithms which are not a code but its a inbuilt function in MATLAB.
All these facility are available in MATLAB 7.1 version. Some typical functions do special tasks like:-

Contd
Imqhw- it gives the detail of camera. Vid1=videoinput(winvideo)- Here Vid1 is just a variable in which we

stores the captured picture and winvedio is a function which gives the connectivity of camera. I=getsnapshot(vid)- This function is used to get the snaps of video input. It gives a picture in RGB format A=im2bw(I)- It is used to convert a RGB image into black and white format. B=rgb2gray(I)- It is used to convert an RGB image into gray shade images.

CIRCUIT DESCRIPTION
TR0 BR0 U0
00 00 0 VI GND VO 0

0 v

C0 U0P S TRAN-0 0 00 00
0 VI GND VO 0 0

C0
0 uf 0

C0
.0 uF

U0
VI

BRIDGE

0 0 uf 00

U0
00 00 0 VI GND VO 0 0

U0
00 00 VI GND VO 0 0

U0
00 00 VI GND VO 0

00 00 VO GND 0

RL0
0V 0

RL0
0V 0

RL0
0V 0

RL0
0V 0

RL0
0V 0

C0 R0
0 pf 0

U0 X0
CRYSTAL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 OSC0 /CLKIN OSC0 /CLKOUT RB0 /INT RB0 RB0 RB0 /PGM RB0 RB0 RB0 /PGC RB0 /PGD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

U0 R0
0k 0 0 0 0 0 0 0 0 0 B 0 B 0 B 0 B 0 B 0 B 0 B COM 0 C 0 C 0 C 0 C 0 C 0 C 0 C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0k 0

C0
0 pf 0

R0
0k 0

RA0 0 /AN RA0 0 /AN RA0 0 /AN /VREF-/CVREF RA0 0 /AN /VREF+ RA0 0 /T CKI/C0 OUT RA0 0 /AN /SS/C0 OUT RC0 0 /T OSO/T0 CKI RE0 0 /AN /RD RC0 0 /T OSI/CCP0 RE0 0 /AN /WR RC0 /CCP0 RE0 0 /AN /CS RC0 /SCK/SCL RC0 /SDI/SDA MCLR/Vpp/THV RC0 /SDO RC0 /TX/CK RC0 /RX/DT RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 RD0 /PSP0 PIC00 A F000

R0
0k 0

ULN0000 A 0k 0

R0R0
0k 0

Contd
Fig shows the circuit description of fish segregation. It comprises

microcontroller PIC 16F877A, MAX RS232,Servomotor ,5v regulated power supply, Relay and a few more components. Microcontroller PIC 16F877A is the heart of the circuit. It is a low-power, high-performance, 8-bit microcontroller with 256 Byte of flash programmable and erasable read-only memory (EEPROM) used as on-chip program memory, 368 bytes of RAM used as internal data memory, 35 individually programmable input/output (I/O) lines divided into four 8-bit ports and one 3-bit port, three16-bit programmable timers/counters on-chip oscillator and clock circuitry. A 11 MHz crystal (XTAL1) is used to provide basic clock frequency for the microcontroller.

contd
Port pins RB-0 through RB-4of the microcontroller are configured as an

output port .Output from each pin of the PIC is connected to pin 1 to 5 of USART through resistor R2 TO R6 respectively Output of the USART is connected to the servomotor through relay. Here relay is working as a on/off switch. Pin no 161nd 17 are configured as PWM2 output and PWM1output. PWM1is controlling three servomotor and PWM1 two servomotor. PC sends signal to the PIC, and according to this signal PIC sends signal to the corresponding servomotor for opening the shutter.

HARDWARE DETAILS
PIC(PROGRAMMABLE INTERFACE CONTROLLER) SERVOMOTOR MAX RS232 REGULATED POWER SUPPLY

PIC
High performance RISC CPU Only 35 single word instructions to learn. All single cycle instructions except for program branches which are two

cycle Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle Up to 8K x 14 words of FLASH Program Memory. Up to 368 x 8 bytes of Data Memory (RAM). Up to 256 x 8 bytes of EEPROM Data Memory.

Contd.
Interrupt capability (up to 14 sources). Eight level deep hardware stack. Direct, indirect and relative addressing modes. Power-on Reset (POR). Power-up Timer (PWRT) and Oscillator Start-up Timer (OST). Watchdog Timer (WDT) with its own on-chip RC oscillator

for reliable operation.

Servomotor
A servomotor is a motor which forms part of a servomechanism. The

servomotor is paired with some type of encoder to provide position/speed feedback A servo motor consists of several main parts, the motor and gearbox, a position sensor, an error amplifier and motor driver and a circuit to decode the requested position.

Contd

Contd
The control pulse is feed to a pulse width to voltage converter. This circuit

charges a capacitor at a constant rate while the pulse is high. When the pulse goes low the charge on the capacitor is fed to the output via a suitable buffer amplifier.

Position sensor
The current rotational position of the servo motor output shaft is read by a

sensor. This is normally a potentiometer (variable resistor) which produces a voltage that is related to the absolute angle of the output shaft. The position sensor then feeds its current value into the Error Amplifier which compares the current position with the commanded position from the pulse width to voltage converter.

Error amplifier
The error amplifier is an operational amplifier with negative feedback. It will always try to minimise the difference between the inverting

(negative) and non-inverting (positive) inputs by driving its output is the correct direction. The output of the error amplifier is either a negative or positive voltage representing the difference between its inputs. The error amplifier output is used to drive the motor; If it is positive the motor will turn in one direction, if negative the other.
This allows the error amplifier to reduce the difference

between its inputs and so make the servo go to the commanded position.

Contd..

MAX232
The MAX232 is a dual driver/receiver and typically converts the RX, TX, The MAX232 is an integrated circuit that converts signals

from an RS-232 serial port to signals suitable CTS and RTS signals.
The drivers provide RS-232 voltage level outputs from a

single + 5 V supply. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 V TTL levels. When a MAX232 IC receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15 V, and changes TTL Logic 1 to between -3 to -15 V, and vice versa for converting from RS232 to TTL.

Contd

Regulated power supply

Block diagram

Contd.
# TRANSFORMER # RECTIFIER # FILTER # VOLTAGE REGULATOR

Transformer
Used for voltage transformation. step down transformer used for down-conversion of ac line voltage to a

smaller peak voltage. step down in voltage is achieved by decreasing the voltage and proportionally increasing the current.

Rectifier
Converts the sinusoidal ac voltage in to either positive or negative pulsating

dc. PN junction diode, which conducts when forward biased and practically does not conduct when reverse biased, can be used for rectification. rectifier may be either half wave rectifier or full wave rectifier(centre tap or bridge) type. bridge rectifier is used because output for the entire cycle of input voltage is obtained.

Filter
To reduce ac component from the rectifier output voltage. Capacitive filter s are used with less charging time and more discharging

time. The capacitor is connected across the output of the rectifier in parallel with the load. The RC charge time of the filter capacitor must be short and the RC discharge time must be long to eliminate ripple action when using this filter. In other words, the capacitor must charge up fast with preferably no discharge at all.

Voltage regulator
To maintain a constant dc output voltage. It also rejects any ac ripple voltage that is not removed by the filter. It include protective feature such as short-circuit protection , current

limiting ,thermal shutdown, or over-voltage protection.


Voltage regulator used here is LM7805

LM7805

Contd
The LM7805 is a three terminal positive regulators, available in the TO-220

package and with fixed output voltage 5v, making it useful in a wide range of applications. It employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. Feature. Output Current up to 1A Output Voltages of 5. Thermal Overload Protection Short Circuit Protection Output Transistor Safe Operating Area Protection.

Application
It can be used in determining health of a fish. It can be used for calculating length of a fish in initial stage.

Conclusion and future work


In initial stage different fishes may be of different length .Some fishes are

very small in size and some are larger and when they growth ,small fishes have lesser growth than larger .This leads to loss for farmer .So using this particular setup we can efficiently sort the fishes according to their length and health so that farmer can farm larger and healthy fishes separately.
The project can be a boon for user.

Contd
This project can successfully segregate healthy and unhealthy fishes. This project detects the unhealthy fish at very early stage and thus is very

effective in controlling spread of disease among fishes.


The best thing about this project is that physical presence is not required

and thus the time can be utilised for other tasks.


we dont need to take the fish out of its surrounding and the health of fish is

detected in its own surrounding.

REFERENCES
PIC 16F877 data sheet Digital image processing using matlab by Rafel c Gonzalez. Embedded C programming by raj kamal www.electronics4u.com www.kits&spares.com

THANK YOU

You might also like