Java Articles - Page 117 of 440

What is masking an image in OpenCV?

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

450 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

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.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

Explain OpenCV Adaptive Threshold using Java Example

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

1K+ 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

Java example demonstrating Scharr edge detection in OpenCV.

Maruthi Krishna
Updated on 13-Apr-2020 11:14:27

310 Views

The Scharr operator for edge detections allows you to find the edges in a given image in both horizontal and vertical directions.The Scharr() method of the Imgproc class applies the Scharr edge detection algorithm on the given image. This method accepts −Two Mat objects representing the source and destination images.An integer variable representing the depth of an image.Two double variables to hold the x and y derivatives.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class ScharrEdgeDetection {    public static void main(String args[]) {       //Loading the OpenCV core library       System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); ... Read More

Explain OpenCV Distance Transformation using java Example

Maruthi Krishna
Updated on 13-Apr-2020 11:03:37

377 Views

The distance transform, in general, is a derived representation of a digital image. In this operation, the gray level intensities of the points inside the foreground regions are changed to distance their respective distances from the closest 0 value (boundary).The distanceTransform() method of the Imgproc class applies Distance Transform on the given image, this method accepts −Two Mat objects representing the source and destination images.An integer variable representing the type of the distance transformation to be applied.An integer value representing the mask size 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 ... Read More

Explain OpenCV Laplacian Transformation using java Example

Maruthi Krishna
Updated on 13-Apr-2020 11:01:24

372 Views

The Laplacian transform on an image highlights the regions where there is a rapid intensity change. Therefore, it is used to detect edges.The Laplacian() method of the Imgproc class applies Laplacian Transform on the given image, this method accepts −Two Mat objects representing the source and destination images.Four integer variables representing the depth, size, scale and, delta values of the transform.An integer value representing the border.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.CvType; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class LaplacianTransform ... Read More

Java implementation of OpenCV Hough Circle Transform.

Maruthi Krishna
Updated on 13-Apr-2020 10:55:03

827 Views

You can detect circles in a given image using the Hough circle transform. You can apply Hough Circle transform using the HoughCircles() method, this method accept the following parameters −A Mat object representing the input image.A Mat object to store the output vectors of the found circles.An integers variables representing the detection method.Two double variables representing an inverse ratio of the accumulator resolution to the image resolution and minimum distance between the centers of the detected circles.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Point; import org.opencv.core.Scalar; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.IOException; import javafx.application.Application; import javafx.embed.swing.SwingFXUtils; ... Read More

Explain Top Hat and Black hat morphological operations in Java.

Maruthi Krishna
Updated on 13-Apr-2020 10:43:48

833 Views

Morphological operations are the set of operations that process images according to the given shapes.Erosion − Erosion is a morphological operation during which pixels are removed from the image boundaries.Dilation − During is a morphological operation during which pixels are added to the image boundaries.Where the total number of pixels added/removed depends on the dimensions of the structuring element used.Morphological Opening − During this operation erosion is applied on the given input and on the result dilation is applied. This is used to remove small objects from the foreground of an image.Morphological Closing − During this operation dilation is applied ... Read More

Is there any alternative for OpenCV imshow() method in Java?

Maruthi Krishna
Updated on 13-Apr-2020 10:40:10

1K+ Views

The HighGui class of the org.opencv.highgui package allows you to create and manipulate windows and display them. You can display an image in a window using the imshow() method of this class. This method accepts two parameters−A string variable representing the name of the window.A Mat object representing the contents of an image.It is recommended to invoke the waitKey() method after imshow().ExampleThe following example reads an image, converts it into a grayscale image, detects the edges in it and displays all the three images (original, gray-scale and, edges) in windows using HighGui.import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import ... Read More

What is morphological gradient in image processing?

Maruthi Krishna
Updated on 13-Apr-2020 10:37:50

2K+ Views

Erosion and dilation are the two basic morphological operations. As the name implies, morphological operations are the set of operations that process images according to their shapes.During dilation operation additional pixels are added to an image boundary and, during erosion operation, additional pixels are removed from image boundaries, The total number of pixels added during the dilation process depends on the dimensions of the structuring element used.Morphological Gradient is the operation that is equal to the difference between dilation and erosion of an image. Each pixel value in the resulting image indicates the contrast intensity in the nearby pixels. This ... Read More

Advertisements