From: George BC on
Hello everyone,

I'm trying to fill the inside of the outer border of this image with black...
can anyone help me?

[URL=http://img9.imageshack.us/i/borderc.jpg/][IMG]http://img9.imageshack.us/img9/5290/borderc.th.jpg[/IMG][/URL]

thank you in advance.
From: ImageAnalyst on
Threshold the image to find black
binaryImage = grayImage == 0;
then use imfill
filledImage = imfill(binaryImage, 'holes');
Then multiply by your original
blackenedImage = grayImage .* filledImage;
From: ImageAnalyst on
OK George, try this:

clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear all; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 18;

% Read in grayscale demo image.
grayImage = imread('borderc.th.jpg');
subplot(2, 3, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

% Crop out stuff we don't want.
croppedImage = imcrop(grayImage, [5, 3, 143, 90]);
subplot(2, 3, 2);
imshow(croppedImage, []);
title('Cropped Image', 'FontSize', fontSize);

binaryImage = croppedImage < 250;
subplot(2, 3, 3);
imshow(binaryImage, []);
title('Binary Image', 'FontSize', fontSize);

% Fill the image.
filledImage = imfill(binaryImage, 'holes');
subplot(2, 3, 4);
imshow(filledImage, []);
title('Filled Binary Image', 'FontSize', fontSize);

% Negate it so the center is black.
filledImage = ~filledImage;
subplot(2, 3, 5);
imshow(filledImage, []);
title('Negated Filled Binary Image', 'FontSize', fontSize);

% Multiply by original.
finalImage = croppedImage .* uint8(filledImage);
subplot(2, 3, 6);
imshow(filledImage, []);
title('Final Image', 'FontSize', fontSize);
From: George BC on
THANK YOU!!

worked perfectly here!!!!