Hi,
Can anybody suggest a way of playing back a MOV file (640*480 using animation lossless codec) at 60fps, and being able to jump to any frame number.
I have a requirment to play the video at exactly 60 fps, and every so often sync the video with an external signal whcih is coming in via a serial connection.
Currently, I can only seem to get about 35 fps or so using P2D which seems to be the fastest mode. If I import a series of TIF images, i can easily get more than 60 fps, so is it being throttled by the buffering speed of the video being loaded?
heres the code. Thanks!
int x=0;
int y=0;
import processing.video.*;
Movie myMovie;
void setup() {
size(640,480,P2D);
frameRate(60);
myMovie = new Movie(this, "skulls.mov");
myMovie.loop();
}
I have a requirement to measure the rotational position of a rotating cylinder and sync it to a processing program that is projecting on it.
The cylinder will be rotating at appromimately 30hz, and I need to know the time at which it completes a full rotation, so if the cyl is marker from 1 to 360 degrees, I need the draw routine to know at what point it has passed 0 degrees.
So far , i have tried using an old mouse, and took the ball out and used the IR / detecter emmiter to try to track a moving tab that passed between them, but this did not work, as the mouse used quaderature interference to tell which direction the mouse wheel moves and will only work with the small circular grating found in mice, and not with a simple blocking of the signal. The other problem, is that I think mice only interupt at about 125 hz, so this would probably not give an accurate position of the cylinder, as those 125 pulses would be spread over 30 rotations and only give a resolution of about 85 degrees.
My next idea is to use the minim library and record the noise of the cylinder hitting a small flexible tag on each rotation, and then use beat detection to tell how far appart the noises are which would also give the speed of the rotation.
Can anybody think of a better way??
Ideally an LED / Light detector shining through a hole in a disc would be best but can't think of a way of reading this into processing without custom hardware.
Hi, I'm writing an application that drives a video signal to a projector for use with high speed structured light patterns and require the signal to be exactly 60hz . The problem is that the computations done per pixel vary per frame so each frame can take a different time to render. I can get the program running at around 60hz but it tends to wander between 59 and 61 hz. I can get it a bit better by counting the millis since the program began and only output a frame every 16.666 ms (1/60th sec). I do this by using the the current number of millis from the next multiple of 16.666 and then use the delay command to wait for for a number of milliseconds before the screen update. Can anybody think of a better way to do this ? I'm using p2d as the performance of OpenGL is very poor in comparison. Also can anybody thi k of a way of sleeping less than 1millisecond ?
Hi,
I have a requirement to make a mov file using using teh moviemaker class, but have hit a problem in that I need to make the fps of the movie 59.6 fps, and current class only seems to allow for whole numbers and not decimals.
I've tried re-encoding my 60fps file (which uses the Animation - lossless) setting , in sony vegas using the correct frame rate, but cannot seem to get it totally lossless, as that software only offers, 'best' settings which do not seemt to be getting encoded as lossless. For my project, it is essential that the output file is 100% totally lossless.
Hi,
Can anybody tell me how I might go about rendering the interaction between 2 3d object meshes.
for example If I import a 3ds mesh of a sphere, and a flat plane, and I have them intersected, I wish to render the resulting circle which is at the point of intersection between the 2 objects. Or if i imported a model of a person, and moved the plane through them, the result would be looking at an MRI scan, a series of human cross sections.
Hi, I'm currently writing a piece of code for visualising slices of a 3d object created from a depth map. The depth map is a 1024*1024 8 bit greyscale BMP file.
The problem I have is that the image() command which writes out the image does not seem to refresh the pixels rather, it waits in until the program has finished looping though all the frames before outputing the image, which contains every frame of animation.
I need it to fresh the screen at exactly 60hz.
regards
Gavin
import processing.opengl.*;
PImage img;
PImage destination;
int[] numbers = new int[25]; // Array of bit masks used to update individual color bit positions.
int h = 1;
void draw() {
loadPixels();
// Since we are going to access the image's pixels too
int z = 0;
img.loadPixels();
for (int l = 1;l < 240;l++) {
if (z > 240) {
z = z - 240;
}
h=h+1;
for (int x = 0; x < width; x++) {
int loc = x + z*width;
int bright = round(brightness(img.pixels[loc]));
float multi = 1;
int offset = round(bright * multi);
int lox = x + (240-offset)*width;
// destination.pixels[lox] = color(55,z,66);
destination.pixels[lox] = destination.pixels[lox] | (0x00FFFFFF & numbers[h]);
// output.pixels[i] = output.pixels[i] | (myMovie.pixels[i] & 0x00FFFFFF & numbers[framepos]);
}
if (h == 24) {
destination.updatePixels();
println("hello");
delay(40);
image(destination, 0, 0);
h = 0;
}