# MATLAB Highlight an object in an image?

Tags:
1. Jun 3, 2017

### Jinzo9090

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?

2. Jun 3, 2017

### phinds

Why do you have to do it in matlab? It's trivial in most graphics processing programs

3. Jun 3, 2017

### Jinzo9090

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:

4. Jun 3, 2017

### phinds

Weird. Good luck.

5. Jun 14, 2017

### Image Analyst

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.