Stereo camera with 2 raspberry pi's |
It would be best to have exact screws which you can use to adjust the angles and such. There are small holes on the camera that would allow these screws to be attached, so its just a matter of finding the right adjustable screws. Although thinking of that now, it should not be a big thing. I know the stereo alignment is a bit funny, which should be fixed, but my eyes where able to find the right focus and you can see the 3D effect quite nicely. The code is up at https://github.com/arcanon/raspbot. It won't compile out of the box, but have a look at video reader for the capture loop/anaglyph composition.
The CUDA kernel that composites the kernel looks like this:
__global__ void anaglyph_dev(char* imageLeft, char* imageRight, char *imageOut, int pitchInputs, int pitchOutput, int width, int height)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
if (x >= width || y >= height)
return;
int linearPosInputs = y*pitchInputs + x;
int linearPosOutput = y*pitchOutput + x*4;
// Red
imageOut[linearPosOutput] = imageLeft[linearPosInputs];
imageOut[linearPosOutput+1] = 0;
imageOut[linearPosOutput+2] = imageRight[linearPosInputs];
}
No comments:
Post a Comment