Skip to content

Instantly share code, notes, and snippets.

View mrifkikurniawan's full-sized avatar

Rifki Kurniawan mrifkikurniawan

View GitHub Profile
@mrifkikurniawan
mrifkikurniawan / color_imaging.m
Created September 1, 2019 04:27
Get 3 color channels, RGB, of image, and stack it together to get color image.
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]);
@mrifkikurniawan
mrifkikurniawan / accessing_image_subregion.m
Last active August 19, 2019 22:29
Slice image sub-regions and perform SSD (sum of squared distance)
# 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))