Found 2617 Articles for Java

Explain the JavaFX Application structure

Maruthi Krishna
Updated on 13-Apr-2020 11:46:40

1K+ Views

In general, a JavaFX application will have three major components namely Stage, Scene and Nodes as shown in the following diagram.StageA stage (a window) contains all the objects of a JavaFX application. It is represented by Stage class of the package javafx.stage. You have to call the show() method to display the contents of a stage.Scene graphA scene graph is a data structure similar to a tree, in modern graphical applications, it is a collection of nodes. In a JavaFX application the javafx.scene.The scene class holds all the contents of a scene graph.While creating a scene it is mandatory to ... Read More

Explain JavaFX Scene Graph

Maruthi Krishna
Updated on 13-Apr-2020 11:43:23

754 Views

In JavaFX, the GUI Applications were constructed using a Scene Graph. A scene graph is a data structure similar to tree, in modern graphical applications. It is the starting point of the application, and it is a collection of nodesTo display something in JavaFX You need to construct a scene graph using the nodes and set it to an object of the Stage class, the top level container of a JavaFX application.A node is a visual/graphical primitive object of a JavaFX application.Each node in the scene graph has a single parent, and the node which does not contain any parents ... Read More

Explain the features of JavaFX

Maruthi Krishna
Updated on 13-Apr-2020 11:41:29

925 Views

Following are some of the important features of JavaFX −Written in Java − The JavaFX library is written in Java and is available for the languages that can be executed on a JVM, which include − Java, Groovy and JRuby. These JavaFX applications are also platform-independent.FXML − JavaFX features a language known as FXML, which is an HTML like declarative markup language. The sole purpose of this language is to define a user interface.Scene Builder − JavaFX provides an application named Scene Builder. On integrating this application in IDE’s such as Eclipse and NetBeans, the users can access the drag ... Read More

JavaFX with eclipse.

Maruthi Krishna
Updated on 13-Apr-2020 11:38:30

1K+ Views

To setup JavaFx in eclipse, first of all, make sure that you have installed eclipse and Java in your system successfully.Maven dependencyTo set up JavaFX environment using maven dependency, create a Java project in eclipse convert it into a maven project as shown below −Then in the pom.xml file add the following JavaFX dependency and refresh the project.    org.openjfx    javafx-controls    14 If you observe the Maven Dependencies directory you can find the installed Jar files as shown below −Adding required Jar files manuallyYou can also add the required JAR files manually, to do soVisit the JavaFX home ... Read More

How to blend to images using OpenCV Java?

Maruthi Krishna
Updated on 13-Apr-2020 11:34:28

589 Views

You can blend two images in OpenCV using the addWeighted() method of the Core class.This method accepts two Mat objects (representing the source and destination matrices) and two double values representing the desired weights of the images alpha, gamma and calculates the weighted sum of them.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; public class AddingTwoImages {    public static void main( String[] args ) {       //Loading the OpenCV core library       System.loadLibrary( Core.NATIVE_LIBRARY_NAME );       //Reading the input images       Mat src1 = Imgcodecs.imread("D://images//a1.jpg");       Mat src2 = Imgcodecs.imread("D://images//a2.jpg"); ... Read More

Explain Otsu threshold technique in OpenCV using a Java Example

Maruthi Krishna
Updated on 13-Apr-2020 11:31:26

439 Views

Thresholding is a simple technique for the segmentation of an image. it is often used to create binary images. In this the pixels greater than a given threshold value will be replaced with a standard valueIn simple, the threshold value is constant throughout the image.Adaptive thresholding the threshold value is calculated for smaller regions and therefore, there will be different threshold values for different regions.Whereas in the Otsu threshold technique the threshold value is determined automatically, it chooses an optimal threshold value based on the image histogram.The threshold() method of the Imgproc class acceptsTwo Mat objects representing the source and ... Read More

What is masking an image in OpenCV?

Maruthi Krishna
Updated on 13-Apr-2020 11:28:39

289 Views

In mask operations the value of each pixel of an image is recalculated based on a given mask matrix, this is known as the kernel. Masking is otherwise known as filtering.The filter2D() method of the Imgproc class accepts a source, destination and kernel matrices and convolves the source matrix with the kernel matrix. Using this method you can mask or filter an image.Exampleimport org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class MaskingExample {    public static void main( String[] args ) {       //Loading the OpenCV core library       System.loadLibrary( Core.NATIVE_LIBRARY_NAME ... Read More

How to setup OpenCV Java with eclipse?

Maruthi Krishna
Updated on 13-Apr-2020 11:25:50

952 Views

To setup JavaFx in eclipse, first of all, make sure that you have installed eclipse and Java in your system successfully.Maven dependencyTo set up JavaFX environment using maven dependency, create a Java project in eclipse convert it into a maven project as shown below −Then in the pom.xml file add the following JavaFX dependency and refresh the project.    org.bytedeco    opencv    4.1.0-1.5.1 If you observe the Maven Dependencies directory you can find the installed Jar files as shown below −Adding required Jar files manuallyYou can also add the required JAR files manually, to do soVisit the OpenCV home ... Read More

How to add borders to an image using Java OpenCV library?

Maruthi Krishna
Updated on 13-Apr-2020 11:21:30

348 Views

You can add borders to a given image using the copyMakeBorder() method, this method accepts the following parameters −Two Mat objects representing the source and destination images.An object of the class Mat representing the destination (output) image.Four integer variables representing the lengths of the borders in all the 4 directions of the image.An integer variable representing the type of the border that is to be used.Exampleimport java.awt.Image; import java.awt.image.BufferedImage; import java.io.IOException; import javafx.application.Application; import javafx.embed.swing.SwingFXUtils; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; import javafx.stage.Stage; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; public class AddingBorders extends Application {   ... Read More

Explain OpenCV Adaptive Threshold using Java Example

Maruthi Krishna
Updated on 13-Apr-2020 11:19:06

809 Views

Thresholding is a simple technique for the segmentation of an image. it is often used to create binary images. In this, the pixels greater than a given threshold value will be replaced with a standard value.Adaptive thresholding is the method where the threshold value is calculated for smaller regions and therefore, there will be different threshold values for different regions.The adaptiveThreshold() method performs the Adaptive Threshold operation on the given image. Following are the parameters of this method −Two Mat objects representing the source and destination images.An integer variable representing the threshold value.Two integer variables representing the adaptive method and ... Read More

Advertisements