I am at the moment trying to simulate an oscilloscope plugged to the output of a camera in the context of digital film-making.
Here is my code :
clear all;
close all;
clc;
A = imread('06.tif');
[l,c,d] = size(A);
n=256;
B = zeros(n,c);
for i = 1:c
for j = 1:l
t = A(j,i);
B(t+1,i) = B(t+1,i) + 1;
end
end
B = B/0.45;
B = imresize(B,[l c]);
B = (B/255);
C = zeros(n,c);
for i = 1:c
for j = 1:l
t = 0.2126*A(j,i,1)+0.7152*A(j,i,2)+0.0723*A(j,i,3); // here is the supposed issue
C(t+1,i) = C(t+1,i) + 1;
end
end
C = C/0.45;
C = imresize(C,[l c]);
C = (C/255);
figure(1),imshow(B);
figure(2),imshow(C);
The problem is that I am getting breaks in the second image, and unfortunately that's the one I want as an output. My guess is that the issue is located in the linear combination done in the second for but I cannot handle it. I tried with both tif and jpg input, with different data format like uint8 in Matlab but nothing is helping...
Thank you for your attention, I stay available for any question.