From: cabrego on
Thanks to community for your wealth of knowledge!

Below is a basic Treshold code that colors pixels based on their values. R is a very large 2D image matrix.

I would like to add another constraint to this code, I would like to only apply the threshold if the pixel values in the 'thesholdedImage' have certain characteristics. At this point I have several characteristics I would like to try to determine the net effect.

A simple example of what I would like to do is only apply my threshold to contiguous pixels of say 4x4 or 2x2. In other words I would like to elminate single pixels and apply size requirements on contiguous pixels and only color those that meet the requirements.

Thanks!


thresholdedImage=R>=.96 & R<=1.05;

% Get three monochrome images that will end up being the color planes.
redPlane =R;
greenPlane =R;
bluePlane =R;

% Assign red to the thresholded part.
redPlane(thresholdedImage) = 255;
greenPlane(thresholdedImage) =0;
bluePlane(thresholdedImage) = 0;

% Make a color version of the image

rgbImage = cat(3, redPlane, greenPlane, bluePlane);
figure
imshow(rgbImage, []);
title('Thresholded Image');
From: ImageAnalyst on
You're going to have to call bwareaopen on your thresholdedImage just
after you create it.
From: cabrego on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <2265f7a3-8073-4340-bc8f-b500ecb5a91d(a)e2g2000yqn.googlegroups.com>...
> You're going to have to call bwareaopen on your thresholdedImage just
> after you create it.


Thanks for the tip, I will review that function. I am also reviewing your blob detection code that I think will be useful too!
 | 
Pages: 1
Prev: Read - serial port
Next: Neral ntework