Identify lamps ON and to identify the frame in Video
Version 1.0.0 (2.59 KB) by
Mrutyunjaya Hiremath
There are only two lamps and need to identify the frame number when each lamp is on and which lamp (lamp number) is on
There are only two lamps and you need to identify the frame number when each lamp is on and which lamp (lamp number) is on, you can follow these % steps:
1. Read the video and extract the first frame where all lamps are off.
2. Convert the first frame to grayscale for frame differencing.
3. Iterate through the remaining frames in the video.
4. For each frame, convert it to grayscale.
5. Perform frame differencing by taking the absolute difference between the current frame and the first frame.
6. Threshold the frame difference to create a binary image, highlighting regions with significant changes (potential lamp regions).
7. Use connected component analysis to find and label connected regions in the binary image.
8. Analyze the labeled regions to identify which lamp is turned on based on their spatial locations.
9. Record the frame number and the lamp number (1 or 2) whenever a lamp is detected as on.
10. Draw bounding boxes or other markers around the detected lamps in each frame to visualize the results.
11. Display each frame with the detected lamps and their corresponding frame and lamp numbers for manual inspection or further analysis.
Cite As
Mrutyunjaya Hiremath (2024). Identify lamps ON and to identify the frame in Video (https://www.mathworks.com/matlabcentral/fileexchange/133112-identify-lamps-on-and-to-identify-the-frame-in-video), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2019b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |