How to play a movie automatically followed by a recognition of light

i want to play a movie automatically when i turn off the light (of a small room). i think maybe i can use the cam of my macbook..

is this possible with processing? how can i make this?


  • Step 1: Can you write a small program that prints something out when it recognizes light?

    Step 2: Can you write a small program that plays a movie?

    Step 3: Can you combine those two small programs?

    Which step are you stuck on? What code have you written so far? What has google told you? What tutorials are you reading?

    It's hard to answer general "how do I do this" type questions. It's much easier to help you with specific technical questions: "I tried X, expected Y, but got Z instead. What am I doing wrong in this code?"

  • @elize:: i think (never tried!!!) that it is possible:: you start capture && loadPixels() and you can do that even without displaying on screen any result. You analyze some part of the image captured which could not be affected by movement; when the light is off the result must be that all pixels in the tested zone are black or quite black (you can precise a threshold); at this moment you have a call for another method which stops the capture (or the analyze) && starts the movie. Another way could be to use android && light sensors from your phone, linking it to your processing app. Android provides way to aceed light sensors on runtime, so in this case it s not only "light on/lightOff" but much more sensitive. Third solution, much more complicated and depending of the OS could be to get the values directly from your computer, which has light sensors. On OSX the values from lightSensor (whih is near the cam, on the left) can be acceded by code, but that is objectiveC!!!!

  • @KevinWorkman ; oh yes sorry and tnx. but actually i just needed the 'possibility' with processing(cuz im a real beginner), and if the answer is yes, i needed some 'keywords' for this. like 'capture', 'loadPixels' which are @akenaton answers for me. then i can find my self some way to go. Anyway. thanks for your advice.

  • @akenaton ; thank you for your nice answer. i would test the first one and try the second one you recommended. thank you so much.

Sign In or Register to comment.