94 inimg.
require(
"input", w,
h, V4L2_PIX_FMT_YUYV);
95 bool demodisplay =
false;
100 VlDsiftFilter * vlds = vl_dsift_new_basic(w,
h, step::get(), binsize::get());
101 int const descsize = vl_dsift_get_descriptor_size(vlds);
102 int const numkp = vl_dsift_get_keypoint_num(vlds);
111 outimg = outframe.get();
116 case V4L2_PIX_FMT_YUYV:
118 outimg.require(
"output", w + 128, h, V4L2_PIX_FMT_YUYV);
119 jevois::rawimage::paste(inimg, outimg, 0, 0);
120 jevois::rawimage::writeText(outimg,
"JeVois Dense SIFT Demo", 3, 3, jevois::yuyv::White);
124 jevois::rawimage::drawFilledRect(outimg, w, numkp, descsize, h-numkp, jevois::yuyv::DarkGrey);
127 case V4L2_PIX_FMT_GREY:
129 outimg.require(
"output", descsize, numkp, V4L2_PIX_FMT_GREY);
132 default: LFATAL(
"This module only supports YUYV or GREY output images");
140 cv::Mat floatimgcv; grayimgcv.convertTo(floatimgcv, CV_32F, 1.0, 0.0);
149 vl_dsift_process(vlds,
reinterpret_cast<float const *
>(floatimgcv.data));
152 float const * descriptors = vl_dsift_get_descriptors(vlds);
156 cv::Mat dfimg(numkp, descsize, CV_32FC1,
reinterpret_cast<void *
>(
const_cast<float *
>(descriptors)));
157 cv::Mat bdfimg; dfimg.convertTo(bdfimg, CV_8U, (demodisplay ? 512.0 : 255.0), 0.0);
159 std::string
const & fpscpu = timer.
stop();
168 VlDsiftKeypoint
const * keypoints = vl_dsift_get_keypoints(vlds);
170 for (
int i = 0; i < numkp; ++i)
172 VlDsiftKeypoint
const & kp = keypoints[i];
173 unsigned int s = (
unsigned int)(kp.s / 150.0 + 1.499);
if (s >20) s = 20;
183 memcpy(outimg.
buf->data(), bdfimg.data, outimg.
width * outimg.
height);
192 vl_dsift_delete(vlds);