MATLAB Highlight an object in an image?

AI Thread Summary
A new user seeks assistance in MATLAB for highlighting food in an image, proposing methods like creating a binary image or outlining the food with a colored frame. The discussion emphasizes the complexity of distinguishing food from similar colors and shapes, highlighting the need for clear definitions and rules for image processing. Experts suggest that without narrowing down the types of images, the task may be overly challenging. Techniques such as mathematical morphology and edge detection are recommended, but the user must consider the inherent difficulties in accurately identifying food items. The conversation underscores the importance of specificity in image analysis tasks.
Jinzo9090
Messages
2
Reaction score
0
Hi Everybody
I'm a new user and hope I have posted in the correct section.

I'm a beginner in MATLAB and image processing.
Using matlab, I have to highlight in an object in an image.

I have an input image where there is a plate with a food. I need to produce an output image where only food is highlighted.

It does not matter that the food can be distinguished. It must be something very simple. Whatever is fine (for example, making a red frame around the food; or treating the food as a all white foreground and the rest as a whole all black background; or just a black image with the edges of the food colored in white ... etc. )

That's my reasoning: I thought that first of all, it might be useful to convert the black and white image (0-255). Then run a pixel edge control technique and the pixel intensity control technique to recognize the dish; Next, the elements in the dish, recognized as in the foreground, are labeled with value 1. Next, I create a matrix of the same size as the input image, with all values at zero. In this matrix, I'll put at 1 the values labeled before, in the same coordinates. In this way, the output image is a binary image where the food has a value of 1 and everything else has a value of 0. And I will only see the white pixels of the food.

Can someone help me to implement in matlab?
 
Physics news on Phys.org
Why do you have to do it in matlab? It's trivial in most graphics processing programs
upload_2017-6-3_12-19-23.png
 
phinds said:
Why do you have to do it in matlab? It's trivial in most graphics processing programs
View attachment 204799

Because for this task I have to use MATLAB (Unfortunately).
I think it's useful to use math morphology. The result I want to get is similar to this:
170603_172910_68f893591caabb9G.jpg
 
Weird. Good luck.
 
Well I know a little bit about image analysis, having done it full time for the last 37 years. You have to define what food is. How would the computer know that the red stripes on the table cloth are stripes and not licorice ropes? How would it know that the chopsticks are not breadsticks or burnt spaghetti? How does it know that a white plate is not food but white mashed potatoes are food when both are white? You need to make up rules that describe all these situations and run the rules. I think you are doomed to failure unless you can narrow it down. It would be super challenging even for experts. For example, you might look for white in the image and see if it has a hole in the white region, which would indicate a white plate with something on it that you can assume is food. Assuming that none of the food breaks up the ring-shaped white region by hanging off the side of the plate (which would turn it into a "C" shape), then you have a problem which is now much much easier to solve. If you can't narrow down the types of images you look at to something simple like that, then I wouldn't even try.
 
Back
Top