- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to convert colored image to HLS using Java OpenCV library?
You can convert HLS image to RGB (colored) image by passing Imgproc.COLOR_RGB2HLS as the 3rd parameter to the cvtColor() method.
Example
import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; public class HSL2RGB { public static void main(String args[]) throws Exception { System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); Mat src = Imgcodecs.imread("D:\images\car3.jpg"); Mat dst = new Mat(); Imgproc.cvtColor(src, dst, Imgproc.COLOR_RGB2HLS); Imgcodecs imageCodecs = new Imgcodecs(); imageCodecs.imwrite("D:\images\hslImage.jpg", dst); System.out.println("Image Saved"); } }
Input
Output
- Related Articles
- How to convert HLS to colored image using Java OpenCV library?
- How to convert a colored image to HLS in OpenCV using Python?
- How to convert HSV to colored image using Java OpenCV library?
- How to convert a colored image to Sepia image using Java OpenCV library?
- How to convert a colored image to grayscale using Java OpenCV library?
- How to convert a colored image to blue/green/red image using Java OpenCV library?
- How to convert RGB image to HSV using Java OpenCV library?
- How to convert HSV to BGR image using Java OpenCV library?
- How to convert a negative image to positive image using Java OpenCV library?
- Reading a colored image as grey scale using Java OpenCV library.
- OpenCV Python – How to convert a colored image to a binary image?
- How to convert a positive image to Negative to using OpenCV library?
- How to write an image using Java OpenCV library?
- How to flip an image using Java OpenCV library?
- How to find Image Contours using Java OpenCV library?

Advertisements