How can I run an applet to access the camera to PC
HelloI'm working on my thesis. I like topic - face recognition. Subjects must be identified in a webcam/PC camera, installed locally. I mean a USB camera. The application I developed so far is a web application and I have all the necessary code, access to the camera in Swing, in a JFrame.
Even if I am not able to transfer this code to an applet to work inside my web application.
I dug into it for a few weeks. The best result I got was an empty applet frame.
Others reported different exceptions, missing as part of JMF, or (my best friend) classes of the applet class could not be found.
The applet code I have is
import java.applet.Applet;
import impossible;
to import java.awt.Dimension;
import java.awt.event.ActionEvent;
java.awt.event.ActionListener import;
Import javax.media.Format;
Import javax.media.Manager;
Import javax.media.MediaLocator;
Import javax.media.Player;
Import javax.media.control.FormatControl;
Import javax.media.format.VideoFormat;
Import javax.media.protocol.CaptureDevice;
Import javax.media.protocol.DataSource;
to import javax.swing.JButton;
to import javax.swing.JFrame;
to import javax.swing.JPanel;
SerializableAttribute public class WebcamSimpleApplet extends Applet {}
/**
*
*/
private static final long serialVersionUID = 1 L;
int width, height;
public void init()
{
Super.init ();
width = getSize () .width;
height = getSize () .height;
JFrame f = new JFrame();
setSize (400, 300);
f.setSize (500, 400);
Add (f.getContentPane () .add (WebcamPlayer())) new;
}
}
class WebcamPlayer extends JPanel implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1 L;
private static String PLAY_COMMAND = "play";
private static String STOP_COMMAND = "stop";
private static String EXIT_COMMAND = "exit";
protected size imageSize = null;
protected player player = null;
DataSource ds = null;
public WebcamPlayer () {}
Super (new BorderLayout());
System.out.println ("MyPlayer ()");
getCam();
createGUI();
}
public void getCam() {}
try {}
MediaLocator ml = new MediaLocator ("vfw:Microsoft WDM Capture of Image (Win32)" :/ / 0 ' ");
DS = Manager.createDataSource (ml);
requestFormatResolution (ds);
Player = Manager.createRealizedPlayer (ds);
} catch (Exception e) {}
DS. Disconnect();
Player.Close ();
Player.DEALLOCATE ();
e.printStackTrace ();
} {Finally
}
} / / getCam
Private Sub createGUI () {}
If (player.getVisualComponent ()! = null)
This.Add (Player.getVisualComponent (), BorderLayout.CENTER);
Buttons
Play JButton = new JButton (WebcamPlayer.PLAY_COMMAND);
play.setBorderPainted (true);
play.setBounds (1, 1, 20, 10);
play.setActionCommand (PLAY_COMMAND);
play.addActionListener (this);
Stop JButton = new JButton (WebcamPlayer.STOP_COMMAND);
stop.setBorderPainted (true);
stop.setBounds (2, 1, 20, 10);
stop.setActionCommand (STOP_COMMAND);
stop.addActionListener (this);
Exit JButton = new JButton (WebcamPlayer.EXIT_COMMAND);
exit.setBorderPainted (true);
exit.setBounds (3, 1, 20, 10);
exit.setActionCommand (EXIT_COMMAND);
exit.addActionListener (this);
JPanel southPanel = new JPanel();
southPanel.add (play);
southPanel.add (stop);
This.Add (southPanel, BorderLayout.SOUTH);
this.setVisible (true);
this.setSize (320, 240);
}
Private boolean requestFormatResolution (DataSource ds) {}
If (ds instanceof CaptureDevice) {}
[FormatControl] fcs = (ds) .getFormatControls () (CaptureDevice);
for (FormatControl fc: fcs) {}
The formats [] = (CF) .getSupportedFormats ((FormatControl));
for (Format format: formats) {}
If ((format instanceof VideoFormat)
& & ((Format) .getSize () .getHeight () (VideoFormat) < = 240)
(& & ((Format) .getSize () .getWidth () (VideoFormat) < = 320)) {}
If (instanceof VideoFormat size) {}
(CF) .setFormat (format) (FormatControl);
imageSize = (format) .getSize () (VideoFormat);
Returns true;
}
}
}
}
}
Returns false;
}
public void actionPerformed (ActionEvent e) {}
If {(e.getActionCommand (.equalsIgnoreCase (EXIT_COMMAND)))
System.out.println ("EXIT_COMMAND");
free resources
DS. Disconnect();
Player.Close ();
Player.DEALLOCATE ();
Reader = null;
System.Exit (0);
}
If (e.getActionCommand () .equalsIgnoreCase (PLAY_COMMAND)) {}
System.out.println ("PLAY_COMMAND");
Player.Start ();
try {}
Thread.currentThread ();
delay in the initialization process
Thread.Sleep (1000);
} catch (InterruptedException e1) {}
Generative TODO catch block
E1. PrintStackTrace();
}
}
If (e.getActionCommand () .equalsIgnoreCase (STOP_COMMAND)) {}
System.out.println ("STOP_COMMAND");
Player.Stop ();
}
}
}
and works fine if I run it in Eclipse-> run as a Java applet.
The question is:
Could you point me to a good tutorial or show me something not working?
I will really appreciate if you can give something for Dummies or non-cerveau webcam Java applet programmer.
Thank you
user985724 wrote:
Well, I got it. But I will REALLY appreciate any advice.
You said earlier "I know I should package the applet into a jar file and the sign, but I have not yet had no chance." which means you try running it without signing (which is strange since you posted this in the forum "Signed Applets" which implies that you know that you have to sign). You must sign the Applet, if any Jo will be able to run it without making any configuration changes that will be detrimental to the overall security of his computer and you can register only jar files and not unique class files. So my advice - spend some time to learn about how in the container of your Applet and how to sign the jar file.
P.S. for test purposes you can "auto sign."
Tags: Java
Similar Questions
-
Hello
I am running 64 Win7HP on a laptop HP dv3, processor Core 2 Duo 4 GB DDR2 Ram, 320 GB HD, just as it came out of the box when purchased directly from HP replaced EXCEPT Vista OS with 64bits Win7HP. Machine worked fine until the LAST update of Windows, where during the reboot, I got to the HP logo screen and in the lower left corner of the screen appeared the statement (for THE FIRST TIME) "Press ESC for the Start Menu." Pressing Esc translates into another command "press Esc...". Break. " When you press ESC, you get a black screen until the machine goes to sleep UNLESS you press Ctrl + Alt + Delete. If you press the 3 key combo, it will continue to start and brings you to the screen of your password for access and then operate nicely, until you turn off the system. So, how can I get rid of the superfluous instructions and get this thing here where he turns and goes directly to the screen of password without intermediate steps? Restore points are long since gone for immediate access to the front last Win Update.The answer may be simple, but until now it has escaped my low range. Any help is appreciated.Creyn1Hi Creyn1,
Welcome to the community Microsoft and thanks for posting the question.
According to the description, it looks that you are facing a problem when connecting, he would be grateful if you can answer this question in order to help you further.
Do you receive an error message or error code?
I suggest trying to boot in safe mode and check if it helps.
Start your computer in safe mode: http://windows.microsoft.com/en-US/windows7/Start-your-computer-in-safe-mode
If its working fine with safe mode then put the computer in a clean boot state, then check if that helps you
Put the computer in a clean boot state and check if any third-party application is causing the problem, as the start-up boot helps eliminate software conflicts.
How to solve the problem by running the clean boot in Windows 7: http://support.microsoft.com/kb/929135
Note: Once you have completed troubleshooting, perform the steps in the step 3: to reset the computer as usual.
If you have any other questions or you need Windows guru, do not hesitate to post your questions and we will be happy to help you.
-
How can I run two sequences simultaneously on the same object to measure
I'm turning two sequences in parallel on even the UUT (own USE) so that I can put a piece of equipment to a certain State while starting a timer at the same time. How can I do this in the sequencer teststand?
You can run a sequence (or a subsequence if you just need a timer) in a new thread (just choose "use new thread" in the call of the sequence)
-
ADF how can I run a parameter query when the page is displayed
Hello
I use web ADF 11 g
I need to run a parameter query when the page is displayed
Thank youprotected DCIteratorBinding getItrtBindings (String binding) {}
DCIteratorBinding outIterBinding is getBindingsForDCB () .findIteratorBinding (binding);.
Return outIterBinding;
}public DCBindingContainer getBindingsForDCB() {}
If (this.bindings == null) {}
FacesContext fc = FacesContext.getCurrentInstance ();
This.Bindings = (DCBindingContainer) fc.getApplication (.evaluateExpressionGet(fc,"#{bindings}",DCBindingContainer.class));
}
return (DCBindingContainer) this.bindings;
}BindingContainer links protected;
public BindingContainer {} getBindings()
Return this.bindings;
}public void setBindings (links BindingContainer) {}
This.Bindings = links;
} -
How can timestamp in LVM file - I access the ms value?
Hi all,
I have a file measurament and when I explain it, I need timestamp with millisecond precision, but I can't read in labview!
sample file:
Channels 4
Samples of 5000 5000 5000 5000
Date 23/04/2010-2010/04/2010 to 23/04/2010 to 23/04/23
Time 12:40:59.828125 12:40:59.828125 12:40:59.828125 12:40:59.828125
X_Dimension time time time time
X 0 3.3548640598213959E, 9 3.3548640598213959E, 9 + 9 + 9 3.3548640598213959E 3.3548640598213959E
Delta_X 2.000000E - 7 2.000000E - 7 2.000000E - 7 2.000000E - 7
End_of_Header *.in labview I can read up to the second value either! Why?
-
On the design of my phone, how can I make a link to access the my desktop version?
I'm doing my site to phone for the first time. My site is very informative, but I don't want that for the phone, of course. How to make a 'click here' if someone wants to see the full version of office?
Hello
Please check this thread
-
How can I block a user/computer access to an IP device on my network
We have a couple of clocks on our network that are accessible via a web browser using the IP address of the device. I want to block some computers to access the device. I tried to modify the HOSTS file, but it only works with domain names. How can I stop these computers to access the device?
Hello Ron,
I'm out of ideas. I hope that someone else will come with entry fees, but I think your best bet would be to bash heads of two management board until they see sense!
I'm guessing that you are on a server-based network. You can get more joy in Server forums...
http://social.technet.Microsoft.com/forums/en-us/categories/
If you ask here, post you a link in this thread so we can monitor? Thank you.
Tricky
-
How can I Run windows on my Macbook Pro Media Center?
How can I Run windos media library on my Macbook Pro?
Hello from marble,
You can check this site for more information about installing Windows on your Macbook with boot camp: -
How can I avoid that OE delete access to the jpg attachments
How can I avoid that OE removing access to attachments containing JPEG files
Tools | Options | Security. Uncheck the box: "block images...". ».
-
How can I run a free scan for pc to check all duplicates multuple files and text files
How can I run a free scan for pc to check all duplicates multuple files and text files
You can try Easy Duplicate File Finder
-
How can I run chkdsk f to repair a corrupted file winmail.exe
How can I run chkdsk f to repair a corrupted file winmail.exe?
Thank you
Don
Hello
Try this: instead of this:
Run the sfc/scannow command.
http://support.Microsoft.com/kb/929833
Use the (SFC.exe) System File Checker tool to determine which file is causing the problem and then replace the file. To do this, follow these steps:
- Open an elevated command prompt. To do this, click Start, click principally madeprograms,Accessories, right-clickguest, and then clickrun as administrator. If you are prompted for an administrator password or a confirmation, type the password, or clickallow.
- Type the following command and press ENTER:sfc/scannow
The sfc/scannow command analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions
How to analyze the entries in the log file generating the program Checker (SFC.exe) resources of Microsoft Windows in Windows Vista
http://support.Microsoft.com/kb/928228#appliesTo
If SFC detects the main problems it can't fix you may need to borrow a Microsoft dvd vista not an acer, HP etc. recovery disk and do a repair installation
read the below tutorial on how to perform a repair installation
http://www.Vistax64.com/tutorials/88236-repair-install-Vista.html
______________________________________________________
and read this;
How to run the check disk at startup in Vista or Windows 7http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html
-
How can I run this program?
I tried to download the online YuGiOh game so I can play with other people, but after I download the Setup Wizard from the wizard does not in fact. It was just my authorization then does nothing. How can I run the name of the file is yo2setup_20081120v.exe
http://www.Microsoft.com/Windows/compatibility/Windows-Vista/default.aspx
Windows Vista Compatibility Center
First thing to do is to check its Vista compatibility at the link above, and if not to see what patches/solutions are available from its manufacturer...
http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-compatibility-mode/
If this is not Vista compatible, read the info on the link above.
It works for some programs, but not all.This applies to software programs, NOT hardware drivers.
If it's Vista compatible > uninstall it > Re-download/save to your desktop > right click on the setup.exe
O run as admin.
See you soon.
Mick Murphy - Microsoft partner
-
Original title: webcam
On my laptop hp15r, it is built in hp truevision hd webcam. After the downsizing of the original software of windows 8 for windows 7 ultimate, I can't find how to access the camera. Can someone help me with this problem?
I have a laptop HP Windows 7.
Type truevision or webcam or similar in the top of the start menu search box > right-click on the result, then select > open file location.
My webcam can be found > lecteurC > Program Files (86) > Cyberlink > YouCam
If I type YouCam in the search box, click with the right button on Cyberlink YouCam, it takes me to YouCam.exe. You can do a right click on the .exe file and choose desktop (shortcut) so that you can access it from there. Once the shortcut on the desktop you can right click it and choose the PIN to the start menu or PIN to the taskbar tasks.
-
How can I run a program Windows Vista Windows 7?
How can I run a window vista program in a window 7?
Many programs of Vista will install and work without problems under Windows 7. If you find difficulties try compatibility mode:
http://windows.microsoft.com/en-US/windows7/Make-older-programs-run-in-this-version-of-Windows .
You can also check the compatibility of programs on the publishers program Web site or here:
http://www.microsoft.com/en-us/windows/compatibility/win7/CompatCenter/Home .
Also, specific 64-bit programs will not work on 32-bit Windows (regardless of whether it is Windows Vista or Windows 7, etc.). Most, but not all, 32-bit programs will run on 64-Bit Windows. For more information. Please see:
http://windows.microsoft.com/en-us/windows7/32-bit-and-64-bit-Windows-frequently-asked-questions .
-
How can I run PACIFIC FIGHTERS on my windows 8?
HOW CAN I RUN FIGHTERS FROM THE PACIFIC FROM UBISOFT WITH WINDOWS 8?
Run a program in Compatibility Mode in Windows 8
http://www.online-tech-tips.com/Windows-8/run-a-program-in-compatibility-mode-in-Windows-8/J W Stuart: http://www.pagestart.com
Maybe you are looking for
-
Having just installed Firefox 4, I went to to connect to my e-mail account and are unable to do it because I don't know if I'm on a secure page. The security icon (the small padlock in the bottom right of the page) is over here telling me I'm on a se
-
Hey, is there a tool/vi, who can tell me progamatically how much memory my computer has available? I looked around and can't seem to find it. Thank you!
-
Play the video full screen on PlayBook
Is it possible to launch a video fullscreen on the PlayBook? For now, I open a video which is fixed at 1024 x 600, but the effect is not as good as the mode full normal screen.
-
Cannot install the printer HP C4500 on Windows 8
I just bought a new computer (acer) and have installed the photosmart c4580, that prints very well with a USB cable, but I am unable to find instructions on how to use the printer wireless on this laptop... can you please help. brand
-
HelloFirst of all... Wanted to know if there is a way to have separate search page layouts based on higher phone and tablet that I currently have. I made the default map my 'search' map... and who is obviously applied to both my Tablet and phone res