Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
removing large objects from a binary image

Subject: removing large objects from a binary image

From: Robert Maidhof

Date: 18 Apr, 2008 20:44:02

Message: 1 of 18

All, I'm wondering if anyone knows of a function or method
to remove large objects from a binary image...what I want
is something similar to bwareaopen, which removes images
will less than a specified number of pixels, but in reverse.

Thanks in advance for any help

Subject: removing large objects from a binary image

From: Daphne

Date: 20 Apr, 2008 06:25:05

Message: 2 of 18


If nothing else I think you could subtract the bwareaopen
from the original image and get only the larger ones...

Daphne


"Robert Maidhof" <rtm2001@columbia.edu> wrote in message
<fub16i$jaf$1@fred.mathworks.com>...
> All, I'm wondering if anyone knows of a function or
method
> to remove large objects from a binary image...what I
want
> is something similar to bwareaopen, which removes images
> will less than a specified number of pixels, but in
reverse.
>
> Thanks in advance for any help

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 20 Apr, 2008 20:06:48

Message: 3 of 18

On Apr 18, 4:44=A0pm, "Robert Maidhof" <rtm2...@columbia.edu> wrote:
> All, I'm wondering if anyone knows of a function or method
> to remove large objects from a binary image...what I want
> is something similar to bwareaopen, which removes images
> will less than a specified number of pixels, but in reverse.
>
> Thanks in advance for any help
----------------------------------------------------------------------------=
---------------
Robert:
Do you want to actually erase them from the image and then get a new
image, or do you just want to do some stats on the small objects. Why
not just bwlabel() the image and then run regionprops on it? Then
just loop though the measurements object returned by regionprops
considering the small objects and ignoring the large objects?
Optionally, if you want to erase them from the image, then you could
use the IdxPixelList to zero out those objects that are in the "too
large" category. This could be faster than trying to "open" the image
to get rid of the small objects and then using the resulting opened
image to subtract from the original binary image.
Regards,
ImageAnalyst

Subject: removing large objects from a binary image

From: David Elsdoerfer

Date: 15 Aug, 2010 14:37:03

Message: 4 of 18

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <c0ebcda9-04ce-49d2-bbb7-5a3cc83e6ee1@l42g2000hsc.googlegroups.com>...
> On Apr 18, 4:44=A0pm, "Robert Maidhof" <rtm2...@columbia.edu> wrote:
> > All, I'm wondering if anyone knows of a function or method
> > to remove large objects from a binary image...what I want
> > is something similar to bwareaopen, which removes images
> > will less than a specified number of pixels, but in reverse.
> >
> > Thanks in advance for any help
> ----------------------------------------------------------------------------=
> ---------------
> Robert:
> Do you want to actually erase them from the image and then get a new
> image, or do you just want to do some stats on the small objects. Why
> not just bwlabel() the image and then run regionprops on it? Then
> just loop though the measurements object returned by regionprops
> considering the small objects and ignoring the large objects?
> Optionally, if you want to erase them from the image, then you could
> use the IdxPixelList to zero out those objects that are in the "too
> large" category. This could be faster than trying to "open" the image
> to get rid of the small objects and then using the resulting opened
> image to subtract from the original binary image.
> Regards,
> ImageAnalyst

Hey thank you all for your Help. I finally managed to read the Braille with my algorithm. My Next Task is to detect from a video wether there is a Medicament Box in the picture or not then taking a shot of the Box and analyze it like I did with the single Picture. I just don't know how to tell matlab to analyze a live video an then take a frame out of it automatically. I would be very pleased by any help and suggestions.

Subject: removing large objects from a binary image

From: SURYA

Date: 23 Feb, 2011 15:24:04

Message: 5 of 18

sir can u explain the command which can use to delete the big area....i want like this...
 delete { pixel>100 and pixel <20}
leave other pixel which between 20 to 100...can i get this...hw...

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 23 Feb, 2011 16:02:02

Message: 6 of 18

On Feb 23, 10:24 am, "SURYA " <balan...@yahoo.com> wrote:
> sir can u explain the command which can use to delete the big area....i want like this...
>  delete { pixel>100 and pixel <20}
> leave other pixel which between 20 to 100...can i get this...hw...

------------------------------------------------------------------
Use bwareaopen() once for each size to cull the blobs of certain
sizes. Then use regular logical operations on the results. Write
back if you can't figure it out.

Subject: removing large objects from a binary image

From: SURYA

Date: 24 Feb, 2011 13:29:05

Message: 7 of 18

sir can u tell wat command is used for view profile histogram...i want see vertical histogram and horizontal histogram of image...it have to show intensity vs image (vertical / horizontal) pixels saiz...

here i upload the image how it should look, if didn't understand wat i mean...tq...

http://www.uploadhouse.com/viewfile.php?id=8199284

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 24 Feb, 2011 15:14:29

Message: 8 of 18

On Feb 24, 8:29 am, "SURYA " <balan...@yahoo.com> wrote:
> sir can u tell wat command is used for view profile histogram...i want see vertical histogram and horizontal histogram of image...it have to show intensity vs image (vertical / horizontal) pixels saiz...
>
> here i upload the image how it should look, if didn't understand wat i mean...tq...
>
> http://www.uploadhouse.com/viewfile.php?id=8199284

-------------------------------------------------------------------------------------------------------------------
You don't call those "histograms." Just because they're bar charts,
like histograms often use, does not mean that they are histograms. In
fact, they are totally different. To get the vertical and horizontal
intensity profiles:
verticalProfile = sum(imageArray, 2); % Sum along columns
horizontalProfile = sum(imageArray, 1); % Sum along rows

Subject: removing large objects from a binary image

From: SURYA

Date: 24 Feb, 2011 17:14:05

Message: 9 of 18

thank you sir i get u...i got my horizontal profile and vertical profile
my image = 269 X 639 pixels

the result like this....
horizontal profile

0 - 262 pixels = 68595 (white)
263 - 395 pixels = 42300 (image wanted)
395- 480 pixels = 20000 (not black pixels)
481 - 639 pixels = 68595 (white)

sir, i want cut the image pixel which contain intensity > 424000 and intensity < 20000,
so i just want image pixels which the intensity between (20000 to 42400) like tat...
sir can help to tell, wat command i have to use to do it...tq...




  

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 24 Feb, 2011 22:16:06

Message: 10 of 18

On Feb 24, 12:14 pm, "SURYA " <balan...@yahoo.com> wrote:
> thank you sir i get u...i got my horizontal profile and vertical profile
> my image = 269 X 639 pixels
>
> the result like this....
> horizontal profile
>
> 0 - 262 pixels = 68595 (white)
> 263 - 395 pixels = 42300 (image wanted)
> 395- 480 pixels = 20000 (not black pixels)
> 481 - 639 pixels = 68595 (white)
>
> sir, i want cut the image pixel which contain intensity > 424000 and intensity < 20000,
> so i just want image pixels which the intensity between (20000  to 42400) like tat...
> sir can help to tell, wat command i have to use to do it...tq...
---------------------------------------------------------------------------------------
columnsToKeep= horizontalProfile > 20000 & horizontalProfile < 42400
subImage = grayImage(:, columnsToKeep);

Subject: removing large objects from a binary image

From: SURYA

Date: 14 Apr, 2011 03:59:23

Message: 11 of 18

sir u got any other method then this, because the the improfile value so different for different images..so i cnt use the improfile method to remove the black edges.... my project is automatic project, which will capture images n process for different images...plz help sir...im in last stage to finish my project...tq

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 14 Apr, 2011 10:18:04

Message: 12 of 18

On Apr 13, 11:59 pm, "SURYA " <balan...@yahoo.com> wrote:
> sir u got any other method then this, because the the improfile value so different for different images..so i cnt use the improfile method to remove the black edges.... my project is automatic project, which will capture images n process for different images...plz help sir...im in last stage to finish my project...tq

-----------------------------------------------
No. You basically need to process your profile to get it to a point
where you can then threshold it. You probably have to use some
algorithm to decide on the threshold rather than using a fixed one.

Subject: removing large objects from a binary image

From: SURYA

Date: 14 Apr, 2011 17:54:08

Message: 13 of 18

Sir can suggest any algorithm...bcz i dun know how to do it...

there also i use other method to remove black edges..example code as below..but i get error...what is the problem...
maskedImage2 = bwareaopen(maskedImage,50);
maskedImage2 = maskedImage - maskedImage2;
maskedImage = maskedImage2;

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 14 Apr, 2011 23:17:40

Message: 14 of 18

On Apr 14, 1:54 pm, "SURYA " <balan...@yahoo.com> wrote:
> Sir can suggest any algorithm...bcz i dun know how to do it...
>
> there also i use other method to remove black edges..example code as below..but i get error...what is the problem...
> maskedImage2 = bwareaopen(maskedImage,50);
> maskedImage2 = maskedImage - maskedImage2;
> maskedImage = maskedImage2;
----------------------------------------------------------------------------------------
I've read back over your postings in this thread and I can't really
figure out what you want. You posted an image and then somehow had
code (which you didn't post) to pick out individual words. But then
you say that you can't do it because you don't know how to threshold
profiles. So I told you and then you start talking about black
edges. I don't know what those are. I don't see any black edge
around your image. I don't see any edge image, like if you had used
the edge() function. Are the "black edges" the individual letters and
numbers on the gray background? And then you start talking about
small blob removal and masking the image. It's getting very
confusing. Please post your code, starting with you reading in your
test image, and comment everything that you want to do, even if it's
just the comment alone and you don't know what MATLAB code to put down
to do that operation.

Subject: removing large objects from a binary image

From: SURYA

Date: 15 Apr, 2011 07:10:13

Message: 15 of 18

sir here i paste all my project source code and image...sir run the first.m file first with all other .m file save in a folder then sir will see the result...my problem is after each book segmented, there got black edges in each book..it's make difficult for me for character recognition because my code detect the edge also as a character....sir plz look at this code ans help me...tq...

first .m file

clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool.
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.

% Find books
clc;
clear;
close all;
workspace;
fontSize = 20;
a=1;

% Change the current folder to the folder of this m-file.
if(~isdeployed)
        cd(fileparts(which(mfilename)));
end

% Read in books image.
folder = 'E:\design\image\';
baseFileName = 'IMG_0047.JPG';
fullFileName = fullfile(folder, baseFileName);
rgbImage = imread(fullFileName);

% Display the original color image.
subplot(2, 2, 1);
imshow(rgbImage);
title('Original Color Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full screen.
set(gcf,'name','Library Robot','numbertitle','off')
grayImage = rgb2gray(rgbImage);

% Do a Canny edge detection on the image.
BW = edge(grayImage,'canny');
subplot(2, 2, 2);
imshow (~BW, []);
title('Canny Edge Image', 'FontSize', fontSize);

%Do hough transformation on image
[H,T,R] = hough(BW);
subplot(2, 2, 3);
imshow(H,[],'XData',T,'YData',R,...
            'InitialMagnification','fit');
title('Hough Peaks', 'FontSize', fontSize);
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
P = houghpeaks(H,20,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2));
y = R(P(:,1));
plot(x,y,'s','color','red');

% Find lines
lines = houghlines(BW,T,R,P,'FillGap',25,'MinLength',100);

% find lines point
max_len = 0;
verticalLineIndexes = [];
for k = 1:length(lines)
   xy = [lines(k).point1; lines(k).point2];
   
   % Determine the endpoints of the longest line segment
   len = norm(lines(k).point1 - lines(k).point2);
   if ( len > max_len)
      max_len = len;
      xy_long = xy;
   end

    % Determine it's angle
    deltaX = xy(1, 1) - xy(2,1);
    deltaY = xy(1, 2) - xy(2,2);
    angle = atand(deltaY / deltaX)
if abs(angle) > 45
    verticalLineIndexes = [verticalLineIndexes, k];
end
end

% Extract just the vertical lines:
lines = lines(verticalLineIndexes);

% Get the size of the image
[rows columns] = size(grayImage);
numberOfLines = length(lines);
for k = 1 : numberOfLines
% Plot the line
xy = [lines(k).point1; lines(k).point2];

% Turn the line and get it's equation.
% Get the formula for the line.
turnedX = xy(:, 2); % The old Y values are the new x values.
turnedY = xy(:, 1); % The old X values are the new y values.
[coeffs S mu] = polyfit(turnedX, turnedY, 1);
% Extend lines to bottom of screen
% Get the x values for y = 1.
fullTurnedY(1) = polyval(coeffs, turnedX(1),[],mu);
fullTurnedY(2) = polyval(coeffs, turnedX(2),[],mu);
fullLengthLines(k, 1, 1) = fullTurnedY(1); % x for point 1
fullLengthLines(k, 2, 1) = fullTurnedY(2); % x for point 2
fullLengthLines(k, 1, 2) = 1; % y for point 1
fullLengthLines(k, 2, 2) = rows; % y for point 2
end
subplot(2, 2, 4);
imshow(rgbImage);
title('Original Color Image with Boundary', 'FontSize', fontSize);
hold on;
format long;
for k = 1 : numberOfLines
% Plot the line
xCoords = fullLengthLines(k, :, 1);
yCoords = fullLengthLines(k, :, 2);
fprintf(1, '%d: point1 = (%.1f, %.1f), point2 = (%.1f, %.1f,)\n', ...
k, xCoords(1), yCoords(1), xCoords(2), yCoords(2));
plot(xCoords, yCoords,'LineWidth',2,'Color','green');
end

% Need to sort them based on their x value.
lines2D = zeros(numberOfLines, 4);
for k = 1 : numberOfLines
lines2D(k, :) = [fullLengthLines(k, 1,1),... % x1
fullLengthLines(k, 1,2), ... % y1
fullLengthLines(k, 2,1), ... % x2
fullLengthLines(k, 2,2)]; % y2
end
lines2D = sortrows(lines2D, 1);

% Crop out each book.
for k = 2:length(lines)
% Plot the line
xCoordsTop1 = lines2D(k-1, 1);
yCoordsTop1 = lines2D(k-1, 2);
xCoordsBottom1 = lines2D(k-1, 3);
yCoordsBottom1 = lines2D(k-1, 4);
xCoordsTop2 = lines2D(k, 1);
yCoordsTop2 = lines2D(k, 2);
xCoordsBottom2 = lines2D(k, 3);
yCoordsBottom2 = lines2D(k, 4);
verticesX = [xCoordsTop1 xCoordsTop2 xCoordsBottom2 xCoordsBottom1 xCoordsTop1];
verticesY = [yCoordsTop1 yCoordsTop2 yCoordsBottom2 yCoordsBottom1 yCoordsTop2];
mask = poly2mask(verticesX, verticesY, rows, columns);
mask = cast(mask, class(grayImage));
maskedImage = grayImage .* mask;
imagen= maskedImage;

figure;
set(gcf,'position', get(0,'Screensize'))
% Convert to gray scale
if size(imagen,3)==3 %RGB image
    imagen=rgb2gray(imagen);
end

% Convert to BW
binaryImage = (imagen == 0);
imagen(binaryImage) = 255;

horizontalProfile = sum(imagen, 1); % Sum along rows
columnsToKeep= horizontalProfile > 26000 & horizontalProfile < 35000 ;
imagen =imagen(:, columnsToKeep);

thresholdValue= 110;
imagen=imagen < thresholdValue;

% Remove all object containing fewer than 20 pixels
imagen = bwareaopen(imagen,20);
imshow(imagen);
%Storage matrix word from image
word=[ ];
imshow(word);
re=imagen;
%Opens text.txt as file for write
fid = fopen('text.txt', 'wt');
% Load templates
load templates
global templates
% Compute the number of letters in template file
num_letras=size(templates,2);
while 1
    %Fcn 'lines' separate lines in text
    [fl re]=line2(re);
    imgn=fl;
    %Uncomment line below to see lines one by one
    imshow(fl);pause(1.0)
    %-----------------------------------------------------------------
    % Label and count connected components
    [L Ne] = bwlabel(imgn);
  
    for n=1:Ne
        [r,c] = find(L==n);
        % Extract letter
        n1=imgn(min(r):max(r),min(c):max(c));
        % Resize letter (same size of template)
        img_r=imresize(n1,[42 24]);
        imwrite(img_r,['E:\design\image\book\',num2str(a),'.jpg']);
        %Uncomment line below to see letters one by one
         imshow(img_r);pause(0.5)
        %-------------------------------------------------------------------
        % Call fcn to convert image to text
        letter=read_letter(img_r,num_letras);
        % Letter concatenation
        word=[word letter];
        a = a + 1;
    end
    
    fprintf(fid,'%s\n',lower(word));%Write 'word' in text file (lower)
    fid = fopen('text.txt','w');
    fprintf(fid,'%s\n',word);%Write 'word' in text file (upper)
    
    % Clear 'word' variable
    %word=[ ];

    %*When the sentences finish, breaks the loop
    if isempty(re) %See variable 're' in Fcn 'lines'
        break
    end
end
word1='PRSBIF5B2005';
z=strcmp(word,word1);
if (z==1)
    %error('no match file');
     fprintf('correct book\n');
 else
     fprintf('not correct book\n');
end
 
 fclose(fid);
    
%Open 'text.txt' file
winopen('text.txt')
end
------------------------------------------------------------------------------------------------
second.m file

function [fl re]=line2(im_texto)
% Divide text in lines
% im_texto->input image; fl->first line; re->remain line
% Example:
% im_texto=imread('TEST_3.jpg');
% [fl re]=lines(im_texto);
% subplot(3,1,1);imshow(im_texto);title('INPUT IMAGE')
% subplot(3,1,2);imshow(fl);title('FIRST LINE')
% subplot(3,1,3);imshow(re);title('REMAIN LINES')
im_texto=clip(im_texto);
num_filas=size(im_texto,1);
for s=1:num_filas
    if sum(im_texto(s,:))==0
        nm=im_texto(1:s-1, :); % First line matrix
        rm=im_texto(s:end, :);% Remain line matrix
        fl = clip(nm);
        re=clip(rm);
        %*-*-*Uncomment lines below to see the result*-*-*-*-
        % subplot(2,1,1);imshow(fl);
        % subplot(2,1,2);imshow(re);
        break
    else
        fl=im_texto;%Only one line.
        re=[ ];
    end
end

function img_out=clip(img_in)
[f c]=find(img_in);
img_out=img_in(min(f):max(f),min(c):max(c));%Crops image
-----------------------------------------------------------------------------------------------------
third.m file

%CREATE TEMPLATES
%Letter
A=imread('letters_numbers\A.bmp');B=imread('letters_numbers\B.bmp');
C=imread('letters_numbers\C.bmp');D=imread('letters_numbers\D.bmp');
E=imread('letters_numbers\E.bmp');F=imread('letters_numbers\F.bmp');
G=imread('letters_numbers\G.bmp');H=imread('letters_numbers\H.bmp');
I=imread('letters_numbers\I.bmp');J=imread('letters_numbers\J.bmp');
K=imread('letters_numbers\K.bmp');L=imread('letters_numbers\L.bmp');
M=imread('letters_numbers\M.bmp');N=imread('letters_numbers\N.bmp');
O=imread('letters_numbers\O.bmp');P=imread('letters_numbers\P.bmp');
Q=imread('letters_numbers\Q.bmp');R=imread('letters_numbers\R.bmp');
S=imread('letters_numbers\S.bmp');T=imread('letters_numbers\T.bmp');
U=imread('letters_numbers\U.bmp');V=imread('letters_numbers\V.bmp');
W=imread('letters_numbers\W.bmp');X=imread('letters_numbers\X.bmp');
Y=imread('letters_numbers\Y.bmp');Z=imread('letters_numbers\Z.bmp');
%Number
one=imread('letters_numbers\1.bmp'); two=imread('letters_numbers\2.bmp');
three=imread('letters_numbers\3.bmp');four=imread('letters_numbers\4.bmp');
five=imread('letters_numbers\5.bmp'); six=imread('letters_numbers\6.bmp');
seven=imread('letters_numbers\7.bmp');eight=imread('letters_numbers\8.bmp');
nine=imread('letters_numbers\9.bmp'); zero=imread('letters_numbers\0.bmp');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A B C D E F G H I J K L M...
    N O P Q R S T U V W X Y Z];
number=[one two three four five...
    six seven eight nine zero];
character=[letter number];
templates=mat2cell(character,42,[24 24 24 24 24 24 24 ...
    24 24 24 24 24 24 24 ...
    24 24 24 24 24 24 24 ...
    24 24 24 24 24 24 24 ...
    24 24 24 24 24 24 24 24]);
save ('templates','templates')
clear all
------------------------------------------------------------------------------------------------------
forth.m file
function letter=read_letter(imagn,num_letras)
% Computes the correlation between template and input image
% and its output is a string containing the letter.
% Size of 'imagn' must be 42 x 24 pixels
% Example:
% imagn=imread('D.bmp');
% letter=read_letter(imagn)
global templates
comp=[ ];
for n=1:num_letras
    sem=corr2(templates{1,n},imagn);
    comp=[comp sem];
end
vd=find(comp==max(comp));
%*-*-*-*-*-*-*-*-*-*-*-*-*-
if vd==1
    letter='A';
elseif vd==2
    letter='B';
elseif vd==3
    letter='C';
elseif vd==4
    letter='D';
elseif vd==5
    letter='E';
elseif vd==6
    letter='F';
elseif vd==7
    letter='G';
elseif vd==8
    letter='H';
elseif vd==9
    letter='I';
elseif vd==10
    letter='J';
elseif vd==11
    letter='K';
elseif vd==12
    letter='L';
elseif vd==13
    letter='M';
elseif vd==14
    letter='N';
elseif vd==15
    letter='O';
elseif vd==16
    letter='P';
elseif vd==17
    letter='Q';
elseif vd==18
    letter='R';
elseif vd==19
    letter='S';
elseif vd==20
    letter='T';
elseif vd==21
    letter='U';
elseif vd==22
    letter='V';
elseif vd==23
    letter='W';
elseif vd==24
    letter='X';
elseif vd==25
    letter='Y';
elseif vd==26
    letter='Z';
    %*-*-*-*-*
elseif vd==27
    letter='1';
elseif vd==28
    letter='2';
elseif vd==29
    letter='3';
elseif vd==30
    letter='4';
elseif vd==31
    letter='5';
elseif vd==32
    letter='6';
elseif vd==33
    letter='7';
elseif vd==34
    letter='8';
elseif vd==35
    letter='9';
else
    letter='0';
end

-------------------------------------------------------------------------------------------
here the input image for first.m file....
http://www.uploadhouse.com/viewfile.php?id=9428651
------------------------------------------------------------------------------------------

here is image template for OCR (character compare)
http://www.uploadhouse.com/viewfile.php?id=9428717
http://www.uploadhouse.com/viewfile.php?id=9428720
http://www.uploadhouse.com/viewfile.php?id=9428723
http://www.uploadhouse.com/viewfile.php?id=9428726
http://www.uploadhouse.com/viewfile.php?id=9428729
http://www.uploadhouse.com/viewfile.php?id=9428732
http://www.uploadhouse.com/viewfile.php?id=9428735
http://www.uploadhouse.com/viewfile.php?id=9428738
http://www.uploadhouse.com/viewfile.php?id=9428741
http://www.uploadhouse.com/viewfile.php?id=9428744
http://www.uploadhouse.com/viewfile.php?id=9428747
http://www.uploadhouse.com/viewfile.php?id=9428750
http://www.uploadhouse.com/viewfile.php?id=9428759
http://www.uploadhouse.com/viewfile.php?id=9428756
http://www.uploadhouse.com/viewfile.php?id=9428753
http://www.uploadhouse.com/viewfile.php?id=9428762
http://www.uploadhouse.com/viewfile.php?id=9428765
http://www.uploadhouse.com/viewfile.php?id=9428768
http://www.uploadhouse.com/viewfile.php?id=9428771
http://www.uploadhouse.com/viewfile.php?id=9428774
http://www.uploadhouse.com/viewfile.php?id=9428867
http://www.uploadhouse.com/viewfile.php?id=9428864
http://www.uploadhouse.com/viewfile.php?id=9428861
http://www.uploadhouse.com/viewfile.php?id=9428870
http://www.uploadhouse.com/viewfile.php?id=9428855
http://www.uploadhouse.com/viewfile.php?id=9428858
http://www.uploadhouse.com/viewfile.php?id=9428846
http://www.uploadhouse.com/viewfile.php?id=9428849
http://www.uploadhouse.com/viewfile.php?id=9428852
http://www.uploadhouse.com/viewfile.php?id=9428843
http://www.uploadhouse.com/viewfile.php?id=9428840
http://www.uploadhouse.com/viewfile.php?id=9428834
http://www.uploadhouse.com/viewfile.php?id=9428837
http://www.uploadhouse.com/viewfile.php?id=9428831
http://www.uploadhouse.com/viewfile.php?id=9428828
http://www.uploadhouse.com/viewfile.php?id=9428825
http://www.uploadhouse.com/viewfile.php?id=9428768
http://www.uploadhouse.com/viewfile.php?id=9428771
http://www.uploadhouse.com/viewfile.php?id=9428774
http://www.uploadhouse.com/viewfile.php?id=9428765
---------------------------------------------------------------------------------------------
tq sir....

Subject: removing large objects from a binary image

From: SURYA

Date: 15 Apr, 2011 10:22:04

Message: 16 of 18

tq sir i overcome my problem....tq alot for your help sir...

Subject: removing large objects from a binary image

From: ImageAnalyst

Date: 15 Apr, 2011 10:40:14

Message: 17 of 18

On Apr 15, 6:22 am, "SURYA " <balan...@yahoo.com> wrote:
> tq sir i overcome my problem....tq alot for your help sir...
-----------------------------------------------------------------------
No problem. You're welcome.

Subject: removing large objects from a binary image

From: Nad

Date: 8 Dec, 2012 17:51:08

Message: 18 of 18

Hi IA - Let me know if I should start a new thread. Hoping to clarify the answer from the original question in this thread.

Could you be more specific about the code you suggested here? I have extra long (unbranched) skeletonized lines in my binary masks that I am trying to get rid of...

I can use either bwareaopen or bwlabel and regionprops. For me less lines of code is important - there is no time constraint here.

Thanks in advance,
Nad


ImageAnalyst <imageanalyst@mailinator.com> wrote in message <c0ebcda9-04ce-49d2-bbb7-5a3cc83e6ee1@l42g2000hsc.googlegroups.com>...
> On Apr 18, 4:44=A0pm, "Robert Maidhof" <rtm2...@columbia.edu> wrote:
> > All, I'm wondering if anyone knows of a function or method
> > to remove large objects from a binary image...what I want
> > is something similar to bwareaopen, which removes images
> > will less than a specified number of pixels, but in reverse.
> >
> > Thanks in advance for any help
> ----------------------------------------------------------------------------=
> ---------------
> Robert:
> Do you want to actually erase them from the image and then get a new
> image, or do you just want to do some stats on the small objects. Why
> not just bwlabel() the image and then run regionprops on it? Then
> just loop though the measurements object returned by regionprops
> considering the small objects and ignoring the large objects?
> Optionally, if you want to erase them from the image, then you could
> use the IdxPixelList to zero out those objects that are in the "too
> large" category. This could be faster than trying to "open" the image
> to get rid of the small objects and then using the resulting opened
> image to subtract from the original binary image.
> Regards,
> ImageAnalyst

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us