Shop OBEX P1 Docs P2 Docs Learn Events
Can the Propeller chip process images? — Parallax Forums

Can the Propeller chip process images?

SciTech02SciTech02 Posts: 154
edited 2006-04-26 14:03 in Propeller 1
Does it have enough processing power to do so?· I wanted it to act like a "Framegraber"·so it would·process the images, can I do that?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There is always an answer.

There is always a way.
There is always a reason.··· -SciTech02.

Comments

  • tperkinstperkins Posts: 98
    edited 2006-04-24 21:44
    Of course it could. It could easily do bytes (8 bits), with one cog processing each bitstream. Whether that would do you any good I don't know.

    One of the common image processing algorithms I can think of looks at the current pixel value, and compares it to the surrounding 8 pixels. A result based off of that comparison is written to a result array. Each cog could get a common "Start" pixel indice into a pixel array (making up an image) and then each cog goes to work looking at a different offset from the initial value.

    Say you have a 256x256 array. Start at the upper left hand corner for arbitrary reasons. That is pixel 0. The ones above and to the left of it are exceptions that need to be handled. The one to the right is pixel 1, and the one beneath pixel 0 is pixel 256. The one beneath that is pixel 512.

    The process looks like this for a 256 x 256 image (WARNING!!! bad pseudo code ahead!).

    Define
    Foo(x , y , z), addr , byte , addr;
    x addr /"This is the location in memory being examined.
    y byte /"This is the offset in memory of the result array.
    z addr /"This is the location in memory it is compared with.

    a byte /"The value of the location being examined.
    b byte /"The value of the location in memory it is being compared with.
    c byte /"This is the result of the comparison.

    { a ==GetMemVal(x);
    b ==Get MemVal(z);
    c == YourComparisonHere(a DELTA b); /"DELTA is whatever comparison you want to make.
    PutMemVal((x + (65536 * y) , c);
    }
    End Foo

    Define
    Array_Proc (done), Boole;
    {While (x++) /= 65536 do:
    Cog0 (foo(x , 1 , (x-257));
    Cog1 (foo(x , 2 , (x-256));
    Cog2 (foo(x , 3 , x-255));
    Cog3 (foo(x , 4 , x-1));
    Cog4 (foo(x , 5 , x+1));
    Cog5 (foo(x , 6 , x+255));
    Cog6 (foo(x , 7 , x+256));
    Cog7 (foo(x , 8 , x+257));
    } end of while;


    So you end up with 8 new arrays beginning at multiples of 65536 from the input array, each array is the result of a comparison between a pixel being tested and another pixel.

    If each pixel takes 50 assembly instructions, then that's one pixel array (a 256x256 image) in under 1/6th of a second.

    Now really with the cog structure you'd only need about 6 or 8 intructions to do the index/lookup functions, and I bet most image processing operations could be done in 8 to 12 assembly math instructions, more like 20 instructions overall and 15 images per second.

    Yours, TDP, ml, msl, & pfpp

    PS. On the likelihood I've screwed that up, someone please correct me. For example with 32kb of RAM, internal memory can only hold half a single 256x256 array, so fetches and stores to external RAM might screw the whole thing, duration wise.

    Post Edited (tperkins) : 4/24/2006 9:51:40 PM GMT
  • SciTech02SciTech02 Posts: 154
    edited 2006-04-25 19:32
    So it can process images, great.· I don't understand·the code·(yet), but it looks good.··One more thing, can it compare the images (Like if it processed two images from·two·CMU cams)?· For example: I wanted it to do a parallax method to find the distance·from the images, can it do that?·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There is always an answer.

    There is always a way.
    There is always a reason.··· -SciTech02.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-04-25 19:35
    The chip will be able to do what you want, the question is how fast do you need it to be? The main limiting factor will be internal memory, once that is exceeded, you have to goto external memory which will likely slow things down.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1+1=10
  • tperkinstperkins Posts: 98
    edited 2006-04-25 20:26
    Please, don't try to understand the code. I said it's bad pseudo code. That's like 20 years of programming cobbled into a fake language..

    Yech.

    I just meant to get across it will be much better at image processing than a single processor. In fact it will be almost 8 times better.

    Yours, TDP, ml,msl, & pfpp
  • Tom WalkerTom Walker Posts: 509
    edited 2006-04-26 14:03
    Also, keep in mind that you must also have a mechanism to get the "analog" image into the digital domain first. Specialized hardware will probably be needed..from as simple as a web-cam type of device to more complex fast ADCs or ASICs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
Sign In or Register to comment.