Could somebody get me started with the following idea:
I want to load an image into my java (java swing) applicatio开发者_JAVA技巧n (a floor plan or blue print). Let's say the floor plan image has a white background with 3 shapes on it (a rectangle, a triangle and a circle). The shapes have a black border.
The program should detect these shapes and draw the 3 shapes on top of it.
For example: it detects the rectangle and a new rectangle will be drawn on top of that rectangle from the image. When that extra rectangle is drawn, the user should be able to modify that rectangle and do extra things with it like filling the rectangle, changing the border style, ...
For example: in this case little points or squares on the corners should be visible so that we can drag/resize/move the rectangle. A bit like this screenshot from visual studio: http://farm1.static.flickr.com/49/132219212_061a1300af_o.png
Does anybody have tutorials for this? Am I missing some very useful java algorithms? etc...? All suggestions or help is welcome
Tnx in advance
Well, one brute force method of doing this would be to go through the pixels in the image, see api for BufferedImage, and detect the shapes by consecutive pixels of a certain color. I am sure there is a much more efficient way of doing this though.
Correctly detecting shapes in scanned picture which could suffer from all sorts of issues (color, dpi, rotation, shear). Even a non-scanned picture could be very difficult. You may want to look into using OpenCV in Java.
精彩评论