-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webcam Capture API JavaFX example #241
Comments
Hi @kypdk, All, I will be glad to merge any JavaFX example if someone write it :) I'm completely unfamiliar with this technology, so sorry, I can't do it myself :( Need your help here. Cheers! |
public class FXMLDocumentController implements Initializable {
javafx not support ? |
This is completely invalid: webpanel = new WebcamPanel(webcam);
webpanel = new Pane(panel); (error : not converted webpanel to Pane) Because Pane is not a subclass of WebcamPanel. Have you tried with import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javax.swing.SwingUtilities;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
public class SwingFx extends Application {
private Webcam webcam = Webcam.getDefault();
private WebcamPanel webcamPanel = new WebcamPanel(webcam, false);
@Override
public void start(Stage stage) {
final SwingNode swingNode = new SwingNode();
createSwingContent(swingNode);
StackPane pane = new StackPane();
pane.getChildren().add(swingNode);
stage.setTitle("Swing in JavaFX");
stage.setScene(new Scene(pane, 250, 150));
stage.show();
}
private void createSwingContent(final SwingNode swingNode) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
swingNode.setContent(webcamPanel);
webcamPanel.start();
}
});
}
} I cannot give you more details because I'm not familiar with JavaFX. |
Little bit late kypdk i had also written one another example to connect with webcam using sarxos API. Link for my sample class: While trying to attach WebCamPanel from FXML Controller can be little bit of mess. You can try this example to update ImageView from webcam feed. Thanks, |
Hi @rakeshbhatt10, This is awesome :) Can I use your code as one of the examples in the Webcam Capture API sources? |
thank you so much bro best javafx+sarxos webcam example |
Hi @sarxos , Sorry for misspelling of your name in my code and repo link. It will be my pleasure if you consider my example to be included in your project thanks a lot. I had to improve JavaFX example code little bit. I wrote it in hurry I will improve it and push it today. I had not tested this example so can't say anything about performance . I tried to implement this example with separate Pane or Canvas but it was not that much successful. In this example I had coded GUI. But i will post one more example of webcam capture using JavaFX with FXML that will give you @kypdk more clarity i suppose. Thanks, |
Hi @rakeshbhatt10, Don't worry :) I tested it and it works very well on Java 8 :) I didn't fork whole the project, but just the |
Okey that will be fine @sarxos you can use this class as you want but i think in case of JavaFx it will be good if there is also an example using FXML. If you want i can write a sample for that too |
thank you so much bro best javafx+sarxos-webcam example, |
@rakeshbhatt10, if you have time and resources for that, please feel free to craft FXML example as well :) I will be happy to include both in the Webcam Capture API examples. |
I hoped it will work - this would make it much easier :( Maybe in some time I will learn more about JavaFX and craft dedicated component. Later this month (need to wait for the vacation to have some more time for coding) I will convert your projects to build with Maven and put them in the examples folder of Webcam Capture API. Thank you! |
Sarxos, I have things working in a demo. Thanks!, |
Dear Team :) Sorry for no response for the time. I just came back from the vacation few days ago, full of energy to play with some new stuff :) I integrated both your examples in the Webcam Capture examples root. Your projects has been Mavenized, some small changes in the code (mostly automated formatting rules) introduced as well, but overall code mechanic remains unchanged. Thank you for this contribution :) By integrating them I managed to learn JavaFX a little bit as well. I will be happy to use your knowledge and merge pull requests you prepare and/or integrate the code from the example you posted on the youtube (it's awesome) :) The JavaFX seems to be very feature rich since I was completely unaware that one can control application by the JavaScript code. I'm looking forward to hear from you. |
Hi @sarxos great work and thanks again. Quite few updates on JavaFx as @carldea has provided one more solution based on JavaFx scripting i suppose JavaFx script is available in JavaFx 1.x release which is now obsolete as well as oracle support for it has been ended you can check these link Now in JavaFX 2.x series. There is no requirement for any scripting language and it is possible to code in Java API. Instead of using any Scripting to build GUI use FXML which also can be build with scenebuilder. For creating a thread safe API you can check javafx.concurrent package i think it will help you more Thanks, |
@rakeshbhatt10, than you for the links, I will check them :) I'm planning to craft dedicated component for JavaFX (like WebcamPanel for Swing). |
ALPS |
hi
Dear all Swing is dead
Simple webcam capture for javafx example
please
The text was updated successfully, but these errors were encountered: