Error in my Code , it didnt produce correct result

1 visualización (últimos 30 días)
Maria
Maria el 21 de Jul. de 2013
If i've an image like : http://img836.imageshack.us/img836/6417/1zw.gif How can i identify the major two arcs in that image .
If the arcs can be modeled by y=(ax)^1/2 +b where a and b are constants such that a∈[250,400] and b∈[0,50] where b is an integer number as it represents the y-intercept of the arc in the image.
Output should be a 2-pixel thicker version of the detected arcs over the original image
May this will done by Hough Transform
Any Demo for doing that !please
  18 comentarios
Maria
Maria el 23 de Jul. de 2013
Editada: Maria el 23 de Jul. de 2013
the deadline for this probllem by thursday , thats why i need it before thursday ,,
Cedric Wannaz ur approach refused by my supervisor ! he need it to be done as i ask before with a full question specification , i'm not specialist in matlab to do all of this ! !
i'm trying to modify my code alot of times but i cant get the result ! i'm sleepless ! if u want to help me the last time , plzz do it for me ..
Cedric
Cedric el 23 de Jul. de 2013
Editada: Cedric el 23 de Jul. de 2013
I already spent way too much time explaining why you should learn MATLAB before trying to undertake this kind of quite complex problems, giving extra information and a simpler alternative (simpler than the fully algorithmic approach). I also told you that you should ask a more specific question (than "please solve my complicated problem for me and provide me with complete code that I can give to my supervisor"). I suggested "how to use hough transforms in MATLAB for extracting parametric curves (e.g. parabola)", which would already be quite complex in itself.. and unlikely to be fully answered on the forum. This would have been a chunk of the answer, which is way more complex as there is a grid (which might vary a bit between images), multiple curves, etc.
As I said above, it is unlikely that anybody will spend time to explain all the material to you, or to provide you with full code. Either your supervisor knows you but doesn't know the material and is asking for way too much, or you are missing a significant amount of practice (math + programming + scientific computing + image processing + MATLAB basics) for working for this person. In either case, it is not up to us to work half a day for providing a full solution to him or to you.

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Jul. de 2013
Just filter out the grid points - they seem to be at fixed positions so it will be very easy to find them but just summing vertically and horizontally and look for high sums
verticalProfile = sum(grayImage, 2);
horizontalProfile = sum(grayImage, 1);
gridLocations = verticalProfile > 50; % or whatever.
grayImage(gridLocations, :) = 0; % Make those rows black.
etc. doing the same for the vertical grid lines.....
Then you have just the curves. Find each one and use polyfit() or whatever.
  2 comentarios
Maria
Maria el 22 de Jul. de 2013
Editada: Maria el 22 de Jul. de 2013
any full demo for doing that plz ...
Maria
Maria el 22 de Jul. de 2013
Editada: Maria el 23 de Jul. de 2013
i'm yrying this code , it's nearly give me 70% of correct result ., i'm do my best to get a correct result but i cant , can u make any simple modification to my code for get correct result , i think this condition play major role in my problem ((( arcs can be modeled by y=(ax)^1/2 +b where a and b are constants such that a∈[250,400] and b∈[0,50))) ,please image analyst :
I = imread('para.gif') ;
[R,C] = meshgrid(30:30:300, 1:15:300) ;
I(sub2ind(size(I), R(:), C(:))) = 0 ;
[R,C] = meshgrid(1:7:300, [10 42 74 106 138 171 203 235 267 300]) ;
I(sub2ind(size(I), R(:), C(:))) = 0 ;
BW = edge(I,'canny');
[H,T,R] = hough(BW);
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2));
y = R(P(:,1));lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
figure,
imshow(I),
hold on
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Parallel and Cloud en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by