Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
hammedhaaret
hammedhaaret's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
problem using tracking in OpenCV
[1 Reply]
18-Nov-2010 01:26 PM
Forum:
Contributed Library Questions
Hi!
I'm trying to do some simple motion tracking with processing and the OpenCV library.
my programming skills are bare minimum, but I'm eager to learn and excited at how fast processing is at getting visible results.
anyway, what ive got untill now is this:
import hypermedia.video.*; // Imports the OpenCV library
OpenCV opencv; // Creates a new OpenCV Object
void setup() {
size( 480, 320 );
opencv = new OpenCV( this ); // Initialises the OpenCV object
opencv.capture( 480, 320 ); // Opens a video capture stream
}
void draw() {
opencv.read(); // Grabs a frame from the camera
opencv.absDiff(); // Calculates the absolute difference
opencv.convert( OpenCV.GRAY );
opencv.blur( OpenCV.BLUR, 4 );
opencv.threshold(10);
opencv.remember(); // Remembers the current frame
Blob[] blobs = opencv.blobs(20, 200, 4, true, 200); //Blob detection
stroke(255,0,0);
println(blobs.length);
if(blobs.length <= 1) {
float midtpunktx = blobs[0].centroid.x;
float midtpunkty = blobs[0].centroid.y;
rect(midtpunktx-5, midtpunkty-5, 10, 10); //drawing rectangle at blobs[0]
}
image( opencv.image(), 0, 0 ); // Display the difference image
opencv.restore();
}
up until blob detection it gives me a black/white image of the motion in frame.
Then I'm trying to get the x and y coordinates from the largest blob.
which doesn't seem to work.
blob.length returns "0" no matter how I tweak the settings of opencv.blobs()
Ive tried different solutions and asked a programmer friend for help, but nothing yielded results.
If anyone can help me out, It will greatly appriciated.
-hammedhaaret
«Prev
Next »
Moderate user : hammedhaaret
Forum