From: sanjay on
Hi all,

How to define radius by treating somw origin and check whether white pixel exist within that radius
From: ImageAnalyst on
On Apr 24, 12:27 pm, "sanjay " <sanjaym...(a)yahoo.com> wrote:
> Hi all,
>
>     How to define radius  by treating somw origin and check whether white pixel exist within that radius

-------------------------------------------------
Can you explain again. This sounds unintelligible. For example, what
is somw? What does it mean to "treat" an origin? You should put
more effort into your question than someone will put answering it. If
you don't care enough to do that then no one will care to help you.
Maybe you can post some sample data with your best shot at coding it
up. Don't make people trying to help you come up with code to
generate an image with lit up pixels or whatever you're trying to do.
Make it easy for people to help you.
From: sanjay on
Dear Sir,
I am new to matlab pls help me.

I have a binary image which is thinned and then I found centroid for each connected

component, Then I specify some radii considering centroid as origin. How to find

whether white pixel exist within that circle in matlab. I am sending code . Pls send me

code in matlab to check white pixel exist within specified radii having centroid as origin.

Thanks in advance.

r = 0.02;
t = bwmorph(bw, &#8216;thin&#8217;,Inf);
figure,imshow(t);title(&#8217;thinned image&#8217;);
[L, n] = bwlabel(t);
hold on
for k = 1:n
[r,c] = find(L == k);
rbar = mean(r);
cbar = mean(c);
plot(cbar,rbar, &#8216;g.&#8217;);
hold off
end
From: Walter Roberson on
sanjay wrote:

> How
> to find
> whether white pixel exist within that circle in matlab.

[X, Y] = ndgrid(1:size(TheImage,1), 1:size(TheImage,2));

NumWhitePixInRadius = sum(sum(TheImage((X-XCenter).^2 + (Y-YCenter).^2
<= TheRadius.^2)));


Note that this code relies upon the image being black (0) and white (1)
with no other values. If white is encoded some other way, the code is
not difficult to modify. It does, however, get more complex for
TrueColor images.
 | 
Pages: 1
Prev: perfcurve function?? simple
Next: fmincon