Prev: mexCallMATLAB : mxArray input and output problem
Next: Buy cheap but top quality gucci bags/Accessories at big discount price,enjoy free delivery
From: Kevin on 14 Jul 2010 23:33 I have this image and I want to cut out a circle from it with an arbitrary center and radius that I can change. Can anyone help me with this code? I can cut out a square from the image easily but a circle is harder...Assume that the image is a large matrix and I am cutting a smaller matrix out of it. Thanks in advance, Kevin
From: Jan Simon on 15 Jul 2010 03:35 Dear Kevin, > I have this image and I want to cut out a circle from it with an arbitrary center and radius that I can change. Can anyone help me with this code? I can cut out a square from the image easily but a circle is harder...Assume that the image is a large matrix and I am cutting a smaller matrix out of it. The points on a circle are defined by the equation: (x - cx)^2 + (y - cy)^2 = r^2 with x and y are the coordinates of the points, cx, cy are the coordinates of the center and r is the radius. To get a disk, use the points inside the circle. Now you can create a mask using logical index to select all pixels of the image, which belong to the disk. Good luck, Jan
From: Kevin on 15 Jul 2010 03:49 "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i1mdns$slk$1(a)fred.mathworks.com>... > Dear Kevin, > > > I have this image and I want to cut out a circle from it with an arbitrary center and radius that I can change. Can anyone help me with this code? I can cut out a square from the image easily but a circle is harder...Assume that the image is a large matrix and I am cutting a smaller matrix out of it. > > The points on a circle are defined by the equation: > (x - cx)^2 + (y - cy)^2 = r^2 > with x and y are the coordinates of the points, cx, cy are the coordinates of the center and r is the radius. > To get a disk, use the points inside the circle. > Now you can create a mask using logical index to select all pixels of the image, which belong to the disk. > > Good luck, Jan Hey Jan, Thanks for your help, but can you give me a little more information about the mask and the logical index part? The circle equation and selecting all points inside of it, should be manageable code for me to write. Thanks, Kevin
From: Jan Simon on 15 Jul 2010 06:13
Dear Kevin, > Thanks for your help, but can you give me a little more information about the mask and the logical index part? The documentation shipped with Matlab and the huge amount of posts in this newsgroup containing the term "logical indexing" are surely a quite better source for getting help. Kind regards, Jan |