This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; | |
%Read the image | |
img = imread('image.jpg'); | |
%Get the size (rows and columns) of the image | |
[r,c] = size(img); | |
rr=r/3; | |
%Wrire code to split the image into three equal parts and store them in B, G, R channels | |
B=imcrop(img,[1,1,c,rr-1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Accessing Image Sub-Regions | |
img = imread('cameraman.png'); #read image filename | |
subimg1 = img(1:50, 1:50); | |
subimg2 = img(end-49:end, end-49:end); | |
ssd = sum(sum((double(subimg1) - double(subimg2)).^2)) |