I have two capacitive sensors ........i am trying to do is if some one touch capacitive sensor 1 then a JPEG will be shown
and if capacitive sensor2 is touched then a movie will play.......
I have done this by serial communication..
I can switch them easily by touching sensors. JPEG is perfectly working and when i touch sensor to play a movie ..... movie runs in background only i can hear sound of movie.
Here is my code
import processing.opengl.*;
import codeanticode.gsvideo.*;
import codeanticode.glgraphics.*;
import processing.serial.*;
Serial port;
GSMovie myMovie;
GSMovie nowPlaying;
GLTexture tex;
PImage img1;
int val1 = 0;
void setup() {
size(960, 540, GLConstants.GLGRAPHICS);
background(0);
//frameRate(60);
img1 = loadImage("00.jpg");
tex = new GLTexture(this);
myMovie = new GSMovie(this, "solar1.mov" );
nowPlaying = myMovie;
println(Serial.list());
// print a list of all available ports
port = new Serial(this, Serial.list()[1], 9600);
}
void draw()
{
if ( port.available() > 0) { // If data is available,
I am working on face-detection. All of face-detection sketches(simple example with large window size or
this example)
working fine but after 5-8 minutes they getting hang and gives an error "Outof memoryError: you may need to increase the memory in preferences ".
I already adjust memory in preference settings to 1502.
I am trying to play a video on my android device. I uploaded the program successfully on my android device but when i tried to play that, it shows me
"cannot play video"...I am using window XP, processing 2.0b6 and video is in data folder of processing sketch.
Here is my code
import apwidgets.*;
APVideoView videoView;
APWidgetContainer container;
void setup()
{
container = new APWidgetContainer(this); //create a new widget container
videoView = new APVideoView(10, 50, 1200, 780, false); //create a new video view, without media controller
videoView.setVideoPath("/sdcard/VID-WA0000.mp4"); //specify the path to the video file
container.addWidget(videoView); //place the video view in the container
videoView.start(); //start playing the video
videoView.setLooping(true); //restart the video when the end of the file is reached
}
void draw()
{
background(255); //black background
text(videoView.getDuration(), 10, 10); //display the length of the video in milliseconds
text(videoView.getCurrentPosition(), 10, 30); //visa hur långt videon spelats
I tried to play movie in processing 2.0b7 using opengl library but it gives me error.
Please don't suggest me for processing1.5 becuase i need to play a movie when a face is detected and i am doing this by OPENCV(opencv is not compatible with processing 1.5)
Need your valuable suggestions
Thanking you in anticipation. Here is error given by processing....
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: processing/opengl/PGraphicsOpenGL$ImageCache
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getConstructor(Class.java:1657)
at processing.core.PApplet.makeGraphics(PApplet.java:1743)
at processing.core.PApplet.size(PApplet.java:1596)
at processing.core.PApplet.size(PApplet.java:1567)
at sketch_130226c.setup(sketch_130226c.java:42)
at processing.core.PApplet.handleDraw(PApplet.java:2117)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
I want to do the transition of images with respect to the intensity of light strike on LDR.
I manipulate the output of LDR from 1 to 10 in arduino and there is 10 images in processing, i want those images in processing to change with respect to the LDR output.
But i am getting this error......
error, disabling serialEvent() for //./COM3
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at processing.serial.Serial.serialEvent(Unknown Source)
at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
at gnu.io.RXTXPort.eventLoop(Native Method)
at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
Caused by: java.lang.NullPointerException
at processing.core.PGraphics.image(PGraphics.java:3541)
at processing.core.PApplet.image(PApplet.java:11912)
at transition_of_images.serialEvent(transition_of_images.java:65)
... 8 more
Here is my code
import processing.serial.*;
Serial myPort;
PImage[] imgs;
int nbr_of_images;
float transitionFrames = 30;
int displayFrames = 50;
float fadeValue = 0;
float img_Actual;
float img_Next;
void setup() {
size(1440, 900);
nbr_of_images = 10;
imgs = new PImage[nbr_of_images];
println(Serial.list());
// print a list of all available ports
myPort = new Serial(this, Serial.list()[1], 9600);
myPort.bufferUntil('\n');
for (int i = 0; i < nbr_of_images; i++)
{
imgs[i] = loadImage(nf(i, 2) + ".JPG");
}
}
void draw () {
// everything happens in the serialEvent()
}
void serialEvent (Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');
// convert to an int and map to the screen height:
I want to do the transition of images with respect to the intensity of light strike on LDR.
I manipulate the output of LDR from 1 to 10 and there is 10 images in processing, i want those images in processing to change with respect to the LDR output.
I have code for transition of images without LDR but i can't manipulate it for the LDR.
Here is the code for transition of images
PImage[] imgs;
int nbr_of_images, img_no;
float transitionFrames = 50; // number of frames for transition
int displayFrames = 250; // number of frames each image shall be displayed
float fadeValue = 0;
void setup() {
size(1440, 900);
nbr_of_images = 10;
img_no = 0;
imgs = new PImage[nbr_of_images];
imgs[1] = loadImage("img1.JPG");
imgs[2] = loadImage("img2.JPG");
imgs[3] = loadImage("img3.JPG");
imgs[4] = loadImage("img4.JPG");
imgs[5] = loadImage("img5.JPG");
imgs[6] = loadImage("img6.JPG");
imgs[7] = loadImage("img7.JPG");
imgs[8] = loadImage("img8.JPG");
imgs[9] = loadImage("img9.JPG");
imgs[10] = loadImage("img10.JPG");
}
void draw() {
background(255);
// full opacity for image in background
tint(255);
image(imgs[img_no], 0, 0);
// fade foreground-image using tint()
tint(255, lerp(0,255,fadeValue));
image(imgs[(img_no+1)%nbr_of_images], 0, 0);
// change image and reset fadeValue
if (frameCount % (displayFrames) == 0){
img_no = (img_no + 1) % nbr_of_images;
fadeValue = 0;
}
// increase opacity of second image
fadeValue = fadeValue+1/transitionFrames;
}
ARDUINO code for LDR
const int numReadings = 10;
int readings[numReadings]; // the readings from the analog input
int index = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average
int inputPin = A0;
void setup()
{
// initialize serial communication with computer:
Serial.begin(9600);
// initialize all the readings to 0:
for (int thisReading = 0; thisReading < numReadings; thisReading++)
I m new to processing. By using nyartoolkit, saito.objloader(3D library) library, I m trying to import a .obj(3D file) model in processing . But everytime i run the program i got the .obj model just near to marker not on the top of marker. So how can i place the .obj model exact on the marker? And there is no proper tracking between the .obj(3D image) and the pattern.
thanking you in anticipation
requesting response
here is my code
import java.io.*; // for the loadPatternFilenames() function
import processing.opengl.*; // for OPENGL rendering
import jp.nyatla.nyar4psg.*; // the NyARToolkit Processing library
import codeanticode.gsvideo.*; // the GSVideo library
import codeanticode.glgraphics.*;
import saito.objloader.*;
MultiMarker nya;
GSCapture cam;
// declare that we need a OBJModel and we'll be calling it "model"
OBJModel model;
// these booleans will be used to turn on and off bits of the OBJModel
//boolean bTexture = true;
//boolean bStroke = false;
//boolean bMaterial = false;
String camPara = "C:/Documents and Settings/javed.hasan/My Documents/Processing/libraries/nyar4psg/data/camera_para.dat";
// the full path to the .patt pattern files
String patternPath = "C:/Documents and Settings/javed.hasan/My Documents/Processing/libraries/nyar4psg/patternMaker/examples/ARToolKit_Patterns";
// the dimensions at which the AR will take place. with the current library 1280x720 is about the highest possible resolution.
int arWidth = 640;
int arHeight = 360;
// the number of pattern markers (from the complete list of .patt files) that will be detected, here the first 10 from the list.
int numMarkers = 10;
void setup()
{
size(640, 480, P3D);
// making an object called "model" that is a new instance of OBJModel
model = new OBJModel(this,"Lancer.obj", "relative");
cam = new GSCapture(this, 640, 480); // initialize the webcam capture at a specific resolution (correct and/or possible settings depend on YOUR webcam)
camera(); // start capturing
// initialize the MultiMarker at a specific resolution (make sure to input images for detection EXACTLY at this resolution)
nya = new MultiMarker(this, arWidth, arHeight, camPara, NyAR4PsgConfig.CONFIG_DEFAULT);
// set the delay after which a lost marker is no longer displayed. by default set to something higher, but here manually set to immediate.
here is my code to play the three videos at a same but they all play in a single frame , one behind the other........
import processing.video.*;
import processing.serial.*;
Serial port;
Movie myMovie;
Movie yourMovie;
Movie ourMovie;
int state = 31;
int play1 = 1;
int play2 = 1;
int play3 = 1;
int val1 = 0;
int val2 = 0;
int val3 = 0;
void setup() {
size(620,440,P2D);
background(0);
myMovie = new Movie(this, "looper.mov");
yourMovie = new Movie(this, "totoro.mov");
ourMovie = new Movie(this, "animal_007-0-0.mov");
myMovie.loop();
yourMovie.loop();
ourMovie.loop();
println(Serial.list());
// print a list of all available ports
port = new Serial(this, Serial.list()[1], 9600);
// choose the port to which the Arduino is connected
// on the PC this is usually COM1, on the Macintosh
// this is usually tty.usbserial-XXX
}
// Called every time a new frame is available to read
void movieEvent(Movie m) {
if(m == myMovie) {
myMovie.read();
} else if(m == yourMovie) {
yourMovie.read();
}
else {