How to remove background from an image?

Hello,
I'm doing project on object recognition, and in one of my module, i need to extract the feature but for that removal of background is necessary.. so how can i do this?? please help me!
Thanks!

 Accepted Answer

In every one of the images in that .zip file, the background has already been removed.
Removal of background is what you do when you have a picture of a real object, or at least a model of that object whose picture has been taken. For example if you had a picture of an apple sitting on a plate, you would need to remove the plate (and the table and everything else that was not the object of interest.)

15 Comments

sir here all the images contains only one object!! i just need to remove that black background, so i would like to know, how can i do this??
What would you like to replace the black background with?
black background with nothing!! i just want to remove that.
Wait... I think I may finally have it:
C = num2cell(YourImage);
C(~YourImage) = {};
This will give you a cell array in which there are empty cells ("nothing") where the background was, and cells containing [1] where the foreground was.
sir it gave me an error 2nd line.
The error is " In an assignment A(:) = B, the number of elements in A and B must be the same."
C = num2cell(YourImage);
C(~YourImage) = {{}};
yes sir it worked but sir how can i make it visible??
Oh, if you want to make it visible, you use the technique I told you to use before:
imagesc(YourImage, 'AlphaData', YourImage)
colormap(gray)
set(gca, 'color', 'none')
Depending on what you have done before in that session you might need to add
set(gcf, 'renderer', 'opengl')
It worked!!
Thanks a ton sir, you helped me through out! Thanks once again!
Sir with this code i implemented to my histopathological image.... now i need to calculate statistical and textural features... how can i process it again.. i have segmented cell as in color cell segmentation in matlab.. now with this code removed the black color... but hw can i proceed with further processing. give ur suggestion sir.. i've tried cell2mat ,, but its not supporting...
Please start your own question. Upload your image , then tell us where it is. You also would need to explain, in that new question, what exactly "further processing" means because that is way too vague to answer.
Sir i doing Pattern recognition Letters Project.. I see the lot math works web page . But i have don't collect How to Remove background from image? I need the coding for remove background from the image..... Advance Thanks...
sir i am doing dust particle monitoring project for this i have to remove all background expect dust particle from the image... What should i do? Could you suggest me some matlab codes?
Sneha Rauniyar I recommend you start a new Question, and post a couple of images. You will need to clarify how you know whether a particular dust particle is a foreground dust particle to be kept, or a background dust particle to be removed.

Sign in to comment.

More Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!