Read Colored Image as Grey Scale Using Java OpenCV Library

Maruthi Krishna
Updated on 08-Apr-2020 14:00:57

353 Views

The imread() method of the Imgcodecs class accepts a string value representing a file name as a parameter. This method reads the contents of the specified file into a matrix object and returns it. Using this method you can read the contents of an image.In addition to this, the Imgcodecs class also provides another variant of this method which accepts an integer value representing a flag specifying the required reading mode.The following are the various fields of the Imgcodecs class that can be used as flag values.IMREAD_COLOR − If the flag is set to this value, the loaded image will be ... Read More

Write an Image Using Java OpenCV Library

Maruthi Krishna
Updated on 08-Apr-2020 13:53:05

716 Views

Using the OpenCV library you can perform image processing operations such as image filtering, geometrical image transformations, color space conversion, histograms, etc.Writing an imageWhenever you read the contents of an image using the imread() method of the Imgcodecs class the result is read into the Matrix object.You can write/save an image using the imwrite() method. This accepts two parameters namely −File − A string value representing the file path to which the result should be stored.Img − A matrix object containing the data of the image to be saved.ExampleThe following Java example reads the contents of the image cat.jpg as a ... Read More

What is an Unnamed Module in Java 9

raja
Updated on 08-Apr-2020 11:52:20

972 Views

An unnamed module is a concept of the unnamed package. It is a module in which packages or classes can't be defined in any named module but exist in the jar file from classpath. If our code can try to load type from those files, the module system attempts to lookup classpath and loads it.An unnamed module read all other modules, including all of the named,  built-in platform modules, and also exports all of its packages. The package in an unnamed module can be ignored, which is also defined in the named module.The unnamed module has access to:All packages exported by all other modules available in module-path.All the jars ... Read More

Create Full Screen Search Box with CSS and JavaScript

AmitDiwan
Updated on 08-Apr-2020 11:08:47

616 Views

Following is the code to create a full screen search box with CSS and JavaScript −Example Live Demo body {    font-family: Arial; } * {    box-sizing: border-box; } .showBtn {    background: #008b0c;    border: none;    color:white;    padding: 10px 15px;    font-size: 20px;    cursor: pointer;    opacity: 0.8; } .showBtn:hover {    opacity: 1; } .overlaySearch {    height: 100%;    width: 100%;    display: none;    position: fixed;    z-index: 1;    top: 0;    left: 0;    background-color: rgba(132, 150, 155, 0.747); } .searchBar {    position: relative;    top: ... Read More

Get Complete Drive Information Using C#

Samual Sam
Updated on 08-Apr-2020 09:33:56

244 Views

Drive information of an Operating System includes.Drive Name Volume Label Free Space Total Size Drive Format Drive TypeTo get above information about a drive, try to run the following code −Exampleusing System.IO; using System; class Program {    static void Main() {       DriveInfo driveInfo = new DriveInfo("D");       Console.WriteLine(driveInfo.Name);       Console.WriteLine(driveInfo.VolumeLabel);       Console.WriteLine(driveInfo.AvailableFreeSpace);       Console.WriteLine(driveInfo.TotalFreeSpace);       Console.WriteLine(driveInfo.TotalSize);       Console.WriteLine(driveInfo.DriveFormat);       Console.WriteLine(driveInfo.DriveType);    } }OutputThe following is the output −D: NTFS 76767677788 76767677788 45463434799 NTFS FixedNote − The output may vary with different Operating Systems.

Create a Form with Icons Using CSS

AmitDiwan
Updated on 08-Apr-2020 09:31:29

735 Views

Following is the code to create a form with icons −Example Live Demo body {    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } * {    box-sizing: border-box; } h1 {    text-align: center; } form {    max-width: 500px;    margin: auto; } .fieldContainer {    display: flex;    width: 100%;    margin-bottom: 15px; } .icon {    font-size: 30px;    padding: 10px;    background: rgb(11, 9, 116);    color: white;    min-width: 50px;    text-align: center; } .field {    font-size: 20px;    width: 100%;    padding: 10px;    outline: none; } .field:focus {    border: 2px solid dodgerblue; } .btn {    font-size: 24px;    background-color: rgb(20, 60, 170);    color: white;    padding: 15px 20px;    border: none;    cursor: pointer;    width: 100%;    opacity: 0.9;    border-radius: 8px; } .btn:hover {    opacity: 1; } Register Form Example Register OutputThis will produce the following output −

Create a Contact Form with CSS

AmitDiwan
Updated on 08-Apr-2020 09:20:49

483 Views

Following is the code to create a contact form using CSS −Example Live Demo * {box-sizing: border-box;} body{    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } label{    font-size: 15px; } input[type=text],textarea {    width: 100%;    padding: 12px;    border: 1px solid #ccc;    border-radius: 4px;    box-sizing: border-box;    margin-top: 6px;    margin-bottom: 16px; } input[type=submit] {    background-color: #4CAF50;    color: white;    padding: 12px 20px;    border: none;    border-radius: 4px;    cursor: pointer; } input[type=submit]:hover {    background-color: #45a049; } form {    border-radius: 5px;    background-color: #feffc6;    padding: 20px; } Contact Form First Name Last Name Email Id Contact OutputThis will produce the following output −

Traverse Process Tree of Process API in Java 9

raja
Updated on 08-Apr-2020 09:18:08

361 Views

Java 9 has improved Process API, and it helps to manage and control operating system processes. Before Java 9, it has been difficult to manage and control operating system processes using Java programs. Since Java 9, new classes and interfaces have added to control the operating system process through Java programs. New interfaces like ProcessHandle and ProcessHandle.Info have added, and also new methods have added to Process class.In the below example, we can traverse a process tree (children and descendant processes) of Process API.Exampleimport java.io.IOException; public class ProcessTreeTest {    public static void main(String args[]) throws IOException {       Runtime.getRuntime().exec("cmd");   ... Read More

Get ID of the Running Process in Java 9

raja
Updated on 07-Apr-2020 18:29:21

764 Views

Java 9 has added improvements to Process API for getting PID of running process, getting children and/or descendants of a process, and also added a new class that helps to list out all running processes, getting information about an arbitrary process, and traversing process tree. The information returned by these methods can be a snapshot of processes running on the OS.In the below example, we can get an ID of the running process by using the pid() method of ProcessHandle.Examplepublic class ProcessHandleTest {    public static void main(String args[]) {       ProcessHandle processHandle = ProcessHandle.current();       System.out.println("PID of running Process: " + ... Read More

Load Source Code into JShell in Java 9

raja
Updated on 07-Apr-2020 14:33:07

313 Views

JShell is an interactive tool for learning Java, and it is a REPL(Read-Evaluate-Print-Loop) that evaluates declarations, statements, and expressions.While leaving a JShell session, we want to reuse the code previously entered into a new session. This can be done by using the command: /open [File_Path]. This command will load all code and internal commands found in file[File_Path] supplied as an option.In the below code snippet, we can use the "/open [File_Path]" command to load source code from the directory with the ".jsh" extension.C:\Users\User>jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> ... Read More

Advertisements