Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

image normalization

Hi

I am working on image image processing on cyclone II.

if I have 8 bit data in YCbCr then

Is it possible to normalize an image by: current pixel / 255

If there is another option please suggest me, I am working on DSP Builder v6.0.

Thank You

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    /255 is rather hard work

    /256 is a lot easier as it is just a right bit shift by 8. In FPGA there is no need to do any bit shifting like this.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    /255 is rather hard work

    /256 is a lot easier as it is just a right bit shift by 8. In FPGA there is no need to do any bit shifting like this.

    --- Quote End ---

    But at the same time I want data bus of the same width(before normalization and after normalization).

    Further, Is it possible to re-gain the same image on de-normalization?

    Thank You Tricky
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If all you are doing is /256 and want an 8 bit fractional, you actually do nothing at all. You just "pretend" you did a divide. In an FPGA there is no real bitshifting when dividing, you just append zeros depending on which way you shift.

    So if you had 152, and then divide by 256, then multiply by 1.5 (answer = 228), you just do this:

    input = 10011000 (152)

    1.5 = 1.1

    just append zeros to 1.5 (multiply by 256)

    = 110000000

    Do the multiply.

    You have 8 bits fractional and 8 bits integer. (because your source, 152 was all fractional bits) so you discard the 8 LSBs and you have your answer

    so you have:

    
                       0 1 0 0 1 1 0 0 0
    x                  1 1 0 0 0 0 0 0 0
    -------------------------------------
    =    0 1 0 0 1 1 0 0 0
    +  0 1 0 0 1 1 0 0 0
    -------------------------------------
       0 1 1 1 0 0 1 0 0|0 0 0 0 0 0 0 0
       --Integer           Fraction
       
     11100100 = 228