Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you need a difference filter:</p> <p>1) you calc the horizontal difference (here you'll have vertical segments)</p> <p>2) you calc the vertical difference (here, horizontal segments)</p> <p>3) you OR the two maps, finding the outlines</p> <p>4) recreate a Bitmap object, if you wish to do so</p> <p>something like (EDITED):</p> <pre><code>int[] pixels; int width = yourbitmap.getWidth(); int height = yourbitmap.getHeight(); yourbitmap.getPixels(pixels, 0, width, 0, 0, width, height); // transform grayscale int[] image = new int[width*height]; for (int y=0; y&lt;height; y++) for (int x=0; x&lt;width; x++) { int pixel = image[y*width + x]; image[y*width + x] = (Color.red(pixel) + Color.green(pixel) + Color.blue(pixel))/3; } // calculate diff_x (vertical segments) int[] dx = new int[width*height]; for (int y=0; y&lt;height; y++) for (int x=0; x&lt;width; x++) dx[y*width + x] = (x==0 || y== 0 ? 0 : Math.abs(image[y*width + x] - image[y*width + x-1])); // calculate diff_y (horizontal segments) int[] dy = new int[width*height]; for (int y=0; y&lt;height; y++) for (int x=0; x&lt;width; x++) dy[y*width + x] = (x==0 || y== 0 ? 0 : Math.abs(image[y*width+x] - image[(y-1)*width+x])); // when the color intensity is higher than THRESHOLD, accept segment // you'll want a slider to change THRESHOLD values bool[] result = new bool[width*height]; const int THRESHOLD = 60; // adjust this value for (int y=0; y&lt;height; y++) for (int x=0; x&lt;width; x++) result[y*width + x] = (dx[y*width + x] &gt; THRESHOLD || dy[y*width + x] &gt; THRESHOLD); Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); for (int y=0; y&lt;height; y++) for (int x=0; x&lt;width; x++) result.setPixel(x, y, result[y*width+x]? Color.Black : Color.White); </code></pre>
    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