Background and Foreground separation.

I try to separate the foreground and background picture. The picture is two people are standing by the sea. How to separate the back ground and foreground. I use the color threshold but I got confused.Please help me out.

댓글 수: 4

Image Analyst
Image Analyst 2020년 6월 13일
You could use image processing or computer vision. Like the foreground detector in the Computer Vision toolbox. Given what information you've provided, that's about all I can say.
Mahesh Taparia
Mahesh Taparia 2020년 6월 15일
Hi
Can you share a sample image which you want to segment?
Image Analyst
Image Analyst 2020년 6월 15일
And what is background and what is foreground? The beach, the sea, the people, the sky?
Sandeep parajuli
Sandeep parajuli 2020년 6월 28일
편집: Sandeep parajuli 2020년 6월 28일
Hey guys sorry for late reply but,
Lets say, I have an RGB image and I binarize that image and I print out the pixels of the image where Foreground pixels are represent by 1 and backgraound pixels are represent 0.
After getting this I want to use the nested for loop so that I can search all 0 and 1 and if 0 is found convert that pixels color to black and if the 1 is found convert that pixels color to white. At last I want to convert that white color into original color.
I want the code for that.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2020년 6월 28일

0 개 추천

Try this to mask your image
% Mask the image using bsxfun() function to multiply the mask by each channel individually. Works for gray scale as well as RGB Color images.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));

댓글 수: 1

Sandeep parajuli
Sandeep parajuli 2020년 6월 29일
I try this code for this image but I think it doesnot work properly, I want to convert the backgound into black color and butterfly and flower into white color without using the matlab app tools.I want general code for RGB so that I can seperate background into black and foreground into white.

댓글을 달려면 로그인하십시오.

질문:

2020년 6월 13일

댓글:

2020년 6월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by