To generate unique vectors
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I have 16 unique decimal values all in the range 3000 to 5000 generated from a fingerprint image. Have such 348 fingerprints each of which is giving me 16 unique decimal values.
Now I want to generate a 16-bit binary vector using these 16 decimal values for each image. Tried doing it in following two ways taking one image at a time.
- Took the sum of 16 decimal values, converted it into binary i.e.
K=i1+i2+i3+i4+i5+i6+i7+i8+i9+i10+i11+i12+i13+i14+i15+i16;
P=dec2bin(K);
For few images K is >54000(approx) and P will be a 17-bit value due to overflow. So all images aren't giving a 16-bit vector.
2. Tried to take initial vector and perform repeated xor operation as follows
iv=zeros(1,16);
i1=dec2bin(i1);
i1=i1([end 1:end-1]) %Rotate right by 1-bit
K1=xor(i1,iv);
iv=K1; %set K1 as initial vector
i2=dec2bin(i2);
i2=i2([end 1:end-1]) %Rotate right by 1-bit
K2=xor(i2,iv);
iv=K2; %set K2 as initial vector
i3=dec2bin(i3);
i3=i3([end 1:end-1]) %Rotate right by 1-bit
K3=xor(i3,iv);
and so on upto K16 which i'm storing as final value.
Unfortunately this is not giving me unique vector for each image. I need 348 16-bit or 32-bit unique vectors corresponding to 348 fingerprint images.
Is there any other way to generate the required unique vectors?
댓글 수: 0
답변 (2개)
Azzi Abdelmalek
2013년 6월 1일
What if you use
P=dec2bin(K,16);
댓글 수: 4
Azzi Abdelmalek
2013년 6월 1일
What you can do is to find the max value, suppose it's 55000,
pas=55000/(2^16-1),
c=k/pas
p=dec2bin(c,16)
Walter Roberson
2013년 6월 1일
1) mod(K, 2^16)
2) If you need the hashes to be constructed independently of each other without knowledge of the entire input, then you are not going to be able to do that -- otherwise you would be doing the equivalent of compressing every possible number of length ceil(log2(5000-3000+1)) bits/entry * 16 entries = 11*16 = 176 bits, into a distinct number of length 16 or 32 bits. You cannot uniquely map 176 bits to 16 bits or 32 bits.
If it is acceptable for the hashes to be constructed with knowledge of the full input set, then you could use "perfect hashing", which would generate (number of entries = 16) different values, which you could then extend arbitrarily to make 16 or 32 bit values. "perfect hashing" is only suitable for the case where the original inputs are the only possible inputs to the system, and if even a single extra input was added, the hash algorithm would need to be recomputed.
What algorithm you use depends a lot on what you are trying to do. If you leave the list of 16 numbers unhashed (or more formally, hash list to itself) then you could use the list as part of the process of finding similar finger prints (e.g., fingerprint recognition.) But as soon as you start hashing the feature list, you start losing that ability unless you deliberately build the hash to maintain the ability based upon something like a prioritization of features.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!