Quantcast

Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
Hi,
I recently followed successfully the official tutorial on gumstix's wiki about how to use the caspa camera (http://wiki.gumstix.org/index.php?title=Caspa_camera_boards) with the help of the great tutorial found there:
http://paparazzi.enac.fr/wiki/Dev/Caspa

I was able to get pictures with my camera with an old kernel (2.6.34).

The thing is that I wanted to use the camera on the 3.5.0 kernel, and if possible with ROS. ROS FAQ (http://answers.ros.org/question/27556/gumstix-caspa-camera-and-ubuntu-1104/) tells that I can manage to install ros on the old 2.6.34 kernel, but I found nothing about ROS and using the camera.

Furthermore, I know that for the 3.5.0 kernel, I can use a simple script to install media-ctl and yavta (https://github.com/RobertCNelson/tools/blob/master/pkgs/aptina-media-ctl-n-yavta.sh). I also know from (http://gumstix.8.x6.nabble.com/Caspa-on-Overo-FE-3-5-kernel-td4966351.html) and (http://gumstix.8.x6.nabble.com/Caspa-FS-on-Yocto-gumstix-td4966530.html) that I can do the following to get images with this 3.5.0 kernel:

media-ctl -r
media-ctl -v -l '"mt9v032 3-005c":0->"OMAP3 ISP CCDC":0[1]'
media-ctl -v -l '"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -v -f '"mt9v032 3-005c":0[SGRBG10 752x480]'
media-ctl -v -f '"OMAP3 ISP CCDC":1[SGRBG10 752x480]'
yavta -p -f SGRBG10 -s 752x480 -n 4 --capture=1 --skip 0 $(media-ctl -e
"OMAP3 ISP CCDC output") --file=img.bin

I don't know what to do with these .bin images. I tried to open it using matlab, but I could not understand the format. Also getting lot of errors from the tools I tried to use to open the images. Also in my case, using the good old mplayer command on the new  kernel gets me solid green images in png format.

So my questions are :
How do we use pictures in the .bin format?
Can we save pictures in png format using 3.5.0 kernel (Linaro)?
Can ROS be used with the caspa cameras somehow?

If anybody could help to answer one question or more, it would be greatly appreciated.
Thanks,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

bhamadicharef
Should be 10bit linear into 16bit words ...
752x480x2 = 721920 bytes
Can you check the size f the .bin files to verify ?

Share one file if you want some MATLAB code
to verify the above ...

Brahim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
Hi and thanks for the reply.

the size of the file is currently 2165760 bytes which is exactly 3 times bigger. So my guess would be that there are 3 channels in this image (which makes sense? is it RBG format?)

The matlab code used to open the image is :

>> directory_name = uigetdir;
>> cd(directory_name);
>> binfile = dir('*.bin');
>> fid = fopen(binfile.name);
>> A = fread(fid, 'uint8=>uint8');
>> fclose(fid);

But the format looks real strange to me. it looks like this, all in one column.
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
3
254
#snip#
95
1
91
1
21
2
251
1
135
1
254
3
49
1
28
3
14
#snip
254
3
254
3
254
3
254
3
254
3
254
3
254
3

Do you have some matlab code that would allow me to reformat the image into a (752*480*3) matrix?
And I might be asking too much, but in fact I would prefer this .bin image to be loaded and manipulated in python, since I will have to translate it to python anyway.

thanks again
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

bhamadicharef
If you driver has this type of format V4L2_PIX_FMT_SGRBG10
http://linuxtv.org/downloads/v4l-dvb-apis/pixfmt-srggb10.html

then you need to decode the "raw sRGB / Bayer formats with 10 bits per colour"

Read this http://www.imatest.com/docs/raw/ 

Try some Bayer to RGB conversion using MATLAB

To reshape MATLAB data use ...
http://www.mathworks.com/help/matlab/ref/reshape.html 

Brahim
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
This post has NOT been accepted by the mailing list yet.
Thanks a lot for this information, I'll look into it and then I will return with feedbacks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

Andrzej Debski
In reply to this post by bhamadicharef
About changing image from Bayer format
(http://en.wikipedia.org/wiki/Bayer_filter) which is used by Caspa you
can write simple application in opencv to load an image and format it to
normal RGB and save it in, for example .PNG file.

I don't have any snippets of the code on me, but I can send it later
how to achieve this if you want.

W dniu 2013-07-03 04:35, bhamadicharef napisaƂ(a):

> If you driver has this type of format V4L2_PIX_FMT_SGRBG10
> http://linuxtv.org/downloads/v4l-dvb-apis/pixfmt-srggb10.html
>
> then you need to decode the "raw sRGB / Bayer formats with 10 bits
> per
> colour"
>
> Read this http://www.imatest.com/docs/raw/
>
> Try some Bayer to RGB conversion using MATLAB
>
> To reshape MATLAB data use ...
> http://www.mathworks.com/help/matlab/ref/reshape.html
>
> Brahim
>
>
>
>
> --
> View this message in context:
>
> http://gumstix.8.x6.nabble.com/Caspa-cameras-with-Linaro-3-5-0-kernel-or-using-ROS-tp4967478p4967492.html
> Sent from the Gumstix mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

Peter A. Bigot
In reply to this post by OlivierDugas
On 07/02/2013 09:41 AM, OlivierDugas wrote:
> Furthermore, I know that for the 3.5.0 kernel, I can use a simple script to
> install media-ctl and yavta
> (https://github.com/RobertCNelson/tools/blob/master/pkgs/aptina-media-ctl-n-yavta.sh).
> I also know from
> (http://gumstix.8.x6.nabble.com/Caspa-on-Overo-FE-3-5-kernel-td4966351.html)
> and
> (http://gumstix.8.x6.nabble.com/Caspa-FS-on-Yocto-gumstix-td4966530.html)
> that I can do the following to get images with this 3.5.0 kernel:
What you know from the second posting (which I wrote) is that you can
get data from the camera on Yocto builds.  The data I got with that
sequence was not a valid image (all constant, encoding is irrelevant).  
A second (VS) camera produced the same sort of data. The failure mode
suggests to me that the driver does not work, or needs special
configuration.

Most of the follow-up posts in your thread deal with the format of the
data.  If the captured image is not an actual image in some other
format, converting it won't help much.

I have yet to see evidence that the Caspa can be made functional on a
current Yocto-based gumstix build, though if somebody could confirm that
and give details on a working configuration I might actually start using
Gumstix again.

Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
Thanks a lot for you advice. I'm a bit busy for the current week, but I will let you know what I was able to do as soon as possible.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

OlivierDugas
In reply to this post by Peter A. Bigot
Hi everybody
First of all, the above replies made me realize that I misused matlab to load the .bin images. The following code is used to load an image into matlab.

binfile = dir('img.bin');
fid = fopen(binfile.name);
A = fread(fid, 'uint16=>uint16');
fclose(fid);
B = reshape(A,752,480);
RGB = demosaic(B,'gbrg');
imshow(RGB)

Right now, I do succeed to load the image into matlab BUT it's a full black image. I know that the camera is not the problem, since I did manage to capture a yellowish portrait of me  using an old angstrom freeze.  Thus, I don't understand why the image capture using a recent OS like Linaro is not working.

I use a Caspa VL, but I don't think it matters to use a VL instead of a FS, since the difference is the infrared filter for all I know.

Thanks again for your time.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Caspa cameras with Linaro 3.5.0 kernel, or using ROS?

flexbex
This post has NOT been accepted by the mailing list yet.
I tried yours. You were very close. The Trick was that by default rgb is in Matlab between 0.0:1.0 and your numbers were between 1 :2^10
So if anybody find this post try:
(btw mine is still not correct cause it just takes the highest number. but it will at least show u sth else than a black screen)

clc
close all
clear all
fid = fopen('~/img-000013.bin');
A = fread(fid, 'uint16=>uint16');
fclose(fid);
B = reshape(A,752,480);
B=B';
RGB = demosaic(B,'gbrg');
RGB=double(RGB);
RGB(:,:,1)=RGB(:,:,1)/max(max(RGB(:,:,1)));
RGB(:,:,2)=RGB(:,:,2)/max(max(RGB(:,:,2)));
RGB(:,:,3)=RGB(:,:,3)/max(max(RGB(:,:,3)));
imshow(RGB);
Loading...