Question
The main part.which read I_mag and I_angle at each pixel position to determine the orientation bin of Image_HoG to be added with the gradient magnitude.
The main part.which read I_mag and I_angle at each pixel position to determine the orientation bin of Image_HoG to be added with the gradient magnitude.
>> % Use 2x2 blocks >> nr_b = 2; >> nc_b = 2; >> nbin = 9; % number of histogram bins >> nr_size = nr/nr_b >> nc_size = nc/nc_b >> Image_HoG = zeros(1, nbin*nr_b*nc_b); >> for i=1:nr_b >> for j=1:nc_b >> I_mag_block = I_mag((i-1)*nr_size+1:i*nr_size, (j-1)*nc_size+1:j*nc_size); >> I_angle_block = I_angle((i-1)*nr_size+1:i*nr_size, (j-1)*nc_size+1:j*nc_size); >> % HoG1 is a function to create the HoG histogram >> gh=HoG1(I_mag_block, I_angle_block, nbin); >> % Histogram_Normalization is a function to normalize the input histogram gh >> ngh=Histogram_Normalization(gh); >> pos = (j-1)*nbin+(i-1)*nc_b*nbin+1 >> Image_HoG(pos:pos+nbin-1) = ngh >> end >> end
The function part
function [ ghist ] = HoG1( Im, Ip, nbin ) % Compute the HoG of an image block, with unsigned gradient (i.e. 0-180) % Im: magnitude of the image block % Ip: orientation of the image block % nbin: number of orientation bins ghist = zeros(1, nbin); [nr1 nc1] = size(Im); % Compute the HoG interval = ????; % the interval for a bin, and what is ????? for I = 1:nr1 for j = 1:nc1 index = floor(Ip(i, j)/interval)+1; ghist(index) =????; % what is ????? end end
The second function part
function [ nhist ] = Histogram_Normalization( ihist ) % Normalize input histogram ihist to a unit histogram total_sum = sum(ihist); nhist = ????; % what is ????? end
Can you help me to finish the missing part "????" ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started