Re: Creating a test image



In article <fq9k11$ob4$1@xxxxxxxxxxxxxxxxxx>,
Abin Mathew <abinmmj@xxxxxxxxx> wrote:

I need to create an image of 100*100 pixels in size with a
circle of radius 50 pixels centered on the image. The gray
scale values inside the circle should be 50 and the rest
100. Thanks

inside = 50;
outside = 100;
width = 100;
height = 100;
radius = 50;
cx = 50;
cy = 50;
[x,y] = meshgrid(1:width,1:height);
circ = repmat(outside, width, height);
circ((x - cx).^2 + (y - cy).^2 <= radius.^2) = inside;

(I might have reversed width and height in the meshgrid statement.)


--
"No sincere artist was ever completely satisfied with his labour."
-- Walter J. Phillips
.



Relevant Pages

  • [SUMMARY] The Smallest Circle (#157)
    ... about the smallest enclosing circle problem... ... def initialize(*coords) ... y_big is the minimum radius of a circle ... always been the square of the radius, we finally take its square root ...
    (comp.lang.ruby)
  • Re: need help with homework
    ... So if you solve for circumference you get pi x diameter, ... Now if you know relation between diameter and radius, ... Center of circle splits diameter into two radii. ... circular disk, i.e. a disk whose perimiter is a circle. ...
    (sci.math)
  • Re: Somebody splain to me about neck radius and...
    ... my regular standard style guitar. ... well over 1/4" off the fretboard, plus I use the bottom 6 strings from ... A fretboard radius is simply that. ... radius of the circle where that arc comes from. ...
    (alt.guitar)
  • Re: Somebody splain to me about neck radius and...
    ... my regular standard style guitar. ... well over 1/4" off the fretboard, plus I use the bottom 6 strings from ... A fretboard radius is simply that. ... radius of the circle where that arc comes from. ...
    (alt.guitar)
  • Re: Help with extend
    ... I have a superclass GeometricObject which compiles. ... Then I have a subclass Circle which extends the superclass, but the compiler doesn't like it and i get the following error (cannot find symbol ... public void setFilled{ ... public Circle(double radius) { ...
    (comp.lang.java.help)