Thank you for your reply Sergi. In my code I configured the camera to
capture the whole 640x480 image which is scaled by a zoom factor of 8 in
x and y to give a 80x60 image. I also set it to be in greyscale so only
1 byte per pixel is needed. Which is why I didn't think the problem was
the buffer being too small or me not interpreting the data into rgb
properly.
The data the camera gives me is basically garbage, it's mostly empty
0x00 or 0x08 and the data doesn't seem to be affected when I put my hand
over the camera. I've attached an example of the image data the epuck
running the code below sends back.
Perhaps I have incorrect drivers for the camera or something? I read
somewhere that there are sometimes po6030k cameras on the epuck. How do
I tell which one my robot has?
Thanks,
Jenny
On 14/02/11 16:35, Sergi Torrellas wrote:
Hi Jenny,
I tried to do exactly the same.
What you get from the e-puck is 40x40 bytes of an RGB code (2bytes).
Have a look at the datasheet of the camera, there is an explanation
there of the codification.
You can create the an image file (jpg, bmp, png) by using this array of
pixels.
Hope that helps,
Sergi
2011/2/14 Jenny Owen <[email protected] <mailto:[email protected]>>
Hello all,
I've been working on some code which tells the epuck to take a
picture with its camera and then send it to my computer via
bluetooth. The problem is that when the camera takes a picture, the
data it creates is rubbish. I've looked at sample code in the
library documentation and the epuck player drivers and I can't tell
where my code is going wrong.
Anyway, this is the code that is running on the epuck:
#include <uart/e_uart_char.h>
#include <motor_led/e_init_port.h>
#include <camera/fast_2_timer/e_po3030k.h>
#define CAM_BUFFER_SIZE 80*60
unsigned char cam_buffer[CAM_BUFFER_SIZE];
void init_cam(void)
{
e_po3030k_init_cam();
e_po3030k_config_cam(0, 0, ARRAY_WIDTH, ARRAY_HEIGHT, 8, 8,
GREY_SCALE_MODE);
e_po3030k_write_cam_registers();
return;
}
void capture(void)
{
e_po3030k_launch_capture((char *)cam_buffer);
while(!e_po3030k_is_img_ready());
}
int main(void)
{
e_init_port();
init_cam();
e_init_uart1();
e_send_uart1_char("photography ", 12);
char ch;
//get ch from uart until we receive an x
while(ch != 'x')
{
//is_char checks for incoming data from uart1
if(e_ischar_uart1())
{
e_getchar_uart1(&ch);
}
}
capture();
//send buffer contents to bluetooth
e_send_uart1_char((char *)cam_buffer, CAM_BUFFER_SIZE);
//wait to finish sending
while(e_uart1_sending()){}
return 0;
}
So the camera is taking a 640 x 480 greyscale image and scaling it
down to an 80x60 image. This is then sent to my computer across
uart1. On my computer I've tried reading the data through the
terminal in TinyBld which gives me raw data which looks like:
û û û û
ÿ ÿ etc. When I
converted that to an image it was basically a black retangle with
some lighter grey pixels.
I thought maybe the problem was with the bluetooth connection, but
when I try and use the data for other things in the epuck it's clear
the camera isn't filling the buffer with data properly. I also tried
running the BTcom/epuck monitor program, and with that code the
camera worked properly so it's not a broken camera either.
I'm not sure what else the problem could be, does anyone here have
any ideas?
Thanks,
Jenny
_______________________________________________
E-puck-user mailing list
[email protected] <mailto:[email protected]>
https://mail.gna.org/listinfo/e-puck-user
--
*SERGI TORRELLAS SOCASTRO
Desenvolupador
R+D Salut
M. 616.21.72.97**
*[email protected] <http://bdigital.org>
*BARCELONA DIGITAL CENTRE TECNOLÒGIC*
Roc Boronat 117, 5a planta, 08018 Barcelona
Tel. +34 93 553 45 40 - Fax. +34 93 553 45 41
www.bdigital.org <http://www.bdigital.org/>
ûûûû
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ ÿ
ÿ ÿ ÿ
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y ÿ
ÿ ÿ
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
ÿ ÿ ÿ ÿ y y y y
_______________________________________________
E-puck-user mailing list
[email protected]
https://mail.gna.org/listinfo/e-puck-user