close all; clc
%% =====================================================================================================
% Parameters to be modified

% Read image
Im = imread('Picture 1.jpg');

% Define the y-coordinate of a line of interest (LOI)
line_y = 360;

% Show LOI (1 = show LOI, 0 = hide LOI)
show_LOI = 1;



% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
%
%                             DO NOT MODIFY THE SCRIPT BEYOND THIS POINT
%
% XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


%% =====================================================================================================
% Process data

%parameters camera
PixNrx          =           1280;
PixNry          =           720;

% select a channel (here red)
Red_1 = Im(:,:,1);

% format conversion
Red_1 = double(Red_1);

% select a line of interest ROI (1 x PixNrx)
Line = Red_1(line_y,1:PixNrx);

%% =====================================================================================================
% Plot data

figure('color','w','Position', [250 250 1242 515])

%visiualize the image to define region of interest
subplot(1,2,1)
imagesc(Im) 
hold on
if show_LOI
    plot([1 PixNrx],[line_y line_y],'b','linewidth',2)
end
title('Original image')
xlabel('Position x (pixel)')
ylabel('Position y (pixel)')

%plot a single line
subplot(1,2,2)
plot(Line,'b','linewidth',2)
xlabel('Position x (pixel)')
ylabel('Signal (counts)')
title(['Raw signal at y = ' num2str(line_y)])
axis([1 PixNrx 0 255])
 




