This is the source code of fish-o-tron, built at Fishackathon London. This source is used in the length calculation algorithm. For the code of the web-app in the link above, visit here.
This source code uses multithread operations to handle image pooling from the webcam and parallel processes to send images and data to the server. In non-technical terms, while the program is sending data to the server, the camera and length-recording subroutines runs normally without synchronous blocking.
Required only if using Android's camera rather than webcam:
mkdir build
cd build
cmake ../
make
./json ip-address-of-camera
- Detect the chilitags on the image
- Warp the perspective of the image and clip the portion of image surrounded by the 4 corners
- Convert the clipped portion into a grayscale image
- Carry out edge detection (Sobel Operator) on the image
- Filter out pixels which are not representative of the distribution
- Carry out minimum bounding rectangle algorithm on the filtrate of the above process to determine the rectangles points
- Calculate the length and width of the rectangle based on information obtain from several frame
- Remove annomalies from the obtain data
- Output the assumed length and width after annomaly detection
- Calculate the length and width of camera using above the algorithm
- Take a snapshot of the image
- Spawn a new process to upload the image to AWS S3 and data to public fish server
- Terminate child process