
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

2K+ Views
The canny edge detector is known as optimal detector since it detects only the existing edges, gives only one response per page and minimizes the distance between the edge pixels and detected pixels.The Canny() method of the Imgproc class applies the canny edge detection algorithm on the given image. this method accepts −Two Mat objects representing the source and destination images.Two double variables to hold the threshold values.To detect the edges of a given image using the canny edge detector −Read the contents of the source image using the imread() method of the Imgcodecs class.Convert it into a gray scale ... Read More

1K+ Views
You can add text to an image using the putText() method of the org.opencv.imgproc.Imgproc class. This method renders the specified text in the given image. It accepts −An empty mat object to store the source image.A string object to specify the desired text.A Point object specifying the position of the text.Integer constant specifying the font of the text.scale factor that is multiplied by the font-specific base size.A Scalar object specifying the color of the text.An integer value specifying the color of the textExampleimport 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; public class AddingText { ... Read More

330 Views
You can fit an ellipse over a shape using the fitEllipse() method of the org.opencv.imgproc.Imgproc class. This method accepts an object of MatOfPoint2f class, calculates the ellipse that would fit the given set of points and returns a RotatedRect object.Using this you can draw ellipses around the possible objects in an image. To do so, Read an image using the imread() method of the Imgproc class.Convert it into a grayscale image using the cvtColor() method of the Imgproc class.Convert the gray image to binary using the threshold() method of the Imgproc class.Find the contours in the image using the findContours() method ... Read More

488 Views
JShell implements REPL (Read-Evaluate-Print Loop) that reads the code from the command-line, evaluates the given snippet, and prints the result back to us.In JShell, it's possible to edit code from the default JShell editor by using JShell Editor Pad. We can also use the "/set" command to modify the default editor in order to define another one. When launching the "/edit" command, this editor can be used. In order to perform this operation, we can simply launch the "/set editor [editor]" command.Suppose we want to set the Notepad application as the default program for editing code, then just type the command: "/set editor ... Read More

565 Views
The module is a named, self-describing collection of code and data. The code has been organized as a set of packages containing types like Java classes and interfaces. The data includes resources and other kinds of static information. We need to declare a module then add module-info.java at the root of the source code.Below is the template of the "module-info.java" file.module { requires ; requires ; exports ; exports ; exports to }We can use certain command-line options that help us to modify existing modules and add dependencies to them, export ... Read More

480 Views
JShell is an interactive command-line tool introduced in Java 9. It is also called a REPL tool that takes input, evaluates it, and prints output to the user.In the JShell tool, it's possible to list all variables created by using the internal command "/vars". We have different "/vars" commands available in the JShell tool as listed below./vars /vars [ID] /vars [Variable_Name] /vars -start /vars -all/vars: This command allows to us display the list of all active variables of the current session./vars [ID]: This command displays the variable and its value, corresponding to the entered ID. This ID corresponds to the name of ... Read More

289 Views
A module that provides the implementation for the Service interface contains a "provides" statement in the module descriptor file. If the module doesn’t have the "provides" statement in the module descriptor file, the service loader can't load that module.We can create the Service Provider Interface by using below steps:We create a new Module com.tutorialspoint.serviceproviderinterface.In the src/main/java directory, we create "module-info.java" file.Inside our source directory, we create the package com.tutorialspoint.serviceproviderinterface.spi.Finally, we create the interface ServiceProviderInterface that contains a method: printServiceName() to be implemented.In the below, we can define Service Provider Interface.package com.tutorialspoint.serviceproviderinterface.spi; public interface ServiceProviderInterface { void printServiceName(); }Read More

2K+ Views
Contours is nothing but the line joining all the points along the boundary of a particular shape. Using this you can −Find the shape of an object.Calculate the area of an object.Detect an object.Recognize an object.You can find the contours of various shapes, objects in an image using the findContours() method. In the same way you can drawYou can draw the found contours of an image using the drawContours() method this method accepts the following parameters −An empty Mat object to store the result image.A list object containing the contours found.An integer value specifying the contour to draw (-ve value ... Read More

3K+ Views
If you try to read an image using the OpenCV imread() method it returns a Mat object. If you want to display the contents of the resultant Mat object using an AWT/Swings window You need to convert the Mat object to an object of the class java.awt.image.BufferedImage. To do so, you need to follow the steps given below −Encode the Mat to MatOfByte − First of all, you need to convert the matrix to the matrix of a byte. You can do it using the method imencode() of the class Imgcodecs.This method accepts a String parameter(specifying the image format), a ... Read More

408 Views
You can compute the bitwise conjunction between two images using the bitwise_not() method of the org.opencv.core.Core class.This method accepts two Mat objects representing the source and destination matrices, calculates the inverse of each element in the source matrix and stores the result in the destination matrix.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; public class BitwiseNOTExample { public static void main(String args[]) throws Exception { //Loading the OpenCV core library System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); //Reading the Image String file ="D://images//elephant.jpg"; Mat src = Imgcodecs.imread(file); ... Read More