Working on plug-in to detect black and draw lines over it.

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

Working on plug-in to detect black and draw lines over it.

_BLUE
I want to measure objects in an image automatically.

I wrote a small macro to turn the image black and white and ImageJ can draw the line and save the results.

So I need to point ImageJ to find the black edges of an object.

I THINK this plug-in here will find the width and height of the image as well as get an array of the pixel values. What do you think I should do from here?

I posted on another forum and they suggested I use getRGB to find the first black pixel by searching up and down rows.

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import java.awt.image.*;
import java.awt.Color;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import ij.plugin.filter.PlugInFilter;

public class Line_ implements PlugInFilter {

        public int setup(String arg, ImagePlus imp) {
                return DOES_RGB;
        }

        public void run(ImageProcessor ip) {
                int width = ip.getWidth();
                int height = ip.getHeight();
                //java.lang.Object getPixels();
                int[] pixels = (int[]) ip.getPixels();
}

        public void run(String arg) {
                IJ.showMessage("Line++","It does appear to be working.");
        }
}