%-------------------------------------------------------------------
%
%  Filename      : example_scripts.v
%  Author        : Huang Lei Lei
%  Created       : 2015-06-05
%  Description   : example for matlab scripts
%
%-------------------------------------------------------------------

clear;
clc;

HON = 640 ;
VER = 480 ;
INPUT = 'img_i.jpg';
OUTPUT = 'img_o.dat';

Img = imread(INPUT);
Img_rgb = zeros(4*HON*VER, 1);
Img_rgb(4:4:4*HON*VER) = reshape(Img(:,:,1)',HON*VER,1);    % THANKS FOR WANGQING
Img_rgb(3:4:4*HON*VER) = reshape(Img(:,:,2)',HON*VER,1);
Img_rgb(2:4:4*HON*VER) = reshape(Img(:,:,3)',HON*VER,1);
Img_rgb_reshape = reshape(Img_rgb,4096,HON*VER*4/4096);
Img_rgb_expand  = zeros(4096*2,HON*VER*4/4096);
Img_rgb_expand(0001:4096,:) = Img_rgb_reshape;
fp_o = fopen(OUTPUT, 'w');
fwrite(fp_o, Img_rgb_expand);
fclose(fp_o);
