Problem 818. Change a specific color in an image

Created by Matthew Eicholtz in Community

The ability to change colors can be a useful tool in image processing. Given an m x n x 3 array (much like CData in images), find all instances of a specific color (c1) and change those pixels to another color (c2). Both colors are inputs to the function. The output is the modified 3D array. If there are no instances of the color to be changed, the output will be the same as the input 3D array.

Assume the class of all colors is double. So, for example, black is [0 0 0] and white is [1 1 1].

Solution Stats

49.12% Correct | 50.88% Incorrect
Last solution submitted on Jan 23, 2019

Problem Comments

Recent Solvers41

Suggested Problems

More from this Author46

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!