Error in my Code , it didnt produce correct result
Show older comments
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 Comments
Maria
on 21 Jul 2013
Image Analyst
on 21 Jul 2013
Your image does not display. Try it yourself. So I'll have no comment until I can see it.
Maria
on 21 Jul 2013
Image Analyst gives a way to improve the performance of the hough transform. Following his idea and assuming that the grid is always at the same location, you can easily eliminate it and run your code on the new image. For example (I hardcode grid locations for sake of simplicity):
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 ;
Then run the code that you submitted above and you'll see that there is already some improvement.
Cedric
on 22 Jul 2013
Editing continuously your question for bumping up your thread is probably going to be less efficient than working on your code using information gathered from Image Analyst's answer and from my comment just above.
Maria
on 22 Jul 2013
Cedric
on 22 Jul 2013
So what changed in your question between all the times you edited it today and your last edit a few minutes ago?
So what is the difference between this version earlier today:
-----------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------
and this version a few minutes ago?
-----------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------
You and Mecheal have pretty much the same behavior as someone called "m" and his/her friend (if these were not the same person) a few months ago, who were asking for full code and making no effort.
Your question isn't more important than the others ones, so there is no justification for bumping your thread up every hour or so.
As I told you when you were using the nickname "m" (and if it was no you, this remark applies to you as well), you should invest your time in learning MATLAB instead of going on multiple forums asking for full code. By taking these complicated projects and asking people to solve them for you, you are trying to take/sell people's goodwill, time, and knowledge, which is not acceptable.
Back to your problem, it is really not trivial to "extract" automatically the four curves and answer your question. Even detecting the grid and removing it automatically is not trivial; if you look at the code that I gave you, grid parameters are hardcoded based on tests that I made by hand, and there is absolutely nothing automatic. Assuming that, by working hard on this, you are able to build a solution for removing the grid (based e.g. on FFT), you might have then to split the image into blocks that contain each a single curve, which is not trivial either, before you can finally fit something and/or perform some hough transform (for matching a parametric curve, which, again, is not trivial). Nobody will be teaching you all this material from A to Z, and you'll have to be particularly lucky to find someone who's willing to spend time developing this code for you (especially if you don't demonstrate that you are making a significant effort on your side for learning the material).
So my recommendation is that, instead of trying to bump up your thread continuously, you go over the Image Processing Toolbox manual, and you follow e.g. an online class like "UCF Computer Vision Video Lectures 2012" on youtube.
Maria
on 23 Jul 2013
Last comment before leaving: if you want to reduce the complexity of the approach by allowing some manual operations, try the following:
I = imread('1zw.gif') ;
imshow(I) ;
then you enlarge the image so it is big enough on your screen. Once done, type the following in the command window:
coord = ginput()
press enter, and you'll see that the cursor on the figure was replaced by some lines which look like a targeting tool. Choose a curve and click at e.g. four or five different locations on this curve. Then press Enter. You see that you have the coordinates of your clicks stored in variable coord. This is "curve matching and data extraction done by eye/hand". Now if this is acceptable for your project (as a temporary solution), the next question that you have to think about is how many points do you need to determine a set of parameters for a curve, or whether you'd prefer recording a significant amount of coordinates and look for a best fit.
Maria
on 23 Jul 2013
Matt Kindig
on 23 Jul 2013
Edited: Matt Kindig
on 23 Jul 2013
If you just need to the equation of the curves, why not use the ginput() method outlined above? Why do you need a full Matlab image processing solution anyway? Why do you need a plot with thicker lines?
Also, what happens on Thursday?
The approach with ginput() is one of the simplest possible, because it bypasses the quite complicated development of an algorithm for detecting/extracting curves from the image.
Have you tried what I told you above? Now take one set of coordinates and inject x and y in the equation that you give in your question. What do you see? Doesn't it look like an equation with two unknowns, a and b? Now repeat the operation for another set of coordinates .. it seems that you have another equation with the same two unknowns, right? So you have two equations with two unknowns a and b, and a bunch of constrains on their values. This should be enough for your to get an approximate result already, without it to involve more than basic algebra.
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.
Accepted Answer
More Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!