Your device will most likely consist of 3 components:
In the industrial world many small parts need to be sorted.
Usually a snake feeder is used to extract individual parts:
It can be seen in action here: https://www.youtube.com/watch?v=TkSPxxsz-j8
For examining the parts usually a conveyor belt is used with a camera and machine vision with OpenCV.
An example conveyor belt with sorter is shown here:
For sorting one can use mechanical flaps or compressed air or a robotic arm:
I recommend using GRIP and USB camera to identify the objects. GRIP can be obtained here: https://github.com/WPIRoboticsProjects/GRIP/releases
Develop a pipeline as explained in class. You will want a pipeline that detects one object only. Then develop a pipeline for the other object and so on.
You can run GRIP on your notebook computer and use the same USB camera as you will use on RasPi
In GRIP generate code and select python. Save the file and name it for the object it can detect.
Each file will have a class called GripPipeline. You will want to merge the files for all the objects into one file grip.py. You can rename the class GripPipeline in the file to GripPiplineSmallScrew for example. You will have as many pipelines as you have objects to detect.
In your main program:
from grip.py import GripPipelineSmallScrew
from grip.py import GripPipelineBigScrew
from grip.py import GripPipelineNut
gpSmallScrew = GripePipelineSmallScrew()
..
While loop
img = read camera
gpSmallScrew.process(img)
gpBigScrew.process(img)
results are in
gpSmallScrew.countours.... # check your python file what they were named
# Contours Found
decide which contours were found
# No matching contour
Grabage
# No contour
Garbage
Alternatively you can follow these instructions:
https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/
Demo of subsystems that work:
Second to last week of class
Last week of class