Skip to content
Robin Deits edited this page Apr 8, 2013 · 1 revision

According to the Virtex-5 family overview, the XC5VLX110T has 148 block RAMs which can store up to 36Kb each. That gives a total capacity of 5328Kb or 666KB. Unfortunately, that's not enough to store an entire image pair, which needs

import quantities as q
import Image as Im
from IPython.core.display import Image as dispIm
im_width = 800
im_height = 600
im_depth = 8 * q.bit
bits_per_im = im_width * im_height * im_depth
print bits_per_im * 2
7680000.0 bit

What if we scale down the bit depth of the images?

small_im_depth = 5 * q.bit
bits_per_im = im_width * im_height * small_im_depth
print bits_per_im * 2
4800000.0 bit

That's probably okay. Alternatively, we could rescale the images:

sqrt(5328 * 1e3 / 7680000.0)
    0.83291656244788403

So we would have to rescale the images to 83% along each dimension:

small_im_width = 800 * .83
small_im_height = 600 * .83
print small_im_width, small_im_height
bits_per_im = small_im_width * small_im_height * im_depth
print bits_per_im * 2
664.0 498.0
5290752.0 bit

I'm not sure what the answer is. Either should be fine. 5-bit depth will be awkward, because the memory and Scemi ports will probably expect data sizes in powers of two. Would 4 bits look okay? Let's see what that would look like. Here's an original image:

original = Image.open("single_vort_sim_0001.tif")
original.save('original.png')
dispIm(filename='original.png')
    

Explicitly converted to 8-bit black and white:

bit_8 = original.convert("P")
bit_8.save('bit_8.png')
dispIm(filename='bit_8.png')
    

And here it is in 4-bit black and white:

bit_4 = bit_8.point(lambda x: x >> 4 << 4)
bit_4.save('bit_4.png')
dispIm(filename='bit_4.png')
    

It's slightly dimmer, but I wouldn't say there's any noticeable difference in the features. Let's try an image from the RoboClam dataset:

roboclam = Image.open("INDEX_101.bmp")
roboclam.save("roboclam.png")
print roboclam.mode
dispIm(filename="roboclam.png")
RGB
    
roboclam8 = roboclam.convert("L")
roboclam8.save('roboclam8.png')
dispIm(filename='roboclam8.png')
    
roboclam4 = roboclam8.point(lambda x: x >> 4 << 4)
roboclam4.save('roboclam4.png')
dispIm(filename='roboclam4.png')
    

We certainly lose some subtlety in, for example, the black area occupied by the clam, but I suspect that that isn't a big deal. I think that a 4-bit image looks like a pretty reasonable approach.

Clone this wiki locally