Hi! I've been thinking about how to reduce the blotches that appear in dark scenes. The problem I believe is one of noise which raises what should be 'black' up to various levels of grey.
I came up with a simple (i.e. very dumb, perhaps too much so) program to generate a histogram of a Y4MPEG2 frame. Using the program on frames which should have been close to solid black (Y' 16, Cr 128, Cb 128) produced some interesting numbers. Of course perfection (all pixels being exactly 16/128/128) is not expected. The variation was quite a bit higher than expected - no wonder there are areas of grey blocks that show up later on. The blocks of non-black are *very* visible when you use y4mtoppm and convert the frame to PPM and view it with the GIMP and 'zoom in'. The columns are Component (Y/U/V), Value (0 thru 255), count of pixels with Value: Y 16 4548 Y 17 4394 Y 18 1465 Y 19 1898 Y 20 3185 Y 21 5589 Y 22 9410 Y 23 15087 Y 24 23431 Y 25 31949 Y 26 39661 Y 27 46066 Y 28 45264 Y 29 38144 Y 30 29041 Y 31 20556 Y 32 12810 Y 33 6805 Y 34 3410 Y 35 1569 Y 36 685 Y 37 380 Y 38 143 Y 39 59 Y 40 31 Y 41 7 Y 42 6 Y 43 3 Y 44 0 Y 45 0 Y 46 1 Y 47 1 Y 48 0 Y 49 0 Y 50 0 Y 51 1 Y 52 0 Y 53 0 Y 54 0 Y 55 0 Y 56 0 Y 57 0 Y 58 0 Y 59 0 Y 60 0 Y 61 0 Y 62 0 Y 63 0 Y 64 0 Y 65 0 Y 66 0 Y 67 0 Y 68 0 Y 69 0 Y 70 0 Y 71 0 Y 72 0 Y 73 0 Y 74 0 Y 75 0 Y 76 0 Y 77 1 ------- totals to the expected 720*480 (or 345600) pixels U 103 2 U 104 0 U 105 0 U 106 0 U 107 0 U 108 2 U 109 0 U 110 0 U 111 2 U 112 0 U 113 2 U 114 2 U 115 0 U 116 2 U 117 0 U 118 0 U 119 2 U 120 4 U 121 4 U 122 24 U 123 90 U 124 340 U 125 1048 U 126 3872 U 127 9888 U 128 20262 U 129 27038 U 130 15510 U 131 5820 U 132 1806 U 133 502 U 134 134 U 135 34 U 136 8 U 137 2 V 119 22 V 120 108 V 121 446 V 122 1862 V 123 6384 V 124 16696 V 125 23840 V 126 18916 V 127 10786 V 128 5138 V 129 1682 V 130 420 V 131 92 V 132 8 The Y values seem to be centered around 27 or 28 with a range of +/- 8 to encompass the bulk of the pixels. Quite a variation that will produce various levels of grey/black. As you can see the U and V components are centered around 128 as expected for 'black' but there is a range of about +/- 6 that It'd be interesting to see what other folks see for 'black frames'. Perhaps a filter could clean up 'dark' scenes by only operating on pixels which have Y' less than 48 (or a specific limit) and U/V within a specified range of 128. Turning something like 34/134/124 into 28/128/128 for example. Perhaps counting the pixels of a frame first and only operating on frames that have a specified percentage of 'dark' pixels would be a good idea - leave the lighter scenes untouched. When a movie fades to black the number of darker pixels dramatically increases and the filter would become active/aggressive about reducing the number of shades of black. Sound like a reasonable approach or am I off in the weeds? ;) Cheers, Steven Schultz ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Mjpeg-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mjpeg-users