detecting red color spots in real time video i.e. video is not stored on hard disk

Hi all! my question is like this... an ultrasonic scanning probe is hovered above a metal rod to scan for defects.The scan can be seen on display connected to this probe. This scan is a colored video in which the defects are red colored. My aim to track the red colored spots in real time and generate a signal 1/0. I mean as we move the probe across the length of rod our algorithm should give a signal immediately whenever there is a red spot. the video generated by probe is 60 frame/sec. Also this video is not stored as file,we see video as we scan rod. I do not need to show the red spots ,but instead generate a signal 1 for red spot and 0 for no red spot. How can this be achieved,any idea. Thanks

 Accepted Answer

See my attached demo where I track green items in a video. You can change it to call getsnapshot() instead of read() so that you get a video frame.
Here's a more primitive and limited version that someone else posted: http://www.mathworks.com/matlabcentral/fileexchange/28757-tracking-red-color-objects-using-matlab

4 Comments

This code works good.Thanks. I do not need to filter out red color in video but generate a signal of type 1/0. I am trying to implement it on a video of red green M&Ms candies...because this video is analogous to video we get from ultrasonic probe. In video,M&Ms will move in straight line in random sequence like...red green red green green red red green.....and so on. My aim is to generate a 1 whenever software detects a red M&M in video. Thanks
i am using more than one images stored in a folder and displaying the defects in those images one by one .My matlab code is written in two separate files(namely try2, try4) in same directory .This code displays 2 images side by side.. original image and binary image of defect in original image. i need help with writing code to plot a 3rd figure displaying a plot of (percentage of defect area) vs (time) for each image in the folder. Here,percentage of defect area = (defect area/ total area of original image) X 100
Just use subplot
subplot(2,2,1);
imshow(firstImage);
subplot(2,2,2);
imshow(secondImage);
subplot(2,2,3);
plot(t, areaFractions);
but how to find areafractions. I am using percentage= (pixels in defect)/(total pixels in binary image).For calculating pixels i have used 'count' in for loop in try2m. But i'm not able to make the plot run, i don't know how to program... my try4.m file uses code from try2.m. I don't know how to code in try4 so that this file knows how to calculate percentage of defected pixels from file try2.m

Sign in to comment.

More Answers (0)

Categories

Asked:

on 6 Nov 2014

Commented:

on 9 Nov 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!