Skip to content

Commit

Permalink
Added demosaic only and fixed the displayRender issue. Still have a p…
Browse files Browse the repository at this point in the history
…roblem setting the diagonal properly for the match. The red is off a bit
  • Loading branch information
wandell committed Jul 26, 2020
1 parent 639cdc5 commit 5a9491d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
13 changes: 8 additions & 5 deletions displays/displayRender.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
% small. In that case, you can scale the data to max function in the GUI.
%
qm = sensorGet(sensor,'quantization method');
imgMax = max(img(:));

switch qm
case 'analog'
Expand All @@ -83,18 +82,22 @@
% brightest part is white. Multiplying by the volts 2 max volts
% ratio sets the range.

imgMax = max(img(:));
fprintf('Analog quantization. Scaling result by %f\n',imgMax);

img = (img/imgMax)*sensorGet(sensor,'volts 2 max ratio');
img = ieClip(img,0,ipGet(ip,'max sensor'));

case 'linear'
% Digital values
% These are displayed correctly displayRender() routine. No need
% for scaling here.
% No need for scaling here.
%
% ieNewGraphWin; imagescRGB(img);
% Digital values, so only clip at the bottom.
img = (img/imgMax)*ipGet(ip,'max digital value');
img = ieClip(img,0,ipGet(ip,'max digital value'));
%
% OLD CODE. Delete when ready
% img = (img/imgMax)*ipGet(ip,'max digital value');
% img = ieClip(img,0,ipGet(ip,'max digital value'));
otherwise
error('Unknown quantization method %s\n',qm);
end
Expand Down
32 changes: 7 additions & 25 deletions imgproc/ipCompute.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

end


%%
function ip = vciComputeSingle(ip,sensor)
% Process image for single exposure case, or after pre-processing for
% bracketed and CFA cases.
Expand All @@ -134,6 +134,9 @@
nFilters = sensorGet(sensor(1),'nfilters');
nSensors = length(sensor);

% We need to know about the quantization before we get to displayRender.
ip = ipSet(ip,'quantization',sensorGet(sensor,'quantization'));

if nFilters == 1 && nSensors == 1
% If monochrome sensor, just copy the sensor values to the RGB values
% of the display, but normalize between 0 and 1 based on the kind of
Expand Down Expand Up @@ -186,7 +189,7 @@

% Save the demosaiced sensor space channel values. May be used later
% for adaptation of color balance for IR enabled sensors
ip = ipSet(ip,'sensor space',img);
ip = ipSet(ip,'sensor space',img); % saveimg = img;

% Decide if we are using the current matrix or we are in a processing
% chain for balancing and rendering, or whether we are using the
Expand Down Expand Up @@ -262,30 +265,8 @@
otherwise
error('Unknown transform method %s\n',tMethod);
end


%{
% This was moved into displayRender. For a while it was duplicated,
% being both there and here. (BW, July 25, 2020).
imgMax = max(img(:));
switch sensorGet(sensor,'quantization method')
case 'analog'
% Changed sensor to sensor(1) to deal with sensor array case.
img = (img/imgMax)*sensorGet(sensor(1),'volts2max ratio');
img = ieClip(img,0,ipGet(ip,'max sensor'));
case 'linear'
% Digital values, so only clip at the bottom.
img = (img/imgMax)*ipGet(ip,'max digital value');
img = ieClip(img,0,ipGet(ip,'max digital value'));
otherwise
% When the data are digital, we should probably do something
% else. Or maybe nothing.
end
% ieNewGraphWin; imagescRGB(img);
%}

ip = ipSet(ip,'quantization',sensorGet(sensor,'quantization'));
% Done with all the image processing. Save in result.
ip = ipSet(ip,'result',img);

% macbethSelect rect handles -- get rid of them
Expand All @@ -294,6 +275,7 @@

end

%%
function ip = vciComputeBracketed(ip,sensor,combinationMethod)
% Compute for bracketed exposure case
%
Expand Down
22 changes: 22 additions & 0 deletions imgproc/ipSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
% 'adaptive' - Use the image processing algorithms for sensor and
% illuminant corrections to determine the matrix on
% this image
% 'render demosaic only' - Sets the ip so only demosaicing and
% sensor zerolevel subtraction are included.
%
% Correction of the sensor data to a standard space
% 'conversion sensor ' - Sensor conversion structure
Expand Down Expand Up @@ -93,6 +95,9 @@
% 'scale display' - True or false for scaling the ipWindow image
%
% Copyright ImagEval Consultants, LLC, 2005.
%
% See also
% ipGet

% Set display parameters to match the new ones in ipGet

Expand Down Expand Up @@ -198,6 +203,11 @@
% The quantization struct might be used to determine if the
% input data were really digital values. Not much used yet.
ip.data.quantization = val;
case {'nbits'}
% ip = ipSet(ip,'nbits',val);
%
% Bit depth of the image representations
ip.data.quantization.bits = val;

case {'transforms'}
% ip = ipSet(ip,'transforms',eye(3),2);
Expand All @@ -224,6 +234,18 @@
ip.render = val;
case {'rendermethod','renderingmethod','customrendermethod'}
ip.render.method = val;
case {'renderdemosaiconly'}
% ipSet(ip,'render demosaic only',true)
%
% Set to true if you want to make sure only demosaicking and
% zerolevel correction are used, but not sensor conversion or
% illuminant correction.
if val
ip = ipSet(ip,'internal cs','Sensor');
ip = ipSet(ip,'conversion method sensor','None');
ip = ipSet(ip,'correction method illuminant','None');
end

case {'scaledisplay','scaledisplayoutput'}
% This is a binary 1 or 0 for one or off
ip.render.scale = val;
Expand Down

0 comments on commit 5a9491d

Please sign in to comment.