int main()
{
raspicam::RaspiCam Camera; //Camera object
Camera.setWidth(1920);
Camera.setHeight(1080);
Camera.setCaptureSize(1920, 1080);
Camera.setFormat(raspicam::RASPICAM_FORMAT_RGBA);
Camera.open();
//waiting 3 secs for camera to settle
sleep(3);
//capture
int bufsize = Camera.getImageTypeSize(Camera.getFormat());
unsigned char *data = new unsigned char[bufsize];
Camera.grab();
Camera.retrieve(data);
//here some interaction with the data: check, amendments: easier to do with RGBA than YUV
raspijpeg::jpegdata returndata = raspijpeg::encode(data, bufsize, 1920, 1080, 90, PIXEL_FORMAT_RGBA);
for (int i = 0; i < returndata.length; i++) {
cout << returndata.data[i];
}
}
Without RGBA support it would be needed to add the alpha channel to the RGB array using for example:
Adds support for the RGBA encoding. Useful for usage together with the Broadcom VideoCore JPEG Encoder (brcmjpeg) from RPi Userland.
For example together with this lib: https://github.com/ideaconnect/raspijpeg/blob/master/raspijpeg.cpp
For example:
Without RGBA support it would be needed to add the alpha channel to the RGB array using for example: