Friday, March 6, 2020

Calibration - Seeing Red



So our Pi Wars robot needs to "see red". Forest Fighters are not going to need to pick up different colours as we are not doing the Eco-Disaster challenge autonomously.

However we do want to attempt the Minesweeper challenge which requires detection of red.

Detecting a colour is simplest when the colour space is viewed in HSV as the Hue for a particular colour remains in a tight range independent of the Saturation and Value (Brightness)


HSV_color_solid_cylinder.png: SharkDderivative work: SharkD  Talk - HSV_color_solid_cylinder.png, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=9801673

Normally red hue values appear across the beginning and end of the range which means typically you have to compare across two ranges, twice as much computation, slowing your frame rate and ultimately slowing the robot. In the above example with a cylinder we will assume that red starts at 340 degrees and finishes at 20 degrees creating two ranges 340 to 359 and 0 to 20.
However there is a very neat trick you can do to move the red range to where the blue is by turning the cylinder. So here is the trick....

Rather than telling Open CV that the camera frame is BGR we do an RGB to HSV conversion instead. This means the red hue value rather than being centred on zero is moved to the blue and centered around 170. Making finding red objects much neater.

Take an BGR image from the Pi Camera and in Python Open CV use:
     imgHSV = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)

Then look for your red object where the blue would be. Simples!!!

Colour detection needs good lighting  ( or at least constant lighting ) and at the event the lighting will be very different to how we have been testing, so we have a spare Pi with camera,a 3.5" touch screen and power bank attached to do some calibration testing.

Note the HSV range is displayed across the top of the screen and some on screen "buttons" allow us to change the values.

Pi Calibration - Ready to "See Red"

Some video of the calibration program in action.






Monday, March 2, 2020

Look out! Here comes Audrey 3!


Amy has finished painting Audrey III!


For comparison. Here is Audrey pre-makeover.


She used 5 different paints all brought from the Model Railway Shop mentioned in the last post: a mid-tone green, a dark blue, a tan-yellow colour, a crimson and an off-white.
The colours weren't ideal since the tops of the lids misleading but Amy is still very happy with the project. She even made some gradients along the leaves, tentacles??? and body of the plant.


Now that Audrey has successfully taken over Eumiísdahd's table, there is no doubt he'll be able to take over the world!




Sunday, March 1, 2020

Neat Plans and Spray Cans

Over the weekend, Amiessdad and Amy have decided to get to work on smoothing, priming and painting the robot!

We purchased some spray paint and primer from our local art supplies store and made sure to stay protected from inhaling too much paint!


These may also come in handy in the event of a coronavirus outbreak... (;'∀`)


Unfortunately, both Amy and Umiesdoahd have forgotten to take any kind of process pictures but it mostly consisted of taking the robot apart, using a 3D pen to fill in holes in the print, painting it and putting it back together. 

The gang also bought some small paints, faux grass and little pieces of shrubbery from a model railway store. However, Amy has been refrained from putting  a l l   t h e   p l a n t s  onto the robot because she has been warned they may fall off if kept on for weeks before the event. 

Stay tuned for a future blog update where she paints Audrey!