⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 full_contrast.m

📁 用于视频压缩编码中的RGB信号到色差信号变换的VHDL程序
💻 M
字号:
%   FULL_CONTRAST 2d Matrix adjustment.
%   FULL_CONTRAST(A) scales and adjusts the incoming data
%   to be positive integer from 0 to 255.
%   FULL_CONTRAST(A,size) scales and adjusts the incoming data
%   to be positive integer from 0 to size-1.
%   FULL_CONTRAST(A) uses the default size = 256.

% full_contrast function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Author : Daniel Michek
%    Date : 29 August 2003
% Version : 0.01
%  Intent : Modify data set to limitted 
%           size.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%      Requirements                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function new_image = full_contrast(orig_image,size)
%   FULL_CONTRAST 2d Matrix adjustment.
%   FULL_CONTRAST(A) scales and adjusts the incoming data
%   to be positive integer from 0 to 256.
%   FULL_CONTRAST(A,size) scales and adjusts the incoming data
%   to be positive integer from 0 to size.
%   FULL_CONTRAST(A) uses the default size = 256.

% Set default size if not given
if nargin==1
   size = 256;
elseif nargin==0
        help full_contrast;
        orig_image = [0 1];
        size = 256;
end

% Modify data set to limitted size
image=double(orig_image);           %convert to double to allow processing
mincont=min(min(image));            %find min val in 2d Matrix
maxcont=max(max(image));            %find max val in 2d Matrix
if (maxcont~=mincont)
    stretch=(size-1)/(maxcont-mincont); %stretch value to fill full bandwidth
else
    stretch=1;
end
normalized=image-mincont;           %adjust original image to offset @ 0
new_image=normalized*stretch;       %offset image * stretch value

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -