java - Reading in a JPEG image and calculate image coordinates -


I want to read a JPEG image of a similar gray background with many colored balls of the same size Can take this image and record the coordinates of each ball. What is the best way to do this?

I agree with James I use the following program at once to find red boxes at one time. (Most people of the first red box were dyed by the community first):

  / ** * @ Author @ karnokd, 2008.11.07 * @ Version $ revision 1.0 $ * / public class redlocator {public static class rect {int x; Int y; Int x2; Int y2; } Fixed list & lt; Racket & gt; Rects = new linked list & lt; Rect & gt; (); Static Boolean Checksert (Int x, int y) {for (Rect R: Rex) {if (x> = rx & x & lt; = r.x2 & y> gt; ry & amp; amp; Y & lt; = r.y2) {back to true; }         }         return false; } Public static zero chief (string [] args throws exceptions {BufferedImage image = ImageIO.read (new file ("fallout3worldmapfull.png")); (Int y = 0; y & lt; image.getHyight (); y ++) {for (int x = 0; x & lt; image.getWidth (); x ++) {int c = image .getRGB (x, y); Int red = (c & amp; 0x00ff0000) & gt; & Gt; 16; Int green = (c & amp; 0x0000ff00) & gt; & Gt; 8; Int Blue = C & amp; 0x000000ff; // Check red if (red> 180 & amp; amp; & amp; & amp; 30; & amp; amp; amp; amp; amp; amp; amp; amp; amp; & amp; amp; amp; ; & Amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; 30 & amp; nbsp; 30) {if (check (x, y)) {int tmpx = X; Int tmpy = y; While (red> 180 & amp; amp; & amp; amp; & amp;; & amp;; & lt; 30 & amp; amp; amp; amp; amp; amp; amp; amp; ; Amp; amp; amp; amp; amp; amp; 30 & amp; 30) {c = image.getRGB (tmpx ++, tmpy); Red = (C & amp; 0x00ff0000) & gt; & Gt; 16; Green = (C & amp; 0x0000ff00) & gt; & Gt; 8; Blue = C & amp; 0x000000ff; } Tmpx - = 2; C = image.getRGB (tmpx, tmpy); Red = (C & amp; 0x00ff0000) & gt; & Gt; 16; Green = (C & amp; 0x0000ff00) & gt; & Gt; 8; Blue = C & amp; 0x000000ff; While (red> 180 & amp; amp; & amp; amp; & amp; ;; & lt; 30 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; ; Amp; amp; amp; amp; amp; amp; 30 & amp; 30) {c = image.getRGB (tmpx, tmpy ++); Red = (C & amp; 0x00ff0000) & gt; & Gt; 16; Green = (C & amp; 0x0000ff00) & gt; & Gt; 8; Blue = C & amp; 0x000000ff; } Rect r = new rectangle (); Rx = x; RI = Y; R.x2 = tmpx; R.y2 = TMP-2 -; Rects.add (r); }}}}}}  

You can give some hints. Is generated by the image.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -