I have the following problem. I have an image where there is an object that looks very much like half an ellipsoidal annulus in an uniform background.
It is very clear and sharp.
Therefore I want to fit an ellipsoidal annulus to it.
Seems an easy task.
I'm working in 3D therefore I have 11 parameters to describe this object: center coordinate (p1,p2,p3), short axis(p4), long axis (p5), thickness of the annulus (p6), description of the plane cutting in half the ellipsoidal annulus (p7,p8,p9), mean value of the background (p10), mean value of the ellipsoidal annulus (p11).
First thing I've tried: do an intensity segmentation, get a map of 1 and 0 (where there is and where there isn't my annulus), make my ellipsoidal annulus mask, xor the two mask, count the number of 1 in the xor (in this way I had only 9 parameters, not 11, as the last two did not apply). Minimize the difference with fminsearch.
Works great as long as the first segmentation went fine . Which does not always happens. So, to make my code more sensible and to avoid a non-useful step as the first segmentation, I tried to generate a full image of this annulus in the background and then calculate a difference between this image and mine. (I used sum of squared differences).
I tried to minimize this function with fminunc (for what I've been told I shouldn't be using fminsearch already with 9 parameters, go figure with 11) and it does not work. Can't get anywhere. It stops at iteration 1 and says: "can't minimize the function along the current search direction". I investigated and I think that the problem lies in the fact that this objective function has a randomatic behaviour for very small changes in the parameters (for dx=~0.001. amplitude of local minima induced by such dx: ~0.0001*f(x) ). I think this is screwing fminunc up.
I think that the reason for this is that my annulus is computed as a discrete mask. Therefore a small change in its parameters does not change the whole mask but just a couple of pixels at a time, producing a random and not continous behaviour.
Said that I don't have any idea of how to generate a "less discretized" ellipsoid. Can anybody suggest me anything?
BTW, out of desperation I've tried fminsearch.
It works fine.
Any suggestion on what could I do?
"Luca " <l.presottoRE@MOVE.campus.unimib.NOTit> wrote in message <firstname.lastname@example.org>...
> Said that I don't have any idea of how to generate a "less discretized" ellipsoid. Can anybody suggest me anything?
I would first extract the coordinates of your ellipse boundaries and fit a 3D plane to them using SVD. Then compute the 2D coordinates of these points in this 3D plane. Then use the file below to fit an ellipse to the 2D points.
%ELLIPSEFIT - form 2D ellipse fit to given x,y data
% XY: Input matrix of 2D coordinates to be fit. Each column XY(:,i) is [xi;yi]
%out: Finds the ellipse fitting the input data parametrized both as
% A*x^2+B*x*y C*y^2+D*x+E*y=1 and [x-x0,y-y0]*Q*[x-x0;y-y0]=1
% report: a structure output with the following fields
% report.Q: the matrix Q
% report.d: the vector [x0,y0]
% report.ABCDE: the vector [A,B,C,D,E]
% report.AxesDiams: The minor and major ellipse diameters
% report.theta: The counter-clockwise rotation of the ellipse.
%NOTE: The code will give errors if the data fit traces out a non-elliptic or
% degenerate conic section.
%See also ellipsoidfit
M= [X.^2, X.*Y, Y.^2, X, Y, -ones(size(X,1),1)];
error 'Data cannot be fit with unique ellipse'
Q=[A, B/2;B/2 C];
if ~all(eigen>=0), error 'Fit produced a non-elliptic conic section'; end
AxesDiams = 2*sqrt(eigen);
report.ABCDE=[A, B, C, D, E]/F;
You can think of your watch list as threads that you have bookmarked.
You can add tags, authors, threads, and even search results to your watch list. This way you can easily keep track of topics that you're interested in. To view your watch list, click on the "My Newsreader" link.
To add items to your watch list, click the "add to watch list" link at the bottom of any page.
To add search criteria to your watch list, search for the desired term in the search box. Click on the "Add this search to my watch list" link on the search results page.
You can also add a tag to your watch list by searching for the tag with the directive "tag:tag_name" where tag_name is the name of the tag you would like to watch.
To add an author to your watch list, go to the author's profile page and click on the "Add this author to my watch list" link at the top of the page. You can also add an author to your watch list by going to a thread that the author has posted to and clicking on the "Add this author to my watch list" link. You will be notified whenever the author makes a post.
To add a thread to your watch list, go to the thread page and click the "Add this thread to my watch list" link at the top of the page.
The newsgroups are a worldwide forum that is open to everyone. Newsgroups are used to discuss a huge range of topics, make announcements, and trade files.
Discussions are threaded, or grouped in a way that allows you to read a posted message and all of its replies in chronological order. This makes it easy to follow the thread of the conversation, and to see what’s already been said before you post your own reply or make a new posting.
Newsgroup content is distributed by servers hosted by various organizations on the Internet. Messages are exchanged and managed using open-standard protocols. No single entity “owns” the newsgroups.
There are thousands of newsgroups, each addressing a single topic or area of interest. The MATLAB Central Newsreader posts and displays messages in the comp.soft-sys.matlab newsgroup.
You can use the integrated newsreader at the MATLAB Central website to read and post messages in this newsgroup. MATLAB Central is hosted by MathWorks.
Messages posted through the MATLAB Central Newsreader are seen by everyone using the newsgroups, regardless of how they access the newsgroups. There are several advantages to using MATLAB Central.
Your MATLAB Central account is tied to your MathWorks Account for easy access.
Use the Email Address of Your Choice
The MATLAB Central Newsreader allows you to define an alternative email address as your posting address, avoiding clutter in your primary mailbox and reducing spam.
Most newsgroup spam is filtered out by the MATLAB Central Newsreader.
Messages can be tagged with a relevant label by any signed-in user. Tags can be used as keywords to find particular files of interest, or as a way to categorize your bookmarked postings. You may choose to allow others to view your tags, and you can view or search others’ tags as well as those of the community at large. Tagging provides a way to see both the big trends and the smaller, more obscure ideas and applications.
Setting up watch lists allows you to be notified of updates made to postings selected by author, thread, or any search variable. Your watch list notifications can be sent by email (daily digest or immediate), displayed in My Newsreader, or sent via RSS feed.