diy Physics Blog

  • Book
    • Book Contents
    • Adopt the Textbook
    • Back Cover
    • Instructor’s Guide
    • Software
    • Book Errata
  • About Us
  • Contact Us
  • Terms of Use
  • Privacy Policy

Matlab Video Frame Integration Program Using VCAPG2 for Single-Photon Double-Slit Interference Experiment

Posted on January 30, 2012 by David Prutchi Posted in Chapter 5 - Wave-Particle Duality, Single-Photon Experiments, Single-Photon Imaging, Two-Slit Interference

Frame integration of single-photon double-slit interference experiment

In Chapter 5 of the book we list a short Matlab® program to integrate successive video frames from our diy intensified camera to image double-slit interference patterns obtained by shooting a single photon at a time.

The program listed in the book uses Vision for Matlab (VFM).  However, this utility is not compatible with all versions of Windows and Matlab.  An alternative is VCAPG2 by Kazuyuki Kobayashi available at http://www.ikko.k.hosei.ac.jp/~matlab/matkatuyo/vcapg2.htm  (Also available from our SOFTWARE page).

The following is a version of the Matlab integration program shown in the book’s Listing 1 that has been modified to work with VCAPG2:

%  ————

%

%  Matlab program to integrate video image frames

%  from single-photon interference setup.

%

%  ©2011 David Prutchi, Ph.D. and Shanni R. Prutchi

%

%  This program uses VCAPG2 to acquire

%  image frames through a Windows video capture card.

%

%————–

noise(288,384)=0;  % initialize array that will hold static dark image

a=vcapg2(‘grab’,1);   % acquire 5 frames

dark=double(a);    % convert from image format to double-precision numbers

% Integrate 5 frames

for n=1:1

noise=noise+dark(:,:,1,n)+dark(:,:,2,n)+dark(:,:,3,n);

end

noise=noise/1;     % Calculate average dark static image

clf                % Clear figure

imagesc(noise)     % Display average dark static image

colorbar

title(‘Dark Static Image’)

drawnow            % Draw figure now

clear a            % Clear the image buffer

clear dark         % Clear the double-precision image buffer

% Ask user to turn LASER on

beep

disp(‘PLEASE TURN LASER ON’)

pause(2)

beep

pause(2)

beep

pause(2)

beep

pause(2)

c(288,384)=0; % initialize array that will hold interference pattern

for n=1:200          % number of frames to be integrated

a=vcapg2(‘grab’,1); % grab a frame

b=double(a);     % convert to double precision

n                % display frame number

c=c+b(:,:,1)+b(:,:,2)+b(:,:,3)-noise(:,:); % integrate frame and subtract dark static image

figure(1)        % select figure #1

clf              % clear the figure

%imagesc(c,[0,max(max(c))])  % apply threshold at 0 and generate color image

imagesc(c,[median(median(c)),max(max(c))])

colorbar         % show color scale

drawnow          % draw figure now

if n == 1        % if this is the first frame, display it in Figure #2

figure(2)

subplot(2,3,1)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 1’)

drawnow

end

if n == 10      % if this is the 10th frame, display it in Figure #2

figure(2)

subplot(2,3,2)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 10’)

drawnow

end

if n == 25      % if this is the 25th frame, display it in Figure #2

figure(2)

subplot(2,3,3)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 25’)

drawnow

end

if n == 50      % if this is the 50th frame, display it in Figure #2

figure(2)

subplot(2,3,4)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 50’)

drawnow

end

if n == 100     % if this is the 100th frame, display it in Figure #2

figure(2)

subplot(2,3,5)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 100’)

drawnow

end

if n == 200     % if this is the 200th frame, display it in Figure #2

figure(2)

subplot(2,3,6)

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 200’)

drawnow

end

end

figure(3)           % display final result of integration in Figure #3

imagesc(c,[0,max(max(c))])

title(‘Frames Integrated = 200’)

colorbar

 

Please visit www.prutchi.com and www.diyPhysics.com for other cutting-edge d.i.y. projects, and remember to check out our new d.i.y. Quantum Physics book:

« DN1221 Thermoelectric Controller for d.i.y. Single-Photon Counter Module
d.i.y. Mod for Perkin Elmer SPCM-AQR Single-Photon Detector Module to Improve Photon Timing Performance »

Buy our book at Amazon.com

Navigate diyphysics.com

  • Book
    • Book Contents
    • Adopt the Textbook
    • Back Cover
    • Instructor’s Guide
    • Software
    • Book Errata
  • About Us
  • Contact Us
  • Terms of Use
  • Privacy Policy

Categories

  • Administrative
  • Book Chapters
    • Chapter 1 – Light as a Wave
    • Chapter 2 – Light as Particles
    • Chapter 3 – Atoms and Radioactvity
    • Chapter 4 – The Priciple of Quantum Physics
    • Chapter 5 – Wave-Particle Duality
    • Chapter 6 – The Uncertainty Principle
    • Chapter 7 – Schrödinger's Wave Equation
    • Chapter 8 – Entanglement
  • Experiments
    • Attenuation of Radiation
    • Bell's Inequality Test
    • Compton Scattering
    • Doppler Effect
    • e/m Measurement
    • Emission Spectrometry
    • Entanglement
    • Glow Discharge
    • Ionizing Radiation Detection
    • Maltese Cross CRT
    • Plasma Physics
    • QKD
    • Quantum Dots
    • Quantum Random Number Generation
    • Quantum Tunneling
    • Radio-Isotope Identification
    • Relativistic Time Dilation
    • Rutherford Alpha-Particle Scattering
    • Single-Electron Experiments
    • Single-Photon Experiments
    • Single-Slit Diffraction
    • Two-Slit Interference
    • β-Particle Magnetic Deflection
  • Instrumentation
    • CDV700 Pro Geiger-Müller Counter
    • Electron-Beam Tube
    • Entangled-Photon Source
    • Gunnplexer Transceiver
    • High-Voltage Power Supply
    • Lasers
    • Mach-Zehnder Interferometer
    • Magneto-Optical Trap
    • Marx Generators
    • MCA/PHA
    • Photomultipliers
    • Photon/Coincidence Counter
    • PMT/Scintillation Processor
    • Polarimetric Imaging
    • Polymeric Radiation Detector
    • Precision Clocks and Timers
      • Atomic Clock
      • GPS-Disciplined
    • Radioisotopes
    • Scintillation Detector
    • Single-Photon Counting Modules (SPCMs)
    • Single-Photon Imaging
    • Spectrometer
    • Thermal Camera
    • Ultraviolet Illuminators
    • Vacuum System
  • Medium Wave Infrared Imaging
  • Nuclear Magnetic Resonance NMR
  • Physics Humor
  • Theoretical Physics
  • Ultraviolet Imaging
  • Uncategorized

Educational Resources

  • ALPhA Advanced Laboratory Physics Association
  • American Journal of Physics
  • Circuit Cellar
  • Dr. Enrique Galvez' Correlated-Photon Experiments Guide
  • Dr. Mark Beck's Undergraduate QM Experiments
  • The Bell Jar

Blogroll

  • Dorith Prutchi's Professional Website
  • More of our projects at prutchi.com
  • My Blog on Implantable Devices
  • My Infrared-to-UV Photography Site

Pages

  • Book
    • Book Contents
    • Adopt the Textbook
    • Back Cover
    • Instructor’s Guide
    • Software
    • Book Errata
  • About Us
  • Contact Us
  • Terms of Use
  • Privacy Policy

Archives

  • November 2023
  • September 2023
  • May 2021
  • March 2021
  • July 2019
  • November 2018
  • October 2018
  • April 2018
  • March 2018
  • November 2016
  • October 2016
  • September 2016
  • July 2016
  • March 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • February 2014
  • December 2013
  • July 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • October 2012
  • September 2012
  • August 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011

Categories

  • Administrative (9)
  • Book Chapters (61)
    • Chapter 1 – Light as a Wave (2)
    • Chapter 2 – Light as Particles (10)
    • Chapter 3 – Atoms and Radioactvity (27)
    • Chapter 4 – The Priciple of Quantum Physics (3)
    • Chapter 5 – Wave-Particle Duality (13)
    • Chapter 6 – The Uncertainty Principle (2)
    • Chapter 7 – Schrödinger's Wave Equation (7)
    • Chapter 8 – Entanglement (18)
  • Experiments (57)
    • Attenuation of Radiation (2)
    • Bell's Inequality Test (8)
    • Compton Scattering (8)
    • Doppler Effect (2)
    • e/m Measurement (3)
    • Emission Spectrometry (2)
    • Entanglement (12)
    • Glow Discharge (1)
    • Ionizing Radiation Detection (18)
    • Maltese Cross CRT (1)
    • Plasma Physics (1)
    • QKD (3)
    • Quantum Dots (1)
    • Quantum Random Number Generation (3)
    • Quantum Tunneling (2)
    • Radio-Isotope Identification (7)
    • Relativistic Time Dilation (1)
    • Rutherford Alpha-Particle Scattering (1)
    • Single-Electron Experiments (1)
    • Single-Photon Experiments (22)
    • Single-Slit Diffraction (1)
    • Two-Slit Interference (4)
    • β-Particle Magnetic Deflection (2)
  • Instrumentation (79)
    • CDV700 Pro Geiger-Müller Counter (7)
    • Electron-Beam Tube (4)
    • Entangled-Photon Source (6)
    • Gunnplexer Transceiver (2)
    • High-Voltage Power Supply (10)
    • Lasers (3)
    • Mach-Zehnder Interferometer (1)
    • Magneto-Optical Trap (1)
    • Marx Generators (3)
    • MCA/PHA (10)
    • Photomultipliers (15)
    • Photon/Coincidence Counter (4)
    • PMT/Scintillation Processor (9)
    • Polarimetric Imaging (4)
    • Polymeric Radiation Detector (1)
    • Precision Clocks and Timers (3)
      • Atomic Clock (2)
      • GPS-Disciplined (1)
    • Radioisotopes (1)
    • Scintillation Detector (14)
    • Single-Photon Counting Modules (SPCMs) (12)
    • Single-Photon Imaging (3)
    • Spectrometer (1)
    • Thermal Camera (1)
    • Ultraviolet Illuminators (3)
    • Vacuum System (2)
  • Medium Wave Infrared Imaging (1)
  • Nuclear Magnetic Resonance NMR (3)
  • Physics Humor (9)
  • Theoretical Physics (1)
  • Ultraviolet Imaging (1)
  • Uncategorized (28)

WordPress

  • Log in
  • WordPress
© diy Physics Blog