Login  Register

Re: Can't find Auto Crop Plugin

Posted by andyg2 on Nov 04, 2010; 6:25pm
URL: http://imagej.273.s1.nabble.com/Can-t-find-Auto-Crop-Plugin-tp3686501p3686504.html

Gabriel Landini wrote
On Friday 16 October 2009  16:50:39 gabejackson wrote:
> Nevermind, i quickly wrote one... it's really ugly, but maybe somebody can
> use it :D

Ah, your message came after I sent mine.
Anyway, it would be also useful to use the options set in the Binary>Options
for foreground or background. I will add this if you do not mind.

Cheers
G
I'm very new to java but I've tried editing the autoCrop script to ignore single pixels by counting them. A kind of fuzziness factor. Alas, I've got nowhere. I think this would both compliment any revisions to this and help me out a great deal. If anyone wants to put me out of my sense of defeat it would mean a lot to me.

Here's the idea I have:


        int dotC = 0;
        for (int x=0; x<imp.getWidth(); x++) {
                for (int y=0; y<imp.getHeight(); y++) {
                                dotC++;
                                if(ip.get(x, y) == 255) {
                                        if(dotC == 50 || y >= imp.getHeight()) {
                                                maxX = x;
                                                break;
                                        }
                                }
                        }
                }
        }

50 being the number of dots to skip before triggering the crop location.

Adding the binary function would further assist me if you're planning that anyway :)