From 2b7cd09ecae36426b7e2c3972700bbb82de30260 Mon Sep 17 00:00:00 2001 From: Peter Abeles Date: Wed, 1 Oct 2014 11:52:30 -0500 Subject: [PATCH] - updated gradle to snapshot - Comments in ColorHsv --- build.gradle | 4 +- change.txt | 13 +++++++ main/ip/src/boofcv/alg/color/ColorHsv.java | 37 ++++++++++++++++++- .../test/boofcv/alg/color/TestColorHsv.java | 4 ++ 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 22d6262c0f..1d729c2658 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ allprojects { apply plugin: 'eclipse' group = 'org.boofcv' - version = '0.18' + version = '0.19-SNAPSHOT' } subprojects { @@ -54,7 +54,7 @@ subprojects { // compile files("$libpath/lib/DDogleg.jar") // compile files("$libpath/lib/GeoRegression.jar") - compile group: 'org.georegression', name: 'georegression', version: '0.7' + compile group: 'org.georegression', name: 'georegression', version: '0.8-SNAPSHOT' testCompile group: 'junit', name: 'junit', version: '4.11' } diff --git a/change.txt b/change.txt index 8606a17e12..a77376ea33 100644 --- a/change.txt +++ b/change.txt @@ -2,6 +2,19 @@ Change Log Date Format: year/month/day +--------------------------------------------- +Date : 2014 +Version : Alpha 0.19 + +TODO + * Square Detector. Create set of images in validation boof with hand selected corners + Improve performance across a range of distances and orientations + * Square Image: Better example image than the dog, which can have ambiguous orientation + * Hough - investigate bug report + * Template with transparent pixels + * Android Demo: Automatic Threshold. Dim slider for global + * Look at Sandreas's NewWarp + --------------------------------------------- Date : 2014/9/22 Version : Alpha 0.18 diff --git a/main/ip/src/boofcv/alg/color/ColorHsv.java b/main/ip/src/boofcv/alg/color/ColorHsv.java index d1c7b605d7..e0e1bccc9e 100644 --- a/main/ip/src/boofcv/alg/color/ColorHsv.java +++ b/main/ip/src/boofcv/alg/color/ColorHsv.java @@ -26,11 +26,45 @@ *

* Color conversion between RGB and HSV color spaces. HSV stands for Hue-Saturation-Value. "Hue" has a range of [0,2*PI] * and "Saturation" has a range of [0,1], the two together represent the color. While "Value" has the same range as the - * input pixels and represents how light/dark the color is. + * input pixels and represents how light/dark the color is. Original algorithm taken from [1] and modified slightly. *

* *

* NOTE: The hue is represented in radians instead of degrees, as is often done. + * NOTE: Hue will be set to NaN if it is undefined. It is undefined when chroma is zero, which happens when the input + * color is a pure gray (e.g. same value across all color bands). + *

+ * + *

+ * RGB to HSV:
+ *

+ * min = min(r,g,b)
+ * max = max(r,g,b)
+ * delta = max-min  // this is the chroma
+ * value = max
+ *
+ * if( max != 0 )
+ *   saturation = delta/max
+ * else
+ *   saturation = 0;
+ *   hue = NaN
+ *
+ * if( r == max )
+ *   hue = (g-b)/delta
+ * else if( g == max )
+ *   hue = 2 + (b-r)/delta
+ * else
+ *   hue = 4 + (r-g)/delta
+ *
+ * hue *= 60.0*PI/180.0
+ * if( hue < 0 )
+ *   hue += 2.0*PI
+ *
+ * 
+ *

+ * + *

+ * [1] http://www.cs.rit.edu/~ncs/color/t_convert.html *

* * @author Peter Abeles @@ -53,7 +87,6 @@ This doesn't seem to improve the runtime noticeably and makes the code uglier. */ - public class ColorHsv { // 60 degrees in radians diff --git a/main/ip/test/boofcv/alg/color/TestColorHsv.java b/main/ip/test/boofcv/alg/color/TestColorHsv.java index 35eb85e765..037d3f2ac5 100644 --- a/main/ip/test/boofcv/alg/color/TestColorHsv.java +++ b/main/ip/test/boofcv/alg/color/TestColorHsv.java @@ -52,6 +52,10 @@ public void backAndForth_F64_and_F32() { check(0.25, 0.5, 0.75); check(0.8, 0.1, 0.75); check(151, 151, 151); + check(151, 120, 120); + check(120, 151, 120); + check(120, 120, 151); + for( int i = 0; i < 50; i++ ) { double r = rand.nextDouble();