Changing a black and white image to color

6 views (last 30 days)
Write a MATLAB script called Exam3Problem3.m that can modify the JPG into a color image. Note: you can type the filename explicitly in your script without asking the user to browse the figure in this problem. Your new color image should have these features: •Black background •Largest object in red •Smallest object in blue •all other objects in yellow (HINT: Yellow is a mix of Red and Green) • Label the centroid of each object by a black "+" sign • Use the plot function to connect the centroids of each object from smallest to largest with green lines (line thickness of 5). (HINT: I need to connect ALL centroids starting from the smallest shape to the largest shape. Try to learn the sort.m MATLAB function.)

Answers (1)

Image Analyst
Image Analyst on 18 Feb 2014
Study my Image Segmentation tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 and you'll be able to do this. Look at how I convert a labeled image to a color image. You just need to supply the proper colormap that is what the question asks for. You can use plot() or line() to draw lines between various centroids.

Community Treasure Hunt

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

Start Hunting!