Maruthi Krishna has Published 870 Articles

OpenCV JavaFX application to alter the sharpness of an image

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 08:09:44

263 Views

Sharpening an image is the opposite of blur. To alter the sharpness of an image using the OpenCV library, you need to smooth/blur it using the Gaussian filter and subtract the smoothed version from the original image.ExampleFollowing is a JavaFX program with two sliders representing the alpha and beta values.import ... Read More

Altering the brightness and contrast of an image using JavaFX and OpenCV

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 08:04:37

652 Views

The convertTo() method of the org.opencv.core.Mat class accepts 4 parameters namely: mat(empty matrix), rtype(integer), alpha(integer), beta(integer), in the same order.To increase the brightness − You need to reduce the beta value from 0 towards -255(keeping alpha value 1).To decrease the brightness − You need to increase the beta value from ... Read More

JavaFX example to decrease the brightness of an image using OpenCV.

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:59:28

216 Views

One way to alter the brightness of an image using Java is to use the convertTo() method. This method performs the required calculations on the given matrix to alter the contrast and brightness of an image. This method accepts 4 parameters −mat − Empty matrix to hold the result with ... Read More

How to alter the sharpness of an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:55:11

1K+ Views

Sharpening an image is the opposite of blur. To alter the sharpness of an image using the OpenCV library, you need to smooth/blur it using the Gaussian filter and subtract the smoothed version from the original image.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Size; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class AlteringSharpness { ... Read More

How to alter the brightness of an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:53:00

902 Views

The convertTo() method of the org.opencv.core.Mat class performs the required calculations on the given matrix to alter the contrast and brightness of an image. This method accepts 4 parameters −mat − Empty matrix to hold the result with the same size and type as the source matrix.rtype − integer value ... Read More

How to alter the contrast of an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:47:51

1K+ Views

The increasing/decreasing of brightness and contrast of an image are the operations that can be achieved by transforming the pixels of the image. this can be expressed in the form of an equation as −g(i, j) = α . f(i, j)+ βWhere, (i, j) are the positions of the pixels.α ... Read More

How to compare two images using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:26:47

7K+ Views

To compare two images −Read Both of them using the Image.IO.read() method.Get the height and width of both of them to make sure they are equal.Get the pixel values and, get the RGB values of both of the images.Get the sum of the differences between the RGB values of these ... Read More

How to flip an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

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

1K+ Views

The flip() method of the Core class of OpenCV flips an image along the x/y axis. This method accepts −A source matrix congaing the data of the original image.An empty destination matrix to hold the data of the resultant image.A flip code to specify the direction of the image (0 ... Read More

How to create a watermark on an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:19:52

475 Views

Following Java example draws a watermark (“Hello”) on the given image and saves it back.Exampleimport java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class WaterMarkExample {    public static void main(String[] args) throws IOException {       //Reading the contents of an image ... Read More

How to create a mirror image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Apr-2020 07:17:16

764 Views

To create a mirror imageRead the required image using ImageIO.read() method.Get the height and width of the image.Create an empty buffered image to store the resultUsing nested for loops traverse through each pixel in the image.Iterate the width of the image from right to left.Get the pixel value using the ... Read More

Advertisements