- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 2617 Articles for Java
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
1K+ 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
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
2K+ 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
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
308 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
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
7K+ Views
A digital image is stored as a 2D array of pixels and a pixel is the smallest element of a digital image.Each pixel contains the values of alpha, red, green, blue values and the value of each color lies between 0 to 255 which consumes 8 bits (2^8).The ARGB values are stored in 4 bytes of memory in the same order (right to left) with blue value at 0-7 bits, Green value at 8-15 bits, Red value at 16-23 bits and, alpha at 24-31 bits.Retrieving the pixel contents (ARGB values) of an image −To get the pixel values from an ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
546 Views
You can draw makers on an image using the drawMarker() method of the org.opencv.imgproc.Imgproc class. This method accepts the following parameters −img − A Mat object representing the input image.position − An object of the class Point to specify the position of the marker.color − An object of the class Scalar to specify the color of the marker.markerType − An integer constant specifying the type of the marker.size − An integer value specifying the size of the marker.thickness − An integer value specifying the thickness of the marker.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 ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
733 Views
The detect() method of the org.opencv.features2d.Feature2D (abstract) class detects the key points of the given image. To this method, you need to pass a Mat object representing the source image and an empty MatOfKeyPoint object to hold the read key points.The drawMatches() method of the org.opencv.features2d.Feature2D class finds the matches between the key points of the two given images and draws them. This method accepts the following parameters −src1 − An object of the Mat class representing the first source image.keypoints1 − An object of the MatOfKeyPoint class representing the Key points of the first source image.src2 − An object of the ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
752 Views
The detect() method of the org.opencv.features2d.Feature2D (abstract) class detects the key points of the given image. To this method, you need to pass a Mat the object representing the source image and an empty MatOfKeyPoint object to hold the read key points.You can draw the draw key points on the image using the drawKeypoints() method of the org.opencv.features2d.Features2d class.NoteSince Feature2D is an abstract class you need to instantiate one of its subclasses to invoke the detect() method. Here we have used the FastFeatureDetector class.Features2D and Features2d are two different classes of the package features2d don’t get confused...Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
671 Views
Contours are 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 also find the area of the shapes in the given input images. To do so you need to invoke the contourArea() method of the Imgproc class. This method accepts the contour of a particular shape, finds and returns its area.ExampleFollowing java ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
1K+ Views
Contours are 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. This method accepts the following parameters −A binary image.An empty list object of type MatOfPoint to store the contours.An empty Mat object to store the image topology.Two integer variables to specify the mode and method to find the contours of the given image.Exampleimport java.util.ArrayList; import java.util.Iterator; import java.util.List; import ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
507 Views
You can compute bitwise conjunction between two images using the bitwise_and() method of the org.opencv.core.Core class.This method accepts three Mat objects representing the source, destination and result matrices, calculates the bitwise conjunction of each every element in the source matrices and stores the result in the destination matrix.ExampleIn the following Java example we are converting an image into binary and gray scale and calculating the bitwise conjunction of the results.import 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 BitwiseAndExample { public static void main(String args[]) throws Exception { //Loading the OpenCV core library ... Read More