Welcome, Guest
Username: Password: Remember me
08 Apr 2018
INDI development team is happy to announce the release of INDI Library v1.7.0. This new exciting release builds on the maturity of INDI Library and comes with many new supported devices and fixes for existing drivers.
Read More...
  • Page:
  • 1

TOPIC: Raspberrypi Camera Driver Raspistill - Searching for teammate

Raspberrypi Camera Driver Raspistill - Searching for teammate 8 months 4 weeks ago #20261

  • Xophe92
  • Xophe92's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1
Hi all,

I am searching a teammate to build a driver for the Raspberry Pi Camera which would actually wrap the raspistill command line.

The base class we would have to derive from is there : link

An example of a simple CCD : link

Basically the plan is to :
  • see how to lauch a command with default parameters
  • : system("raspistill --raw .... &");
  • see how we would convert the file generated into an array of integers
  • most of the work done here github.com/illes/raspiraw/blob/master/raspi_dng.c
  • fill the PrimaryCCD.FrameBuffer with this array
  • same reference as supra

A comparable work has been done in java link

Hope to find someone interested !

PLEASE : inform me if such initiative or comparable already exists !


EDIT : my progress :
* I can compile;
* I ran a command line in the start exposure
* I worked on the commands line I will launch 'time raspiyuv -v -t 1 -w 960 -h 720 -rgb --shutter 300000 -o ~/img.rgb" gave me 3.6s while I was expecting far less (as 300000 is supposed to be a 3/10th of a second

* I read the v4l2 driver to get inspired on colors link :

Line 503 :
PrimaryCCD.setNAxis(3)

Line 1319 :
// We have RGB RGB RGB data but for FITS file we need each color in separate plane. i.e. RRR GGG BBB ..etc
             unsigned char *red   = dest;
             unsigned char *green = dest + v4l_base->getWidth() * v4l_base->getHeight() * (v4l_base->getBpp() / 8);
             unsigned char *blue  = dest + v4l_base->getWidth() * v4l_base->getHeight() * (v4l_base->getBpp() / 8) * 2;
 
             for (int i = 0; i < (int)frameBytes; i += 3)
             {
                 *(red++)   = *(src + i);
                 *(green++) = *(src + i + 1);
                 *(blue++)  = *(src + i + 2);
             }

Most of the work is done here : link

Xophe
The following user(s) said Thank You: Gilles

Please Log in or Create an account to join the conversation.

Last Edit: by Xophe92.

Raspberrypi Camera Driver Raspistill - Searching for teammate 4 months 1 week ago #23955

I'm considering writing this as well, because the v4l modes don't seem to expose the same ones that raspistill does.

In experimenting, I've come across this which github.com/Gordon999/Pi-AutoGuider seems to work better by a fair bit compared to using the v4l settings, after days of trying to mess with it, and uses most of the process you describe.

Have you started a github project or anything to work on it?

Please Log in or Create an account to join the conversation.

Raspberrypi Camera Driver Raspistill - Searching for teammate 2 months 4 weeks ago #25223

github.com/james-lan/indi/tree/raspiccd

I have started some work on doing this and have gotten images. (Really crappy ones so far) using a V2 and using this library: www.uco.es/investiga/grupos/ava/node/40

After getting those images, I think I'm going to have to either make my own replacement for the library I'm using (tearing into raspistill) or use the raspistill method above.

The more I look at the Raspi cameras the more it looks as ad-hoc as the above code, but I have an understanding of it, which should let me make a decent replacement.

Updates will take a bit.... on the last reboot, the root fs on the SD apparently corrupted.

Please Log in or Create an account to join the conversation.

Raspberrypi Camera Driver Raspistill - Searching for teammate 2 weeks 22 hours ago #27017

  • Xophe92
  • Xophe92's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1
hi,

I an cleaning my projects right now and before erasing, I share with you a bunch of code lines:

i tweeaked the example 3 in the libindi folder

/**************************************************************************************
** Client is asking us to start an exposure
***************************************************************************************/
bool SimpleCCD::StartExposure(float duration)
{
ExposureRequest = duration;
system("raspiyuv -t 1 -w 2592 -h 1944 -rgb -o /tmp/test.rgb");
// Since we have only have one CCD with one chip, we set the exposure duration of the primary CCD
PrimaryCCD.setExposureDuration(duration);

gettimeofday(&ExpStart, nullptr);

InExposure = true;

// We're done
return true;
}


void SimpleCCD::grabImage()
{
// Let's get a pointer to the frame buffer
uint8_t *image = PrimaryCCD.getFrameBuffer();

streampos size;
char * memblock;

ifstream file ("/tmp/test.rgb2", ios::in | ios::binary);

if (file.is_open())
{
file.seekg (0, ios::end);
size = file.tellg();
memblock = new char [size];
file.seekg (0, ios::beg);
file.read (memblock, size);
file.close();

int expectedNbPixel = PrimaryCCD.getXRes() * PrimaryCCD.getYRes();

uint8_t * red = image;
uint8_t * green = image +expectedNbPixel;
uint8_t * blue = image+2*expectedNbPixel;

for(int i=0;i<expectedNbPixel;i++)
{
*(red++) = (uint8_t)(*(memblock + 3*i ));
*(green++) = (uint8_t)(*(memblock + 3*i + 1));
*(blue++) = (uint8_t)(*(memblock + 3*i + 2));
}

} //end if image exists
IDMessage(getDeviceName(), "Download complete.");

// Let INDI::CCD know we're done filling the image buffer
ExposureComplete(&PrimaryCCD);
}

wish it helps :)

regards

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.139 seconds

Login

3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!


Gallery

Replica

Why INDI

Replica