dogecv / DogeCV

FTC Vision Library
https://discord.gg/colton
GNU General Public License v3.0
68 stars 64 forks source link

Should color filter values be clipped? #9

Closed gearsincorg closed 5 years ago

gearsincorg commented 5 years ago

Wondering... In the filtering methods, should the HSV ranges be clipped?.

eg: in the following code, a poor user-choice of perfect and range values could result in negative or excessive HSV values...

Scalar lower = new Scalar(perfect.val[0] - range.val[0], perfect.val[1] - range.val[1],perfect.val[2] - range.val[2]);
        Scalar upper = new Scalar(perfect.val[0] + range.val[0], perfect.val[1] + range.val[1],perfect.val[2] + range.val[2]);
victoryforphil commented 5 years ago

That is a good point. In all honesty I never used or payed attention to HSVFilter until this season. Ill probably add in either a setting or new detector that is a clipped version that you described.

gearsincorg commented 5 years ago

If you are looking for other thoughts, I'd suggest splitting the ranges in half and applying them to the perfect value... eg: If I set a perfect value of 20 and a range of 10, I think I'd expect the actual min-max to be 15-25, rather than 10 - 20 as in the current code.

Just a thought..

victoryforphil commented 5 years ago

Yea that's a good point. That's the tactic I use nowadays. I'll throw these changes into 2018.1.

victoryforphil commented 5 years ago

Alright, im closing this thread as I just implemented it into 2018.1 (Releasing Soon). The dividing the range by 2 actually explains why the White HSV were so wide compared to my initial tuning, I was assuming that I was dividing by 2. Anyways this update should be live within a day.