0
votes

I'm learning about statistical feature of an image.A quote that I'm reading is

For the first method which is statistical features of texture, after the image is loaded, it is converted to gray scale image. Then the background is subtracted from the original image. This is done by subtract the any blue intensity pixels for the image. Finally, the ROI is obtained by finding the pixels which are not zero value.

The implementation :

% PREPROCESSING segments the Region of Interest (ROI) for
% statistical features extraction.
% Convert RGB image to grayscale image
g=rgb2gray(I);
% Obtain blue layer from original image
b=I(:,:,3);
% Subtract blue background from grayscale image
r=g-b;
% Find the ROI by finding non-zero pixels.
x=find(r~=0);
f=g(x);

My interpretation :

The purpose of substracting the blue channel here is related to the fact that the ROI is non blue background? Like :

enter image description here

But in the real world imaging like for example an object but surrounded with more than one colors? What is the best way to extract ROI in that case? like for example (assuming only 2 colors on all parts of the bird which are green and black, & geometri shaped is ignored):

enter image description here

what would I do in that case? Also the picture will be transformed to gray scale right? while there's a black part of the ROI (bird) itself.

I mean in the bird case how can I extract only green & black parts? and remove the rest colors (which are considered as background ) of it?

1
This question cannot be answered without knowing the image or more context. There are many possible reasons. - Piglet
Hello, I've edited it, please help me :D - Plain_Dude_Sleeping_Alone
for the bird image it doesn't make much sense to subtract blue. it would remove a few highlights, nothing more. can you provide the source of that "quote"? - Piglet
Hello, yes , I mean in the bird case how can I extract only green & black parts? and remove the rest colors (which are considered as background ) of it? - Plain_Dude_Sleeping_Alone

1 Answers

0
votes

Background removal in an image is a large and potentielly complicated subject in a general case but what I understand is that you want to take advantage of a color information that you already have about your background (correct me if I'm wrong).

If you know the colour to remove, you can for instance:

  • switch from RGB to Lab color space (Wiki link).
  • after converting your image, compute the Euclidean from the background color (say orange), to all the pixels in your image
  • define a threshold under which the pixels are background

In other words, if coordinates of a pixel in Lab are close to orange coordinates in Lab, this pixel is background. The advantage of using Lab is that Euclidean distance between points relates to human perception of colours.

I think this should work, please give it a shot or let me know if I misunderstood the question.