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

Read More...