Fit Ellipses Around Possible Objects in Image Using OpenCV Java

Maruthi Krishna
Updated on 13-Apr-2020 09:20:23

369 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

Modify Default Editor of JShell in Java 9

raja
Updated on 13-Apr-2020 09:12:48

508 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

Satellite Tracking

Ajay yadav
Updated on 13-Apr-2020 08:18:46

657 Views

This article showcases the real − time satellite tracking and orbit prediction program for both the Linux and desktop using gpredict software. We can run in real-time, simulated real-time (fast forward and backward), and manual time control with this tool.Core features of GpredictTracking of a large number of satellites moving across the globe.Display the tracking data in lists, maps, polar plots and any combination of these.We can predict upcoming passes with the base stationDetailed information both the real-time and non-real time modesDoppler tuning of radios via Hamlib rigctldAntenna rotator control via Hamlib rotctldPrerequisiteThe satellite tracking software gpredict requires the following ... Read More

Run Linux Natively on Windows 10

Ajay yadav
Updated on 13-Apr-2020 08:11:16

495 Views

Microsoft has introduced the WSL Subsystem for Linux, which lets users run their favorite Linux distributions directly from Windows 10 without dual-booting or using a virtual machine.Limitations of Windows Subsystem for LinuxWhile this is a step in the right direction for Microsoft, it's not quite there yet in terms of full functionality. Specifically, WSL does not support AF_PACKET for security restrictions. This means that you won't be able to put a Wi-Fi adapter in promiscuous mode (or monitor mode), and tools that require raw sockets to function properly won't work, such as Nmap.Installation the Windows Subsystem for LinuxStep-1:To do so, ... Read More

Modify Existing Module in Java 9

raja
Updated on 10-Apr-2020 17:24:53

592 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

Different VARS Commands in JShell in Java 9

raja
Updated on 10-Apr-2020 13:48:38

509 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

Create a Service Provider Interface in Java 9

raja
Updated on 10-Apr-2020 12:19:26

310 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

C# Program to Read All Lines of a File at Once

karthikeya Boyini
Updated on 10-Apr-2020 09:42:53

216 Views

Use ReadAllText() method to read all the lines of a file at once.Let’s say we have a file “hello.txt” with the following lines −One Two ThreeTo read the above file, add the path of the file as parameter.File.ReadAllText(myPath);Above, myPath had the file path.String myPath = "hello.txt";Let us see the complete code −Exampleusing System; using System.IO; public class Demo {    public static void Main() {       String myPath = "hello.txt";       String allLines;       allLines = File.ReadAllText(myPath);       Console.WriteLine(allLines);    } }OutputThe following is the output −One Two Three

Draw Image Contours Using Java OpenCV Library

Maruthi Krishna
Updated on 10-Apr-2020 09:15:05

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

Convert OpenCV Mat to BufferedImage in Java

Maruthi Krishna
Updated on 10-Apr-2020 09:13:16

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

Advertisements