burning visible images onto cd rs with data beta

10
http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/ Home Sign Up! Explore  Community Submit Burning visible images onto CD-Rs with data (beta) by argon on January 29, 2006 Table of Contents intro: Burning visible images onto CD-Rs with da ta (beta)  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 File Downloads  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 step 1: Learn how CDs and CD-Rs work  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 step 2: Convert a picture to data  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 File Downloads  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 step 3: Calibrate your CD-Rs  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 step 4: Draw a picture!  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Related Instructables  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Advertisements  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Customized Instructable T-shirts  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Comments  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Upload: ashwin-s-purohit

Post on 11-Oct-2015

103 views

Category:

Documents


1 download

DESCRIPTION

Burning Visible Images Onto CD Rs With Data Beta asd

TRANSCRIPT

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    Home Sign Up! Explore Community Submit

    Burning visible images onto CD-Rs with data (beta)by argon on January 29, 2006

    Table of Contents

    intro: Burning visible images onto CD-Rs with data (beta) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    step 1: Learn how CDs and CD-Rs work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    step 2: Convert a picture to data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    step 3: Calibrate your CD-Rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    step 4: Draw a picture! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Customized Instructable T-shirts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    intro: Burning visible images onto CD-Rs with data (beta)By carefully choosing the right 1s and 0s to burn to a CD, it is possible to burn visible images on normal CD-Rs. These images rely on the fact that the 1s and 0s createdby pits in the CDs surface reflect light differently.

    Image Notes1. This is the picture I drew on the CD-R. It is a little wavy because I haven't completely calibrated the CD-R.

    File Downloads

    picture.h (160 bytes)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'picture.h']

    img2cd.c (5 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'img2cd.c']

    cd.h (9 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'cd.h']

    step 1: Learn how CDs and CD-Rs workData on a CD, or any optical media, is stored as a sequence of pits of varying lengths. To be precise, a 1 is represented by the change from pit to no-pit or the changefrom no-pit to pit, and a 0 is represented by no change in height (pit to pit or no-pit to no-pit). The pits and no-pits reflect different amounts of light; thus it is possible todraw images on CDs by appropriately arranging these 1s and 0s.

    How do you arrange the 1s and 0s? It helps to know that the data is written along a spiral that starts from the center of the CD and spirals outward in a clockwisedirection. The length of each bit is a fairly precise value (more on this later), and the pitch of the spiral, or the distance between successive spirals, is also a fairly precisevalue. Thus, using some math and some guesswork, it is possible to create a mapping from the nth bit in your data to an x,y coordinate.

    Now we really have to look under the hood of CD data storage to figure out how to tell the CD writer to write a 0 or 1 for the nth bit. Data is organized as a sequence ofsectors, each of which is 2352 bytes long. The data within each sector is organized in a particular way depending on what type of CD your are dealing with (data, audio,etc...). The most "raw" type of organization is known as "mode 2." Mode 2 does away with many of the nice things about CDs like error correction, but it gives us the mostcontrol over the bits. In a mode 2 sector, the first 12 bytes contain "syncing" data and the next 4 contain specific information about the sector. These bytes cannot bechanged at the software level. (Maybe it is possible to write a driver that could change these?) The next 2336 bytes are free to be anything though. If this were all thathappened to the data, our job would be easy. Unfortunately, there's a lot more data manipulation before the data actually gets written to the CD.First, the data in each sector is "scrambled" by which we mean it is run through some math function which is supposed to "whiten" the data (i.e. keep the average heightof the data on the CD half-way between pit and no-pit).Second, the data is sent through a CIRC encoder, which applies some error correction codes.

    Finally, the data is sent though an eight-to-fourteen modulator (EFM). This maps each 8-bit byte to a 14-bit sequence. This is to prevent long sequences of 0's (nochange in height) which are hard for the CD drive to read.The point is: drawing pictures on CDs is possible, so it should be done.

    For a more complete (but still at some times cryptic) explanation of CDs, check out the freely available ECMA-130 specification.

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    step 2: Convert a picture to dataHere are the MATLAB programs that I use to convert an image to a data file.

    Use the freely available cdrecord program in "mode 2" to burn the data to a CD-R.

    File Downloads

    img2cd.m (12 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'img2cd.m']

    calcCoord.m (2 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'calcCoord.m']

    step 3: Calibrate your CD-RsEach brand (or maybe even set) of CD-Rs has slightly different properties such as track pitch or linear scanning velocity. Before successfully drawing a picture, it isnecessary to determine what these values are. To do this, create a data file which represents a radial line. Draw this to the CD-R, and you may get a spiral. Now it's timefor the guesswork. Try to change the values, to convert this spiral back into a radial line.

    Image Notes1. The picture is here. It has a shadow picture, which means that there is still a bug in my program.2. Two almost radial lines are visible here. The lines are a little wavy, which means that I haven't completely calibrated my CD-R. Also, they shouldn't really even behere, which means that there is a bug in my program.

    step 4: Draw a picture!Here I've shown a CD-R with a picture of two people kissing burned on it. It's a little hard to discern because I haven't completely calibrated this CD-R yet.

    Image Notes1. This is the picture I drew on the CD-R. It is a little wavy because I haven'tcompletely calibrated the CD-R.

    Image Notes1. The picture is here. It has a shadow picture, which means that there is still abug in my program.

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    2. Two almost radial lines are visible here. The lines are a little wavy, whichmeans that I haven't completely calibrated my CD-R. Also, they shouldn't reallyeven be here, which means that there is a bug in my program.

    Related Instructables

    Build anAmazing TeslaCD Turbine bymrfixits

    The Making ofthe PrototypeTesla CDTurbine (video)by mrfixits

    CD box byDuobix

    Tech deck grindrail by Xander dagr8

    Make anOrigami CDHolder byyoussefgaber

    CD Jewl CaseCD Holder bythatjawn

    Micro LASERShow with a CDLensMechanism bylinefeed

    SinkSciencewith the TeslaCD Turbine bymrfixits

    AdvertisementsCustomized Instructable T-shirts

    Comments50 comments Add Comment view all 98 comments

    Shellard says: Oct 13, 2008. 8:50 AM REPLYok i have all the codes i got matlab, and i have my monochrome image with the right dimensions, what do i do with the image? dont i have to put a link to itsomewhere?? im so confused

    spinach_dip says: Jul 30, 2006. 5:35 AM REPLYHow can I get this to work with octave? I don't and never will own Matlab, so I need to run it in octave, anyone know how? Or maybe it could be rewritten inC?

    spinach_dip says: Jul 30, 2006. 5:40 AM REPLYFigured it out, but it doesn't work:

    octave:1> img2cd('logo.gif')n128sec = 1error: invalid row index = 83error: invalid column index = 142error: evaluating binary operator `

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    error: evaluating for command near line 174, column 3error: evaluating for command near line 156, column 1error: called from `img2cd' in file `/home/pabs/img2cd.m'

    Any idea how to fix this?

    bomholt says: Nov 11, 2006. 7:11 AM REPLYIn octave try:

    octave:1> img = imread('sohv.jpg')octave:2> img2cd(img)RegardsJB

    dombeef says: Sep 30, 2008. 6:18 PM REPLYdoes it work

    tubbychick3n says: Aug 4, 2008. 5:11 AM REPLYcan someone help me? can this be done with a normal dvd burner? how do i run the software?

    tubbychick3n says: Aug 4, 2008. 5:23 AM REPLYi just want to know if there is anywhere that i can download the software used to do this

    sniper120 says: Aug 3, 2008. 8:05 PM REPLY>> Important

    /* Simple C++ code convertion for matlab code */

    /*

    This is the base of the C code you would need. You would have to xor the data. Note: Looked for C++ BITXOR/XOR function but could not find any!

    "this sequence of bytes is xored with the bytes of sector to "scramble" the data" --matlab code

    Then setup the calabration for the type or brand of CD used. Get the center radius and other things. The comments were not clear in the program!

    There was picture adjustment code to make the picture as it was on the computer screen."i came up with these fudge factors to attempt to straighten my picture. they work OK for my CD-Rs.they probably won't work for yours" --matlab code

    Then write the image to 1/0 bits as a file. The matlab code tried to write at 128 sectors( A second?)>>>>> NOTE: Most of the code in the MATLAB is math! The C++ code would be much better to read and less lines!

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    I hope that C++ pro will take this on!

    whopoder says: Feb 29, 2008. 3:30 AM REPLYMy God! Long time... This project is Abadonned! Was a good idea, not good instructions, but really good proj...*

    A.C.E. says: Feb 23, 2008. 5:19 AM REPLYi dont know where to get cdrecord from, can anyone give me a link?

    denilsonsa says: Dec 13, 2007. 4:51 AM REPLYI know that photographing a CD surface probably is tricky, but couldn't you try to take better photos? It is almost impossible to see anything on those.

    I haven't tried to download those files yet, but do we need both C compiler and MatLab/Octave to make this? Or just C would be enough? What tools areneeded? (I guess most of these questions will be answered whenever this instructable leaves the beta stage)

    Soksume says: Nov 25, 2007. 9:54 AM REPLYumm noob question but how do i save these or what ever it just redirects me to som crazy html doc when i click

    jonnxt says: Aug 16, 2007. 3:56 PM REPLYyou sould make a c++ version!!!

    creedtv says: Aug 15, 2007. 10:26 PM REPLY

    whopoder says: Jul 19, 2007. 10:58 AM REPLYWell, I'm new on C language. Dev-cpp:

    error: syntax error before '=' tokenimg2cd.c:7:1: warning: "RAND_MAX" redefinedIn file included from img2cd.c:3:stdlib.h:29:1: warning: this is the location of the previous definitionimg2cd.c: In function `main':img2cd.c:53: error: `PICTURE_X' undeclared (first use in this function)error: `PICTURE_Y' undeclared (first use in this function)error: `f1tof2Frame' undeclared (first use in this function)GOD!At last... Have I to put something after {(at the end)?static unsigned char PIC_HEIGHTPIC_WIDTHpicture = {Don't kill me XD

    winkman says: Aug 24, 2006. 2:33 AM REPLYAnd I haven't got a copy of MATLAB... And won't... Is there another way i can do it?It looks SUPER-DUPER cool, and i'd LOVE to be able to do it... :)If someone has a suggested way that i could do it without having to buy software, that'd be GREAT!

    Mitch

    Wesley R. Elsberry says: Jul 14, 2007. 2:01 PM REPLYIf the Matlab code is pretty generic, it might work in Octave, which is the open source project to handle much of what Matlab does. IIRC, you can getoctave for Win32, Linux, and Mac.

    lyallp says: May 15, 2007. 6:22 AM REPLYIt's called Lightscribe.A lot of CD/DVD burners nowadays have the ability.

    Erik Andersen says: Jun 22, 2007. 1:17 AM REPLYLight scribe burns the other side of the CD. You are writing the data side when you use this method. When you use lightscribe, you use the label side :)

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    rgbphil says: Sep 8, 2006. 10:50 PM REPLYHope this helps with the hologram on a disk dream....but heres a link to a synthetic hologram maker program in Java....don't know if it works, but apparentlyyou can get some basic results using 600dpi transparencies....surely a CD can give higher resolution.http://www.medcosm.com/prog_CGHmaker.htm

    VIRON says: Jun 4, 2007. 3:02 PM REPLYThere is a method for making holograms either by hand ormechanically, at amasci.com or google "hand-drawn holograms",and also some instructables on it. If you can do the math ANDburn the curves with this instructable's way, you can Make all theholograms you want.

    Suggestions: Holographic and/or digital sundial CD!or, CD clock with 3D numbers and hands, using a quartz movement.

    WIth c being enough points between 0 and 2 x pi, and radius rx= r cos(c) ; y=r sin(c) makes circular fresnel curves,and r determines the depth or projection distance of the image.This then has to be remapped onto the CD using similar math,converting voxel coordinates to pits bit and byte addresses.

    A second conversion is needed to try to find the tracks and bytesof every hologram pit burnt on the surface of the disc relativeto the center, using polar coordinates instead of x,y.

    "for" all x and y that x2+y2=r2 is the pythagorean theorem wayto do the same thing... both maths are useful for triangles andcircles also. I hope you know a good geometry teacher if youneed help.

    Don't fear the math, it just does what you can easily do by handwith a coaster and a double pointed circle making compass,when you make "hand drawn holograms". And if you can doodlea video game on graph paper, that's related too, to where yourpixels are when you're laser burning your own hologram coaster.

    reubensammut says: Aug 28, 2006. 10:36 AM REPLYHey,Nice instructable mate. I'm having problems about the raw file system. Do I have to use a cd burning program like nero and burn the file as data or do i haveto do otherwise?

    Thanks Reuben

    argon says: Aug 29, 2006. 2:04 AM REPLYI used cdrecord, which is freely available and open source.

    ahf2009 says: May 27, 2007. 2:15 AM REPLYHi Argon, I'm working in a electronic experiment that needs to make a very accurate pits pattern on a cd, i run your matlab code, works fine! I will bevery pleased if you post your new version code. Are you doing exactly that ECMA130 says? How did you made EFM code turn binary images?Thanks!

    argon says: May 30, 2007. 11:03 AM REPLYHi,

    I'll post the updated code... but I haven't worked on this project in a while, so I don't remember what the c code's status is. I believe I'm doingexactly what ECMA130 says, but it's not the clearest standard in the world....

    ;) says: Mar 21, 2007. 9:00 PM REPLYHIIIIIIIIIIIIIIII,

    I found something cool out i dont know how it works though or how you would use it.1. in microsoft paint make an image you like2. save it to desktop3. go to note pad4. go to open and click all files then find and open it5. it should come out in a very long pattern with a lot of y's6. figure out some way to write that to the cd

    I cant really do this so if someone could please post a "REPLY" to this comment!!thanks!!- ;)

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    kainino says: May 23, 2007. 10:19 PM REPLYWhat you saw in MS Paint is just notepad trying to read what is really a series of hexadecimal numbers, for example:if FF is white, 00 is black, and 01 means to go to the next line,FF00FF0100FF00010000000100FF00represents a small image of the letter A. This only indicates lines of black and white, so what you see here is already being used by the program.

    P.S. That string of numbers works as follows:FF00FF0100FF00010000000100FF00which becomes this when splitting bytes apart with spaces:FF 00 FF 01 00 FF 00 01 00 00 00 01 00 FF 00then, converting 01 to a new line, 00 to #, and FF to a space:

    ## ##### #

    and you should be able to read the letter in that.

    choppahead says: Jan 31, 2006. 8:47 PM REPLYAny idea how to correct his error? I've never used MATLAB and I'm new to programming, so I'm a little lost. I figured out how to run the code and parse theinput in, but I have no idea how to get around this error. I'm using a black and white, 142x83 JPG...

    ??? Attempted to access img(83,142); index out of bounds because size(img)=(1,9).Error in ==> img2cd at 176if img(ny(k), nx(k))

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    ooger says: Mar 25, 2007. 12:22 PM REPLYHello I'm using Matlab 7.1.

    when i try to run img2cd i get:

    EDU>> img2cd

    n128sec =

    1

    ??? Input argument "img" is undefined.

    Error in ==> img2cd at 176if img(ny(k), nx(k))

  • http://www.instructables.com/id/Burning-visible-images-onto-CD-Rs-with-data-beta/

    paulrobinson says: Oct 19, 2006. 2:04 PM REPLYis any windows exe program available to convert the image into data?

    dunkel2002 says: Sep 26, 2006. 11:01 PM REPLYhey argon it's only a sugest why you don't send or let me send it your sorce code in c to k3b team meybe a larger gropu can progress much faster, sinceyour idea it's amazing

    Ouch says: Sep 10, 2006. 4:37 PM REPLYbrilliant! you are a genius.

    flaso says: Sep 4, 2006. 7:01 AM REPLYHello Argon,i'm particulary interested on your tutorial about graphics imaging burning on CD. I don't know Matlab very well: i've downloaded img2cd.m and calcCoord.mbut when i run then i receive an error message back: "undefined command/function 'calcCoord'.What should i do?Thanks, Paolo

    view all 98 comments