Morphing Program
I want to create a program to to morph at least two images into one another, I have seen some algorithms but am really struggling as I dont know how to get started and I also dont know how to apply the algorithms in java.
For each pixel X in the destination image
find the corresponding u,v
find the X' in the source image for that u,v
destinationImage(X) = sourceImage(X')
[
How to go about applying the algorithm.
I have created Java GUI's in swing in the past but nothing of to this extent, I have seen Laxmi Narayana .Kota's morphing program at http://javaboutique.internet.com/Morph/source.html but cant seem to understand it. I dont know what algorithm he's used.
Thank You
Similar Messages
-
Morph Age MOV files crashing Final Cut Pro
Hello folks,
I wonder if anyone here has used .MOV files created by Morph Age (the morphing program). I have some sequences to use in a project and I just loaded the first one. Well, every single time I try to render it FC goes into a fine crash!
The mov file is 5 seconds long and 142.2Mb and plays fine in QuickTime.
Any suggestions will be greatly appreciated.
Thanks,
IsmenioThanks for the tip Tom. I'll check that out. In the meantime, I have this update:
1. I just got word from support saying that the output size can be changed: main document window, right column, document section (I can't check that now because of the crash)
2. The crash seems to be related to Mac OS X 15.5.5 they said. They're working on a fix.
I'll look at MorphX! Also, I found a 'work around' that's very long but helped me get the clips to work. Here it goes in case it can help someone else but remember I'm a newbie and there's probably a better way of doing it.
1. I imported each individual clip in an iMovie project and exported it (took me a while to figure it out it was under the 'Share' menu!) using QuickTime Export - then the HD1080i60 codec
2. Imported that clip into an individual, temporary, FCP project, did my edit (I had to change the speed of the clip as it was going to match a beat to a song) and exported it as a QT file
3. Created a new FCP project just for the morph sequence, imported all the clips from step 2 and it worked!
Thanks,
Ismenio -
Effect NeededL Still photo to 3D animation
Hi Everyone,
I've recently seen two amazing applications that produce an effect that I'm trying to incorporate into an FCE 3.5 sequence. One is called motion portrait, the other is Fage Gen Modeller. Both PC apps. In essence, what they do is to take a 2d still image of a face, and let the user convincingly manage facial expressions just by mapping a few points. This is exactly what I need for a sequence I'm working on. Does anyone have any leads for a similar Mac based app? Thanks! Sorry if this is a tiny bit afield from FCE.You probably want a morph program.
I tried MorphX (see http://www.norrkross.com/software/morphx/download.php) a free program that creates movie files that can be imported into FCE. Simple to use.
Piero -
After Effects CS5 crashes when I make a selection in the destination field of BCC Morph plug-in
Steps to reproduce bug:
1.Open AE
2.Create a composition
3.Import photos (.png)
4.Put photos on timeline
5. Add BCC Morph from Effects&Presets BCC7 OpenGL to first photo on timeline
6. Select Source Unwarped in Render Mode field
7. Select 2nd photo in Destination field
Results: AE crashes
Error messages displayed for several attempts:
A.Crash occurred while invoking effect plug-in BCC last logged message 4424, 4604
B.Crash in progress. Last logged message was : <5000> <DynamicLink><5> C:\ Program Files (x86) \Common Files\Adobe\dynamiclink/CS5/dynamiclinkmanager.exe
C. AE can't continue: sorry AE has crashed. See www.adobe.com/support/products/aftereffects.html for know issues (0 :: 42)
Expected results:
Able to continue selecting options (setup the duration of the Morph by adding a key frame using the Key Marker)
What I've tried so far:
- I verified I have the latest version of After Effects
- I Removed the OpenGL plug-in from the After Effects plug-ins folder and After Effect still crashed
- My PC meets the minimum requirements for After Effects
- My video card driver is the most current the manufacture has available to date
Video information: NVIDIA, GeForce GTX 480, driver ver 266.58
Prod Name: After Effects CS5
Prod Ver: 10.0.1.19
OS: Windows 7
OS Ver: 64-bit
DirX: 11
BCC ver: 7.0.7.200
Processor: Intel(R) Core(TM) i7 CPU
Memory: 6.00 GBSorry, but you are at the wrong forum; this one is only for disc
ussions on the forums themselves. The After Effects forums is here:
http://forums.adobe.com/community/aftereffects_general_discussion -
When I try to open an embedded PDF file (Word doc) I get an error "The program used to create this object is AcroExch.exe. That program is either not installed on your computer, or is corrupt..." I've tried about everything from unchecking
protected mode at startup to removing & reinstalling Adobe. Nothing seems to fix this issue. Any other ideas?
This is happening on Adobe reader 9, 10 & 11 with MS Word 2010 & 2013. I've uninstalled, cleaned & reinstalled Reader 9, 10 & 11, as well as Acrobat 10 Pro & 11 Standard. Removed "Protected mode at startup, and changed
the default program for viewing from reader to Acrobat. This will not go away. It is affecting production at our company." Help > Troubleshooting Information > Profile Directory: Open Containing Folder" . i can't find open containing folder in profile directory. it does give me the option to open the places.sqlite file using graphic converter. when i try that, graphic converter gives me a window saying that it can't be opened because it is corrupted or is not a file type supported by graphic converter.
i appreciate your help with a workaround to get the old bookmarks. that works. however, the problem has morphed from that concern to why adobe reader [the default app.] won't open firefox .sqlite files. is the problem in adobe reader or firefox? also, how can i tell if the places.sqlite file is corrupt?
i'm getting in over my head here and do appreciate your help. -
Why is skype the worst program I have ever laid my...
This program is such a **bleep**ing joke. Every single time skype updates it does the exact opposite of "improving my experience". I have no idea how my favorite messenger program has morphed into this peice of absolute garbage that I'm dealing with now. It started with updates only adding advertisements, now with skypes new update that was COMPLETELY forced by the way it is almost unusable at this point. I've noticed recently that closing skype made my game counter-strike:global offensive run without any lag, and all the lag that was being caused was from skype, how is it a single program can lag my entire computer, how could the design of a program be so awful. Now I cannot "find" any messages sent or received. I have changed no computer setting, I have not changed any skype setting this all happen from it's own updates alone. Messages literally load in random order, it loads all my msgs in the past week or something and puts new msgs somewhere scrambled in with them in all different areas (never places the newsest messages at the bottom). I just now woke up and noticed skype was updating, it had been all night that means and it made my computer run stressfully all night whilst not accomplishing any update and failing to stop itself from trying to update more. I actually literally had to reset my router which I rarely have to do b/c skype updates knocked my internet off. This program is a **bleep**ing joke and will die as soon as something better comes along, anyone using an altnerative already?
It doesn't help to change the clock back to correct time. When the clock was wrong, the sent/received messages were labelled with the wrong time and are now misplaced. The only what you can do now is either to clear the whole chat history or to try to correct the wrong timestamp of the misplaced messages or just delete them.
http://community.skype.com/t5/The-Skype-Lounge/Delete-a-conversation/m-p/743928#M56527 -
Anyone know How to Morph an object in Z space?
Hello,
I have an odd problem. I am trying to morph an object in 3D space in after effects.
I was wanting something like the puppet tool but that does not seem to be working in Z space.
Here is a few pictures of the character I am trying to morph. I basically want him to move like a fish.
http://www.flickr.com/photos/ken-maxwell/5684975527/in/photostream
http://www.flickr.com/photos/ken-maxwell/5685545994/in/photostream
http://www.flickr.com/photos/ken-maxwell/5685545884/in/photostream
http://www.flickr.com/photos/ken-maxwell/5684975741/in/photostream
Any suggestions?
Thanks!Freeform would be pretty much your only option for an interactively deformable 3D entity in AE. Everything else will require a genuine 3D program or buying plug-ins.
Mylenium -
Once a morph pattern is created in Sculpture, is it possible to create a loop inside scultpure rather than retriggering the whole "patch" from the midi keyboard? I know that I can convert to audio, put in EXS and create a loop. But can it be done in Sculpture itself. I may have missed it, but I didn't see that in the owner's manual tutorial.
Thanks so muchThe answer is........yes you can! Took me a few days but I figured it out.
I know negative comments about Logic and Apple products are forbidden on this site and I'm not being negative oh great webmaster. I'm just curious...
How many Logic 7.X users actually use sculpture? It's truly the main reason I work with the program and am curious what others think about. Try to make negative comments sound positive — Spin it baby like Karl Rove! -
Hello,
Is there anyway besides using the fade-in, fade-out transition that I can morph some pictures using FCE?
If not, how can I accomplish that.......I have about 36 pictures that need morphing into one-another......what will be a good solution?
Thanks for your time and effort,
Chase
Ipod Mini Other OS I also have a emac (os-?)Questions about morphing in FCE occur periodically.
There is a free program but I don't know how good it is.
Download the free Morph-X here:-
http://www.macupdate.com/info.php/id/7979
Ian. -
Morphing class deprecated??
I have been working with a Morphing example found on the internet (posted below) and when I go to compile the code, I get the following warning:
"javax.media.j3d.Morph in javax.media.j3d has been deprecated"
Java 3D is fully functioning on my pc, so it isn't a case of java3d being missing.
Can anyone help explain? Any help would be greatly appreciated, Thanks.
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.util.Enumeration;
import javax.media.j3d.Alpha;
import javax.media.j3d.Appearance;
import javax.media.j3d.Background;
import javax.media.j3d.Behavior;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.GeometryArray;
import javax.media.j3d.Morph;
import javax.media.j3d.QuadArray;
import javax.media.j3d.Shape3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.WakeupOnElapsedFrames;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.SimpleUniverse;
public class Pyramid2Cube extends Applet {
private SimpleUniverse u = null;
private BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
// Create a Transformgroup to scale all objects so they
// appear in the scene.
TransformGroup objScale = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.setScale(0.4);
objScale.setTransform(t3d);
objRoot.addChild(objScale);
// Create a bounds for the background and behavior
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
100.0);
// Set up the background
Color3f bgColor = new Color3f(0.05f, 0.05f, 0.2f);
Background bg = new Background(bgColor);
bg.setApplicationBounds(bounds);
objScale.addChild(bg);
// Create the transform group nodes for the 3 original objects
// and the morphed object. Add them to the root of the
// branch graph.
TransformGroup objTrans[] = new TransformGroup[4];
for (int i = 0; i < 4; i++) {
objTrans[i] = new TransformGroup();
objScale.addChild(objTrans);
Transform3D tr = new Transform3D();
Transform3D rotY15 = new Transform3D();
rotY15.rotY(15.0 * Math.PI / 180.0);
objTrans[0].getTransform(tr);
tr.setTranslation(new Vector3d(-3.0, 1.5, -6.5));
tr.mul(rotY15);
objTrans[0].setTransform(tr);
objTrans[1].getTransform(tr);
tr.setTranslation(new Vector3d(0.0, 1.5, -6.5));
tr.mul(rotY15);
objTrans[1].setTransform(tr);
objTrans[2].getTransform(tr);
tr.setTranslation(new Vector3d(3.0, 1.5, -6.5));
tr.mul(rotY15);
objTrans[2].setTransform(tr);
objTrans[3].getTransform(tr);
tr.setTranslation(new Vector3d(0.0, -2.0, -5.0));
tr.mul(rotY15);
objTrans[3].setTransform(tr);
// Now create simple geometries.
QuadArray g[] = new QuadArray[3];
Shape3D shape[] = new Shape3D[3];
for (int i = 0; i < 3; i++) {
g[i] = null;
shape[i] = null;
g[0] = new ColorPyramidUp();
g[1] = new ColorCube();
g[2] = new ColorPyramidDown();
Appearance a = new Appearance();
for (int i = 0; i < 3; i++) {
shape[i] = new Shape3D(g[i], a);
objTrans[i].addChild(shape[i]);
// Create a Morph node, and set the appearance and input geometry
// arrays. Set the Morph node's capability bits to allow the weights
// to be modified at runtime.
Morph morphing = new Morph((GeometryArray[]) g, a);
morphing.setCapability(Morph.ALLOW_WEIGHTS_READ);
morphing.setCapability(Morph.ALLOW_WEIGHTS_WRITE);
objTrans[3].addChild(morphing);
// Now create the Alpha object that controls the speed of the
// morphing operation.
Alpha morphAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE
| Alpha.DECREASING_ENABLE, 0, 0, 4000, 1000, 500, 4000, 1000,
500);
// Finally, create the morphing behavior
MorphingBehavior mBeh = new MorphingBehavior(morphAlpha, morphing);
mBeh.setSchedulingBounds(bounds);
objScale.addChild(mBeh);
return objRoot;
public Pyramid2Cube() {
public void init() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
add("Center", c);
// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
u = new SimpleUniverse(c);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
u.getViewingPlatform().setNominalViewingTransform();
u.addBranchGraph(scene);
public void destroy() {
u.cleanup();
public static void main(String[] args) {
new MainFrame(new Pyramid2Cube(), 700, 700);
class ColorPyramidUp extends QuadArray {
private static final float[] verts = {
// front face
1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f,
-1.0f, 1.0f,
// back face
-1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
-1.0f, -1.0f,
// right face
1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
-1.0f, 1.0f,
// left face
-1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f,
-1.0f, -1.0f,
// top face
0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
0.0f,
// bottom face
-1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, };
private static final float[] colors = {
// front face (cyan)
0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
1.0f,
// back face (magenta)
1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f,
// right face (yellow)
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
0.0f,
// left face (blue)
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f,
// top face (green)
0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
0.0f,
// bottom face (red)
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.0f,
ColorPyramidUp() {
super(24, QuadArray.COORDINATES | QuadArray.COLOR_3);
setCoordinates(0, verts);
setColors(0, colors);
class ColorCube extends QuadArray {
private static final float[] verts = {
// front face
1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f,
-1.0f, 1.0f,
// back face
-1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f,
-1.0f, -1.0f,
// right face
1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
-1.0f, 1.0f,
// left face
-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f,
-1.0f, -1.0f,
// top face
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f,
1.0f, 1.0f,
// bottom face
-1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, };
private static final float[] colors = {
// front face (red)
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.0f,
// back face (green)
0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
0.0f,
// right face (blue)
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f,
// left face (yellow)
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
0.0f,
// top face (magenta)
1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f,
// bottom face (cyan)
0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
1.0f, };
ColorCube() {
super(24, QuadArray.COORDINATES | QuadArray.COLOR_3);
setCoordinates(0, verts);
setColors(0, colors);
class ColorPyramidDown extends QuadArray {
private static final float[] verts = {
// front face
0.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 0.0f,
// back face
0.0f, -1.0f, 0.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 0.0f,
-1.0f, 0.0f,
// right face
0.0f, -1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 0.0f,
// left face
0.0f, -1.0f, 0.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 0.0f,
-1.0f, 0.0f,
// top face
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f,
1.0f, 1.0f,
// bottom face
0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
-1.0f, 0.0f, };
private static final float[] colors = {
// front face (green)
0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
0.0f,
// back face (red)
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.0f,
// right face (yellow)
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
0.0f,
// left face (magenta)
1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f,
// top face (blue)
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f,
// bottom face (cyan)
0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
1.0f, };
ColorPyramidDown() {
super(24, QuadArray.COORDINATES | QuadArray.COLOR_3);
setCoordinates(0, verts);
setColors(0, colors);
//User-defined morphing behavior class
class MorphingBehavior extends Behavior {
Alpha alpha;
Morph morph;
double weights[];
WakeupOnElapsedFrames w = new WakeupOnElapsedFrames(0);
// Override Behavior's initialize method to setup wakeup criteria
public void initialize() {
alpha.setStartTime(System.currentTimeMillis());
// Establish initial wakeup criteria
wakeupOn(w);
// Override Behavior's stimulus method to handle the event
public void processStimulus(Enumeration criteria) {
// NOTE: This assumes 3 objects. It should be generalized to
// "n" objects.
double val = alpha.value();
if (val < 0.5) {
double a = val * 2.0;
weights[0] = 1.0 - a;
weights[1] = a;
weights[2] = 0.0;
} else {
double a = (val - 0.5) * 2.0;
weights[0] = 0.0;
weights[1] = 1.0f - a;
weights[2] = a;
morph.setWeights(weights);
// Set wakeup criteria for next time
wakeupOn(w);
public MorphingBehavior(Alpha a, Morph m) {
alpha = a;
morph = m;
weights = morph.getWeights();A method or (in this case it seems) a class being deprecated is nothing to worry about. All it means is that it is strongly advised that you not use this method/class because they have made something better to use. It also means that support for the method/class is no longer available from the makers and that they will soon be discontinuing the method/class.
In the case of the Morph class, you can still use it, but it may not be there in the next version or two. If you want to stop those compile warnings, then you can stick this somewhere (before the method that uses the Morph, I think):
@SuppressWarnings("unused")Using that will Suppress further Warnings of any "unused" (read "no longer supported/deprecated") classes or methods. And in your next program, see if you can find a replacement for the Morph class.
Tustin2121 -
Hello,
Does anyone know a program that will be fast and easy to morph about 35 pictures and the result could go on FCE?
Thanks,
ChaseHi there
I was looking for the same thing and found the following that might help you. I haven't qualified any though. Hope that helps.
http://www.versiontracker.com/dyn/moreinfo/macosx/19432
http://www.versiontracker.com/dyn/moreinfo/macosx/2987
http://www.versiontracker.com/dyn/moreinfo/macosx/26499
Good Luck
Hisham -
Interfacing LabVIEW with Meta Morph Journal
Hi
I'm just starting a project where I must fully automate an experiment involving a microscope and a microfluidics manifold. I am planning to use LabVIEW to control the manifold and Meta Morph Journal to program the motions of the microscope stage and I'm wondering if it's possible to interface the two (i.e. have one talk to the other to coordinate the actions).
ThanksHi Shaheen,
You can get started by followind this tutorial which explains how to add your instrument so that MAX can see it and establish communication with the device.
Regards,
Daniel REDS
RF Systems Engineer
Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it. -
Hi I don't know if I was able to send this question before but here it goes again. I'am doing a poor man's morph project on my motion 4 program, and it works great while in Motion, but once I try to import it to fcp, it will import the photos but not the optical flow fx, what am I doing wrong? I appreciate you help
Decided to use cmd A to select all the icons on the desktop and then looked for a right click option. There it was - the option to move to a folder. I now have them all in this folder which tells me it holds 157 items. Now you know why I needed to know LOL
Thought it might be of help to someone.
Cheers Mally -
Problem with threads, program always crash
new to threads, may be doing something COMPLETELY wrong. When I run the program I get a couple of NullPointerExceptions in Thread-0 and Thread-1. I'm confused because it screws up when I call size() for arrayList, and in the API size doesn't throw anything.
public class ProducerConsumerRunner
public static void main(String args[])
Queue q = new Queue(QUEUE_MAX_SIZE);
ProducerRunnable producer = new ProducerRunnable(q, ITERATIONS);
ConsumerRunnable consumer = new ConsumerRunnable(q, ITERATIONS);
//works good up to here
Thread t1 = new Thread(producer);
Thread t2 = new Thread(consumer);
t1.start();
t2.start();
private static int ITERATIONS = 50;
private static int QUEUE_MAX_SIZE = 25;
import java.util.ArrayList;
import java.util.concurrent.locks.ReentrantLock;
public class Queue {
public Queue(int maxSize)
list = new ReentrantLock();
underLimit = list.newCondition();
MAX_SIZE = maxSize;
public void add(String line)
list.lock();
try{
System.out.println("add method of Queue");
while(record.size() >= MAX_SIZE){//things get screwed up when this condition is evaluated
//size method is crashing the program
System.out.println("2");
underLimit.await();
System.out.println("3");
record.add(line);
}catch(java.lang.InterruptedException e){
System.out.println("await interupted: "+e.getMessage());
}finally{
list.unlock();
public void remove(int line)
list.lock();
record.remove(line);
list.unlock();
public ArrayList<String> record;
private final ReentrantLock list;
private final java.util.concurrent.locks.Condition underLimit;
private final int MAX_SIZE;
import java.util.Date;
public class ProducerRunnable implements Runnable{
public ProducerRunnable(Queue q, int itterations)
this.q = q;
ITTERATIONS = itterations;
public void run()
String date;
for(int i = 0; i<ITTERATIONS; i++)
date = new Date().toString();
q.add(date);//this is where it screws up
System.out.println(date+" added");
try{
Thread.sleep(100);
}catch(java.lang.InterruptedException e){
System.out.println("ProduccerRunnable's sleep was interupted");
private final Queue q;
private final int ITTERATIONS;
public class ConsumerRunnable implements Runnable{
public ConsumerRunnable(Queue q, int itterations)
this.q = q;
ITTERATIONS = itterations;
public void run()
//Queue q = new Queue();
int length;
for(int i = 0; i<ITTERATIONS; i++)
length = q.record.size();//things are getting screwed up here
while(q.record.get(length) == null)
length--;
System.out.println((String)q.record.get(length));
q.remove(length);
try{
Thread.sleep(100);
}catch(java.lang.InterruptedException e){
System.out.println("ConsumerRunnable's sleep was interupted");
private final Queue q;
private final int ITTERATIONS;
}question:
this works right
public void remove()
list.lock();
int line = 0;
try{
*while(record.size() < 1)*
range.await();
record.remove(line);
range.signalAll();
}catch(java.lang.InterruptedException e){
System.out.println("await interupted: "+e.getMessage());
}finally{
list.unlock();
}this is deadlock
*int list = 0;*
*while((list = record.size)<1) was screwing things up because of the assignment*record is ArrayList of strings. when better to use Vector instead of ArrayList? i notice no differnce and i use threads
initially I thought record.size was being evaluated and before could be assigned to list, time slice ran out. this could not be case because I use ReentrantLock (list) to lock it.
Edited by: bean-planet on Apr 1, 2009 4:31 PM -
Tried
https://discussions.apple.com/thread/2713232?start=0&tstart=0
and
http://www.vistax64.com/vista-general/159940-computer-blocking-anything-no-digit al-signature.html
with no avail!!!
iTunes opens after I click OK on the above message however I cannot do anything within the app its like Windows it preventing it from running.
PLEASE HELP!!!Update:
I tried what the diagnostic told me to do, and repaired the installation. I was able to burn a CD in iTunes, but after I restarted, the drives have disappeared again! Here's the diagnostic info now:
Microsoft Windows Vista Home Edition (Build 6000)
MICRO-STAR INC. MS-6728
iTunes 7.6.0.29
QuickTime 7.4
CD Driver 2.0.6.1
CD Driver DLL 2.0.6.2
Apple Mobile Device 1.1.3.26
iTunes Serial Number 20D6EAF059AB94B4
Current user is not an administrator.
The current local date and time is 2008-01-15 19:09:32.
iTunes is not running in safe mode.
Video Display Information
ATI Technologies Inc., Radeon X1600/X1650 Series
ATI Technologies Inc., Radeon X1600/1650 Series Secondary
** External Plug-ins Information **
Plug-in Name: Last.fm iTunes plugin
Plug-in Loaded: Yes
Plug-in Version: 0.0.13
Plug-in File Version: 2.0.13.0
Plug-in Path: C:\Program Files\iTunes\Plug-ins\itw_scrobbler.dll
No drives showed up to be tested.
Maybe you are looking for
-
Ive got a 128GB SSD on my macbook Air and i know as time goes on ill eventually run out of space so i want to know if their suggestions on how to run applications like google chrome, Skype etc on an external hard drive with out installing int on my S
-
Can I use the iphone 6 contract free in Brazil?
I want to know if I can use my iPhone6 contract free of T-mobile in a brazilian plan?
-
Though I'm going to upgrade within a couple months, I'm currently using a Panasonic HDC-SD9 for a few projects, and like shooting in 24p mode. The AVCHD editing modes in PE7 do not offer a "Full HD" mode with 23.976 timebase. It instead offers a 29.9
-
Why can't I right-click to see settings?
When I am using my cam and microphone on a website I cannot right-click to get to the settings manager. This started three days ago out of nowhere. What can I do? I am using Google Chrome, but I have tried it on IE and Firefox as well. I am using Win
-
Is it possible to get Front Page or Visual InterDev to recognize the Java Web Server. I keep getting errors because of Front Page extensions not being installed. Thanks.