apps: cam: Add option to set stream orientation
Add a '--orientation|-o' option to the cam test application to set an orientation to the image stream. Supported values are the ones obtained by applying flips to the camera sensor: - rot0: no rotation - rot180: rotate 180 degrees - flip: vertical flip - mirror: horizontal flip Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
c65e40b848
commit
7e5f1e1ced
3 changed files with 24 additions and 0 deletions
|
@ -65,6 +65,24 @@ CameraSession::CameraSession(CameraManager *cm,
|
|||
return;
|
||||
}
|
||||
|
||||
if (options_.isSet(OptOrientation)) {
|
||||
std::string orientOpt = options_[OptOrientation].toString();
|
||||
static const std::map<std::string, libcamera::Orientation> orientations{
|
||||
{ "rot0", libcamera::Orientation::Rotate0 },
|
||||
{ "rot180", libcamera::Orientation::Rotate180 },
|
||||
{ "mirror", libcamera::Orientation::Rotate0Mirror },
|
||||
{ "flip", libcamera::Orientation::Rotate180Mirror },
|
||||
};
|
||||
|
||||
auto orientation = orientations.find(orientOpt);
|
||||
if (orientation == orientations.end()) {
|
||||
std::cerr << "Invalid orientation " << orientOpt << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
config->orientation = orientation->second;
|
||||
}
|
||||
|
||||
/* Apply configuration if explicitly requested. */
|
||||
if (StreamKeyValueParser::updateConfiguration(config.get(),
|
||||
options_[OptStream])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue