- 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 HSV to BGR image using Java OpenCV library?
The cvtColor() method of the Imgproc class changes/converts the color of the image from one to another. This method accepts three parameters −
src − A Matrix object representing source.
dst − A Matrix object representing the destination.
code − An integer value representing the color of the destination image.
To convert an HSV image to BGR you need to pass Imgproc.COLOR_HSV2BGR as the 3rd parameter to the cvtColor() method.
Example
public class HSV2RGB { public static void main(String args[]) throws Exception { System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); Mat src = Imgcodecs.imread("D:\images\hsvimage2.jpg"); Mat dst = new Mat(); Imgproc.cvtColor(src, dst, Imgproc.COLOR_HSV2BGR); Imgcodecs imageCodecs = new Imgcodecs(); imageCodecs.imwrite("D:\images\hsv2bgr.jpg", dst); System.out.println("Image Saved"); } }
Input
Output
- Related Articles
- How to convert RGB image to HSV using Java OpenCV library?
- How to convert HSV to colored image using Java OpenCV library?
- How to convert an RGB image to HSV image using OpenCV Python?
- How to convert HLS to colored image using Java OpenCV library?
- How to convert colored image to HLS using Java OpenCV library?
- How to convert a negative image to positive 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 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?
- How to draw Image Contours using Java OpenCV library?
- How to create a mirror image using Java OpenCV library?

Advertisements