MATLAB: How to produce a solid green image directly above an imported image


I have imported an image and I require there to be a solid green image of the same dimensions directly above the imported image. How would I go about doing this? I have attempted using patch but to no success.

Best Answer

  • I1 = imread('peppers.png') ;
    [nx,ny,nz] = size(I1) ;
    I2 = zeros(nx,ny,nz) ;
    I2(:,:,2) = 255 ;
    I12 = vertcat(I2,I1) ;