TeamCode/src/main/java/org/firstinspires/ftc/teamcode/libraries/CameraLib.java
String scanlineDomColor(int y, int bandWidth) {
            // scan the given horizontal line of the image for red, green, and blue strips and report
            // dominant pixel color of each bandWidth-pixel band
            Histogram hist = new Histogram(15);      // wrgbcym01234567
            String sDom = "";               // string describing the line of pixels ito "dominant color"
            for (int x=0; x<cameraSize().width; x++) {
                int pix = getPixel(x, y);
                int domClr = CameraLib.Pixel.dominantColor(pix);
                if (x%bandWidth == (bandWidth-1)) {
                    sDom += CameraLib.Pixel.colorName((bandWidth>1) ? hist.maxBin() : domClr);
                        // add symbol string for most popular color in this band, either directly or from histogram
                    hist.clear();                                // ... and restart the histogram for the next band
                }
                else
                    hist.add(domClr);                            // add a sample to Histogram for this band
            }
            return sDom;
        }
// return a string representation of the dominant colors along the given scanline
return a string representation of the dominant colors along the given scanline
return a string representation of the dominant colors along the given scanline
String scanlineDomColor(int y, int bandWidth) {
            Histogram hist = new Histogram(15);      
            String sDom = "";               
            for (int x=0; x<cameraSize().width; x++) {
                int pix = getPixel(x, y);
                int domClr = CameraLib.Pixel.dominantColor(pix);
                if (x%bandWidth == (bandWidth-1)) {
                    sDom += CameraLib.Pixel.colorName((bandWidth>1) ? hist.maxBin() : domClr);
                    hist.clear();                                
                }
                else
                    hist.add(domClr);                            
            }
            return sDom;
        }
String scanlineDomColor ( int y , int bandWidth ) { Histogram hist = new Histogram ( 15 ) ; String sDom = "" ; for ( int x = 0 ; x < cameraSize ( ) . width ; x ++ ) { int pix = getPixel ( x , y ) ; int domClr = CameraLib . Pixel . dominantColor ( pix ) ; if ( x % bandWidth == ( bandWidth - 1 ) ) { sDom += CameraLib . Pixel . colorName ( ( bandWidth > 1 ) ? hist . maxBin ( ) : domClr ) ; hist . clear ( ) ; } else hist . add ( domClr ) ; } return sDom ; }
return a string representation of the dominant colors along the given scanline
return a string representation of the dominant colors along the given scanline
// scan the given horizontal line of the image for red, green, and blue strips and report // dominant pixel color of each bandWidth-pixel band // wrgbcym01234567 // string describing the line of pixels ito "dominant color" // add symbol string for most popular color in this band, either directly or from histogram // ... and restart the histogram for the next band // add a sample to Histogram for this band