Info

This question is closed. Reopen it to edit or answer.

seperation of Background and Object in an color image

1 view (last 30 days)
JAM
JAM on 8 May 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello drs.. I had code to determine the boundary pixels of an image below
clc; % Clear command window. clear; % Delete all variables. %%
close all; % Close all figure windows except those created by imtool.
%% Read image
I = imread('C:\Users\admin\Downloads\shadow.jpg'); figure, imshow(I),title('Original image'); imtool(I); [h w d] = size(I);
%% Top boundary
for j =1:w Tr(j) = I(1,j,1); Tg(j) = I(1,j,2); Tb(j) = I(1,j,3); end
%% Left boundary
for j =1:h Lr(j) = I(j,1,1); Lg(j) = I(j,1,2); Lb(j) = I(j,1,3); end
%% Right boundary
for j =1:h Rr(j) = I(j,255,1); Rg(j) = I(j,255,2); Rb(j) = I(j,255,3); end
%% Bottam boundary
for j =1:w Br(j) = I(255,j,1); Bg(j) = I(255,j,2); Bb(j) = I(255,j,3); end
I need check the colors in pixels with other pixels in the image and need to eliminate the same colors to get the background and object seperately

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!