Zoom : adding 'no aspect ratio change' in general settings (1 Viewer)

Would you like to be able to set up the zoom modes you want to use ?


  • Total voters
    373

jawbroken

Portal Pro
August 13, 2005
706
0
Afghanistan Afghanistan
NLS said:
indeed

being ugly in the minds of some people and being CPU intensive for those who want to use it, doesn't mean it shouldn't be implemented

people that like it (and can "afford" it) will use it... the others won't

ALL 16:9 TV on planet Earth right now implement this feature. So it must be nice to some people (I know I always see TV like that and yes the guys near the edges look weird :) ...but since I am not one of them, I don't care... after all who cares about "video clarity" in a discussion show hehehe)
I was mainly making the point that this thread had a simpler, more achievable focus in mind, not that your suggestion should never be implemented. Also, if ALL 16:9 TVs on the planet implement this feature already, isn't it possible for people who want this to use their TVs aspect ratio correction as a sort of workaround in the mean time? I see the simpler aspect ratio options as a more important as far as usability and feasibility go, is all.
 

ziphnor

Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Denmark Denmark
    jawbroken said:
    That is looking pretty good. Would you consider sharing a description of the algorithm or sharing the code you have used? How fast does it currently run?
    Not at all, its an embarrasingly simple approach. First of i rely on the assumption that logos will be either to left or top right and define an interval on the x-axis where i dont expect to find logos. In that interval i choose a number of random x values which are my samples points. I then start scanning from the bottom up. For each line y, i calculate the average R,G,B values of the samples points, and then sum over the sample points deviation from the average. This gives an indications of how different the image is at the sample points, so it will find consider any non-uniform line as image content. This catches most things, but not uniform white for example, so another check is added considering the max of any color component(R,G,B) seen by a sample point, if that is high enough it is also considered as content(would capture any kind of at least somewhat bright uniform background). The reason i dont just use the last method alone, is that very dark images will have low color components, but still have a variation i dark colors which will yield a variance from the average not seen in the black edges. Noise on analogue signals might confuse it though(i use DVB-C) since it can add 'snow' to the black edges.

    In order to avoid considering VBI data or whatever that whiteblack line is in some of my screenshots as content, a line is only considered image content if the next line also fullfills this criteria.

    For the above i think i used 20 sample points, meaning i sample 20*576 pixels in total. I havent optimized it yet, the annoying lookahead mentioned above causes some double-work right now(easily fixed). I could also reduce the scanned lines by ~50% by scanning bottom up, and then top down instead of going right through the image. Furthermore i have considered trying a binary search style scan, which i think would make it capable of running in real-time. I havent timed it as such yet, but will do.

    Right now, i would howevever prefer to get an idea of how to add it to mediaportal. I have no idea where to look in the code, so some assistance would be appreciated.

    As for 4:3 in 16:9, ie black bars on the side, this could easily be added by scanning sideways as long as one has an idea where the logos will be encountered.

    Btw, it would be nice if i could get some more screenshots(or better yet, direct frame grabs from the video) to try out. If you have some you can email them to ziphnor@gmail.com (Dont worry its a spam email address anyway :) Just put [Screenshot] in the subject so i can find them.
     

    jawbroken

    Portal Pro
    August 13, 2005
    706
    0
    Afghanistan Afghanistan
    I might play around with this a little as well, if you don't mind. If you wouldn't mind sharing your test images with me I would appreciate it. I will PM you my email address. I think that perfecting and speed testing the algorithm should be done before you try to implement it within MediaPortal, as that will probably guide decisions as to where it is best implemented. I have the impression that a DirectShow filter would be the best place for this, though someone might be able to advise you better on that issue.
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Denmark Denmark
    jawbroken said:
    I might play around with this a little as well, if you don't mind. If you wouldn't mind sharing your test images with me I would appreciate it. I will PM you my email address. I think that perfecting and speed testing the algorithm should be done before you try to implement it within MediaPortal, as that will probably guide decisions as to where it is best implemented. I have the impression that a DirectShow filter would be the best place for this, though someone might be able to advise you better on that issue.
    I have emailed the screens and the code to you, if you intend to work alot on it, we should sync so we avoid repeating work.

    I see your point, but i think a DS filter would be a good idea regardless of the way it runs, at least for grabbing frames, dont know where the scaling is done currently. Im pretty sure that using a binary search style approach would make it realtime capable. Instead of scanning samples points on 576 lines, one might get away with just a few (however due to the nature of it, one would probably have to check a few lines in each iteration to make sure you dont hit a black spot in the middle of the screen :)
     

    jawbroken

    Portal Pro
    August 13, 2005
    706
    0
    Afghanistan Afghanistan
    Thank you for the code, I will need to dust off my copy of Visual Studio as I have been writing mostly Java code for uni at the moment. Your image code should be a helpful starting point to get me up to scratch. I have been thinking that the best way to find corners would be to start in, say, the top left corner and scan down diagonally, say in units of 4 pixels, then backtrack when you find interesting pixels to find the edge. Then you can figure out if it is a horizontal or vertical edge by sampling around the area. Once it has been determined to be horizontal or vertical, the edge can be followed to the corner. Then the same steps can be followed from the bottom right corner. Then it only remains to scan the subtitle area, which is best done in its own special way, I think, as it differs greatly from regular video sections.

    A few issues:
    1) Finding the corner will only work for frames with a clear contrast between the black sections and the frame. If this is running as a DS filter then this is not a big issue, as any frames not usable to find bounds can be ignored until a good frame comes along.
    2) Ignoring subtitle sections and logos when the diagonal scan is being done. This test can probably be incorporated into the test to find out if it is a horizontal or vertical edge. So a Region of Interest can be a horizontal edge, a vertical edge or neither (neither being a logo or subtitle).
    3) Some stuff I probably haven't even considered yet (special cases, etc).

    I think that this method, while being much more specialised and sectionalised than your approach, could yield a significant decrease in pixel tests.

    Any input/ideas or an entirely different approach that is more efficient would be welcome.
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Denmark Denmark
    Just want to add two comments to this thread:

    1. Moving subtitles
    You guys were joking about doing this in real-time, but i actually think its possible. It isnt too hard finding a seperate bounding box for the subtitles and then its just transposing all the really bright pixels in the box into the video area.

    2. Smart Stretch
    Im not going to work on that but i think that there might exist seperatly developed smart strech filters that can be used. For example i noticed that on my computer i have a DMO Video Effect called smart stretch. Not sure what it does though :)
    If such a filter exists, it would be very easy to add it to MP(based on my newbie knowledge of DirectShow), so if you like to see it added, go and google for such a filter.
     

    jawbroken

    Portal Pro
    August 13, 2005
    706
    0
    Afghanistan Afghanistan
    ziphnor said:
    1. Moving subtitles
    You guys were joking about doing this in real-time, but i actually think its possible. It isnt too hard finding a seperate bounding box for the subtitles and then its just transposing all the really bright pixels in the box into the video area.
    I have thought about this and it is fairly easy if the subtitles are totally in the black area, next to impossible if they overlap the frame slightly. You don't even really need to do any tests for bright pixels and only transpose them, just overlay the image with a blend mode that only really copies the bright pixels (additive mode?) and perhaps increase the contrast and decrease the brightness a little to cut down on the noise for analogue tuners.
     

    miljbee

    Portal Pro
    November 11, 2005
    91
    0
    Orléans, France
    France France
    I don't think that real time detection is really important.

    If the user could select "auto detect frame size" from the osd, zoom modes, or menu, it could do the trick as a start point.

    If the algo shows to be really strong, fast and error free, then this could be added later in a filter to continuously detect and adapt the display frame.

    Anyway, i am very happy to see that there is some real progress about Zoom modes. Thank you very much for all your contributions.
     

    miljbee

    Portal Pro
    November 11, 2005
    91
    0
    Orléans, France
    France France
    huge said:
    [...]
    So, once the above (constant for given hardware setup, ie, do not need to be dynamically addressable) considerations have been taken into account, the problem reduces to the problem of fitting one rectangle inside another. A simple scheme is this:
    Have 2 controls, "allowable crop" and "allowable stretch".
    I definitively agree with this, and that's why i think these 2 parameters should be implemented right now to define the "smart zoom" feature. Perhaps the name "smart zoom" is a bit ambitious, but this mode could be improved in the future to integrate progressive stretch/expand and black area auto detection.

    I see no reason why this couldn't be added in a zoom section into the general settings of the mp configuration program. Sorry, in fact the reason is that i am not skilled enough to do it myself ...
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    Top Bottom