Menu

small/big step in Detector

Anonymous
2013-03-01
2013-03-04
  • Anonymous

    Anonymous - 2013-03-01

    It looks like a bug to me, but don't want to file it as a bug in case I read the code wrong, so asking question here.

    In Detector.detectAtScale method, it says "if there is no hint of detection, then increase the step size".

    But if I read the code correctly, if it detectes something then "result > 0". And "xstep = result == 0 ? smallStep : bigStep;" would get "bigStep" when something was detected.

    Per OpenCV code, it has small step if something is detected, and big step if nothing is detected. Same logic as stated in the comment, but the code here seems to do otherwise.

    Thanks,

    Anthony


        protected void detectAtScale(final SummedSqTiltAreaTable sat, final int startX, final int stopX, final int startY,
                        final int stopY, final float ystep, final int windowWidth, final int windowHeight,
                        final List<Rectangle> results)
        {
                for (int iy = startY; iy < stopY; iy++) {
                        final int y = Math.round(iy * ystep);
    
                        for (int ix = startX, xstep = 0; ix < stopX; ix += xstep) {
                                final int x = Math.round(ix * ystep);
    
                                final int result = cascade.classify(sat, x, y);
    
                                if (result > 0) {
                                        results.add(new Rectangle(x, y, windowWidth, windowHeight));
                                }
    
                                // if there is no hint of detection, then increase the step size
                                xstep = result == 0 ? smallStep : bigStep;
                        }
                }
        }
    
     
  • Jonathon Hare

    Jonathon Hare - 2013-03-04

    I think you're right. I've just changed it to xstep = (result > 0 ? smallStep : bigStep) to better match the comment and the behaviour of OpenCV.

    It might be better to do something a little more clever if the result is negative and large (i.e. if more than a certain proportion of the total number stages have passed, you should also use smallStep because it's likely that you're going to make a detection soon). This warrants further investigation.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.