image to gcode
16 Nov 2010 12:55 - 16 Nov 2010 12:56 #5331
by eslavko
Replied by eslavko on topic Re:image to gcode
I do simple test to flow Bitmap image.
1. I trace white/black edge of image (image is 1 color B/W lineart) to get edge
2. I folow that traced outline/edge and for each pixel I do next steps (loops)
A. Start loop of radius from 1 to some max limit
B. Start Angle counter from 0 to 2PI
C. Check if Circle with loop radius with center of radius and angle from loop fit's on bitmap black area
If circle fit's then remember that radius and angle
D. finish all loops
Remembered radius and angle should point to just right point for cutter.
It's should work but I got some strange errors and still can't solve it. Just some pixels are seems to be noisy. The principle seems right one.
Just see sample... The white should be router path but isn't clear. I do not now why
1. I trace white/black edge of image (image is 1 color B/W lineart) to get edge
2. I folow that traced outline/edge and for each pixel I do next steps (loops)
A. Start loop of radius from 1 to some max limit
B. Start Angle counter from 0 to 2PI
C. Check if Circle with loop radius with center of radius and angle from loop fit's on bitmap black area
If circle fit's then remember that radius and angle
D. finish all loops
Remembered radius and angle should point to just right point for cutter.
It's should work but I got some strange errors and still can't solve it. Just some pixels are seems to be noisy. The principle seems right one.
Just see sample... The white should be router path but isn't clear. I do not now why
Last edit: 16 Nov 2010 12:56 by eslavko.
Please Log in or Create an account to join the conversation.
16 Nov 2010 13:49 #5336
by andypugh
Replied by andypugh on topic Re:image to gcode
That's actually surprisingly good looking, I wouldn't have expected to be able to do it from a Bitmap at all.
You need to convert the points to a path, and you should be able to filter at the same time.
Any point more than a few pixel-widths from another point is noise, so can be eliminated.
The next stage is probably to walk the list, attempting to sort the pixels into sequence, you can then start deleting those that add no extra information about the path. There is probably a well-known way to do this. Spotting divergent paths will be fun.
I am pretty sure that you _don't_ want to write G-code than simply hops from one pixel to the nearest unvisited one.
You need to convert the points to a path, and you should be able to filter at the same time.
Any point more than a few pixel-widths from another point is noise, so can be eliminated.
The next stage is probably to walk the list, attempting to sort the pixels into sequence, you can then start deleting those that add no extra information about the path. There is probably a well-known way to do this. Spotting divergent paths will be fun.
I am pretty sure that you _don't_ want to write G-code than simply hops from one pixel to the nearest unvisited one.
Please Log in or Create an account to join the conversation.
17 Nov 2010 17:06 #5370
by eslavko
Replied by eslavko on topic Re:image to gcode
I got 1'st code output.
It's not smothed and hughe.
Only smothing is done with G64 P0.1 Q0.1 ie smothing by EMC itself.
Now I had to do smoothig of cone and for now I had no idea how to do that. and to remove path where is double. (As I trace contour I got in near all points double trace
Here is simple cutout. The image is not so good than real part is.
It's not smothed and hughe.
Only smothing is done with G64 P0.1 Q0.1 ie smothing by EMC itself.
Now I had to do smoothig of cone and for now I had no idea how to do that. and to remove path where is double. (As I trace contour I got in near all points double trace
Here is simple cutout. The image is not so good than real part is.
Please Log in or Create an account to join the conversation.
Time to create page: 0.069 seconds