Can this be done with a CNC plotter ? - Page 1
Forum section: electronics / projects

author: MrOmnos
author_rank: Frequent Contributor
timestamp: August 01, 2016, 09:21:13 pm
content: Hi, I am building a CNC machine and today I came across this video of this guy with awesome skills drawing a face with more than a million points.And I was wondering if something similar can be done with a CNC plotter I am building. If yes, how?My CNC plotter specifications:Microcontroller: Arduino with grbl firmwareSteppers : Nema 17Stepper Drivers: A4988I don't know if I'll be able to get the resolution to obtain the same results like in the video but still I would like to give it a try. The question is, how do I convert an image into millions of points with varying density for lighter and darker parts? I was thinking of writing my own code but I thought it would be better to ask the community first. If this can be done with any of the software that is already out there or if someone else has already tried something similar before then it would save me a lot of work. Thanks!!

author: rs20
author_rank: Super Contributor
timestamp: August 01, 2016, 09:26:09 pm
content: Just to keep things simple, I'd do my first tests with the simplest approach of all: open the image in whatever program you want, and save as a black-and-white image with dither. Any half-decent image program supports it (Photoshop and the GIMP being just two). Then, write a basic program that finds every black pixel in the image, and plots it.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 02, 2016, 02:52:25 am
content: Quote from: MrOmnos on August 01, 2016, 09:21:13 pmdot matrix or bubble jet printer. you may try to fin the vintage one, but the current one can do 1440 dot per inch.

author: MrOmnos
author_rank: Frequent Contributor
timestamp: August 02, 2016, 12:46:05 pm
content: Quote from: Mechatrommer on August 02, 2016, 02:52:25 amWhat is this answer supposed to mean? I don't want to print using a printer. I am trying to do it with a CNC.

author: m98
author_rank: Frequent Contributor
timestamp: August 02, 2016, 01:49:46 pm
content: Try searching for "pointillism", which is the effect you want to achieve. There are may tutorials and software, so maybe there you'll find something that works for such a application.Dithering won't work, as I know of no algorithm that resolves the image to discrete points and varies their density.

author: DJohn
author_rank: Regular Contributor
timestamp: August 02, 2016, 02:09:01 pm
content: StippleGenhttp://wiki.evilmadscientist.com/StippleGenlooks like exactly what you're after.

author: andtfoot
author_rank: Unknown
timestamp: August 02, 2016, 02:19:54 pm
content: Also look up 'Halftone'; it's a common way of getting gradients using only black and white.I used a variant to engrave a photo on the side of a cajon I made:

author: rs20
author_rank: Super Contributor
timestamp: August 02, 2016, 04:53:53 pm
content: Quote from: m98 on August 02, 2016, 01:49:46 pmHere's one:loop over all pixels in black+white dithered image {draw discrete point at pixel coordinates iff pixel is black}As I said, I'm not claiming it's the best or prettiest option (it'll have a very obvious grid pattern to it for one thing, although slightly randomising the plot positions would be an intersting fix), but it's just a really easy first-order approach to let the OP focus on the CNC side and getting an end-to-end system up and running, before overengineering the software.I do endorse the other solutions given as better/prettier, albeit maybe more difficult, alternatives.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 02, 2016, 05:02:49 pm
content: Quote from: MrOmnos on August 02, 2016, 12:46:05 pmeh i thought you want to save a lot of work. btw, this subject is the play ground for the mentioned printing technology... you may want to study into that....Quote from: m98 on August 02, 2016, 01:49:46 pmdiffusion dither...halftone screen...you may google the algorithm if you are interested...

author: m98
author_rank: Frequent Contributor
timestamp: August 02, 2016, 05:12:59 pm
content: Quote from: rs20 on August 02, 2016, 04:53:53 pmThis won't work, because no dithering algorithm generates any aesthetically pleasing result that you could transform to g-code in first place.The results would rather look like this:The stipple gen software DJohn suggested does exactly what the TC wants. And it is then easy to convert the SVG result to g-code with readily available software.@mechatrommerI know. But none of those two images consists of discrete black dots, just look closely.

author: CM800
author_rank: Frequent Contributor
timestamp: August 02, 2016, 05:20:59 pm
content: I think you are just going to have to bite the bullet and develop one.Might I suggest Wolfram Mathmatica, MatLAB or the likes?I'd do something like:Convert to GrayscaleScale so each pixel is 8x the resolution of your CNC machine.put 1 through 64 dots in the area, using a small expression to spread them out in that 8x8 grid psudoevenly

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 02, 2016, 05:24:11 pm
content: Quote from: m98 on August 02, 2016, 05:12:59 pmif you are talking about shadow area, you can make pre processing to avoid that, as simple as adjusting gradient curve. on lit area, there are certainly discrete black dots, look closely...

author: m98
author_rank: Frequent Contributor
timestamp: August 02, 2016, 05:41:30 pm
content: Quote from: Mechatrommer on August 02, 2016, 05:24:11 pmThere are, but only in the lightest grays. As the area gets darker, patterns of dots and lines form with the diffusion dither, which make the image look comparably unaesthetic.

author: rs20
author_rank: Super Contributor
timestamp: August 02, 2016, 06:43:50 pm
content: Quote from: m98 on August 02, 2016, 05:12:59 pmFfs, you're deliberately not reading my messages. Did I ever claim my approach was beautiful, or anything other than a first-order hack? You're the one that is outright lying by saying that "it won't work". It obviously totally will work, just not necessarily prettily. Also, Photoshop, which I suggested, offers a few different dithering options, including ones that look like both your examples. So please, stop constructing strawman arguments and bullshit.

author: dnwheeler
author_rank: Regular Contributor
timestamp: August 02, 2016, 07:29:38 pm
content: I don't think you'll be able to generate different sized dots, so something like a Floyd-Steinberg dither (seehttps://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering) is probably your best bet. Ultimately, this ends up being like a single-pin dot-matrix printer.If you can come up with some way to create different sized dots (perhaps with differing pressure or drawing small filled circles with a fine pen), you might be able to do something more like real half-toning (e.g., like a newspaper photo). I suspect you'll either have trouble getting enough sizes, or enough resolution, though. If you're CNC plotter is big enough, you could do large, low-res "pop art" that might look nice.

author: electr_peter
author_rank: Unknown
timestamp: August 02, 2016, 07:49:34 pm
content: To get similar image as shown in original posting one needs to get/develop SW with special kind of dithering method, get coordinates of each dot (even when dots overlap completely) and send it to CNC.There are many dithering algorithms available. I am not familiar with all of them, but there should be something almost identical in image processing SW to the required effect. Dismissing dithering outright is ignorant.

author: cncjerry
author_rank: Unknown
timestamp: August 02, 2016, 08:26:13 pm
content: There's software out there to take a BMP and convert it to an NC file. look around in the Mach3 yahoo group or look at Mach3 itself. I remember seeing it somewhere. Basically, it drills to a depth which varies by grayscale, both being adjustable within a given range. Takes lots of time to cut. Requires good z axis control and lots of patience.Another way to do it is to take a BMP to vector program and then use vector to DXF translation. once you have it in DXF you can convert the code using Flashcut or Mach3 directly. basically, this is a drawing at a constant depth but you can break the vectors into layers and proceed from there. I did this for a pet tombstone. Came out nearly perfect but is was more engraving than what the OP was looking for in his post.

author: Johnb5012
author_rank: Newbie
timestamp: August 03, 2016, 11:35:07 am
content: Take a look at the cheap chinese laser engraving cnc machines. The cheap ones can not generate grayscale properly, so people use dithering to get closer to their desired result.T2 is the software I'm thinking of, it can handle dithering. You can find a trial version atwww.benboxlaser.usInkscape is a graphics program that has several plugins to generate gcode. raster2laser being one such plug in.

author: Kean
author_rank: Unknown
timestamp: August 03, 2016, 02:28:13 pm
content: This is definitely possible, but the gcode for all that "pecking" is going to be a mighty long file and take a huge amount of time to run.To make it at all practical you'd want to keep the number of dots and the length of the Z moves to a minimum.