Create a 3D matrix with zeros function

8 views (last 30 days)
Emily Boylan
Emily Boylan on 20 Oct 2018
Answered: Walter Roberson on 20 Oct 2018
I have a colored image, along with its red, green, and blue slices.
%Red slice
Color_image(:,:,1) = [
0.1404 0.1181 0.5174 0.1853 0.1970
0.7209 0.6983 0.9076 0.8515 0.5259
0.7139 0.3624 0.0197 0.6650 0.4536
0.4115 0.3160 0.7876 0.3144 0.6214
0.9239 0.7383 0.8414 0.7929 0.5493];
%Green slice
Color_image(:,:,2) = [
0.3214 0.5073 0.8719 0.3824 0.3846
0.4178 0.5498 0.8380 0.1565 0.0525
0.3253 0.9336 0.3601 0.0547 0.6873
0.7746 0.6559 0.3224 0.7198 0.0416
0.7200 0.1234 0.8255 0.0714 0.0355];
%Blue slice
Color_image(:,:,3) = [
0.9097 0.3499 0.5066 0.6442 0.7992
0.6706 0.4552 0.6817 0.8266 0.5359
0.6087 0.6807 0.5263 0.3405 0.8173
0.4936 0.0177 0.5669 0.5567 0.2896
0.8476 0.6322 0.2102 0.4169 0.6036];
How would I create a 3D matrix of Color_image with the zeros function?

Answers (1)

Walter Roberson
Walter Roberson on 20 Oct 2018
zeros(size(Color_image)) 

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!