title: Compute curvature of a bent pipe using image processing (Hough transform parabola detection)
body: <p>I'm trying to design a way to detect this pipe's curvature. I tried applying hough transform and found detected line but they don't lie along the surface of pipe so smoothing it out to fit a beizer curve is not working .Please suggest some good way to start for the image like this.[<img src="https://i.stack.imgur.com/ILwH7.jpg" alt="sample picture"></p>
  
  <p>The image obtained by hough transform to detect lines is as follows
  [<img src="https://i.stack.imgur.com/46yNZ.png" alt="Hough_transformed">
  I'm using standard Matlab code for probabilistic hough transform line detection that generates line segment surrounding the structure. Essentially the shape of pipe resembles a parabola but for hough parabola detection I need to provide eccentricity of the point prior to the detection. Please suggest a good way for finding discrete points along the curvature that can be fitted to a parabola. I have given tag to opencv and ITK so if there is function that can be implemented on this particular picture please suggest the function I will try it out to see the results.</p>
  
  <pre><code>img = imread('test2.jpg');
  rawimg = rgb2gray(img);
   [accum, axis_rho, axis_theta, lineprm, lineseg] = Hough_Grd(bwtu, 8, 0.01);
  figure(1); imagesc(axis_theta*(180/pi), axis_rho, accum); axis xy;
   xlabel('Theta (degree)'); ylabel('Pho (pixels)');
   title('Accumulation Array from Hough Transform');
    figure(2); imagesc(bwtu); colormap('gray'); axis image;
    DrawLines_2Ends(lineseg);
    title('Raw Image with Line Segments Detected');
  </code></pre>
  
  <p>The edge map of the image is as follows <a href="https://i.stack.imgur.com/uFBtU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uFBtU.png" alt="edge map"></a> and the result generated after applying Hough transform on edge map is also not good. I was thinking a solution that does general parametric shape detection like this curve can be expressed as a family of parabola  and so we do a curve fitting to estimate the coefficients as it bends to analyze it's curvature. I need to design a real time procedure so please suggest anything in this direction.<a href="https://i.stack.imgur.com/eiwbP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eiwbP.png" alt="Processed Edge map"></a></p>