function [pixOut,ctrlOut] = InvertImage(pixIn,ctrlIn)
  
  persistent invertI;
  if isempty(invertI) 
      tabledata = linspace(255,0,256);
      invertI = visionhdl.LookupTable(uint8(tabledata));
  end
  
  % *Note:* This syntax runs only in R2016b or later. If you are using an 
  % earlier release, replace each call of an object with the equivalent |step|
  % syntax. For example, replace |myObject(x)| with |step(myObject,x)|.  
  [pixOut,ctrlOut] = invertI(pixIn,ctrlIn);
end