Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my attempt using ImageJ:</p> <pre><code> // Open the Image ImagePlus image = new ImagePlus(filename); // Make the Image 8 bit IJ.run(image, "8-bit", ""); // Apply a Threshold (0 - 50) ByteProcessor tempBP = (ByteProcessor)image.getProcessor(); tempBP.setThreshold(0, 50, 0); IJ.run(image, "Convert to Mask", ""); // Analyze the Particles ParticleAnalyzer pa = new ParticleAnalyzer( ParticleAnalyzer.SHOW_MASKS + ParticleAnalyzer.IN_SITU_SHOW, 1023 + ParticleAnalyzer.ELLIPSE , rt, 0.0, 999999999, 0, 0.5); IJ.run(image, "Set Measurements...", "bounding fit redirect=None decimal=3"); pa.analyze(image); int k = 0; double maxSize = -1; for (int i = 0; i &lt; rt.getCounter(); i ++) { // Determine creteria for best oval. // The major axis should be much longer than the minor axis. // let k = best oval } double bx = rt.getValue("BX", k); double by = rt.getValue("BY", k); double width = rt.getValue("Width", k); double height = rt.getValue("Height", k); // Your angle: double angle = rt.getValue("Angle", k); double majorAxis = rt.getValue("Major", k); double minorAxis = rt.getValue("Minor", k); </code></pre> <p>How the code works:</p> <ol> <li>Make the image grayscaled.</li> <li>Apply a threshold on it to only get the dark areas. This assumes the lines will always be near black.</li> <li>Apply a Particle Analyzer to find Ellipses on the image.</li> <li>Loop through the "Particles" to find ones that fit our criteria.</li> <li>Get the angle from our Particle.</li> </ol> <p>Here's an example of what the image looks like when I analyze it:</p> <p><img src="https://i.stack.imgur.com/L3CQQ.png" alt="Oval Image"> <img src="https://i.stack.imgur.com/SknWB.png" alt="Oval Image 2"></p> <p><strong>NOTE</strong>: The code is untested. I just converted what I did in the Visual ImageJ into Java.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload