We are supposed to make the
matlab code below work to recolor the image to maize and blue
lab3_1recolor.m:
function [ outputImg ] = lab31recolor(hsvImg)
% This function takes an hsv image.
% An image is composed of 3 matrices (hue, saturation, and value).
% This function fixes the colors of the OSU algorithm.
% The corrected image is assigned into outputImg.
% Obtains the hue and saturation layers from the matrix
% An image has 3D dimensions, which is why we use hsvImg(:, :, layer)
hue = hsvImg(:, :, 1);
sat = hsvImg(:, :, 2);
% Fix the green and make it blue
hue(0.35 > hue & hue > 0.25) = hue .* 2;
% Replace the red with yellow
hue(.15 > hue | (1 > hue & hue > .97)) = 0.15;
% Increase saturation by a multiplier of 1.2 to make colors more vivid
sat(:, :) .* 1.2 = sat(:, :);
% We modified hue and sat
% We need to copy these back into hsvImg!
hsvImg(:, :, 1) = hue;
hsvImg(:, :, 2) = sat;
end
lab3_1_test.m:
% Read the image from the file
img = imread('evil2.jpg'); % hardcode as evil1.jpg or evil2.jpg
% Converts from RGB to HSV (hue, value, saturation)
img = rgb2hsv(img);
% Fixes the image with our function
img = lab1_3_recolor(img);
% Converts from HSV to RGB
img = hsv2rgb(img);
% Displays the image
imshow(img);
% lab31recolor.m : Matlab function to recolor the image
function [ outputImg ] = lab31recolor(hsvImg)
% This function takes an hsv image.
% An image is composed of 3 matrices (hue, saturation, and
value).
% This function fixes the colors of the OSU algorithm.
% The corrected image is assigned into outputImg.
% Obtains the hue and saturation layers from the matrix
% An image has 3D dimensions, which is why we use hsvImg(:, :,
layer)
outputImg = hsvImg; % copy the values of hsvImg to outputImg
% obtain the hue values
hue = hsvImg(:, :, 1);
% obtain the saturation values
sat = hsvImg(:, :, 2);
% Fix the green and make it blue
hue(0.35 > hue & hue > 0.25) = hue(0.35 > hue &
hue > 0.25) .* 2;
% Replace the red with yellow
hue(.15 > hue | (1 > hue & hue > .97)) = 0.15;
% Increase saturation by a multiplier of 1.2 to make colors more
vivid
sat(:, :) = sat(:, :).* 1.2;
% We modified hue and sat
% We need to copy these back into hsvImg!
outputImg(:, :, 1) = hue;
outputImg(:, :, 2) = sat;
end
%end of function
%main script
% Read the image from the file
img = imread('evil2.jpg.png'); % hardcode as evil1.jpg or evil2.jpg
% Converts from RGB to HSV (hue, value, saturation)
img = rgb2hsv(img);
% Fixes the image with our function
img = lab31recolor(img);
% Converts from HSV to RGB
img = hsv2rgb(img);
% Displays the image
imshow(img);
%end of script
Output:
Input image:

Output Image:

We are supposed to make the matlab code below work to recolor the image to maize...
the picture above is the one you are supposed to use for the
MATlab code please help
Problems. Grayscale images are composed of a 2D matrix of light intensities from O (Black) to 255 (White). In this lab you will be using grayscale images and do 2D-array operations along with loops and iflelse branches. 1. We can regard 2D grayscale images as 2D arrays. Now load the provided image of scientists at the Solvay Conference in 1927 using the imread)...
use MATLAB to upload the following:
an image that you want to process (can be taken yourself or
downloaded from the internet)
a script that processes the image in TWO ways.
manipulates the colors
averages pixels together
Please make sure the script displays the images (like how I did
with the 40 and 80 pixel averaging) so I can easily compare them to
the original. Make sure to COMMENT your code as well.
Homework 13 Please upload the following: an...
% BACKGROUND:Image processing is the generation of a new image from one or more existing images. % MATLAB makes it easy to work with images by providing some basic functions % that allow you to read and write images in standard image -file formats, such as JPEG % Locate the attached photo of a blue bird stored in JPEG format, bbird.jpg (must be on same folder as script). % Fill in the ? in the code with correct values to...
from PIL import Image import random # NOTE: Feel free to add in any constant values you find useful to use BLACK = (0, 0, 0) WHITE = (255, 255, 255) # NOTE: Feel free to add in any helper functions to organize your code but # do NOT rename any existing functions (or else, autograder # won't be able to find them!!) # NOTE: The following function is already completed for you as an example # You can use...