2

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.

Vindic
  • 25
  • 6
  • You are probably getting in a situation where not all members of C are getting populated. You can check for this by running `find(C==0)` Any return suggests that this is the case. You could use interp2 to fill in those values – Trogdor Sep 05 '14 at 17:19
  • Can You provide an image for testing? I used some random tif i found and both images look much alike, without any 'breaks'. – Maksim Gorkiy Sep 05 '14 at 17:53
  • First, thanks for your answers. I tried interp2 but no effect, even though C is not completely populated, like you said. Here are examples of what I am talking about: http://postimg.org/image/puntsmwmp/ http://postimg.org/image/kz1oyo0dp/ The first picture is normal, the second one presents breaks. This is particularly obvious in the red circle I drew. – Vindic Sep 05 '14 at 18:28
  • Well, i've never plugged an oscilloscope into a camera so i have no idea why would you call these breaks? I'd guess that it is just some darker part of the image.... What do You expect to see there? – Maksim Gorkiy Sep 05 '14 at 18:44
  • Well I do not have those breaks on the first picture that is made from the standard RGB input, I only get these when I multiply the different layers with different coefficients. This is not supposed to happen but, as Trogdor said, it's most presumably because C isn't completely populated. Ihave to find a way to fix that though. – Vindic Sep 05 '14 at 19:26

0 Answers0