Maruthi Krishna has Published 870 Articles

How to get the list of all the MongoDB databases using java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:18:10

1K+ Views

In MongoDB, you can view the list of databases using the show dbs command> show dbs admin config local myDatabase sampleDatabase students test testDBIn Java, you can get the list of all the databases in MongoDb using the getDatabaseNames() method.Exampleimport com.mongodb.client.MongoIterable; import com.mongodb.MongoClient; public class ListOfDatabases {    public static ... Read More

Explain Java MongoDB projections

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:16:54

1K+ Views

While retrieving data from MongoDb collections you can select only necessary data using projections. In Java, you can project necessary data while reading the documents from a collection using the projection() method. Invoke this method on the result of find(), bypassing the names of the required filed names as −projection(Projections.include("name", ... Read More

How to skip documents while retrieving data from MongoDB, using java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:14:51

290 Views

While retrieving records from a MongoDB collection, you can skip records in the result using the skip() method.Syntaxdb.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER)The Java MongoDB library provides a method with the same name, to skip records, invoke this method (on the result of the find() method) bypassing an integer value representing the number of records ... Read More

How to display OpenCV Mat object using Swings?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:12:22

587 Views

The class ImageIcon is an implementation of the Icon interface that paints Icons from Images. You can display images on a Swing window using this class, the constructor of this class accepts a BufferedImage object as a parameter.Therefore to display an OpenCV image that is stored in a Mat object ... Read More

How to display OpenCV Mat object using JavaFX?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:10:36

459 Views

The JavaFX library provides a class with name ImageView using this you can display an image. This class accepts an object of the WritableImage class.To display an image Stored in OpenCV Mat object you need to convert it into a WritableImage object and pass it the ImageView class.Exampleimport java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; ... Read More

How to convert a positive image to Negative to using OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 13:59:35

358 Views

Algorithm to convert an image to negativeGet the red green blue values of each pixelSubtract each color value from 255 and save them as new color values.Create a new pixel value from the modified colors.set the new value to the pixel.Implementation in JavaRead the required image using ImageIO.read() method.Get the ... Read More

How to declare OpenCV Mat object using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 09:24:23

747 Views

In OpenCV Mat class represents a matrix object which is used to store images. You can also declare a Mat object manually −Load the OpenCV native library − While writing Java code using OpenCV library, the first step you need to do is to load the native library of OpenCV ... Read More

Explain the Mat class in Java OpenCV library

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 09:22:09

2K+ Views

In OpenCV, images are stored in Using Mat object. It is nothing but an n-dimensional array and is used to store image data of grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms, etc.If you try to read an image using the OpenCV library it will be ... Read More

How to create custom color maps in Java using OpenCV?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 09:20:38

426 Views

The applyColorMap() method of the Imgproc class applies specified color map to the given image. This method accepts three parameters −Two Mat objects representing the source and destination images.An integer variable representing the type of the color map to be applied.You can pass any of the following as color map ... Read More

How to alter the brightness of a grey scale image?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 09:18:12

262 Views

The equalizeHist() method of the Imgproc class accepts a greyscale image and equalizes its histogram, which will, in turn, normalizes the brightness and increases the contrast of the given image. This method accepts two parameters −A Mat object representing the source image (greyscale).A Mat object to save the result.ExampleFollowing Java ... Read More

Advertisements