Forums > Jitter

Debayering / demosaicing

May 19, 2008 | 5:22 pm

Hello list,

Do you know if it’s possible to implement (and eventually how) a
debayering (or demosaicing / demosaicking) algorithm in Jitter ? I
got an Allied Tecs. color camera which works in RAW format. I
searched the forum but didn’t find anything about that.

Any idea or help would be greatly appreciated…
Best

Thierry

—————————————-
Thierry Fournier

http://www.thierryfournier.net


May 21, 2008 | 4:27 am


May 21, 2008 | 6:41 am


May 21, 2008 | 2:16 pm


June 13, 2008 | 10:33 am

im aiming for a simple linear debayer conversion.
if anyone like to help that’ll be great. its impossible

souces -
http://en.wikipedia.org/wiki/Demosaicing
http://scien.stanford.edu/class/psych221/projects/07/demosaicing/introduction.htm
http://web.cecs.pdx.edu/~cklin/demosaic/
http://tinyurl.com/6nu8nq – googlecode search, see demosaic section
(highlighted)

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 35 85 632 259;
#P window setfont "Sans Serif" 9.;
#P newex 223 35 27 9109513 + 30;
#P newex 191 36 27 9109513 + 36;
#P outlet 72 130 15 0;
#P newex 51 130 16 9109513 t l;
#P toggle 288 52 15 0;
#P message 289 69 64 9109513 usedstdim $1;
#P number 488 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 452 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 400 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 364 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 417 90 95 9109513 pak dstdimend 12 10;
#P newex 326 90 89 9109513 pak dstdimstart 0 0;
#P toggle 50 50 15 0;
#P message 51 67 64 9109513 usesrcdim $1;
#P number 250 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 214 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 162 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 126 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 179 88 95 9109513 pak srcdimend 12 10;
#P newex 88 88 89 9109513 pak srcdimstart 0 0;
#P connect 7 0 6 0;
#P fasten 9 0 16 0 422 119 56 119;
#P fasten 8 0 16 0 331 119 56 119;
#P fasten 14 0 16 0 294 108 56 108;
#P connect 6 0 16 0;
#P connect 0 0 16 0;
#P fasten 1 0 16 0 184 118 56 118;
#P connect 16 0 17 0;
#P connect 2 0 0 1;
#P connect 3 0 0 2;
#P connect 2 0 18 0;
#P connect 18 0 4 0;
#P connect 4 0 1 1;
#P connect 3 0 19 0;
#P connect 19 0 5 0;
#P connect 5 0 1 2;
#P connect 15 0 14 0;
#P connect 10 0 8 1;
#P connect 11 0 8 2;
#P connect 12 0 9 1;
#P connect 13 0 9 2;
#P pop;
#P newobj 42 103 44 9109513 p srcdim;
#P newex 17 126 218 9109513 jit.matrix 3 char 12 10 @planemap 1 2 3 @adapt
0;
#P user jit.pwindow 263 105 122 102 1 0 0 0 1 0;
#P toggle 17 21 15 0;
#P newex 17 41 44 9109513 metro 2;
#P newex 17 78 81 9109513 jit.qt.movie 12 10;
#B color 5;
#P message 67 42 290 9109513 read
http://shup.com/Shup/45595/Shades_framed_bayer_small.png;
#P user jit.fpsgui 102 520 60 9109513 3;
#P user jit.pwindow 16 511 82 62 1 0 0 0 1 0;
#P newex 17 487 568 9109513 jit.pack 3;
#P user jit.pwindow 208 409 82 62 1 0 0 0 1 0;
#P newex 209 381 132 9109513 jit.matrix 1 char 6 5 @adapt 0;
#P newex 209 335 146 9109513 jit.matrix 1 float32 6 5 @adapt 0;
#P newex 209 358 90 9109513 jit.op @op * @val 2;
#P newex 209 314 100 9109513 cv.jit.resize @size 6 5;
#P user jit.pwindow 400 409 82 62 1 0 0 0 1 0;
#P newex 401 339 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 401 315 147 9109513 jit.demultiplex @demultiplexdim 0;
#P user jit.pwindow 84 409 82 62 1 0 0 0 1 0;
#P newex 17 339 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 17 315 147 9109513 jit.demultiplex @demultiplexdim 0;
#P user jit.pwindow 415 245 82 62 1 0 0 0 1 0;
#P user jit.pwindow 221 245 82 62 1 0 0 0 1 0;
#P user jit.pwindow 37 245 82 62 1 0 0 0 1 0;
#P newex 17 223 586 9109513 jit.unpack 3;
#N vpatcher 15 55 932 466;
#P origin 0 -16;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P newex 419 27 371 9109513 jit.expr @expr
"(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.2-0.1" "(cell[0]*0.5%2.>0.6)*0.15-0.075"
"0." "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.1" "(cell[0]*0.5%2.>0.6)*0.1";
#P comment 438 60 302 9109513 this jit.expr object is the key to how we
generate a quad for each point in the incoming matrix , and assign texture
coordinates to each point.;
#P window linecount 1;
#P message 785 181 33 9109513 cell[0];
#P message 720 181 61 9109513 "(cell[0]%2) ";
#P message 705 146 94 9109513 "(cell[0]%2) + cell[0]";
#P newex 532 225 84 9109513 t b l;
#P button 522 183 15 0;
#P number 643 113 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 619 167 50 9109513 tosymbol;
#P newex 633 213 26 9109513 print;
#P newex 619 146 83 9109513 pak cell[0]% 0 + 2;
#P newex 620 190 62 9109513 prepend expr;
#P newex 521 298 94 9109513 jit.expr @expr cell[0];
#P newex 521 201 40 9109513 jit.noise;
#P window linecount 2;
#P newex 521 249 80 9109513 jit.matrix 1 float32 12 10 @adapt 0;
#P window linecount 1;
#P newex 172 264 175 9109513 jit.matrix 1 char 6 5 @interp 1 @adapt 0;
#P newex 92 124 356 9109513 jit.matrix 1 char 12 10 @adapt 0 @usedstdim 1
@dstdimstart 0 0 @dstdimend 10 8;
#P newex 93 213 86 9109513 jit.pack;
#P newex 75 66 78 9109513 jit.unpack;
#P newex 91 94 166 9109513 jit.submatrix @dim 12 10 @offset 1 1;
#B color 5;
#N vpatcher 35 85 632 259;
#P outlet 72 130 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 51 130 16 9109513 t l;
#P toggle 288 52 15 0;
#P message 289 69 64 9109513 usedstdim $1;
#P number 488 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 452 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 400 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 364 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 417 90 95 9109513 pak dstdimend 12 10;
#P newex 326 90 89 9109513 pak dstdimstart 0 0;
#P toggle 50 50 15 0;
#P message 51 67 64 9109513 usesrcdim $1;
#P number 250 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 214 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 162 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 126 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 179 88 95 9109513 pak srcdimend 12 10;
#P newex 88 88 89 9109513 pak srcdimstart 0 0;
#P connect 7 0 6 0;
#P fasten 9 0 16 0 422 119 56 119;
#P fasten 8 0 16 0 331 119 56 119;
#P fasten 14 0 16 0 294 108 56 108;
#P connect 6 0 16 0;
#P connect 0 0 16 0;
#P fasten 1 0 16 0 184 118 56 118;
#P connect 16 0 17 0;
#P connect 2 0 0 1;
#P connect 3 0 0 2;
#P connect 4 0 1 1;
#P connect 5 0 1 2;
#P connect 15 0 14 0;
#P connect 10 0 8 1;
#P connect 11 0 8 2;
#P connect 12 0 9 1;
#P connect 13 0 9 2;
#P pop;
#P newobj 56 269 90 9109513 p;
#P window linecount 2;
#P newex 50 290 298 9109513 jit.matrix 1 char 12 10 @adapt 0 @usesrcdim 1
@srcdimstart 1 1 @srcdimend 11 9 @usedstdim 0 @dstdimstart 0 0 @dstdimend 11
9;
#P window linecount 1;
#P newex 113 164 185 9109513 jit.matrix 1 char 24 20 @interp 1 @adapt 0;
#P inlet 75 46 15 0;
#P connect 3 0 2 0;
#P connect 0 0 5 0;
#P connect 5 1 4 0;
#P connect 4 0 7 0;
#P connect 7 0 6 0;
#P connect 5 2 1 0;
#P connect 1 0 6 1;
#P connect 5 3 6 2;
#P connect 17 0 10 0;
#P fasten 10 0 9 0 526 223 526 223;
#P connect 18 0 9 0;
#P connect 9 0 11 0;
#P fasten 18 1 11 0 611 289 526 289;
#P fasten 12 0 18 0 625 221 537 221;
#P fasten 13 0 15 0 624 166 624 166;
#P connect 15 0 12 0;
#P fasten 19 0 12 0 710 188 625 188;
#P connect 20 0 12 0;
#P connect 21 0 12 0;
#P fasten 12 0 14 0 625 211 638 211;
#P connect 16 0 13 1;
#P pop;
#P newobj 491 55 30 9109513 p;
#P comment 67 26 174 9109513 http://en.wikipedia.org/wiki/Demosaicing;
#P user jit.pwindow 109 164 62 52 1 0 0 0 1 0;
#P connect 22 0 26 0;
#P fasten 22 0 25 0 22 99 269 99;
#P fasten 21 0 22 0 72 68 22 68;
#P fasten 23 0 22 0 22 71 22 71;
#P connect 26 0 3 0;
#P fasten 26 0 0 0 22 161 115 161;
#P fasten 27 0 26 0 47 124 22 124;
#P connect 18 0 19 0;
#P fasten 18 0 20 0 22 509 107 509;
#P connect 11 0 12 0;
#P fasten 11 0 18 2 406 361 580 361;
#P connect 3 2 10 0;
#P connect 3 2 6 0;
#P connect 10 0 11 0;
#P connect 16 0 17 0;
#P fasten 16 0 18 1 214 404 301 404;
#P connect 3 1 13 0;
#P connect 3 1 5 0;
#P connect 14 0 16 0;
#P connect 15 0 14 0;
#P connect 13 0 15 0;
#P fasten 8 1 18 0 90 369 22 369;
#P fasten 8 1 9 0 90 361 90 361;
#P connect 3 0 7 0;
#P connect 3 0 4 0;
#P fasten 7 1 8 0 90 336 22 336;
#P connect 24 0 23 0;
#P window clipboard copycount 28;

tags: demosaic, debayer, fail


June 13, 2008 | 1:00 pm

tighter, the wikipedia image source was not pixel accurate, now it looks
better, but jaggy. need interpolation or fancier algo.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex -1 110 19 9109513 t 1;
#P user jit.pwindow 16 452 102 102 1 0 0 0 1 0;
#P newex 17 428 152 9109513 jit.matrix 4 char 100 100 @adapt 0;
#P newex 17 308 148 9109513 t b l;
#P message 27 65 278 9109513 read
http://shup.com/Shup/45607/Shades_framed_bayer100.png;
#B color 5;
#P user jit.pwindow 144 110 102 102 1 0 0 0 1 0;
#P toggle 17 21 15 0;
#P newex 17 41 44 9109513 metro 2;
#P newex 17 85 91 9109513 jit.qt.movie 100 100;
#B color 5;
#P user jit.fpsgui 185 424 60 9109513 3;
#P newex 17 397 387 9109513 jit.pack 4;
#P user jit.pwindow 193 331 52 52 1 0 0 0 1 0;
#P newex 194 257 142 9109513 jit.matrix 1 char 50 50 @adapt 0;
#P user jit.pwindow 453 331 52 52 1 0 0 0 1 0;
#P newex 386 286 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 386 257 147 9109513 jit.demultiplex @demultiplexdim 0;
#P user jit.pwindow 42 331 52 52 1 0 0 0 1 0;
#P newex 17 286 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 17 257 147 9109513 jit.demultiplex @demultiplexdim 0;
#P newex 17 223 561 9109513 jit.unpack 4;
#P comment 67 26 174 9109513 http://en.wikipedia.org/wiki/Demosaicing;
#P connect 12 0 1 0;
#P fasten 12 0 15 0 22 106 150 106;
#P connect 8 0 9 0;
#P fasten 8 0 10 2 199 309 272 309;
#P fasten 6 1 10 3 459 322 397 322;
#P connect 6 1 7 0;
#P connect 10 0 18 0;
#P fasten 10 0 11 0 22 420 190 420;
#P connect 3 0 17 0;
#P connect 3 0 4 0;
#P fasten 1 2 8 0 296 249 199 249;
#P fasten 12 1 20 0 103 107 4 107;
#P connect 20 0 14 0;
#P connect 14 0 13 0;
#P fasten 16 0 12 0 32 83 22 83;
#P fasten 13 0 12 0 22 78 22 78;
#P fasten 1 1 2 0 159 249 22 249;
#P fasten 2 1 3 0 90 281 22 281;
#P connect 17 0 10 0;
#P fasten 18 0 19 0 22 450 22 450;
#P fasten 17 1 10 1 160 387 147 387;
#P fasten 1 3 5 0 433 250 391 250;
#P connect 5 0 6 0;
#P window clipboard copycount 21;

On Fri, Jun 13, 2008 at 12:33 PM, yair reshef wrote:

> im aiming for a simple linear debayer conversion.
> if anyone like to help that’ll be great. its impossible
>
> souces -
> http://en.wikipedia.org/wiki/Demosaicing
>
> http://scien.stanford.edu/class/psych221/projects/07/demosaicing/introduction.htm
> http://web.cecs.pdx.edu/~cklin/demosaic/< http://web.cecs.pdx.edu/%7Ecklin/demosaic/>
>
http://tinyurl.com/6nu8nq – googlecode search, see demosaic section
> (highlighted)
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #N vpatcher 35 85 632 259;
> #P window setfont "Sans Serif" 9.;
> #P newex 223 35 27 9109513 + 30;
> #P newex 191 36 27 9109513 + 36;
> #P outlet 72 130 15 0;
> #P newex 51 130 16 9109513 t l;
> #P toggle 288 52 15 0;
> #P message 289 69 64 9109513 usedstdim $1;
> #P number 488 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 452 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 400 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 364 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 417 90 95 9109513 pak dstdimend 12 10;
> #P newex 326 90 89 9109513 pak dstdimstart 0 0;
> #P toggle 50 50 15 0;
> #P message 51 67 64 9109513 usesrcdim $1;
> #P number 250 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 214 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 162 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 126 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 179 88 95 9109513 pak srcdimend 12 10;
> #P newex 88 88 89 9109513 pak srcdimstart 0 0;
> #P connect 7 0 6 0;
> #P fasten 9 0 16 0 422 119 56 119;
> #P fasten 8 0 16 0 331 119 56 119;
> #P fasten 14 0 16 0 294 108 56 108;
> #P connect 6 0 16 0;
> #P connect 0 0 16 0;
> #P fasten 1 0 16 0 184 118 56 118;
> #P connect 16 0 17 0;
> #P connect 2 0 0 1;
> #P connect 3 0 0 2;
> #P connect 2 0 18 0;
> #P connect 18 0 4 0;
> #P connect 4 0 1 1;
> #P connect 3 0 19 0;
> #P connect 19 0 5 0;
> #P connect 5 0 1 2;
> #P connect 15 0 14 0;
> #P connect 10 0 8 1;
> #P connect 11 0 8 2;
> #P connect 12 0 9 1;
> #P connect 13 0 9 2;
> #P pop;
> #P newobj 42 103 44 9109513 p srcdim;
> #P newex 17 126 218 9109513 jit.matrix 3 char 12 10 @planemap 1 2 3 @adapt
> 0;
> #P user jit.pwindow 263 105 122 102 1 0 0 0 1 0;
> #P toggle 17 21 15 0;
> #P newex 17 41 44 9109513 metro 2;
> #P newex 17 78 81 9109513 jit.qt.movie 12 10;
> #B color 5;
> #P message 67 42 290 9109513 read
> http://shup.com/Shup/45595/Shades_framed_bayer_small.png;
> #P user jit.fpsgui 102 520 60 9109513 3;
> #P user jit.pwindow 16 511 82 62 1 0 0 0 1 0;
> #P newex 17 487 568 9109513 jit.pack 3;
> #P user jit.pwindow 208 409 82 62 1 0 0 0 1 0;
> #P newex 209 381 132 9109513 jit.matrix 1 char 6 5 @adapt 0;
> #P newex 209 335 146 9109513 jit.matrix 1 float32 6 5 @adapt 0;
> #P newex 209 358 90 9109513 jit.op @op * @val 2;
> #P newex 209 314 100 9109513 cv.jit.resize @size 6 5;
> #P user jit.pwindow 400 409 82 62 1 0 0 0 1 0;
> #P newex 401 339 147 9109513 jit.demultiplex @demultiplexdim 1;
> #P newex 401 315 147 9109513 jit.demultiplex @demultiplexdim 0;
> #P user jit.pwindow 84 409 82 62 1 0 0 0 1 0;
> #P newex 17 339 147 9109513 jit.demultiplex @demultiplexdim 1;
> #P newex 17 315 147 9109513 jit.demultiplex @demultiplexdim 0;
> #P user jit.pwindow 415 245 82 62 1 0 0 0 1 0;
> #P user jit.pwindow 221 245 82 62 1 0 0 0 1 0;
> #P user jit.pwindow 37 245 82 62 1 0 0 0 1 0;
> #P newex 17 223 586 9109513 jit.unpack 3;
> #N vpatcher 15 55 932 466;
> #P origin 0 -16;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 2;
> #P newex 419 27 371 9109513 jit.expr @expr
> "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.2-0.1" "(cell[0]*0.5%2.>0.6)*0.15-0.075"
> "0." "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.1" "(cell[0]*0.5%2.>0.6)*0.1";
> #P comment 438 60 302 9109513 this jit.expr object is the key to how we
> generate a quad for each point in the incoming matrix , and assign texture
> coordinates to each point.;
> #P window linecount 1;
> #P message 785 181 33 9109513 cell[0];
> #P message 720 181 61 9109513 "(cell[0]%2) ";
> #P message 705 146 94 9109513 "(cell[0]%2) + cell[0]";
> #P newex 532 225 84 9109513 t b l;
> #P button 522 183 15 0;
> #P number 643 113 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 619 167 50 9109513 tosymbol;
> #P newex 633 213 26 9109513 print;
> #P newex 619 146 83 9109513 pak cell[0]% 0 + 2;
> #P newex 620 190 62 9109513 prepend expr;
> #P newex 521 298 94 9109513 jit.expr @expr cell[0];
> #P newex 521 201 40 9109513 jit.noise;
> #P window linecount 2;
> #P newex 521 249 80 9109513 jit.matrix 1 float32 12 10 @adapt 0;
> #P window linecount 1;
> #P newex 172 264 175 9109513 jit.matrix 1 char 6 5 @interp 1 @adapt 0;
> #P newex 92 124 356 9109513 jit.matrix 1 char 12 10 @adapt 0 @usedstdim 1
> @dstdimstart 0 0 @dstdimend 10 8;
> #P newex 93 213 86 9109513 jit.pack;
> #P newex 75 66 78 9109513 jit.unpack;
> #P newex 91 94 166 9109513 jit.submatrix @dim 12 10 @offset 1 1;
> #B color 5;
> #N vpatcher 35 85 632 259;
> #P outlet 72 130 15 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 51 130 16 9109513 t l;
> #P toggle 288 52 15 0;
> #P message 289 69 64 9109513 usedstdim $1;
> #P number 488 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 452 72 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 400 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 364 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 417 90 95 9109513 pak dstdimend 12 10;
> #P newex 326 90 89 9109513 pak dstdimstart 0 0;
> #P toggle 50 50 15 0;
> #P message 51 67 64 9109513 usesrcdim $1;
> #P number 250 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 214 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 162 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 126 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 179 88 95 9109513 pak srcdimend 12 10;
> #P newex 88 88 89 9109513 pak srcdimstart 0 0;
> #P connect 7 0 6 0;
> #P fasten 9 0 16 0 422 119 56 119;
> #P fasten 8 0 16 0 331 119 56 119;
> #P fasten 14 0 16 0 294 108 56 108;
> #P connect 6 0 16 0;
> #P connect 0 0 16 0;
> #P fasten 1 0 16 0 184 118 56 118;
> #P connect 16 0 17 0;
> #P connect 2 0 0 1;
> #P connect 3 0 0 2;
> #P connect 4 0 1 1;
> #P connect 5 0 1 2;
> #P connect 15 0 14 0;
> #P connect 10 0 8 1;
> #P connect 11 0 8 2;
> #P connect 12 0 9 1;
> #P connect 13 0 9 2;
> #P pop;
> #P newobj 56 269 90 9109513 p;
> #P window linecount 2;
> #P newex 50 290 298 9109513 jit.matrix 1 char 12 10 @adapt 0 @usesrcdim 1
> @srcdimstart 1 1 @srcdimend 11 9 @usedstdim 0 @dstdimstart 0 0 @dstdimend 11
> 9;
> #P window linecount 1;
> #P newex 113 164 185 9109513 jit.matrix 1 char 24 20 @interp 1 @adapt 0;
> #P inlet 75 46 15 0;
> #P connect 3 0 2 0;
> #P connect 0 0 5 0;
> #P connect 5 1 4 0;
> #P connect 4 0 7 0;
> #P connect 7 0 6 0;
> #P connect 5 2 1 0;
> #P connect 1 0 6 1;
> #P connect 5 3 6 2;
> #P connect 17 0 10 0;
> #P fasten 10 0 9 0 526 223 526 223;
> #P connect 18 0 9 0;
> #P connect 9 0 11 0;
> #P fasten 18 1 11 0 611 289 526 289;
> #P fasten 12 0 18 0 625 221 537 221;
> #P fasten 13 0 15 0 624 166 624 166;
> #P connect 15 0 12 0;
> #P fasten 19 0 12 0 710 188 625 188;
> #P connect 20 0 12 0;
> #P connect 21 0 12 0;
> #P fasten 12 0 14 0 625 211 638 211;
> #P connect 16 0 13 1;
> #P pop;
> #P newobj 491 55 30 9109513 p;
> #P comment 67 26 174 9109513 http://en.wikipedia.org/wiki/Demosaicing;
> #P user jit.pwindow 109 164 62 52 1 0 0 0 1 0;
> #P connect 22 0 26 0;
> #P fasten 22 0 25 0 22 99 269 99;
> #P fasten 21 0 22 0 72 68 22 68;
> #P fasten 23 0 22 0 22 71 22 71;
> #P connect 26 0 3 0;
> #P fasten 26 0 0 0 22 161 115 161;
> #P fasten 27 0 26 0 47 124 22 124;
> #P connect 18 0 19 0;
> #P fasten 18 0 20 0 22 509 107 509;
> #P connect 11 0 12 0;
> #P fasten 11 0 18 2 406 361 580 361;
> #P connect 3 2 10 0;
> #P connect 3 2 6 0;
> #P connect 10 0 11 0;
> #P connect 16 0 17 0;
> #P fasten 16 0 18 1 214 404 301 404;
> #P connect 3 1 13 0;
> #P connect 3 1 5 0;
> #P connect 14 0 16 0;
> #P connect 15 0 14 0;
> #P connect 13 0 15 0;
> #P fasten 8 1 18 0 90 369 22 369;
> #P fasten 8 1 9 0 90 361 90 361;
> #P connect 3 0 7 0;
> #P connect 3 0 4 0;
> #P fasten 7 1 8 0 90 336 22 336;
> #P connect 24 0 23 0;
> #P window clipboard copycount 28;
>
> tags: demosaic, debayer, fail
>


June 14, 2008 | 10:55 pm

i’ve been reading about this demosaicing thing, and its a bitch. tons of
different concepts.
demosaicing on gpu- http://rw4.cs.uni-sb.de/~phlucas/pubs/Diss.pdf (see p.
146)
RAW decoder comparison – http://users.tkk.fi/%7Estanhua/rawcomp/

im aiming low and skip cross gradient checking, group ranking etc etc for a
simple working one. but I’m failing with implementing some basic ideas with
jitter matrices.

1.how do i write an efficient exprop that for every ON pixel will copy the
value of the ON pixel to the one to its right (and latter, to which one of
its nine neighbours)
like
if getcell(x,y)>0 then cell(x+1,y)=getcell(x,y)

2. how do i preform a sum of pixels with fixed distribution (not sure about
the usage of Distro here),
like
set of {0 0 1 0 0 1 0 0 1 0 0 1} sum every 3rd member.
[jit.demultiplex @scan_a 3] > cv.jit.sum

zl for matrices.


June 16, 2008 | 4:43 pm

for the interested, a repos version, but this is going nowhere

#P user gswitch2 19 150 39 32 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 796 181 1182 496;
#P window setfont "Sans Serif" 9.;
#P newex 196 80 45 9109513 loadbang;
#P newex 85 225 32 9109513 t b l;
#P newex 85 251 78 9109513 jit.pack;
#P newex 151 221 159 9109513 jit.repos @in2_dim 100 100;
#N vpatcher 484 236 968 675;
#P origin 0 7;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 35 381 212 9109513 jit.pack 2;
#P outlet 35 409 15 0;
#P window linecount 0;
#P newex 238 213 27 9109513 – 1;
#P inlet 35 44 15 0;
#P newex 238 358 59 9109513 jit.transpose;
#P newex 35 334 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P newex 238 337 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P newex 238 239 88 9109513 t b i;
#P newex 238 266 90 9109513 pack setcell 0 val 0;
#P comment 283 286 38 9109513 plane y;
#P newex 330 316 26 9109513 print;
#P newex 238 315 90 9109513 jit.matrix 1 long 100;
#P newex 81 213 27 9109513 – 1;
#P newex 35 239 120 9109513 t b i;
#P newex 35 263 123 9109513 pack setcell 0 plane 0 val 0;
#P button 35 65 15 0;
#P newex 35 94 323 9109513 Uzi 100;
#P newex 35 213 27 9109513 – 2;
#P newex 35 136 56 9109513 t i i i;
#P newex 35 183 27 9109513 +;
#N counter 1 100;
#X flags 0 0;
#P newobj 35 115 66 9109513 counter 1 100;
#P newex 52 161 27 9109513 % 2;
#P newex 35 312 90 9109513 jit.matrix 1 long 100;
#P comment 80 283 38 9109513 plane x;
#P connect 20 0 8 0;
#P fasten 8 0 7 0 40 87 40 87;
#P connect 7 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 10 0;
#P connect 10 0 9 0;
#P connect 7 1 1 0;
#P fasten 9 0 1 0 40 303 40 303;
#P connect 1 0 18 0;
#P connect 18 0 23 0;
#P connect 23 0 22 0;
#P fasten 5 1 2 0 63 158 57 158;
#P connect 2 0 4 1;
#P connect 11 0 9 1;
#P connect 5 2 11 0;
#P connect 10 1 9 5;
#P connect 19 0 23 1;
#P fasten 4 0 21 0 40 209 243 209;
#P connect 21 0 16 0;
#P connect 16 0 15 0;
#P fasten 15 0 12 0 243 306 243 306;
#P connect 7 1 12 0;
#P connect 12 0 17 0;
#P connect 17 0 19 0;
#P fasten 11 0 15 1 86 234 269 234;
#P connect 16 1 15 3;
#P pop;
#P newobj 300 126 47 9109513 p blue;
#P newex 129 198 129 9109513 jit.repos @in2_dim 100 100;
#N vpatcher 195 158 789 572;
#P origin 0 -8;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 13 321 334 9109513 jit.pack 2;
#P outlet 13 349 15 0;
#P newex 337 131 27 9109513 – 1;
#P newex 337 298 59 9109513 jit.transpose;
#P newex 337 154 36 9109513 t i i;
#P newex 440 251 26 9109513 print;
#P newex 337 273 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P newex 337 178 88 9109513 t b i;
#P newex 337 202 90 9109513 pack setcell 0 val 0;
#P newex 337 251 90 9109513 jit.matrix 1 long 100;
#P comment 382 222 38 9109513 plane x;
#P newex 116 251 26 9109513 print;
#P window linecount 0;
#P newex 158 152 27 9109513 – 1;
#P inlet 13 -17 15 0;
#P newex 13 273 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P newex 158 178 114 9109513 t b i;
#P newex 158 202 115 9109513 pack setcell 0 1 val 0;
#P comment 261 225 38 9109513 plane y;
#P newex 59 152 27 9109513 – 1;
#P newex 13 178 118 9109513 t b i;
#P newex 13 202 121 9109513 pack setcell 0 0 val 0;
#P button 13 4 15 0;
#P newex 13 33 449 9109513 uzi 100;
#P newex 13 152 27 9109513 – 2;
#P newex 13 75 56 9109513 t i i i;
#P newex 13 122 27 9109513 +;
#N counter 1 100;
#X flags 0 0;
#P newobj 13 54 66 9109513 counter 1 100;
#P newex 30 100 27 9109513 % 2;
#P newex 13 251 98 9109513 jit.matrix 1 long 100 2;
#P comment 58 222 38 9109513 plane x;
#P connect 16 0 8 0;
#P fasten 8 0 7 0 18 26 18 26;
#P connect 7 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 10 0;
#P connect 10 0 9 0;
#P connect 7 1 1 0;
#P fasten 13 0 1 0 163 242 18 242;
#P connect 9 0 1 0;
#P connect 1 0 15 0;
#P connect 15 0 29 0;
#P connect 29 0 28 0;
#P fasten 5 1 2 0 41 97 35 97;
#P connect 2 0 4 1;
#P connect 11 0 9 1;
#P connect 5 2 11 0;
#P connect 10 1 9 4;
#P fasten 4 0 17 0 18 148 163 148;
#P connect 17 0 14 0;
#P connect 14 0 13 0;
#P fasten 11 0 13 1 64 173 189 173;
#P connect 14 1 13 4;
#P fasten 5 2 27 0 64 120 342 120;
#P connect 27 0 25 0;
#P connect 25 0 22 0;
#P connect 22 0 21 0;
#P connect 21 0 20 0;
#P connect 7 1 20 0;
#P connect 20 0 23 0;
#P connect 23 0 26 0;
#P connect 26 0 29 1;
#P connect 25 1 21 1;
#P connect 22 1 21 3;
#P pop;
#P newobj 248 126 46 9109513 p green;
#P button 196 102 15 0;
#N vpatcher 484 236 968 675;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 35 394 213 9109513 jit.pack 2;
#P window linecount 0;
#P newex 238 220 27 9109513 – 2;
#P inlet 35 51 15 0;
#P newex 238 365 59 9109513 jit.transpose;
#P newex 35 341 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P newex 238 344 164 9109513 jit.scanwrap 1 long 100 100 @mode 3;
#P outlet 35 422 15 0;
#P newex 238 246 88 9109513 t b i;
#P newex 238 273 90 9109513 pack setcell 0 val 0;
#P comment 283 293 38 9109513 plane y;
#P newex 330 323 26 9109513 print;
#P newex 238 322 90 9109513 jit.matrix 1 long 100;
#P newex 81 220 27 9109513 – 1;
#P newex 35 246 120 9109513 t b i;
#P newex 35 270 123 9109513 pack setcell 0 plane 0 val 0;
#P button 35 72 15 0;
#P newex 35 101 276 9109513 Uzi 100;
#P newex 35 220 27 9109513 – 1;
#P newex 35 143 56 9109513 t i i i;
#P newex 35 190 27 9109513 +;
#N counter 1 100;
#X flags 0 0;
#P newobj 35 122 66 9109513 counter 1 100;
#P newex 52 168 27 9109513 % 2;
#P newex 35 319 90 9109513 jit.matrix 1 long 100;
#P comment 80 290 38 9109513 plane x;
#P connect 21 0 8 0;
#P fasten 8 0 7 0 40 94 40 94;
#P connect 7 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 10 0;
#P connect 10 0 9 0;
#P connect 7 1 1 0;
#P fasten 9 0 1 0 40 310 40 310;
#P connect 1 0 19 0;
#P connect 19 0 23 0;
#P connect 23 0 17 0;
#P fasten 5 1 2 0 63 165 57 165;
#P connect 2 0 4 1;
#P connect 11 0 9 1;
#P connect 5 2 11 0;
#P connect 10 1 9 5;
#P fasten 4 0 22 0 40 216 243 216;
#P connect 22 0 16 0;
#P connect 16 0 15 0;
#P connect 7 1 12 0;
#P fasten 15 0 12 0 243 313 243 313;
#P connect 12 0 18 0;
#P connect 18 0 20 0;
#P connect 20 0 23 1;
#P fasten 11 0 15 1 86 241 269 241;
#P connect 16 1 15 3;
#P pop;
#P newobj 196 126 46 9109513 p red;
#P newex 85 176 121 9109513 jit.repos @in2_dim 100 100;
#P newex 50 50 151 9109513 jit.unpack 4;
#P inlet 50 30 15 0;
#P outlet 85 275 15 0;
#P connect 1 0 2 0;
#P connect 2 1 3 0;
#P connect 3 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 0 0;
#P connect 11 1 10 1;
#P fasten 2 2 7 0 125 133 134 133;
#P connect 7 0 10 2;
#P fasten 2 3 9 0 160 145 156 145;
#P connect 9 0 10 3;
#P connect 12 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 3 1;
#P fasten 5 0 6 0 201 121 253 121;
#P connect 6 0 7 1;
#P fasten 5 0 8 0 201 121 305 121;
#P connect 8 0 9 1;
#P pop;
#P newobj 18 185 39 9109513 p repos;
#N vpatcher 25 70 686 370;
#P window setfont "Sans Serif" 9.;
#P newex 50 135 148 9109513 t b l;
#P newex 50 224 387 9109513 jit.pack 4;
#P user jit.pwindow 226 158 52 52 1 0 0 0 1 0;
#P newex 227 84 142 9109513 jit.matrix 1 char 50 50 @adapt 0;
#P user jit.pwindow 486 158 52 52 1 0 0 0 1 0;
#P newex 419 113 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 419 84 147 9109513 jit.demultiplex @demultiplexdim 0;
#P user jit.pwindow 75 158 52 52 1 0 0 0 1 0;
#P newex 50 113 147 9109513 jit.demultiplex @demultiplexdim 1;
#P newex 50 84 147 9109513 jit.demultiplex @demultiplexdim 0;
#P newex 50 50 561 9109513 jit.unpack 4;
#P inlet 50 30 15 0;
#P outlet 50 248 15 0;
#P connect 1 0 2 0;
#P fasten 2 1 3 0 192 76 55 76;
#P fasten 3 1 4 0 123 108 55 108;
#P connect 4 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 0 0;
#P connect 4 0 5 0;
#P fasten 12 1 11 1 193 214 180 214;
#P fasten 2 2 9 0 329 76 232 76;
#P connect 9 0 10 0;
#P fasten 9 0 11 2 232 136 305 136;
#P fasten 2 3 6 0 466 77 424 77;
#P connect 6 0 7 0;
#P fasten 7 1 11 3 492 149 430 149;
#P connect 7 1 8 0;
#P pop;
#P newobj 59 185 63 9109513 p demultiplex;
#P newex 18 226 111 9109513 jit.window @size 500 500;
#P newex 0 110 19 9109513 t 1;
#P message 28 65 278 9109513 read
http://shup.com/Shup/45607/Shades_framed_bayer100.png;
#B color 5;
#P user jit.pwindow 154 130 102 102 1 0 0 0 1 0;
#P toggle 18 21 15 0;
#P newex 18 41 45 9109513 metro 55;
#P newex 18 85 91 9109513 jit.qt.movie 100 100;
#B color 5;
#P comment 68 26 174 9109513 http://en.wikipedia.org/wiki/Demosaicing;
#P connect 1 0 10 1;
#P fasten 1 0 4 0 23 106 160 106;
#P connect 10 1 8 0;
#P connect 9 0 7 0;
#P fasten 8 0 7 0 64 215 23 215;
#P connect 10 0 9 0;
#P fasten 5 0 1 0 33 83 23 83;
#P fasten 2 0 1 0 23 78 23 78;
#P connect 3 0 2 0;
#P connect 6 0 3 0;
#P fasten 1 1 6 0 104 107 5 107;
#P window clipboard copycount 11;

On Sun, Jun 15, 2008 at 12:55 AM, yair reshef wrote:

> i’ve been reading about this demosaicing thing, and its a bitch. tons of
> different concepts.
> demosaicing on gpu- http://rw4.cs.uni-sb.de/~phlucas/pubs/Diss.pdf< http://rw4.cs.uni-sb.de/%7Ephlucas/pubs/Diss.pdf>(see p. 146)
> RAW decoder comparison –
http://users.tkk.fi/%7Estanhua/rawcomp/
>
> im aiming low and skip cross gradient checking, group ranking etc etc for a
> simple working one. but I’m failing with implementing some basic ideas with
> jitter matrices.
>
> 1.how do i write an efficient exprop that for every ON pixel will copy the
> value of the ON pixel to the one to its right (and latter, to which one of
> its nine neighbours)
> like
> if getcell(x,y)>0 then cell(x+1,y)=getcell(x,y)
>
> 2. how do i preform a sum of pixels with fixed distribution (not sure about
> the usage of Distro here),
> like
> set of {0 0 1 0 0 1 0 0 1 0 0 1} sum every 3rd member.
> [jit.demultiplex @scan_a 3] > cv.jit.sum
>
>
> zl for matrices.
>
>
>


June 16, 2008 | 6:05 pm

Hrm. This sounds fun, Im at work so cant check it out too much, but for your "1.how do i write an efficient exprop that for every ON pixel will copy the value of the ON pixel to the one to its right (and latter, to which one of its nine neighbours)?"

Perhaps you could do a jit.op @op > 1, and then a convolution filter, which would move all values to the left, a filter something like?

0 0 0
1 1 0
0 0 0

? for a 9 point convolution kernel?

This sounds like a really fun challenge.


June 16, 2008 | 8:11 pm

Unfortunately, I don’t have too much time to play around with this right now,but in looking at some of the links you provided, I came up with a quick fragment shader that (I think) does what you are trying to accomplish. Check out the attached patch and shader file.

Best,
Andrew B.

– Pasted Max Patch, click to expand. –

June 16, 2008 | 8:13 pm

Sorry, here is the shader…


June 17, 2008 | 11:46 am

the internets will (also) thank you for this

i’ll look into the shader, i know your have a lot of work so double tnx


June 14, 2013 | 5:20 am

Andrew, can you please upload the shader again?


June 14, 2013 | 5:27 am

By the way, now I see that it works without it.

And it is a bit weird that the patch works even though I don’t have the ab.debayer.jxs file on my mac. "jit.gl.shader: can’t find file ab.debayer.jxs"


Viewing 14 posts - 1 through 14 (of 14 total)