src/main/java/com/xceptance/neodymium/visual/ai/pre_processing/PreProcessing.java
/***
     * Segmentation and grouping of all edges, artifacts under a specific threshold will ignored. Parameter are
     * {@link Constants#THRESHOLD}, {@link Constants#MINGROUPSIZE}. Both parameter get calculated in response to the
     * dimensions of the image {@link Helper#setImageParameter()}.
     * 
     * @param edges
     *            List of {@link FeaturePoint}
     * @param currentImage
     *            fastBitmap of the current screenshot.
     */
Segmentation and grouping of all edges, artifacts under a specific threshold will ignored. Parameter are
Constants#THRESHOLD,  Constants#MINGROUPSIZE. Both parameter get calculated in response to the
dimensions of the image  Helper#setImageParameter().

@param edges
List of  FeaturePoint
@param currentImage
fastBitmap of the current screenshot.
Segmentation and grouping of all edges artifacts under a specific threshold will ignored . Parameter are Constants#THRESHOLD Constants#MINGROUPSIZE . Both parameter get calculated in response to the dimensions of the image Helper#setImageParameter () . @param edges List of FeaturePoint @param currentImage fastBitmap of the current screenshot .
private void findGroups(List<FeaturePoint> edges, FastBitmap currentImage)
    {
        ArrayList<HashSet<FeaturePoint>> allGroups = new ArrayList<>();
        while (!edges.isEmpty())
        {
            int index = 0;
            int internIndex = 0;
            HashSet<FeaturePoint> todoList = new HashSet<FeaturePoint>();
            todoList.add(edges.get(0));
            Iterator<FeaturePoint> iter = todoList.iterator();
            FeaturePoint currentPoint = iter.next();
            while (internIndex < todoList.size())
            {
                currentPoint.visited = true;
                while (currentPoint.x + Constants.THRESHOLD >= edges.get(index).x)
                {
                    if (Helper.inBetween(currentPoint.y, edges.get(index).y, Constants.THRESHOLD))
                    {
                        todoList.add(edges.get(index));
                    }
                    ++index;
                    if (edges.size() == index)
                    {
                        break;
                    }
                }
                index = 0;
                ++internIndex;
                iter = todoList.iterator();
                if (iter.hasNext())
                {
                    currentPoint = iter.next();
                    while (currentPoint.visited && iter.hasNext())
                    {
                        currentPoint = iter.next();
                    }
                }
                if (currentPoint.visited)
                {
                    break;
                }
            }
            if (!todoList.isEmpty() && todoList.size() >= Constants.MINGROUPSIZE)
            {
                allGroups.add(todoList);
            }
            edges.removeAll(todoList);
        }
        ArrayList<ArrayList<FeaturePoint>> returnList = new ArrayList<ArrayList<FeaturePoint>>();
        for (int index = 0; index < allGroups.size(); ++index)
        {
            returnList.add(new ArrayList<>(allGroups.get(index)));
            Collections.sort(returnList.get(index));
            met.metricList.add(new Metric(returnList.get(index), currentImage));
            Collections.sort(met.metricList);
        }
        allGroups = null;
    }
private void findGroups ( List < FeaturePoint > edges , FastBitmap currentImage ) { ArrayList < HashSet < FeaturePoint > > allGroups = new ArrayList < > ( ) ; while ( ! edges . isEmpty ( ) ) { int index = 0 ; int internIndex = 0 ; HashSet < FeaturePoint > todoList = new HashSet < FeaturePoint > ( ) ; todoList . add ( edges . get ( 0 ) ) ; Iterator < FeaturePoint > iter = todoList . iterator ( ) ; FeaturePoint currentPoint = iter . next ( ) ; while ( internIndex < todoList . size ( ) ) { currentPoint . visited = true ; while ( currentPoint . x + Constants . THRESHOLD >= edges . get ( index ) . x ) { if ( Helper . inBetween ( currentPoint . y , edges . get ( index ) . y , Constants . THRESHOLD ) ) { todoList . add ( edges . get ( index ) ) ; } ++ index ; if ( edges . size ( ) == index ) { break ; } } index = 0 ; ++ internIndex ; iter = todoList . iterator ( ) ; if ( iter . hasNext ( ) ) { currentPoint = iter . next ( ) ; while ( currentPoint . visited && iter . hasNext ( ) ) { currentPoint = iter . next ( ) ; } } if ( currentPoint . visited ) { break ; } } if ( ! todoList . isEmpty ( ) && todoList . size ( ) >= Constants . MINGROUPSIZE ) { allGroups . add ( todoList ) ; } edges . removeAll ( todoList ) ; } ArrayList < ArrayList < FeaturePoint > > returnList = new ArrayList < ArrayList < FeaturePoint > > ( ) ; for ( int index = 0 ; index < allGroups . size ( ) ; ++ index ) { returnList . add ( new ArrayList < > ( allGroups . get ( index ) ) ) ; Collections . sort ( returnList . get ( index ) ) ; met . metricList . add ( new Metric ( returnList . get ( index ) , currentImage ) ) ; Collections . sort ( met . metricList ) ; } allGroups = null ; }
Segmentation and grouping of all edges, artifacts under a specific threshold will ignored.
Segmentation and grouping of all edges artifacts under a specific threshold will ignored .
// MainLoop for grouping // current list for the group and all its elements // initiation point // check if the current list is in border of the edges list // mark element as visited // check if there are more points around the current point // range check around the current point // safety check for overflow error // double check if there are more points in the list and all of them visited // when all points are visited so must the last one // filter if the HashSet is too small, in case it is to small it will be ignored and discarded // change the HashSet to an ArrayList for further working // add all found group lists to an ArrayList // sort the elements in ascending order for score(intensity) values // create the metrics for the found groups and save them in the curator // sort the Metrics after group size