Bug in orphan plugin? Hough Circles

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in orphan plugin? Hough Circles

Mike Cowperthwaite
Greetings all,

I've been trying out the Hough_Circles plugin, to investigate whether
this technique will be useful in my application (so far, it looks
promising).  I noticed what I think is a bug.  I sent mail to the two
addresses listed as the authors, both of which bounced.

The bug:  When I limit the plugin’s action using a selection, the Hough
Space image looks as I would expect it to, but the Circles Found image
appears to be completely garbled.  I can provide an example image, but I
think this is easily reproducible.

I may be able to look at fixing this sometime, but I don't need a fix at
the moment.

--
Mike Cowperthwaite
Lathrop Engineering, San Jose CA
Reply | Threaded
Open this post in threaded view
|

Re: Bug in orphan plugin? Hough Circles

David Webster
Mike,
I ran the "Dot_Blot.jpg" test image and got the same behavior. I also get
the flollowing exception when the ROI ismbig enough. Do you get this as
well?

David

java.lang.ArrayIndexOutOfBoundsException: 50971
at Hough_Circles.drawCircles(Hough_Circles.java:280)
.
.
.

On Mon, Apr 27, 2009 at 1:23 PM, Mike Cowperthwaite <
[hidden email]> wrote:

> Greetings all,
>
> I've been trying out the Hough_Circles plugin, to investigate whether this
> technique will be useful in my application (so far, it looks promising).  I
> noticed what I think is a bug.  I sent mail to the two addresses listed as
> the authors, both of which bounced.
>
> The bug:  When I limit the plugin’s action using a selection, the Hough
> Space image looks as I would expect it to, but the Circles Found image
> appears to be completely garbled.  I can provide an example image, but I
> think this is easily reproducible.
>
> I may be able to look at fixing this sometime, but I don't need a fix at
> the moment.
>
> --
> Mike Cowperthwaite
> Lathrop Engineering, San Jose CA
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug in orphan plugin? Hough Circles

David Webster
In reply to this post by Mike Cowperthwaite
Mike,

I couldn't help myself. i found the problem anbd hacked in a fix (see
below). The drawCircles method is/was a little confused between  ROI and
input image coordinates. This is a fix. The actual online code should be
fixed, but I don't know what to do or who to ask,

David

// Fix for Hough_Circles.java

    // Draw the circles found in the original image.
    public void drawCircles(byte[] circlespixels) {

  // HACK
  // Copy original input pixels into output
  // circle location display image and
  // combine with saturation at 100
  int roiaddr=0;
  for( int y = offy; y < offy+height; y++){
   for(int x = offx; x < offx+width; x++){
    // Copy;
    circlespixels[roiaddr] = imageValues[x+offset*y];
    // Saturate
    if(circlespixels[roiaddr] != 0 )
                 circlespixels[roiaddr] = 100;
             else
                 circlespixels[roiaddr] = 0;
    roiaddr++;
   }
  }
        // Copy original image to the circlespixels image.
        // Changing pixels values to 100, so that the marked
        // circles appears more clear. Must be improved in
        // the future to show the resuls in a colored image.
        //for(int i = 0; i < width*height ;++i ) {
            //if(imageValues[i] != 0 )
            //if(circlespixels[i] != 0 )
                //circlespixels[i] = 100;
            //else
                //circlespixels[i] = 0;
        //}
        if(centerPoint == null) {
            if(useThreshold)
                getCenterPointsByThreshold(threshold);
            else
                getCenterPoints(maxCircles);
        }
        byte cor = -1;
  // HACK
  // Redefine these so refer to ROI coordinates exclusively
  int offset = width;
  int offx=0;
  int offy=0;

        for(int l = 0; l < maxCircles; l++) {
            int i = centerPoint[l].x;
            int j = centerPoint[l].y;
            // Draw a gray cross marking the center of each circle.
            for( int k = -10 ; k <= 10 ; ++k ) {
             int p = (j+k+offy)*offset + (i+offx);
                if(!outOfBounds(j+k+offy,i+offx))
                    circlespixels[(j+k+offy)*offset + (i+offx)] = cor;
                if(!outOfBounds(j+offy,i+k+offx))
                    circlespixels[(j+offy)*offset   + (i+k+offx)] = cor;
            }
            for( int k = -2 ; k <= 2 ; ++k ) {
                if(!outOfBounds(j-2+offy,i+k+offx))
                    circlespixels[(j-2+offy)*offset + (i+k+offx)] = cor;
                if(!outOfBounds(j+2+offy,i+k+offx))
                    circlespixels[(j+2+offy)*offset + (i+k+offx)] = cor;
                if(!outOfBounds(j+k+offy,i-2+offx))
                    circlespixels[(j+k+offy)*offset + (i-2+offx)] = cor;
                if(!outOfBounds(j+k+offy,i+2+offx))
                    circlespixels[(j+k+offy)*offset + (i+2+offx)] = cor;
            }
        }
    }


On Mon, Apr 27, 2009 at 1:23 PM, Mike Cowperthwaite <
[hidden email]> wrote:

> Greetings all,
>
> I've been trying out the Hough_Circles plugin, to investigate whether this
> technique will be useful in my application (so far, it looks promising).  I
> noticed what I think is a bug.  I sent mail to the two addresses listed as
> the authors, both of which bounced.
>
> The bug:  When I limit the plugin’s action using a selection, the Hough
> Space image looks as I would expect it to, but the Circles Found image
> appears to be completely garbled.  I can provide an example image, but I
> think this is easily reproducible.
>
> I may be able to look at fixing this sometime, but I don't need a fix at
> the moment.
>
> --
> Mike Cowperthwaite
> Lathrop Engineering, San Jose CA
>