3D打印浮雕照片
March 12, 2015 05:17AM
3 D打印机可打印一种半透明的白色材料,这种材料可以用于制作一些独特的黑白照片。这些照片可能难以从侧面辨认,但从背面打光时,图像的精度高得惊人,而且更增添了微妙的维度和细腻的纹理。
通过改变这种半透明材料不同区域的厚度,我们可以影响穿过材料的光度,从而控制亮度(较薄的地方亮,较厚的地方暗)。在这个处理中,我将每个像素的灰度图像转变为厚度,从而准确复制任何灰度图像。
下面是打印的一些照片:


制作的方法如下:
1.下载Processing,解压
2.在proces中导入ModelBuilder library, (作者是 Marius Watz.,导入方法见Processing's "libraries" folder.)
3.将下面的代码粘贴进sketch
其中,String name ="YOUR_FILE_NAME.jpg";//name of file
需要将你要转换的图片放入processing.exe所在的文件夹,图片格式支持jpg,gif,png等,然后输把YOUR_FILE_NAME替换成你的文件名.
//3D printed photograph
//by Amanda Ghassaei
//May 2013
//[www.instructables.com]
/*
* This program is free software; you canredistribute it and/or modify
* it under the terms of the GNU General PublicLicense as published by
* the Free Software Foundation; either version3 of the License, or
* (at your option) any later version.
*/
//libraries
import processing.opengl.*;
import unlekker.util.*;
import unlekker.modelbuilder.*;
import ec.util.*;
String name ="YOUR_FILE_NAME.jpg";//name of file
//storage for dimensions
int widthRes;
int heightRes;
float widthDim = 8;//widthdimension (in inches)
float widthScaled;
float heightScaled;
float zDim = 0.1;//max verticaldisplacement (in inches)
float thickness = 0.02;//basethickness (in inches)
boolean invert = true;//if true,then white areas are lower than black, if not true white areas are taller
PImage img;//storage for image
float pixeldata[];//storage forpixel array
UVertexList v1,v2,v3,v4;//storagefor verticies
UGeometry geo;//storage for stlgeometry
void setup(){
img = loadImage(name);//load image
//get dimensions of image
widthRes = img.width;
heightRes =img.height;
size(widthRes,heightRes,P3D);//set dimensions of output
image(img, 0,0);//display image
loadPixels();//poad pixels into array
pixeldata = new float[widthRes*heightRes];//initialize storage for pixeldata
for(int index=0;index 0) name =name.substring(0, dotPos); geo.writeSTL(this,name+".stl"); exit(); println("Finished");}
4.保存这个sketch文件,然后运行。
5.processing会将你的图片按照灰度转换成一个.stl文件,运行完成会有finish提示。生成的.stl文件自动保存在和sketch文件相同的目录下。
6.最后打印就好。
(原文来自于网络,稍作修改)
Attachments:
open | download - 113724mdpx4ggnhhu5nhgh.jpg.thumb.jpg (137 KB)
Sorry, only registered users may post in this forum.

Click here to login