- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Peace!
I want ask about the number of bits shoud I use in an fixed_point number to obtein the good precision, precision of distance eclidean. some detail: I want to determine an vector of foor element VECT[MOY1,MOY2,MOY3,MOY4], each element is the moyen of one quart of matrix of (64*64), the matrix' element value varies (0-255)'''it's pixel valor''' --> the result of division (MOY1=SUM/Nbits) has 8 bits in the integer part; Question: how many bits of fractional part shout I use to get the good result (result of euclidean distance between two vector VECT1[MOY11,MOY12,MOY13,MOY14] and VECT[MOY21,MOY22,MOY23,MOY24]).. thank you....peace:Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you sum N digital values you generally need log2(N) (approximate to the next integer) more bits to store the result. Otherwise you possibly overflow the sum or lose information.
The same applies to the average of N values: you need log2(N) more bits if you want to have the full precision; consider, for example, that any division by 2 introduces one more decimal bit.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you Cris72!
I divide 18 bits by "10000000000" //1024//, I want to keep a big part of information consider that the integer part of the division result id coded in 8 bit (varies from 0 to 255), how many of bits shoud Allocated to the fractional part so I keep big part of information.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
your division just needs discarding 10 lsb bits from 18 so you are left with 8 bits. If you want to keep fractional bits then just don't divide as the 10 lsbs is the fractional bits. so I don't really get it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so 10 bits in fractional part assure the big part of information
..thank you Kaz !
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page