Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A error with using cv2.cvtColor to convert BGR img to HSV #963

Open
4 tasks
leptonic opened this issue Mar 19, 2024 · 0 comments
Open
4 tasks

A error with using cv2.cvtColor to convert BGR img to HSV #963

leptonic opened this issue Mar 19, 2024 · 0 comments

Comments

@leptonic
Copy link

Expected behaviour

The Hue value of one color value is 180 , the return value should be 180 , but it return 0.
it will make the average value be impacted very much.

Actual behaviour

I tried to use cv2.cvtColor convert 2 similar pure color pictures to HSV and compare with the Hue result,
I found the delta of them near to 50%,

until I print both of them , that be found like this :

6

h_top [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178]
s_top 42.46882456140351
v_top 96.90878947368421
h_bottom [177 177 177 177 177 177 177 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
177 177 177 177 177 177 177 177 177 177 177 177 177 177 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178
178 178 178 178 178 178 178 178 178 178 178 178 178 178 178]
s_bottom 43.50040350877193
v_bottom 95.66519298245613

h_top and h_bottom are the similar pictures I got.

Steps to reproduce

use this to drop the zero data for short term
non_zero_h = hsv_piece[:,:, 0][hsv_piece[:,:, 0] > 0]

windows 10
opencv-python 4.5.5

Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant