I am trying to detect a curved conveyor in an image. I used the following code using the Hough transform to detect its edges
%# load image, and process it I = imread('ggp\2.jpg'); g = rgb2gray(I); bw = edge(g,'Canny'); [H,T,R] = hough(bw); P = houghpeaks(H,500,'threshold',ceil(0.4*max(H(:)))); % I apply houghlines on the grayscale picture, otherwise it doesn't detect % the straight lines shown in the picture lines = houghlines(g,T,R,P,'FillGap',5,'MinLength',50); figure, imshow(g), hold on for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; deltaY = xy(2,2) - xy(1,2); deltaX = xy(2,1) - xy(1,1); angle = atan2(deltaY, deltaX) * 180 / pi; if (angle == 0) plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green'); % Plot beginnings and ends of lines plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); end end

As shown, two straight lines successfully detect the upper and lower edges of the conveyor, but I donβt know how to determine if it is bent or not (in the picture it is bent) and how to calculate the degree of what.
The curve is approximately drawn manually in the figure below (red):

I did not find a code or function for the Hough transform in matlab to detect such smooth curves (for example, polynomials of the 2nd degree: y= a*x^2 ). Any other solution is also welcome.
This is the original image: 