https://github.com/winand/hsv_color_picker
HSV Color Picker for OpenCV and ROI
https://github.com/winand/hsv_color_picker
color-picker colors cv hsv opencv python roi widget
Last synced: about 1 month ago
JSON representation
HSV Color Picker for OpenCV and ROI
- Host: GitHub
- URL: https://github.com/winand/hsv_color_picker
- Owner: Winand
- Created: 2021-12-16T18:00:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-04T10:43:02.000Z (over 4 years ago)
- Last Synced: 2025-03-26T04:34:52.748Z (about 1 year ago)
- Topics: color-picker, colors, cv, hsv, opencv, python, roi, widget
- Language: Python
- Homepage:
- Size: 2.32 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HSV Color Picker and ROI
## Color Picker
HSV Color Picker widget for OpenCV (Python) allows to select hue value and
saturation/brightness range with your mouse cursor.

Usage example (see `demo.py`):
```
import cv2 as cv
from hsv_color_picker import SliderHSV
color_slider = SliderHSV("HSV slider", normalized_display=True)
while True:
k = cv.waitKey(5) & 0xFF
if k == 27:
break
```
## ROI
`selection.RectSelection` class allows to select ROI on any loaded image.
The selection rectangle can be moved or resized using the mouse cursor.

Usage example (see `demo_roi.py`):
```
import cv2
from hsv_color_picker.selection import RectSelection
img = cv2.imread("house.jpg")
cv2.imshow('ROI', img)
sel = RectSelection('ROI', img)
while True:
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
```
### selectROI
`selection.selectROI` function implements interface of
[cv2.selectROI](https://docs.opencv.org/4.x/d7/dfc/group__highgui.html#ga8daf4730d3adf7035b6de9be4c469af5).
```
import cv2
from hsv_color_picker.selection import selectROI
img = cv2.imread("house.jpg")
rc = selectROI(img)
print(rc)
```