Step 2Convert a picture to data
Use the freely available cdrecord program in "mode 2" to burn the data to a CD-R.
| « Previous Step | Download PDFView All Steps | Next Step » |
| « Previous Step | Download PDFView All Steps | Next Step » |

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.
if FF is white, 00 is black, and 01 means to go to the next line,
FF00FF0100FF00010000000100FF00
represents 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:
FF00FF0100FF00010000000100FF00
which becomes this when splitting bytes apart with spaces:
FF 00 FF 01 00 FF 00 01 00 00 00 01 00 FF 00
then, converting 01 to a new line, 00 to #, and FF to a space:
and you should be able to read the letter in that.
octave:1> img2cd('logo.gif')
n128sec = 1
error: invalid row index = 83
error: invalid column index = 142
error: evaluating binary operator `<' near line 176, column 25
error: if: error evaluating conditional expression
error: evaluating if command near line 176, column 5
error: evaluating for command near line 174, column 3
error: evaluating for command near line 156, column 1
error: called from `img2cd' in file `/home/pabs/img2cd.m'
Any idea how to fix this?
octave:1> img = imread('sohv.jpg')
octave:2> img2cd(img)
Regards
JB
Talking about a C/C++ ver, this code is easy to read and understand to a c++ programer(noob or pro!). It would be easy to convert it.(open in free SCITE to read it first!)
C++ Code simplified (I am a noob at C!)
< Start >
/* 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! <<<<<
*/
#include <stdio.h>
int main ()
{
FILE * CDfile;
/* First lines of the MATLAB code I can't get about the Xor :( */
char code[] = { The Code };
/* State the variable || (Below) open the file on the CD to be writen to. */
CDfile = fopen ( "f:/temp/CDHOLOGRAM.data" , "wb" );
/* Write the data (file) to the CD */
fwrite (code , 1 , sizeof(code) , CDfile );
/*
Sorry! I don't know how to write it to the CD (fwrite?). . Close the file (below code).
*/
fclose (CDfile);
return 0;
}
/* This takes much more time to read, then to load http://www.3-z.net (My website) ! */
< End >
I hope that C++ pro will take this on!
??? Attempted to access img(83,142); index out of bounds because size(img)=(1,9).
Error in ==> img2cd at 176
if img(ny(k), nx(k))<128