Author Topic: Can this be done with a CNC plotter ?  (Read 7708 times)

0 Members and 1 Guest are viewing this topic.

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: np
  • BE in Electronics and Communication
Can this be done with a CNC plotter ?
« on: August 01, 2016, 09:21:13 pm »
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 firmware
Steppers : Nema 17
Stepper Drivers: A4988

I 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!!
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Can this be done with a CNC plotter ?
« Reply #1 on: August 01, 2016, 09:26:09 pm »
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.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11622
  • Country: my
  • reassessing directives...
Re: Can this be done with a CNC plotter ?
« Reply #2 on: August 02, 2016, 02:52:25 am »
if someone else has already tried something similar before then it would save me a lot of work.
dot matrix or bubble jet printer. you may try to fin the vintage one, but the current one can do 1440 dot per inch.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: np
  • BE in Electronics and Communication
Re: Can this be done with a CNC plotter ?
« Reply #3 on: August 02, 2016, 12:46:05 pm »
if someone else has already tried something similar before then it would save me a lot of work.
dot matrix or bubble jet printer. you may try to fin the vintage one, but the current one can do 1440 dot per inch.
What is this answer supposed to mean? I don't want to print using a printer. I am trying to do it with a CNC.
 

Offline m98

  • Frequent Contributor
  • **
  • Posts: 614
  • Country: de
Re: Can this be done with a CNC plotter ?
« Reply #4 on: August 02, 2016, 01:49:46 pm »
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.
 

Offline DJohn

  • Regular Contributor
  • *
  • Posts: 103
  • Country: gb
Re: Can this be done with a CNC plotter ?
« Reply #5 on: August 02, 2016, 02:09:01 pm »
StippleGen http://wiki.evilmadscientist.com/StippleGen looks like exactly what you're after.
 

Offline andtfoot

  • Supporter
  • ****
  • Posts: 352
  • Country: au
Re: Can this be done with a CNC plotter ?
« Reply #6 on: August 02, 2016, 02:19:54 pm »
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:
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Can this be done with a CNC plotter ?
« Reply #7 on: August 02, 2016, 04:53:53 pm »
Dithering won't work, as I know of no algorithm that resolves the image to discrete points and varies their density.

Here'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.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11622
  • Country: my
  • reassessing directives...
Re: Can this be done with a CNC plotter ?
« Reply #8 on: August 02, 2016, 05:02:49 pm »
if someone else has already tried something similar before then it would save me a lot of work.
dot matrix or bubble jet printer. you may try to fin the vintage one, but the current one can do 1440 dot per inch.
What is this answer supposed to mean? I don't want to print using a printer. I am trying to do it with a CNC.
eh 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....

Dithering won't work, as I know of no algorithm that resolves the image to discrete points and varies their density.
diffusion dither...


halftone screen...


you may google the algorithm if you are interested...
« Last Edit: August 02, 2016, 05:04:34 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 
The following users thanked this post: rs20

Offline m98

  • Frequent Contributor
  • **
  • Posts: 614
  • Country: de
Re: Can this be done with a CNC plotter ?
« Reply #9 on: August 02, 2016, 05:12:59 pm »
Dithering won't work, as I know of no algorithm that resolves the image to discrete points and varies their density.

Here's one:

loop over all pixels in black+white dithered image {
  draw discrete point at pixel coordinates iff pixel is black
}

This 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.

@mechatrommer
I know. But none of those two images consists of discrete black dots, just look closely.
« Last Edit: August 02, 2016, 05:18:40 pm by m98 »
 

Offline CM800

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: Can this be done with a CNC plotter ?
« Reply #10 on: August 02, 2016, 05:20:59 pm »
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 Grayscale
Scale 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

 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11622
  • Country: my
  • reassessing directives...
Re: Can this be done with a CNC plotter ?
« Reply #11 on: August 02, 2016, 05:24:11 pm »
@mechatrommer
I know. But none of those two images consists of discrete black dots, just look closely.
if 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 ;)...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline m98

  • Frequent Contributor
  • **
  • Posts: 614
  • Country: de
Re: Can this be done with a CNC plotter ?
« Reply #12 on: August 02, 2016, 05:41:30 pm »
@mechatrommer
I know. But none of those two images consists of discrete black dots, just look closely.
if 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 ;)...
There 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.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Can this be done with a CNC plotter ?
« Reply #13 on: August 02, 2016, 06:43:50 pm »
Dithering won't work, as I know of no algorithm that resolves the image to discrete points and varies their density.

Here's one:

loop over all pixels in black+white dithered image {
  draw discrete point at pixel coordinates iff pixel is black
}

This won't work, because no dithering algorithm generates any aesthetically pleasing result that you could transform to g-code in first place.

Ffs, 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.
 

Offline dnwheeler

  • Regular Contributor
  • *
  • Posts: 86
  • Country: us
Re: Can this be done with a CNC plotter ?
« Reply #14 on: August 02, 2016, 07:29:38 pm »
I don't think you'll be able to generate different sized dots, so something like a Floyd-Steinberg dither (see https://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.
 

Offline electr_peter

  • Supporter
  • ****
  • Posts: 1301
  • Country: lt
Re: Can this be done with a CNC plotter ?
« Reply #15 on: August 02, 2016, 07:49:34 pm »
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.
 
The following users thanked this post: rs20

Offline cncjerry

  • Supporter
  • ****
  • Posts: 1279
Re: Can this be done with a CNC plotter ?
« Reply #16 on: August 02, 2016, 08:26:13 pm »
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.
 

Offline Johnb5012

  • Newbie
  • Posts: 6
  • Country: us
Re: Can this be done with a CNC plotter ?
« Reply #17 on: August 03, 2016, 11:35:07 am »
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 at www.benboxlaser.us

Inkscape is a graphics program that has several plugins to generate gcode. raster2laser being one such plug in.
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2089
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
Re: Can this be done with a CNC plotter ?
« Reply #18 on: August 03, 2016, 02:28:13 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf