VS the detection titan

fukurou

Administrator
Java:
public ArrayList<Rectangle> detectObjects(Bitmap bmp){
        /* returns list of objects rectangled locations on the bitmap
        * */
        int upperLid = 0;
        int lowerLid =0;
        int minY = bmp.getHeight()+1;int maxY = 0;int minX = 0;
        ArrayList<Rectangle> allObjects = new ArrayList<Rectangle>();//*global
        Boolean topLid = true;
        Boolean isWhiteLine = true;
        //bmp = graphicContour(bmp,0,bmp.getWidth(),0,bmp.getHeight(),Color.WHITE);
        for (int i = 2; i < bmp.getHeight()-2; i++) {
            isWhiteLine=true;
            for (int j = 0; j < bmp.getWidth()-2; j++) {
                Boolean blackPxl = isBlackPixel(bmp.getPixel(j,i));
                if(!blackPxl){isWhiteLine=false;break;}
            }
            if(!isWhiteLine&&topLid){upperLid=i;topLid=!topLid;}
            else if(isWhiteLine&&!topLid){lowerLid=i;topLid=!topLid;}
            
        }
        return new ArrayList<Rectangle>();
    }
 
Top