# Hough Transform 2D Circles Image Filter GetCircles patch.

**URL:** https://discourse.itk.org/t/hough-transform-2d-circles-image-filter-getcircles-patch/350
**Category:** Algorithms
**Created:** [October 24, 2017, 5:26pm UTC](https://discourse.itk.org/t/hough-transform-2d-circles-image-filter-getcircles-patch/350 "2017-10-24T17:26:37Z")
**Posts on this page:** 1
**Showing post:** 36

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [December 10, 2017, 12:20pm UTC](https://discourse.itk.org/t/hough-transform-2d-circles-image-filter-getcircles-patch/350/36 "2017-12-10T12:20:46Z")

</div>

FYI, I just had a closer look at how the patch I proposed last week, _“PERF: Improved speed of copying and resizing NeighborhoodAllocator”_ [http://review.source.kitware.com/#/c/22862/](http://review.source.kitware.com/#/c/22862/) would affect the performance of ITK’s Hough Transform.

I observed a 10% reduction (approximately) of the duration of _filter-\>Update()_, typically going from 50 to 45 seconds, on the following test program, using VS2017, Release, 64-bit:

```
#include <itkHoughTransform2DCirclesImageFilter.h>
#include <iostream>
#include <ctime>

int main()
{
  typedef unsigned char PixelType;
  const auto image = itk::Image<PixelType>::New();
  enum { sizeX = 4096, sizeY = sizeX };
  image->SetRegions({ sizeX, sizeY });
  image->Allocate();
  image->FillBuffer(1);

  const auto filter =
    itk::HoughTransform2DCirclesImageFilter<PixelType, unsigned char, double>::New();
  filter->SetInput(image);

  const auto time1 = std::time(nullptr);
  filter->Update();
  const auto time2 = std::time(nullptr);

  std::cout << "Duration: " << (time2 - time1) << " seconds" << std::endl;
}

```

HoughTransform2DCirclesImageFilter::GenerateData() indirectly does a lot of Neighborhood allocations, by calling GaussianDerivativeImageFunction::EvaluateAtIndex on each input pixel \> Threshold.

---

_[View the full topic](https://discourse.itk.org/t/hough-transform-2d-circles-image-filter-getcircles-patch/350)._
