Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/camera_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#pragma once

#include <string>
#include <string_view>
#include <vector>

enum CameraModel {
Expand All @@ -30,5 +31,5 @@ enum CameraModel {
OV7251,
Unknown
};
CameraModel stringToModel(const std::string &model);
CameraModel stringToModel(std::string_view model);
bool isGrayScale(CameraModel model);
20 changes: 10 additions & 10 deletions src/camera_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
#include <algorithm>
#include <cstring>
#include <string>
#include <string_view>

static const CameraModel grayScaleCameras[] = {OV9281};
static const CameraModel grayScaleCameras[] = {OV9281, OV7251};

CameraModel stringToModel(const std::string &model) {
const char *famname = model.c_str();
if (!strcmp(famname, "ov5647"))
CameraModel stringToModel(std::string_view model) {
if (model == "ov5647")
return OV5647;
else if (!strcmp(famname, "imx219"))
else if (model == "imx219")
return IMX219;
else if (!strcmp(famname, "imx708"))
else if (model == "imx708")
return IMX708;
else if (!strcmp(famname, "imx477"))
else if (model == "imx477")
return IMX477;
else if (!strcmp(famname, "ov9281"))
else if (model == "ov9281")
return OV9281;
else if (!strcmp(famname, "ov7251"))
else if (model == "ov7251")
return OV7251;
else if (!strcmp(famname, "Disconnected"))
else if (model == "Disconnected")
return Disconnected;
else
return Unknown;
Expand Down
Loading