Homework Solution: Hello! I'm currently working on a program that will hide an image in a…

    MATLAB Hello! I'm currently working on a program that will hide an image in another. I am on part 2, but cannot get it to work when I click Odd/Even Red Embedding. I have included the prompt, code, and GUI. Any help is appreciated, thank you! Part 1: Flattening the Images There is an image dog.png, which you will be concealing at least 10 hidden images in. Try viewing it with <image>. 1. 2. There are ten images labeled hiddenXXpng with XX from 1 to 10. Lets take the grayscale hidden image and make it black and white: a. Load one of the hidden images. It should be in a 400x400 integers matrix (grayscale). b. Create a function to Flatten the image by creating a 400x400 matrix with values 1 if the corresponding hidden image pixel is dark and O if the pixel is light (black&white) Your threshold for dark/light is up to you as long as the image is still distinguishable after converting from grayscale to black&white Create a function to Expand the flattened image by taking the 400x400 flattened image and creating a new RGB image with black pixels for 1 elements, and white pixels for O elements Test by Flattening and Expanding one of the images and making sure it can be displayed properly with the simage> command. c. Part 2: Create Embedding Techniques As an example for one of the techniques that can be used is the odd/even embedding technique This is an example one of the different techniques that you will use to hide all the black and white images into the concealing image. The flattened hidden image is a 400x400x1 matrix of values 0 (white) and 1 (black) pixels. The normal image is a 400x400x3 matrix of values 0-255, representing the values of the red, green, and blue channels. Our first embedding technique goes as follows: 1. 2. 3. Use your Flattening function from part 1 to flatten the hidden image selected by the user to a flattened hidden image If flattened hidden image pixel (x.y) is black, make the red channel of pixel (x.y) in the normal image odd valued by either subtracting zero or one. If flattened hidden image pixel (x,y) is white, make pixel (x.y) on the red channel of the normal Function as stated in part 1: function [BW] = flatten(img) I = imread(img); BW = imbinarize(I); code in text: % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) normalImg = getimage(handles.axes1); hiddenImg = getimage(handles.axes2); flatHiddenImg = flatten(hiddenImg); normalRedCh = normalImg(:,:,1); [r,c] = size(flatHiddenImg); for i=1:r for j=1:c if (flatHiddenImg(i,j) == 0) % If pixel is white if (mod(normalRedCh(i,j),2) == 0) % If normal image has an even value, normalRedCh(i,j) = normalRedCh(i,j) - 1; % then subtract 1 to make odd. else % If normal image has an odd value. normalRedCh(i,j) = normalRedCh(i,j) - 0; % subtract 0 to keep odd. end elseif (flatHiddenImg(i,j) == 1) % If pixel is black if (mod(normalRedCh(i,j),2) == 0) % If dog image has an even value, normalRedCh(i,j) = normalRedCh(i,j) - 0; % then subtract 0 to keep even. else % If dog image has an odd value normalRedCh(i,j) = normalRedCh(i,j) - 1; % then subtract 1 to make even. end end end end normalImg = normalRedCh; axes(handles.axes3); imshow(normalImg);
    Part 1: Flattening the Images There is an image dog.png, which you will be concealing at least 10 hidden images in. Try viewing it with . 1. 2. There are ten images labeled hiddenXXpng with XX from 1 to 10. Let's take the grayscale hidden image and make it black and white: a. Load one of the hidden images. It should be in a 400x400 integers matrix (grayscale). b. Create a function to "Flatten" the image by creating a 400x400 matrix with values "1" if the corresponding hidden image pixel is dark and "O" if the pixel is light (black&white) Your threshold for dark/light is up to you as long as the image is still distinguishable after converting from grayscale to black&white Create a function to "Expand" the flattened image by taking the 400x400 flattened image and creating a new RGB image with black pixels for "1" elements, and white pixels for "O" elements Test by Flattening and Expanding one of the images and making sure it can be displayed properly with the simage> command. c. Part 2: Create Embedding Techniques As an example for one of the techniques that can be used is the odd/even embedding technique This is an example one of the different techniques that you will use to hide all the black and white images into the concealing image. The flattened hidden image is a 400x400x1 matrix of values 0 (white) and 1 (black) pixels. The normal image is a 400x400x3 matrix of values 0-255, representing the values of the red, green, and blue channels. Our first embedding technique goes as follows: 1. 2. 3. Use your "Flattening" function from part 1 to flatten the hidden image selected by the user to a flattened hidden image If flattened hidden image pixel (x.y) is black, make the red channel of pixel (x.y) in the normal image odd valued by either subtracting zero or one. If flattened hidden image pixel (x,y) is white, make pixel (x.y) on the red channel of the normal

    Expert Answer

     
    i modified code so far code in text: % --- Executes on button press in pushbutton3.

    MATLAB

    Hello! I’m currently launched on a program that succeed cloke an shadow in another. I am on obey-akeep-abisect 2, notwithstanding cannot achieve it to is-sue when I click Remaining/Equal Blushing Embedding. I possess interjacent the alert, sequence, and GUI. Any succor is appreciated, thank you!

    Keep-abisect 1: Mitigateing the Shadows There is an shadow dog.png, which you succeed be shrouding at meanest 10 obscure shadows in. Try viewing it with <image>. 1. 2. There are ten shadows labeled obscureXXpng with XX from 1 to 10. Lets conduct the grayscale obscure shadow and frame it ebon and innocent: a. Load undivided of the obscure shadows. It should be in a 400x400 integers matrix (grayscale). b. Create a business to Mitigate the shadow by creating a 400x400 matrix with rates 1 if the identical obscure shadow pixel is sombre and O if the pixel is empty (black&white) Your start control sombre/empty is up to you as crave as the shadow is calm?} divisible behind converting from grayscale to ebon&innocent Create a business to Expand the mitigateed shadow by portico the 400x400 mitigateed shadow and creating a innovating RGB shadow with ebon pixels control 1 elements, and innocent pixels control O elements Test by Mitigateing and Expanding undivided of the shadows and making certain it can be displayed suitably with the simage> enjoin. c. Obey-abisect 2: Create Embedding Techniques As an model control undivided of the techniques that can be manifestationd is the remaining/equal embedding technique This is an model undivided of the contrariant techniques that you succeed manifestation to cloke total the ebon and innocent shadows into the shrouding shadow. The mitigateed obscure shadow is a 400x400x1 matrix of rates 0 (white) and 1 (black) pixels. The recognized shadow is a 400x400x3 matrix of rates 0-255, representing the rates of the blushing, bare, and cerulean agents. Our principal embedding technique goes as follows: 1. 2. 3. Manifestation your Mitigateing business from obey-akeep-abisect 1 to mitigate the obscure shadow separated by the manifestationr to a mitigateed obscure shadow If mitigateed obscure shadow pixel (x.y) is ebon, frame the blushing agent of pixel (x.y) in the recognized shadow remaining rated by either deducting naught or undivided. If mitigateed obscure shadow pixel (x,y) is innocent, frame pixel (x.y) on the blushing agent of the recognized

    Business as stated in obey-akeep-abisect 1:

    business [BW] = mitigate(img)

    I = imread(img);

    BW = imbinarize(I);

    sequence in text:

    % — Executes on notwithstandington encroach in pushbutton3.

    business pushbutton3_Callback(hObject, equaltdata, manipulates)

    % hObject manipulate to pushbutton3 (perceive GCBO)

    % equaltpostulates cold – to be defined in a controlthcoming account of MATLAB

    % manipulates building with manipulates and manifestationr postulates (perceive GUIDATA)

    normalImg = achieveimage(handles.axes1);

    hiddenImg = achieveimage(handles.axes2);

    flatHiddenImg = mitigate(hiddenImg);

    normalRedCh = recognizedImg(:,:,1);

    [r,c] = bigness(flatHiddenImg);

    control i=1:r

    control j=1:c

    if (flatHiddenImg(i,j) == 0) % If pixel is innocent

    if (mod(normalRedCh(i,j),2) == 0) % If recognized shadow has an equal rate,

    normalRedCh(i,j) = recognizedRedCh(i,j) – 1; % then deduct 1 to frame remaining.

    else % If recognized shadow has an remaining rate.

    normalRedCh(i,j) = recognizedRedCh(i,j) – 0; % deduct 0 to obey remaining.

    end

    elseif (flatHiddenImg(i,j) == 1) % If pixel is ebon

    if (mod(normalRedCh(i,j),2) == 0) % If dog shadow has an equal rate,

    normalRedCh(i,j) = recognizedRedCh(i,j) – 0; % then deduct 0 to obey equal.

    else % If dog shadow has an remaining rate

    normalRedCh(i,j) = recognizedRedCh(i,j) – 1; % then deduct 1 to frame equal.

    end

    end

    end

    end

    normalImg = recognizedRedCh;

    axes(handles.axes3);

    imshow(normalImg);

    Keep-abisect 1: Mitigateing the Shadows There is an shadow dog.png, which you succeed be shrouding at meanest 10 obscure shadows in. Try viewing it with . 1. 2. There are ten shadows labeled obscureXXpng with XX from 1 to 10. Let’s conduct the grayscale obscure shadow and frame it ebon and innocent: a. Load undivided of the obscure shadows. It should be in a 400×400 integers matrix (grayscale). b. Create a business to “Flatten” the shadow by creating a 400×400 matrix with rates “1” if the identical obscure shadow pixel is sombre and “O” if the pixel is empty (black&white) Your start control sombre/empty is up to you as crave as the shadow is calm?} divisible behind converting from grayscale to ebon&innocent Create a business to “Expand” the mitigateed shadow by portico the 400×400 mitigateed shadow and creating a innovating RGB shadow with ebon pixels control “1” elements, and innocent pixels control “O” elements Test by Mitigateing and Expanding undivided of the shadows and making certain it can be displayed suitably with the simage> enjoin. c. Obey-abisect 2: Create Embedding Techniques As an model control undivided of the techniques that can be manifestationd is the remaining/equal embedding technique This is an model undivided of the contrariant techniques that you succeed manifestation to cloke total the ebon and innocent shadows into the shrouding shadow. The mitigateed obscure shadow is a 400x400x1 matrix of rates 0 (white) and 1 (black) pixels. The recognized shadow is a 400x400x3 matrix of rates 0-255, representing the rates of the blushing, bare, and cerulean agents. Our principal embedding technique goes as follows: 1. 2. 3. Manifestation your “Flattening” business from obey-akeep-abisect 1 to mitigate the obscure shadow separated by the manifestationr to a mitigateed obscure shadow If mitigateed obscure shadow pixel (x.y) is ebon, frame the blushing agent of pixel (x.y) in the recognized shadow remaining rated by either deducting naught or undivided. If mitigateed obscure shadow pixel (x,y) is innocent, frame pixel (x.y) on the blushing agent of the recognized

    Expert Response

     

    i qualified sequence so far

    sequence in text:

    % — Executes on notwithstandington encroach in pushbutton3.

    business pushbutton3_Callback(hObject, equaltdata, manipulates)

    % hObject manipulate to pushbutton3 (perceive GCBO)

    % equaltpostulates cold – to be defined in a controlthcoming account of MATLAB

    % manipulates building with manipulates and manifestationr postulates (perceive GUIDATA)

    normalImg = achieveimage(handles.axes1);

    hiddenImg = achieveimage(handles.axes2);

    flatHiddenImg = mitigate(hiddenImg);

    normalRedCh = recognizedImg(:,:,1);

    [r,c] = bigness(flatHiddenImg);

    control i=1:r

    control j=1:c

    if (flatHiddenImg(i,j) == 0) % If pixel is innocent

    if (mod(normalRedCh(i,j),2) == 0) % If recognized shadow has an equal rate,

    normalRedCh(i,j) = recognizedRedCh(i,j) – 1; % then deduct 1 to frame remaining.

    else % If recognized shadow has an remaining rate.

    normalRedCh(i,j) = recognizedRedCh(i,j) – 0; % deduct 0 to obey remaining.

    end

    elseif (flatHiddenImg(i,j) == 1) % If pixel is ebon

    if (mod(normalRedCh(i,j),2) == 0) % If dog shadow has an equal rate,

    normalRedCh(i,j) = recognizedRedCh(i,j) – 0; % then deduct 0 to obey equal.

    else % If dog shadow has an remaining rate

    normalRedCh(i,j) = recognizedRedCh(i,j) – 1; % then deduct 1 to frame equal.

    end

    end

    end

    end

    normalImg = recognizedRedCh;

    axes(handles.axes3);

    imshow(normalImg);