Note that there are some explanatory texts on larger screens.

plurals
  1. POAbout: Extracting Region From Bitmap
    primarykey
    data
    text
    <p>i am trying to extract outline path from given bitmap, i create a fast algorithm (for me) on as3 and that is: </p> <pre><code> //@v source bitmap's vector data //@x x to starting extraction //@y y to stating extraction //@w extraction width //@h extraction height //@mw source bitmap width //@mh source bitmap height private function extractRects(v:Vector.&lt;uint&gt;, x:int, y:int, w:int, h:int, mw:int, mh:int):Array { var ary:Array = [], yy:int=y, vStart:int, _xx:int, xx:int; var lcold:int = 0, lc:int; //first line to last line while(yy &lt; h) { //first index of current vector vStart = yy * mw + x; xx = x; lc = 0; //first vector to last on current scan while(xx &lt; w) { /* if current vector value (color) is empty (transparent) then check next */ while(xx &lt; w &amp;&amp; !v[vStart]) { vStart++; xx++; } //it is not empty so copy first index _xx = xx; //check till value is not empty while(xx &lt; w &amp;&amp; v[vStart]) { xx++; vStart++; } //create rectangle var rr:Rectangle = new Rectangle(_xx, yy, (xx-_xx), 1); //if previous line has the same rectangle index if(lc &lt; lcold) { var oldrr:Rectangle = ary[ary.length - lcold]; //if previous neighbour rect on top //has same horizontal position then //resize its height if(oldrr.left == rr.left &amp;&amp; oldrr.width == rr.width) oldrr.height++; else ary.push(rr); } else ary.push(rr); lc++; xx++; } lcold = lc; yy++; } return ary; } </code></pre> <p>by the method above, i extract the region and create shape by drawing rects.. drawing rects not a good solution for me because of non-smooth view.</p> <p>to have smoother view, i should use lines or curves but, calculation of point neighbouring is really big headache for me with sleepy eyes right now.</p> <p>could you recommend me some well-known or any better solution?</p> <p>as3, c++, c#, vb.net, vb6, delphi, java or similar languages will be fine for answers.</p> <p>thanks your advance..</p> <p><strong>EDIT FOR CLEARIFICATION</strong></p> <p>I am trying to extracting non-transparent pixels' x, y coordinates from a bitmap to drawing on different path data. (32 bit ARGB) (creating shape)</p> <p>to drawing i could use lineTo, curveTo, moveTo operations</p> <pre><code>moveTo(x, y) lineTo(x, y) curveTo(cx, cy, ax, ay) </code></pre> <p>in my code, i thought that i could extract the rectangles of current non-transparent blocks and i could use the same rects with moveTo and lineTo operations on further graphic methods</p> <p>the problem is using this method gives non-smooth look on edges which is neighter horizontal nor vertical</p> <p>so, the solution is creation a point map on edges, detecting the point neighborhood, using the lineTo operation (because it generates antialiased lines) between neighbour points on rows, or calculating the points placement on nearest circle area and using curveTo method..</p> <p>my question is could you recommend me some algorithms or methods for extracting job.</p> <p>sorry for my English</p> <p>thank you</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.
 

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