# how to do iris encoding correctly

2 views (last 30 days)
Karthik Krishnan on 24 Jul 2021
Answered: Garmit Pant on 5 Mar 2024
I have successfully extracted the phase data of normalised iris using 2d gabor filter. now i need to encode to make the template. what should i do? i tried imbinarize but before that should i resize the array? Please help
##### 3 CommentsShow 1 older commentHide 1 older comment
Karthik Krishnan on 24 Jul 2021
also say if there is any change is to be made in the above code
Image Analyst on 24 Jul 2021

Garmit Pant on 5 Mar 2024
As per my understanding of your query, you are trying to implement iris encoding after generating phase data by applying 2D Gabor Filter after segmenting the iris from the image. You can follow the steps listed below to implement iris encoding and generate an iris template from the phase data.
To generate the iris template from the phase data, you need to apply 2-bit phase quantization. This process involves assigning a 2-bit value to each resultant phasor by identifying which quadrant of the complex plane the phasor lies in. You can add the following code snippet to your code to perform 2-bit quantization on the phase data.
% Phase Quantization
quantized_phase = zeros(size(phase));
quantized_phase(phase >= 0 & phase < pi/2) = 3; % 11
quantized_phase(phase >= pi/2 & phase < pi) = 1; % 01
quantized_phase(phase >= -pi & phase < -pi/2) = 0; % 00
quantized_phase(phase >= -pi/2 & phase < 0) = 2; % 10
% Convert the quantized values into a binary code
% Each value will be represented by two bits
binary_code = int2bit(quantized_phase,2,false);
% Flatten the binary template into a 1D iris code
iris_code = binary_code(:)';
% Display the size of the iris code
disp(size(iris_code));
For further understanding, refer to the links to the MATLAB documentation given below:
1. imgaborfiltfunction- https://www.mathworks.com/help/images/ref/imgaborfilt.html
2. int2bit” function – https://www.mathworks.com/help/comm/ref/int2bit.html
I hope you find the above explanation and suggestions useful!

### Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!