Generate Gray code

142 views
Skip to first unread message

Dalia Nada

unread,
Feb 13, 2012, 5:58:08 PM2/13/12
to structured-light
Is there a open source code to generate gray code pattern ( 20 frames
maximum) using matlab ??????

Elliot Woods

unread,
Feb 14, 2012, 12:03:35 AM2/14/12
to structur...@googlegroups.com
generating graycode isn't mathematically very difficult
do you want to store it in a 768x1024x20 matrix?
or is it enough just to have the binary values in a 768x1024 matrix?
I can't remember much about matlab to be honest

you can see how to render the graycode values at:
that'll give you a 1024*768 array of integers
then for each frame, you should trasmit a bit for each frame
this is performed at
but you can code this in a way that makes more sense to you

for (int i=0; i<size; i++)
*pixel++ = (*data++ & (uint)1 << frame) == (uint)1 << frame ? (uchar)255 : (uchar)0;
means for each pixel, get the integer for that pixel
then select the bit for this frame (bitshift 1 by frame, [&] this value against the int, check whether equals 1 bitshift by frame)
the output is then converted to 255 (full brightness) or 0

elliot

On 13 February 2012 22:58, Dalia Nada <dalia...@gmail.com> wrote:
Is there a open source code to generate gray code pattern ( 20 frames
maximum)  using matlab ??????



--
Elliot
-- 
Elliot Woods
elliot@KimchiAndChips.com


Reply all
Reply to author
Forward
0 new messages