25#include <linux/videodev2.h>
27#include <opencv2/core/core.hpp>
28#include <opencv2/imgproc/imgproc.hpp>
39 Effect::Twirl, Effect_Values, ParamCateg);
105 public jevois::Parameter<effect>
111 itsFilter = addSubComponent<FilterGPU>(
"gpu");
136 LFATAL(
"Input and output image sizes must match");
139 if (outimg.
fmt == V4L2_PIX_FMT_RGB565)
143 itsFilter->process(inimgcv, outimgcv);
146 else if (outimg.
fmt == V4L2_PIX_FMT_YUYV)
151 itsFilter->process(inimgcv, tmpcv);
152 cv::Mat tmpcvbgr; cv::cvtColor(tmpcv, tmpcvbgr, cv::COLOR_BGR5652BGR);
156 else LFATAL(
"output format must be RGB565 or YUYV");
159 std::string
const & fpscpu = timer.
stop();
161 std::ostringstream oss; oss <<
"JeVois DemoGPU - Effect: " << effect::get();
174 case Effect::NoEffect:
175 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/simplefragshader.glsl");
179 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/blurfragshader.glsl");
183 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/sobelfragshader.glsl");
187 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/medianfragshader.glsl");
191 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/multfragshader.glsl");
195 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/threshfragshader.glsl");
199 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/dilatefragshader.glsl");
203 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/erodefragshader.glsl");
207 itsFilter->setProgram(
"shaders/simplevertshader.glsl",
"shaders/twirlfragshader.glsl");
208 itsFilter->setProgramParam1f(
"twirlamount", 2.0F);
213 itsFilter->setProgram(
"shaders/dewarpvertshader.glsl",
"shaders/dewarpfragshader.glsl");
218 itsFilter->setProgramParam2f(
"offset", -1.0F, -1.0F);
219 itsFilter->setProgramParam2f(
"scale", 2.0F, 2.0F);
222 itsFilter->setProgramParam2f(
"offsetd", -1.2F, -1.2F);
223 itsFilter->setProgramParam2f(
"scaled", 2.4F, 2.4F);
227 std::shared_ptr<FilterGPU> itsFilter;
JEVOIS_REGISTER_MODULE(ArUcoBlob)
#define JEVOIS_UNUSED_PARAM(x)
Simple image filtering demo using OpenGL-ES shaders on the Mali-400MP2 GPU.
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function.
void onParamChange(effect const &JEVOIS_UNUSED_PARAM(param), Effect const &newval) override
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(effect, Effect, "GPU image processing effect to apply", Effect::Twirl, Effect_Values, ParamCateg)
Parameter.
virtual ~DemoGPU()
Virtual destructor for safe inheritance.
JEVOIS_DEFINE_ENUM_CLASS(Effect,(NoEffect)(Blur)(Sobel)(Median)(Mult)(Thresh)(Dilate)(Erode)(Twirl)(Dewarp))
Parameter.
DemoGPU(std::string const &instance)
Constrctor.
friend friend class Module
std::string const & stop(double *seconds)
cv::Mat convertToCvRGBA(RawImage const &src)
cv::Mat cvImage(RawImage const &src)
void writeText(RawImage &img, std::string const &txt, int x, int y, unsigned int col, Font font=Font6x10)
void convertCvBGRtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
unsigned short constexpr White
unsigned short constexpr White