ipa: raspberrypi: Enable focus measure without recompile
Previously, output of the focus measure could not be enabled without recompiling (because of the RPI_LOGGING_ENABLE macro). This uses the libcamera logging mechanism instead, so can be enabled/disabled at runtime. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
73b18967b6
commit
fd2b55cb3f
3 changed files with 9 additions and 14 deletions
|
@ -6,11 +6,15 @@
|
|||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libcamera/internal/log.h"
|
||||
|
||||
#include "../focus_status.h"
|
||||
#include "../logging.hpp"
|
||||
#include "focus.hpp"
|
||||
|
||||
using namespace RPi;
|
||||
using namespace libcamera;
|
||||
|
||||
LOG_DEFINE_CATEGORY(RPiFocus)
|
||||
|
||||
#define NAME "rpi.focus"
|
||||
|
||||
|
@ -24,11 +28,6 @@ char const *Focus::Name() const
|
|||
return NAME;
|
||||
}
|
||||
|
||||
void Focus::Read(boost::property_tree::ptree const ¶ms)
|
||||
{
|
||||
print_ = params.get<int>("print", 0);
|
||||
}
|
||||
|
||||
void Focus::Process(StatisticsPtr &stats, Metadata *image_metadata)
|
||||
{
|
||||
FocusStatus status;
|
||||
|
@ -37,10 +36,10 @@ void Focus::Process(StatisticsPtr &stats, Metadata *image_metadata)
|
|||
status.focus_measures[i] = stats->focus_stats[i].contrast_val[1][1] / 1000;
|
||||
status.num = i;
|
||||
image_metadata->Set("focus.status", status);
|
||||
if (print_) {
|
||||
uint32_t value = (status.focus_measures[5] + status.focus_measures[6]) / 10;
|
||||
RPI_LOG("Focus contrast measure: " << value);
|
||||
}
|
||||
|
||||
LOG(RPiFocus, Debug)
|
||||
<< "Focus contrast measure: "
|
||||
<< (status.focus_measures[5] + status.focus_measures[6]) / 10;
|
||||
}
|
||||
|
||||
/* Register algorithm with the system. */
|
||||
|
|
|
@ -22,10 +22,7 @@ class Focus : public Algorithm
|
|||
public:
|
||||
Focus(Controller *controller);
|
||||
char const *Name() const override;
|
||||
void Read(boost::property_tree::ptree const ¶ms) override;
|
||||
void Process(StatisticsPtr &stats, Metadata *image_metadata) override;
|
||||
private:
|
||||
bool print_;
|
||||
};
|
||||
|
||||
} /* namespace RPi */
|
||||
|
|
|
@ -415,6 +415,5 @@
|
|||
},
|
||||
"rpi.focus":
|
||||
{
|
||||
"print": 1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue