burti wrote:Hi.
Sorry to bother you again but why can NxtCamView capture images within 4 seconds?
How can it read all the lines so fast?
Well for starters it is using USB not i2c to transfer the image. Then assuming your timings come from the standard firmware it is not running in the same resolution. The default image resolution is 176x144, I use the highest resolution available from the camera which is 352*288 so there is 4 times as much data to transfer. Finally the protocol for USB is much cleaner. The generic pic firmware supplied by Mindsensors which you have to use when using custom commands requires a lot more handshaking when using i2c (you basically have to poll the pic using i2c commands, and clear the buffer when you have finished the transfer).
why can't you use 75 bytes at a time instead of 60 bytes? (then you only have 5 sections instead of 6 ones)
I actually transfer 64 bytes of data at a time (there are 4 bytes of wrapper information around the actual frame data), which fits exactly into two 32byte i2c transactions (the maximum i2c transaction supported by leJOS). So to transfer a line requires 12 i2c transactions. If I used the full 75 bytes that would require 3 i2c transactions (two of 323bytes and one of 11 bytes) which would give a total of 15 i2c operations. So it is a swings and roundabouts thing really. I tested both and the 60 byte option was faster.
Do you mean changing the transfer order of the lines with "interleaving"?
Why is it so tricky?
Well let me know when you have it working....
Things are actually much more complex than your description. Firstly there is a longer gap between frames than between lines (the vsync period), then you have the various delays in the transfer process, and given that we have 3 processors talking asynchronously to each other it is hard to get the timing right. Finally if you get it wrong then the cost is quite high as you end up having to wait for an entire frame to get the requested line. It can be made to work but the results are not as good as your calculations would indicate. Also remember that the lines have to be processed, there is not really enough memory in the nxt to store the data, so you typically have to process them as you read them (even if you are simply sending the data on to a PC), and guess what, this also takes time...
I'm sure it can be made faster, but I've not really had the need to do this. ...
But feel free to try it for yourself, and let me know how you get on...
Andy
