|
ImageAnalyst <imageanalyst@mailinator.com> wrote in
message <6b2d16b5-f5d1-4d42-910c-
dd77ab69d02d@m44g2000hsc.googlegroups.com>...
> On Jul 1, 2:56=A0pm, "huda nawaf" <halmam...@yahoo.com>
wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in
> > message <85e736d8-0d10-429c-a1f3-
> > c2405d6b2...@m73g2000hsh.googlegroups.com>...
> >
> >
> >
> > > On Jun 30, 9:40=3DA0am, "huda nawaf"
<halmam...@yahoo.com>
> > wrote:
> > > > "Image Analyst" <imageanal...@mailinator.com>
wrote in
> > > > message <g3m26v$hl...@fred.mathworks.com>...
> >
> > > > > rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote
> > in
> > > > > message <g3lup2$75...@canopus.cc.umanitoba.ca>...
> > > > > > In article <g3lteu$gr...@fred.mathworks.com>,
> > > > > > huda nawaf <halmam...@yahoo.com> wrote:
> >
> > > > > > >i didn't understand this by image analyzing :
> >
> > > > > > >> intensityThreshold =3D3D3D 200; % Use an
> > appropriate
> > > > value.
> > > > > > >> foregroundImage =3D3D3D originalImage >
> > > > intensityThreshold;
> > > > > > >> labeledImage =3D3D3D bwlabel
(foregroundImage);
> > > > > > >> measurementStructure =3D3D3D regionprops
> > (labeledImage);
> >
> > > > > > >is this code?
> >
> > > > > > No. However, if you convert the quoted-
printable
> > > > > encodings of
> > > > > > the equal signs from equals-sign number-three
> > upper-
> > > > case-
> > > > > dee to just
> > > > > > plain equals-sign, then Yes, that is code. I
am not
> > > > very
> > > > > familiar
> > > > > > with the image processing toolkit, but it
appears
> > to
> > > > be
> > > > > valid code
> > > > > > to me, at least for grayscale images.
> >
> > > > > > intensityThreshold =3D3D 200; % Use an
appropriate
> > value.
> > > > > > foregroundImage =3D3D originalImage >
> > intensityThreshold;
> > > > > > labeledImage =3D3D bwlabel(foregroundImage);
> > > > > > measurementStructure =3D3D regionprops
(labeledImage);
> > > > > > --
> > > > > > =3DA0 "Prevention is the daughter of
intelligence."
> > > > > > =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0
=3DA0 =3DA0 =3DA0 =3DA0=
> =3DA0
> >
> > =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D
> >
> >
> >
> > > =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 -- Sir
> > > > > Walter Raleigh
> > > > > -------------------------------------------------
> > > > > huda nawaf :
> > > > > You're using a news reader that's not smart
enough to
> > > > > recognize mime encoding so you get =3D3D3D
instead of
> > =3D3D. =3DA0
> > > > Try
> > > > > using Google or one the the many newsreaders
that can
> > > > > understand mime (Mathworks is not one of them
but for
> > > > you
> > > > > I'll post the code from my Mathworks account).
> > > > > Take a look at the following code:
> > > > > It's a very basic, elementary macro to find
objects
> > > > based
> > > > > on intensity threshold and outline them and make
some
> > > > basic
> > > > > measurements. =3DA0Try it out if you have the
image
> > > > processing
> > > > > toolbox, which you should if you're going to deal
> > with
> > > > > images.
> > > > > Regards
> > > > > ImageAnalyst
> >
> > > > > disp(' ');
> > > > > disp('Running BlobsDemo.m...');
> > > > > originalImage =3D3D imread('coins.png'); % Read
in
> > image
> > > > > binaryImage =3D3D im2bw(originalImage, 0.4);
=3DA0 =3DA0
> > =3DA0 %
> > > > Threshold
> > > > > to binary
> >
> > > > > subplot(3,2,1); imagesc(originalImage); colormap
(gray
> > > > > (256)); title('Original Image');
> > > > > subplot(3,2,2); imagesc(binaryImage); colormap
(gray
> > > > (256));
> > > > > title('Binary Image');
> >
> > > > > labeledImage =3D3D bwlabel(binaryImage, 8);
=3DA0 =3DA0 %
> > Label each
> > > > > blob so can do calc on it
> > > > > coloredLabels =3D3D label2rgb
> > > > > (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo
> > random
> > > > > color labels
> >
> > > > > subplot(3,2,3); imagesc(labeledImage); title
('Labeled
> > > > > Image');
> > > > > subplot(3,2,4); imagesc(coloredLabels); title
('Pseudo
> > > > > colored labels');
> >
> > > > > blobMeasurements =3D3D regionprops
> >
> > (labeledImage, 'all'); =3DA0 %
> >
> >
> >
> > > > > Get all the blob properties.
> > > > > numberOfBlobs =3D3D size(blobMeasurements, 1);
> >
> > > > > % bwboundaries returns a cell array, where each
cell
> > > > > % contains the row/column coordinates for an
object
> > in
> > > > the
> > > > > image.
> > > > > % Plot the borders of all the coins on the
original
> > > > > % grayscale image using the coordinates returned
by
> > > > > bwboundaries.
> > > > > subplot(3,2,5); imagesc(originalImage); title
> > > > ('Outlines');
> > > > > hold on;
> > > > > boundaries =3D3D bwboundaries(binaryImage);
=3DA0 =3DA0
> > > > > for k =3D3D 1 : numberOfBlobs
> > > > > =3DA0 =3DA0thisBoundary =3D3D boundaries{k};
> > > > > =3DA0 =3DA0plot(thisBoundary(:,2), thisBoundary
> > > > > (:,1), 'g', 'LineWidth', 2);
> > > > > end
> > > > > hold off;
> >
> > > > > fprintf(1,'Blob # =3DA0 =3DA0 =3DA0Mean
Intensity =3DA0Area
> > =3DA0 =3DA0
> > > > Perimeter =3DA0
> > > > > Centroid\n');
> > > > > for k =3D3D 1 : numberOfBlobs =3DA0 =3DA0 =3DA0
=3DA0 =3DA0 %
> > Loop through all
> > > > > blobs.
> > > > > =3DA0 =3DA0% Find the mean of each blob. =3DA0
(R2008a has a
> > > > better
> > > > > way where you can pass the original image
> > > > > =3DA0 =3DA0% directly into regionprops. =3DA0The
way below
> > works
> > > > > for all versions including earlier versions.)
> > > > > =3DA0 =3DA0 thisBlobsPixels =3D3D
blobMeasurements
> >
> > (k).PixelIdxList; =3DA0> > %
> > > > > Get list of pixels in current blob.
> > > > > =3DA0 =3DA0 meanGL =3D3D mean(originalImage
> > > > > (thisBlobsPixels)); =3DA0 =3DA0 =3DA0 =3DA0
=3DA0 =3DA0 % Find
> > mean intensity
> > > > (in
> > > > > original image!)
> > > > > =3DA0 =3DA0blobArea =3D3D blobMeasurements
(k).Area; =3DA0
> >
> > =3DA0 =3DA0 =3DA0 =3DA0 =3DA0%> > > Get area.
> > > > > =3DA0 =3DA0blobPerimeter =3D3D blobMeasurements
> > (k).Perimeter; =3DA0
> > > > > =3DA0 =3DA0% Get perimeter.
> > > > > =3DA0 =3DA0blobCentroid =3D3D blobMeasurements
> >
> > (k).Centroid; =3DA0 =3DA0
> >
> >
> >
> > > > > =3DA0 =3DA0% Get centroid.
> > > > > =3DA0 =3DA0 fprintf(1,'#%d %18.1f %11.1f %8.1f %
8.1f %
> > 8.1f\n',
> > > > k,
> > > > > meanGL, blobArea, blobPerimeter, blobCentroid);
> > > > > end
> > > > > msgbox('Finished running BlobsDemo.m. =3DA0Check
out
> > the
> > > > figure
> > > > > window and the command window for the results.');
> > > > > %------------------------------------------------
-
> > > > > thank you sir for code,
> >
> > > > I tried it ,the result is image has sevral colored
> > region.
> > > > for ex.:the background is green and the object is
red.
> > > > now how I can deal with =3DA0red region?
> > > > i do appreciate your reply
> > > > thanks- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > > -----------------------------------------------------
----
> >
> > -------------------=3D
> >
> >
> >
> > > --
> > > huda:
> > > The red region are the pixels that represent one
> > particular labeled
> > > object (one of the coins in the image). =A0I gave
you code
> > for measuring
> > > the centroid, perimeter, and area. =A0What do you
want to
> > do?
> > > Specifically, please explain in detail what you mean
> > by "deal." =A0There
> > > are other things you can measure - check out the
> > documentation on
> > > regionprops().
> > > Regards,
> > > ImageAnalyst
> > > -----------------------------------------------------
----
> >
> > -------------------=3D> --
> >
> > thanks,I want workING with medical image (brain) for a
> > diagnosis =A0 a type =A0of disease. So, I =A0want
=A0totaly
> > separate the object (brain) from its background .
> > I noted that the object itself has several colors
while I
> > need it one color.
> > please ,this is the first time I working with this
topic
> > so, I need your advice- Hide quoted text -
> > > - Show quoted text -
>
> ---------------------------------------------------------
---
> huda:
> There is no object with several different colors. There
are several
> different objects, each with a single color that the
labeling process
> has assigned. I showed you how to separate a group of
objects from a
> background and how to make measurements on each of those
objects. You
> should be able to adapt this to your situation with
little
> difficulty. You case might even be simpler since you
have just one
> object, not several.
> Good luck,
> ImageAnalyst
hi,
there is an error when i ran your code:
??? Undefined function or variable 'bwboundaries'.
Error in ==> E:\d\MATLAB6p5\bin\win32\isolate.m
On line 25 ==> boundaries = bwboundaries(binaryImage);
how i can get bwboundaries function?
thanks in advance,
huda
|