Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
lewuus
lewuus'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
processing videoLib video starts itself ? quick help needet...
[0 Replies]
18-Jul-2010 06:00 AM
Forum:
Core Library Questions
hi there !
I use processing video library to read a quicktime movie and
i use openCV library to grap a video from my i-sight.
Via reactivision i want to playback the movie when
i hold a marker into the camera
(but this is not a reactivision problem...)
Most of the code works fine
(video grapping and playing or pausing the movie when a marker appears.)
BUT when Im running the code,
first of all the sound of the movie plays
(means its running without beeing displayed, because theres no marker).
I tried it with for example...
void mousePressed() {
pressed = true;
myMovie.stop();
}
... and it stops for about 3 seconds,
but then it starts again at the beginning.
Summarized, my problem is that the quicktime file
starts whithout being asked do do that.
once the movie is finnished one time, everything works just normal.
thanks for your help,
import fullscreen.*;
import japplemenubar.*;
import hypermedia.video.*;
OpenCV opencv;
import processing.video.*;
Movie myMovie;
import TUIO.*;
TuioProcessing tuioClient;
// these are some helper variables which are used
// to create scalable graphical feedback
float cursor_size = 15;
float object_size = 60;
float table_size = 760;
float scale_factor = 1;
PFont font;
FullScreen fs;
PImage a;
PFont font_S;
PFont font_M;
PFont font_L;
void setup()
{
//size(screen.width,screen.height);
size(1280,755,P2D);
// Create the fullscreen object
fs = new FullScreen(this);
// enter fullscreen mode
fs.enter();
a = loadImage("Hintergrundseite02.png"); // Load the image into the program
noStroke();
fill(0);
opencv = new OpenCV( this );
opencv.capture( 800, 590 ); // open video stream
loop();
frameRate(30);
//noLoop();
hint(ENABLE_NATIVE_FONTS);
font = createFont("Arial", 18);
scale_factor = height/table_size;
tuioClient = new TuioProcessing(this);
myMovie = new Movie(this, "plastivideoMINI.mov");
// Load and play the video in a loop
// myMovie.loop();
}
// within the draw method we retrieve a Vector (List) of TuioObject and TuioCursor (polling)
// from the TuioProcessing client and then loop over both lists to draw the graphical feedback.
void draw()
{
myMovie.pause(); //doesn´t do anything ... why?
background (40);
smooth ();
image(a, 0, 0);
opencv.read(); // grab frame from camera
image( opencv.image(), 450, 150 ); // and display image
noStroke();
fill(255,40);
rect (450, 150,800, 100); //oben
rect (450,250,70,460); //links
rect (1180, 250, 70, 460); //rechts
rect (450, 710,800, 30); //unten
textFont(font,18*scale_factor);
float obj_size = object_size*scale_factor;
float cur_size = cursor_size*scale_factor;
Vector tuioObjectList = tuioClient.getTuioObjects();
for (int i=0;i<tuioObjectList.size();i++) {
TuioObject tobj = (TuioObject)tuioObjectList.elementAt(i);
stroke(0);
fill(0);
pushMatrix();
translate(tobj.getScreenX(width),tobj.getScreenY(height));
rotate(tobj.getAngle());
image(myMovie,0, 300);
myMovie.play();
popMatrix();
}
Vector tuioCursorList = tuioClient.getTuioCursors();
for (int i=0;i<tuioCursorList.size();i++) {
TuioCursor tcur = (TuioCursor)tuioCursorList.elementAt(i);
Vector pointList = tcur.getPath();
if (pointList.size()>0) {
stroke(0,0,255);
TuioPoint start_point = (TuioPoint)pointList.firstElement();;
for (int j=0;j<pointList.size();j++) {
TuioPoint end_point = (TuioPoint)pointList.elementAt(j);
line(start_point.getScreenX(width),start_point.getScreenY(height),end_point.getScreenX(width),end_point.getScreenY(height));
start_point = end_point;
}
stroke(192,192,192);
fill(192,192,192);
ellipse( tcur.getScreenX(width), tcur.getScreenY(height),cur_size,cur_size);
fill(0);
text(""+ tcur.getCursorID(), tcur.getScreenX(width)-5, tcur.getScreenY(height)+5);
}
}
}
// these callback methods are called whenever a TUIO event occurs
// called when an object is added to the scene
void addTuioObject(TuioObject tobj) {
println("add object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
}
// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj) {
println("remove object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
}
// called when an object is moved
void updateTuioObject (TuioObject tobj) {
println("update object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()
+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
}
// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
println("add cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY());
}
// called when a cursor is moved
void updateTuioCursor (TuioCursor tcur) {
println("update cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY()
+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
}
// called when a cursor is removed from the scene
void removeTuioCursor(TuioCursor tcur) {
println("remove cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
}
// called after each message bundle
// representing the end of an image frame
void refresh(TuioTime bundleTime) {
redraw();
}
«Prev
Next »
Moderate user : lewuus
Forum