Before detecting fish using Raspberry Pi, I need to detect fish on computer. In this case, I choose Windows 8.1 platform and Visual Studio for running the C++ code for detecting fish. The original image is taken from the fish lab in university, I choose one for detection,
Figure 1: Original image for fish
After processing, the picture is shown as follows:
Figure 2: Processed image
As shown in Figure 2, the color of background has been changed to the black and the color of noise changed to gray, the edge of fish has been changed to white, so that I need to count the number of white pixels which is shown in the window behind of processed image. In this case, the number of white pixels is 110.
Then process another image which does not have fish as shown in Figure 3,
Figure 3: No fish in image
The processed image is shown as following,
Figure 4: Processed image
There are only noise on the processed image and the number of white pixels is 4. After statistics, the threshold value can be set 10. If the the number of white pixels are larger than 10, the feeder will be rotating because fish is detected, otherwise, the feeder does not operate.
No comments:
Post a Comment