@@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
*/
28
28
29
29
/*
30
- * \file RaspiStill .c
31
- * Command line program to capture a still frame and encode it to file.
30
+ * \file RaspiStillYUV .c
31
+ * Command line program to capture a still frame and dump uncompressed it to file.
32
32
* Also optionally display a preview/viewfinder of current camera input.
33
33
*
34
34
* \date 4th March 2013
@@ -102,6 +102,7 @@ typedef struct
102
102
char * filename ; /// filename of output file
103
103
int verbose ; /// !0 if want detailed run information
104
104
int timelapse ; /// Delay between each picture in timelapse mode. If 0, disable timelapse
105
+ int useRGB ; /// Output RGB data rather than YUV
105
106
106
107
RASPIPREVIEW_PARAMETERS preview_parameters ; /// Preview setup parameters
107
108
RASPICAM_CAMERA_PARAMETERS camera_parameters ; /// Camera setup parameters
@@ -131,6 +132,7 @@ static void display_valid_parameters(char *app_name);
131
132
#define CommandVerbose 4
132
133
#define CommandTimeout 5
133
134
#define CommandTimelapse 6
135
+ #define CommandUseRGB 7
134
136
135
137
static COMMAND_LIST cmdline_commands [] =
136
138
{
@@ -141,6 +143,7 @@ static COMMAND_LIST cmdline_commands[] =
141
143
{ CommandVerbose , "-verbose" , "v" , "Output verbose information during run" , 0 },
142
144
{ CommandTimeout , "-timeout" , "t" , "Time (in ms) before takes picture and shuts down. If not specified set to 5s" , 1 },
143
145
{ CommandTimelapse ,"-timelapse" , "tl" , "Timelapse mode. Takes a picture every <t>ms" , 1 },
146
+ { CommandUseRGB , "-rgb" , "rgb" ,"Save as RGB data rather than YUV" , 0 },
144
147
};
145
148
146
149
static int cmdline_commands_size = sizeof (cmdline_commands ) / sizeof (cmdline_commands [0 ]);
@@ -292,6 +295,9 @@ static int parse_cmdline(int argc, const char **argv, RASPISTILLYUV_STATE *state
292
295
i ++ ;
293
296
break ;
294
297
298
+ case CommandUseRGB : // display lots of data during run
299
+ state -> useRGB = 1 ;
300
+ break ;
295
301
296
302
default :
297
303
{
@@ -551,8 +557,16 @@ static MMAL_STATUS_T create_camera_component(RASPISTILLYUV_STATE *state)
551
557
format = still_port -> format ;
552
558
553
559
// Set our stills format on the stills port
554
- format -> encoding = MMAL_ENCODING_I420 ;
555
- format -> encoding_variant = MMAL_ENCODING_I420 ;
560
+ if (state -> useRGB )
561
+ {
562
+ format -> encoding = MMAL_ENCODING_BGR24 ;
563
+ format -> encoding_variant = MMAL_ENCODING_BGR24 ;
564
+ }
565
+ else
566
+ {
567
+ format -> encoding = MMAL_ENCODING_I420 ;
568
+ format -> encoding_variant = MMAL_ENCODING_I420 ;
569
+ }
556
570
format -> es -> video .width = state -> width ;
557
571
format -> es -> video .height = state -> height ;
558
572
format -> es -> video .crop .x = 0 ;
0 commit comments