312 float tHigh = hysteresis_threshold_high_;
313 float tLow = hysteresis_threshold_low_;
314 const int height = input_->height;
315 const int width = input_->width;
317 output.
resize(height * width);
319 output.
width = width;
324 kernel_.setKernelSize(3);
325 kernel_.setKernelSigma(1.0);
327 kernel_.fetchKernel(*gaussian_kernel);
328 convolution_.setKernel(*gaussian_kernel);
329 convolution_.setInputCloud(input_);
330 convolution_.filter(*smoothed_cloud);
334 setInputCloud(smoothed_cloud);
335 detectEdgeSobel(*edges);
338 discretizeAngles(*edges);
342 suppressNonMaxima(*edges, *maxima, tLow);
345 for (
int i = 0; i < height; i++) {
346 for (
int j = 0; j < width; j++) {
347 if ((*maxima)(j, i).intensity < tHigh ||
348 (*maxima)(j, i).intensity == std::numeric_limits<float>::max())
351 (*maxima)(j, i).intensity = std::numeric_limits<float>::max();
352 cannyTraceEdge(1, 0, i, j, *maxima);
353 cannyTraceEdge(-1, 0, i, j, *maxima);
354 cannyTraceEdge(1, 1, i, j, *maxima);
355 cannyTraceEdge(-1, -1, i, j, *maxima);
356 cannyTraceEdge(0, -1, i, j, *maxima);
357 cannyTraceEdge(0, 1, i, j, *maxima);
358 cannyTraceEdge(-1, 1, i, j, *maxima);
359 cannyTraceEdge(1, -1, i, j, *maxima);
364 for (std::size_t i = 0; i < input_->size(); ++i) {
365 if ((*maxima)[i].intensity == std::numeric_limits<float>::max())
366 output[i].magnitude = 255;
368 output[i].magnitude = 0;
378 float tHigh = hysteresis_threshold_high_;
379 float tLow = hysteresis_threshold_low_;
380 const int height = input_x.
height;
381 const int width = input_x.
width;
383 output.
resize(height * width);
385 output.
width = width;
389 kernel_.setKernelSize(3);
390 kernel_.setKernelSigma(1.0);
392 kernel_.fetchKernel(*gaussian_kernel);
393 convolution_.setKernel(*gaussian_kernel);
396 convolution_.setInputCloud(input_x.
makeShared());
397 convolution_.filter(smoothed_cloud_x);
400 convolution_.setInputCloud(input_y.
makeShared());
401 convolution_.filter(smoothed_cloud_y);
405 sobelMagnitudeDirection(smoothed_cloud_x, smoothed_cloud_y, *edges.get());
408 discretizeAngles(*edges);
411 suppressNonMaxima(*edges, *maxima, tLow);
414 for (
int i = 0; i < height; i++) {
415 for (
int j = 0; j < width; j++) {
416 if ((*maxima)(j, i).intensity < tHigh ||
417 (*maxima)(j, i).intensity == std::numeric_limits<float>::max())
420 (*maxima)(j, i).intensity = std::numeric_limits<float>::max();
423 cannyTraceEdge( 1, 0, i, j, *maxima);
424 cannyTraceEdge(-1, 0, i, j, *maxima);
425 cannyTraceEdge( 1, 1, i, j, *maxima);
426 cannyTraceEdge(-1, -1, i, j, *maxima);
427 cannyTraceEdge( 0, -1, i, j, *maxima);
428 cannyTraceEdge( 0, 1, i, j, *maxima);
429 cannyTraceEdge(-1, 1, i, j, *maxima);
430 cannyTraceEdge( 1, -1, i, j, *maxima);
436 for (
int i = 0; i < height; i++) {
437 for (
int j = 0; j < width; j++) {
438 if ((*maxima)(j, i).intensity == std::numeric_limits<float>::max())
439 output(j, i).magnitude = 255;
441 output(j, i).magnitude = 0;