We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Getting this error:
2016-04-12 13:35:41.560 java[13582:1313660] Surface is the wrong size: Can’t find surface
2016-04-12 13:35:41.560 java[13582:1313660] Surface is the wrong size: 1280 720 vs 320.000000 240.000000
The cause is a settings mimatch between CamTwist and the Processing Video Library and I can resolve this by setting the CamTwist Studio video settings to 320 x 240 though this is entirely useless as it is far too small. I need to get the 720p output of CamTwist. When I run the processing sketch, the video library returns all available cameras and the biggest resolution it gets from CamTwist is 320 x 240 even though the program is set to, and is capable of outputting 1280 x 720.
My question is why isn't processing picking up the 720p output and how can I make it see it. Any help would be appreciated.
Using CamTwist 3.1Beta, OSX 10.11.something and Processing 3
I know this looks like a clone of this thread but I thought better of simply repurposing that thread.
Here's my code:
Main:
import processing.video.*;
Movie mov;
Capture cam;
Timer timer;
int countdownSecs = 1;
void setup()//--------------------------------------------------------------
{
//fullScreen();
size(320, 240);
timer = new Timer(width/2, height/2);
mov = new Movie(this, "Dimension Loop 1.mp4");
mov.play();
String[] cameras = Capture.list();
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, cameras[0]);
cam.start();
}
}
void draw()//---------------------------------------------------------------
{
//noCursor();
if (cam.available() == true) {
cam.read();
}
image(mov, 0, 0, width, height); //displays the movie behind the webcam
//image(cam, 0, 0, width, height); //displays the webcam top left
pushMatrix();
scale(-1, 1); //reverses the webcam image
image(cam.get(), -width, 0, width, height);
popMatrix();
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
timer.DisplayTime();
if (timer.theTime == countdownSecs)
{
capture();
}
}
void mouseReleased()//--------------------------------------------------------
{
//if ((key == 's') || (key == 'S'))
//{
timer.start();
timer.currentTime();
//}
}
void capture()//------------------------------------------------------------
{
timer.start();
timer.pause();
println("captured");
saveFrame("Open Day Photos/CGD-PhotoBooth-2016-######.png");
}
void movieEvent(Movie m)
{
m.read();
}
Timer Class:
class Timer
{
long startTime; // time in msecs that timer started
long timeSoFar; // use to hold total time of run so far, useful in
// conjunction with pause
boolean running;
int x, y, theTime;
Timer(int posX, int posY)//-----------------------------------
{
x = posX;
y = posY;
running = false;
timeSoFar = 0;
}
int currentTime()//----------------------------------------------------------
{
if (running)
{
return ((int)((millis() - startTime) / 1000.0));
} else
{
return ((int)(timeSoFar / 1000.0));
}
}
void start()//---------------------------------------------------------------
{
running = true;
startTime = millis();
}
void restart()//-------------------------------------------------------------
// reset the timer to zero and restart, identical to start
{
start();
}
void pause()//--------------------------------------------------------------
{
if (running)
{
timeSoFar = millis() - startTime ;
running = false ;
}
}
void DisplayTime()//---------------------------------------------------------
{
String output = "";
theTime = currentTime();
output = output + theTime;
fill(150, 0, 200);
//textSize(500);
//textAlign(CENTER);
//text(output, x, y);
}
}
Answers
Bumping to see if there's anyone who can help? It's kind of a time crunch.
https://GitHub.com/processing/processing-video/issues
https://GitHub.com/processing/processing-video/issues/50