View Full Version : 3D GCode from greyscale?


cncuser1
12-09-2006, 05:22 PM
Is it possible to use a greyscale image ( jped, bmp etc) and generate a raised image?

Something like the darker the pixel the deeper the cut and vice versa?

erase42
12-09-2006, 06:10 PM
yes, there are several programs that will do this, deskcnc is one, vcarves also i believe and bobcads bobart if im not mistaken,

ger21
12-10-2006, 07:46 AM
www.meshcam.com

dertsap
12-10-2006, 12:38 PM
http://www2.fwi.com/~kimble/scispec/scispec.htm
http://www.brusselsprout.org/CAMBAM/

both freeware

Tony Mac
12-10-2006, 12:58 PM
Hello cncuser1,

PhotoVCarve (http://www.vectric.com/WebSite/Vectric/pvc/pvc_features.htm) will do what you want and will work with both grayscale and colour images. The software includes options for making either dark or light pixels in an image to be the highest or lowest regions to machine.

The software also includes the option to mask an area of a specific colour to create a machining boundary. Plus estimated machining times and a 3D simulation preview that shows exactly what the finished job will look like when machined.

PhotoVCarve also provides toolpath strategies for cutting Lithophanes (http://www.vectric.com/WebSite/Vectric/pvc/pvc_case_custom_lithophanes.htm) that are essentially grayscale machining but need to be lit from behind.

I hope this helps,

Tony

cncuser1
12-10-2006, 05:55 PM
Thanks for the tips
I should communicated better
I am interested in generatinng xyz points, not gcode.
I want to try and manipulate it in a cad program, So points in *.DXF format or *.XYZ or meshes are what i am looking for, not an NC program.

ger21
12-10-2006, 06:59 PM
MeshCAM can import a .bmp, and export is as an .stl

erase42
12-10-2006, 08:23 PM
send me a file and ill run it thru bobart and send you back a dxf if you want to try a sample.
send me a PM

cncuser1
12-10-2006, 09:51 PM
Thanks but even if it works, Bobcad is not an option.

sparkgirl
12-10-2006, 10:53 PM
Does anyone know how to create my own gradiants to "color" in a drawing to generate my own 3D designs. I'm not sure I even know how to word this correctly. I have two of the software pkgs that will produce the 3d from greyscale, but most pictures aren't colored so that the light/dark areas are in the places they would need to be for a true 3D image. I want to learn how to "shade in" my own designs so the lightest areas of drawing would be in the areas to be the most raised of 3D image, with the darker areas shaded to be the least raised. My struggle to word this properly will hopefully still make sense to someone who has done a 3d image where something like dark eyebrows, or the black nose tip of a dog would be recessed instead of more pronounced. I'm wondering if some kind of gradiant with a blurring may work?
I am not current with all the photo/picture editing software out there, but am willing to learn.

dertsap
12-10-2006, 11:57 PM
Does anyone know how to create my own gradiants to "color" in a drawing to generate my own 3D designs. I'm not sure I even know how to word this correctly. I have two of the software pkgs that will produce the 3d from greyscale, but most pictures aren't colored so that the light/dark areas are in the places they would need to be for a true 3D image. I want to learn how to "shade in" my own designs so the lightest areas of drawing would be in the areas to be the most raised of 3D image, with the darker areas shaded to be the least raised. My struggle to word this properly will hopefully still make sense to someone who has done a 3d image where something like dark eyebrows, or the black nose tip of a dog would be recessed instead of more pronounced. I'm wondering if some kind of gradiant with a blurring may work?
I am not current with all the photo/picture editing software out there, but am willing to learn.

if i understand you correctly ,photoshop would do this

dertsap
12-11-2006, 12:00 AM
Thanks for the tips
I should communicated better
I am interested in generatinng xyz points, not gcode.
I want to try and manipulate it in a cad program, So points in *.DXF format or *.XYZ or meshes are what i am looking for, not an NC program.

http://inkscape.org/download/ , try inkscape , you can create dxf from a bitmap

once again ,freeware

erase42
12-11-2006, 12:29 AM
yes in either photoshop or even paintshop pro you can selecet areas of similar shading or color, right down to the pixel, and then give it a new color. you can also tell it how big of a color spread to select, for example you can select "anything blue" in the whole photo, or narrrow it down to just a certain intensity of blue. once its selected you can recolor it anything you want.

rweatherly
12-11-2006, 02:49 PM
cncuser1:

You can take a .bmp file and extract the greyscale data one pixel at a time. Each pixel will be represented by a number from 0 to 255. They are in order just like you look at the image, starting at the upper left, and going to the end of the row, then the next row, etc. The "normal" .bmp file will have a header, followed by the data you are looking for. What you see when you open a .bmp or a .raw file are ascii characters that represent the value of the pixel.

There are several bmp2raw programs on the web, all free, which will extract just the pixel information, and write it to a ".raw" file.

I do this all of the time, because I write (almost) all of my own software. If you need some help let me know.

Richard

rweatherly
12-11-2006, 03:01 PM
sparkgirl-

Are you trying to do 3D machining from a greyscale image?

greybeard
12-11-2006, 06:46 PM
cncuser1:

You can take a .bmp file and extract the greyscale data one pixel at a time. Each pixel will be represented by a number from 0 to 255. They are in order just like you look at the image, starting at the upper left, and going to the end of the row, then the next row, etc. The "normal" .bmp file will have a header of 54 to 56 characters, followed by the data you are looking for.

Richard

Richard, are there any characters at the end of each line - like "carriage return/line feed", or does the output data run continuously from the header, right to the end ?
Many thanks
John

cncuser1
12-11-2006, 07:03 PM
http://inkscape.org/download/ , try inkscape , you can create dxf from a bitmap

I only found save as dxf for a desktop cutter, not what I was interested in

cncuser1
12-11-2006, 07:08 PM
http://www2.fwi.com/~kimble/scispec/scispec.htm
this one only saves as Gcode

http://www.brusselsprout.org/CAMBAM/[/url]


This one only saves as lines, close but i'd like points. The author invited me to write the code to make the program do what I want.

rweatherly
12-11-2006, 07:51 PM
greybeard-

No CR or LF. Just characters. You can open the .bmp files in a text editor, and it will be a long string.

So what you have to do is to know the size, and in a .bmp file know the starting point, and if it is 1000 wide x 750 high, then the first 1000 characters are the greyscale values for the top line, etc.

Richard

rweatherly
12-11-2006, 07:53 PM
cncuser1:

If you want to write the code, I can help, but if you just want the points, I have a routine in Excel that does that. Do you have Excel?

Richard

rweatherly
12-11-2006, 09:20 PM
Oops, I made another mistake. I am using the bmp2raw program, which changes the order of the pixel data so that it reads starting at the top left. However a bitmap file actually starts at the bottom. Here's some more information:

http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

dertsap
12-11-2006, 09:33 PM
this one only saves as Gcode



This one only saves as lines, close but i'd like points. The author invited me to write the code to make the program do what I want.

sorry to waste your time ,

i'm not quite clear on what your looking for , can you not go point to point with a dxf

sparkgirl
12-11-2006, 10:02 PM
Going back a few posts, Yes, I am looking to create my own 3D images based off of greyscale that I can machine at least .5" deep or raised that look true. I will probably have to seperate the picture into a few layers in a CAD pkg. Say if I wanted to use an animal, I want to "color" in the animal so that the body will be rounded by using the lightest color where I want it to be the most raised. This is probably a bit ambitious, since I am a beginner to CNC, but it is something I do want to work on. I enjoy doing 3D raised carvings the most. I am currently playing with Celtic cross designs to get the "intertwined" looking knots. I know how to do pixel by pixel colorchange touch ups to a photograph in MGI PhotoSuite. My computer in the shop came with Paint and possibly some other editing software, but no directions. I will try to study the help section of paint when I can. Anyone know if there is a good handbook to Paint? Also is PhotoShop by Adobe? Is Paintshop Pro an upgrade to just Paint?

thanks, sparkgirl

rweatherly
12-12-2006, 07:52 AM
There have been a lot of efforts to try to go from greyscale to 3D, but it is tough to do. I don't think anyone here has done it yet.

I think there is some software out there that allows you to "pull up" areas that need it. I have also seen a effort (I think successful) to take a series of photos with the light on different sides of the object and combine them somehow to get a true 3D from the final product.

Photoshop is by Adobe. They had a limited version - Photoshop Elements (which I have) that is less expensive than the full deal.

rweatherly
12-12-2006, 08:02 AM
This will lead you to some $$$$ software that will do the job:

http://www.designscomputed.com/vs3d/examples/img_emboss.html

greybeard
12-12-2006, 10:36 AM
There have been a lot of efforts to try to go from greyscale to 3D, but it is tough to do. I don't think anyone here has done it yet.

I think there is some software out there that allows you to "pull up" areas that need it. I have also seen a effort (I think successful) to take a series of photos with the light on different sides of the object and combine them somehow to get a true 3D from the final product.


My current direction "3D for Crazies" in the Laser digitizing forum is to immerse the object in a dye bath, but I can see that there are circumstances when this is not appropriate. :D

However, yesterday's idea was to photo the object with the camera mounted in the centre of a circular fluorescent tube. The idea is not to remove all shadow but that there should be an "even" shadow on all sides. If this happens, then a simple increase in the contrast setting found in all photo editing programmes should get me to a depth/darkness ratio that could be usefully imported into 3D software. And, of course, it would also be effective without the dye bath.

I fear it will not work, however, only from the fact that everyone isn't doing it already, so I'll have to find out why. :devious:
John

rweatherly
12-12-2006, 03:27 PM
Those are really interesting ways to get a 3D surface.

Here is a link to the method I referred to earlier, using information from pictures taken with the light on each of the four sides:

http://zarria.net/

I'm not sure I understand the theory, but it looks like the steps produce the desired result.

Richard

greybeard
12-12-2006, 05:13 PM
Richard, thanks for that link(I think :confused: )
I started through it and saw what my own tortured grey cells were working on last night ! However, it's the steps from the "displacement maps" to getting the 3d information out where I get lost.

I started from the old cinema red/green spectacle idea to make two images throwing red and green shadows on the left and right. Then blue and orange shadows top and bottom. This, I imagined would enable me to produce an alternative way of getting depth info out without needing the messy dye bath. All the colours would add on the high points, and all would subtract in the lower areas.

I'd noticed years ago, when living in an attic(don't ask !) where I suspended a bare light bulb painted red on one side and green on the other, it threw shadows with red and green edges on opposite sides.

If you can make sense of that, you'll guess that I'm fine with imagining the technology, but fall over when it comes to extracting the information it produces.

If I convert the image above into a greyscale, I know that some machine software can use it directly, but I should like to go from greyscale to g code.

John

rweatherly
12-12-2006, 05:20 PM
Look at http://www.cnczone.com/forums/showthread.php?t=7398, post #14. It has an image to gcode program (I have not tried it)

cncuser1
12-12-2006, 05:39 PM
can you not go point to point with a dxf

All the programs I have seen so far output either g-code to machinne an oblect or a DXF file that contains LINES

I would like a *.dxf (or *.dwg etc) file that contains POINTS

( why: I can take the points and create a surface in my CAD software. I cannot do this with lines or gcode.)

dertsap
12-12-2006, 05:55 PM
now i understand what your looking for

i know just the thing to do that

greybeard
12-12-2006, 06:01 PM
I'll stick to the hardware problems for the moment, but thanks for the latest link. I've downloaded the file and will take a peek later, but I'm beginning to suspect that I'm getting out of my depth.
So it's back to the workroom to see if I can improve the photography first.
John

miljnor
12-12-2006, 06:06 PM
http://www.muellerr.ch/engineering/laserscanner/default.htm

here is a link to a neat little DIY project that uses a laser scanner made from a laser pointer and a camera.

greybeard
12-13-2006, 03:29 AM
http://www.muellerr.ch/engineering/laserscanner/default.htm

here is a link to a neat little DIY project that uses a laser scanner made from a laser pointer and a camera.

Many, many thanks for that link.
His text explanation is so clear that I can now see and understand the missing pieces in my jigsaw.
He's just turned the light on for me. :D :D :D

John

rweatherly
12-13-2006, 09:11 AM
Cncuser1:

The basic data from the bitmap would be a row, column & value for each pixel. From there you have to convert it to the size you want to machine. It sounds like dertsap might be working on this (?), but if not, I can translate to x, y, z values.

Richard

miljnor
12-13-2006, 10:26 AM
Many, many thanks for that link.
His text explanation is so clear that I can now see and understand the missing pieces in my jigsaw.
He's just turned the light on for me.

Did the same for me even though it isn't quite what this post was started for, I gained some wonderful insight to how I should go about digitizing.

Now if only I could find the time.

gbarker
12-13-2006, 09:22 PM
Thanks but even if it works, Bobcad is not an option.

I just wondered why bobcad isn't an option? Is there something wrong with it?

rweatherly
12-14-2006, 11:53 AM
I don't want to speak for cncuser1, but as their web site says, "It's only $2495".

cncuser1
12-14-2006, 05:37 PM
I just wondered why bobcad isn't an option? Is there something wrong with it?


1. Price
2. I am happy with my current package ( solidworks). I will not learn a whole new package for just this one functionality


( Bobcad has been th subject of many heated discussions , i will not be ppart of one)

cadcam
12-15-2006, 02:37 PM
Hi all just throwing another option that works good with the Gray scale or color pictures.

Here is a link to Mastercams Art option .
http://www.mastercam.com/Products/Art/Default.aspx

username
12-20-2006, 01:51 AM
You can do this pretty easily with perl using the GD module or convert the images to
a text format like PPM and use an text langage to parse it (all *nix tools/formats).
I have written a program that takes a PPM file and generate the G-gode for the
image (no write ups, and it has no error handling whatsoever so it is not
very useful for other people). Unfortunately, I do not know the syntax of a DXF file to
generate the output. Except for the DXF output part, this is a pretty easy process.

HenryCNC
01-01-2007, 06:47 PM
cncuser1,

My suggestion is to take a look at the import options for SolidWorks and see what they are. You may want to create an stl file from the image and work with a mesh inside SW... or you may want to make a set of cross-sections from the image.

The STL file format is reasonably easy to understand. Stick with the text version at first and save the binary version for later. A block of 2x2 pixels would create two triangles. Note that some CAD software will import and display mesh data, but working with it can be painfull.

To create cross-sections, just treat the image "row-wise" and "column-wise" to create a curve network. You will have polylines and not typical curves. My suggestion is to create a polyline in SW and export it to every text-type of file format so that you can pick an easy one to create yourself. I have written VDA files for polyline data before - only because it was easy and the target software read it in fine.

Are we getting closer to answering your original question?

Henry Boschen
01-01-2007, 07:39 PM
As a Newbie to CNC and 69 yrs old, I am bewildered by the multiplicity of software programs out there that purport to do almost anything. I have a Techno CNC with 4th axis ability and am trying to get EnRoute Pro to produce 2-D and 3-D art from .bmp. I successfully engraved line art onto an 8' by 7" cylinder, (go to youtube.com and search for Hank's CNC) but producing the line art required Scan2CAM. I couldn't get good results with EnRoute.
I have Corel 3x but it doesn't do what I expected yet.

What would you suggest is the best program to get vector art from Rastor art?

Hank

cncuser1
01-01-2007, 09:19 PM
cncuser1,

My suggestion is to take a look at the import options for SolidWorks and see what they are. You may want to create an stl file from the image and work with a mesh inside SW... or you may want to make a set of cross-sections from the image.

The STL file format is reasonably easy to understand. Stick with the text version at first and save the binary version for later. A block of 2x2 pixels would create two triangles. Note that some CAD software will import and display mesh data, but working with it can be painfull.

To create cross-sections, just treat the image "row-wise" and "column-wise" to create a curve network. You will have polylines and not typical curves. My suggestion is to create a polyline in SW and export it to every text-type of file format so that you can pick an easy one to create yourself. I have written VDA files for polyline data before - only because it was easy and the target software read it in fine.

Are we getting closer to answering your original question?

I'll take a look, but in the mean time can you tell me at what point would the
3rd dimension be created from the differences in greyscale ( or other similar colour data)

cadcam
01-02-2007, 08:55 AM
The 3rd would be like this image I am ataching from Mastercam art of a BMP picture brought straght in and now has depth from the picture.
Then from here you can Cut.

Happy New Year

cncuser1
01-02-2007, 11:29 AM
The 3rd would be like this image I am ataching from Mastercam art of a BMP picture brought straght in and now has depth from the picture.
Then from here you can Cut.

Happy New Year

Yup, I understand what you did, my question to HenryCNC what part of the solidworks process would do the conversion from grayscale to z-height.

cadcam
01-02-2007, 11:34 AM
As I know SW can not do this , but I may be wrong. I can look thru my SW 2007 and see.

HenryCNC
01-02-2007, 06:02 PM
cncuser1,

Oops... I thought you were going to write a little program to do this. Any programming language should be able to read in a BMP file and create a mesh or sections. I must have misunderstood the intent. Of course, you will have to enter the Z depth for black and the Z depth for white.

If you are looking for software that does this conversion for you, I can't offer any suggestions . I think that in this thread there have been some software suggestions.

There was a thread someplace about turning map reliefs into a mesh... I think the file format for the map information is DEM. This is basically a BMP file with some extra stuff in it so a solution for map data would be a solution for you too. You may want to spend a few minutes with google and see if anything shows up. {edit} I just looked around in the forum on the ArtCam website and found a couple suggestions :

http://www.globalmapper.com
(install the free trial and turn a bmp into a stl)

also, search for a program called Wilbur. They talk about it a lot. Good luck. If you find a solution will you please post it here so we can all learn about it.

Henry

cadcam
01-02-2007, 06:15 PM
I also can get a 2d if needed to.Like I showed earlier Mastercam Art will do all of what he wants and the file I show earlier was a BMP of my 2 kids.
I also can get a 2d if needed to.

marting
01-05-2007, 06:38 AM
Hi Guys, I've been brousing through this section and got curiuos and at the same time a bit confused with all the suggestions going on. I have one question, is there any CAD software in which you can import an image (JPEG, BMP, etc) and expot it in dxf? I am a familiar with some softwares such as Pro-E, Acad, Mechanical Desktop, Solid Works, Catia but have never found this function in any of them. Does anyone out there have any idea?
Tks
Marten

cadcam
01-05-2007, 08:55 AM
Well with MC Art you can do this but you can also write the gcode to so there is no need for the DXF. Is there a resion for DXF?

marting
01-05-2007, 10:14 AM
Hi cadcam,
The reason is that after I export it in dxf, I would require to defign and create cutting paths only in specific areas and not the whole image as would be done in Mach 3 etc.
Do you have any idea where I can find further info on MC Art?
Tks

cadcam
01-05-2007, 10:23 AM
I am not sure were you are but I would contact the local dealer and ask for a demo and have them show you what you want.
Look on www.mastercam.com
If you still have know luck contact me and I will go on line with you and Demo it for you.

Cadcam

marting
01-05-2007, 11:01 AM
Thanks alot, I'll have a look at the website.

marting
01-05-2007, 11:03 AM
Yeh, I'm downloading the demo for a closer look.

rweatherly
01-11-2007, 05:54 PM
Attached is an Excel file that will convert an 8 bit greyscale bitmap to x, y, z coordinates. The x and y are the column and row numbers, respectively. The z value is the pixel value (0-255).

cncuser1
01-12-2007, 11:56 AM
This is elegant in its' simplicity!
It takes a creative mind to solve a problem efficienly like this.
I will report back with results.


Attached is an Excel file that will convert an 8 bit greyscale bitmap to x, y, z coordinates. The x and y are the column and row numbers, respectively. The z value is the pixel value (0-255).

rweatherly
01-12-2007, 01:53 PM
Thanks. I don't use the Excel program directly, but it is a part of a program I wrote to machine a 3D greyscale image for lithopanes.

I don't use CAD programs, so I don't know if anyone can use the Excel program as-is, but it is easy to change. Normally you would want to scale the rows or columns to the height or width of the final machined product and scale the pixel value to the depth range.

bobyblue
01-27-2007, 03:50 PM
hi,
im new here and i am looking to do photo in halftone
engrave with rotating bit and then color fill and sand the excess, and i want to do it on stainless and aluminium,
the halftone would be about 60 to 65 d.p.i., i know how
to do in photoshop but how i convert into dot for cnc. Process is the same has preparing a photo for newspaper
but I want to do it with cnc, any help appreciate, tanks Bob

dcarr
01-29-2007, 10:46 PM
Hi cadcam,
The reason is that after I export it in dxf, I would require to defign and create cutting paths only in specific areas and not the whole image as would be done in Mach 3 etc.
Do you have any idea where I can find further info on MC Art?
Tks

VS3D has the capability to import digital images, convert image brightness to relief surface height, and save as G-Code, STL, or DXF.
In addition, VS3D can perform virtual sculpting to correct issues with the relief. So rather than trying to "paint" the image in PhotoShop and guess what the relief will look like, you actually can sculpt in real time in VS3D and see all changes in the slope/contour as you hammer, scrape, lift, smooth, etc. the surface.

And VS3D also allows you to output G-Code in selected areas only, and those selected areas can have multiple holes or islands.

http://www.designscomputed.com/vs3d/

dcarr
01-29-2007, 10:52 PM
hi,
im new here and i am looking to do photo in halftone
engrave with rotating bit and then color fill and sand the excess, and i want to do it on stainless and aluminium,
the halftone would be about 60 to 65 d.p.i., i know how
to do in photoshop but how i convert into dot for cnc. Process is the same has preparing a photo for newspaper
but I want to do it with cnc, any help appreciate, tanks Bob

VS3D can do this. You simply import the image scaling image brightness to surface height (lighter-higher, darker=lower). Then run a "Peck" (pogo-sitck) path using a V-bit to generate G-Code.

The resulting path will peck deeper where the image is darker.
And since a V-bit is used, the deeper it goes, the larger the diameter circle it makes. And when the holes are filled with black and the surface is polished, the darker parts of the image correspond to bigger black dots on the surface.

Torchhead
01-29-2007, 11:37 PM
Bodyblue:

The Halftone process (peck type photo-graving) you want is available in PhotoVcarve (http://www.vectric.com/WebSite/Vectric/pvc/pvc_index.htm). Also check out the bitmap import in LazyCAM that comes with MACH3 for free. It may do what you want.

bobyblue
01-30-2007, 08:07 AM
thanks dcarr and torchead, i guess that solve my problem
i will look and try these prog and give you feedback'
Bob