OpenCV and Python Color Detection – PyImageSearch

I am working on some stuff at the Makerspace that involves computer vision. Hopefully this information will help. Currently we are trying to do this another way, but it is just getting to be more complicated than I think it should be.

Python code for taking a photo and saving it:

Import picamera
camera = picamera.PiCamera()
camera.capture('image.png')

https://www.raspberrypi.org/documentation/usage/camera/python/README.md

Button Pressed code:

import os
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.setup(18, GPIO.OUT)

def loop():
    if (GPIO.input(23) == False):
        os.system('Enter the command to execute your code')

    if Test == "open":
        GPIO.output(18, True)
    else:
        GPIO.output(18, False)
loop()
finally:
    GPIO.cleanup()

This should listen for the button to be pressed, then it will run your code. If the code returns Test as “open”, Pin 18 goes high.

The image detection part of the code. I have yet to get this going.

http://www.pyimagesearch.com/2014/08/04/opencv-python-color-detection/