Intro: Dancing Traffic Light
A very interesting concept i see in the web to make pedestrians to wait in the signal its dancing traffic. Here i explore simple image processing code to out put the data to led matrix display.
Did your own image Processing code with out any third party tool
Step 1: Materials Required
Materials required and used
1) Laptop or PC (To display the actual) - 1 No
PC Configuration greater than or equal to 2 GB RAM, Windows XP (using windows7 or windows8 may cause problem in connected to the camera, at the first time its work fine when stop the camera and start it not connected, want to restart the system to connect again. But in Windows XP its work very very fine), Pentium dual core or more, low disk space is enough
2) Monitor (To see the result) - 1No
3) Camera (I use web camera integrated with the pc. For more resoultion use seperate camera)- 1No
4) Back Screen, Lights.
1) VB.net 2005
no other third party tool is required for image processing
For display in street (not used by my currently)
I have micro controllers but large LED matrix display cost very high so it simulate the output in a CRT Monitor to see the result.
2) LED matrix display.
Step 2: Plan and Concept
1) Capture image from camera.
2) Lighting must be perfect to avoid shadow while perform.
3) As per LED matrix planned reduce the image size.
4) Extract the person before the camera. Use pixel matching to extract the image. For that first store the background image separately and compare that image with the current image, then extract the difference image. (Green screen also use as per availability).
5) Now Store the extracted image in a separate picture box.
6) Extracted image is a binary image where background is set as black and object (person) is set as white.
7) if the led matrix is 32 X 32 then the extracted image is also 32 X 32. So as per each pixel in the image, if the pixel is black then off the led or if white then switch on the led.
8) Continue the loop from 1 again.
Step 3: Setup Computer
1) Place the PC on the desk opposite to the stage and focus the camera to cover the whole person.
2) Keep the extra monitor on the side to view the output in that monitor.
3) Make that monitor as extended monitor.
Step 4: Screen Design
1) Create three forms.
Form1-To process the commands and get result.
Form2-Display the actual get from the camera in full screen.
Form3-Display the result going to publish in the LED display.
Form1 Contains 4 Picture boxes as shown in the picture. A menu bar contain menus start and stop image capture, Drop down combo to set the threshold and a button to set the back ground image
Form2 contains a picture box to display the actual camera image
Form3 contains a picture box to display the out put image look alike in LED display.
Step 5: Coding Startup
1) Open VB.net 2005 and create new application.
2) API (application program interface) used in the program to fetch result image from the camera are
SendMessage (Send queries to the device and retrieve the results)
capCreateCaptureWindowA (creates a capture window)
capGetDriverDescriptionA (retrieves the version description of the capture driver)
3) When pixel matching want to done go through full x and y axis of the image. If u get each pixel in x an y axis and compare its take long time and video is like a slide show. So to over come that image is converted to array and compare that array, save the result in a new array and convert that array to image again.
Some Changes as per your needs in program
To change the LED display size change the declaration dw(no of led in width) and dh (no of led in height)
To change the round led to rectangle led Change comment the FillEllipse and uncomment the FillRectangle in the last of CompareImage2 sub program.
(Coding is attached with this step)
Step 6: Test With Jpg Image
1) Test the output with jpg image loaded to the picture box.
2) Input the blank screen in the first box.
3) Input the image in the second box.
4) see the result. If all the lighting and background is correct the result is amazing like this).
Step 7: Run the Program
1) Press F5 to run the program.
2) Form 1 Run on the screen.
3) Click the command menu and click start.
4) Web cam image display in the second picture box in the left.
5) with no one in the stage click set background. Image in the second picture display in the first picture box in the left.
6) Here after if any one go to stage the difference show in the third picture box in the left and big picture box in the right.
7) Now double click the third picture box in the left.
8) Form2 and Form3 loaded .
9) Move any one form to the extended monitor and double click the picture box it shows the output in the full extended, Click the other form in the same monitor to see the actual in the same monitor.
10) Now all ready go and dance before the camera. See how u dance in one monitor and how it reflect as led in second monitor. If u have LED panel connect it and see display outside.
Step 8: Setup the Stage
1) Any color in the background is not a problem. But the same color in the person make hallow in that place.(its fine if use same color curtains as background)
2) Cover the person from top to foot fully.
3) Lighting must be from four sides with same luminance. It avoid drop of shadow in the floor and also give clarity to the person (I use few lighting available).
Step 9: Output Result in Picture
See how u look in LED. Dance, run, Climb any thing u do reflect like led display in second monitor. If u have led display connect it to the computer through micro controller and send the result matrix to the led display through Serial communication. See the result.
Step 10: Dancing Hand Video
Make the hand dance and converted to led Display.
Step 11: Dance Videos
I am not a good dancer. To show u the result with my little arrangement.
On working with pixels in image u can able to do lot of works like dilution, Erosion, Blobing, Edge detection, Motion detection etc with out any third party tools. And implement it in various fields.
Thank you very much for read my instructable......