As seen at rentacoder



  • I need a text smoothing function written as a DLL. The function will accept the device context and the color of the font in RGB format (i.e 3 parameters will be used to pass in red,green,blue values). The device context will contain a screenshot of whatever is currently on the screen. You may assume that all the text in the device context is of the same color (i.e, all black or all blue etc) and that nothing else on the screen has the color of the text. The reason the font needs to be smoothed is because the screen is magnified (see attachment for a sample). When the screen is magnified the individual pixels that make up the font become visible, which is undesirable.

    The font smoothing function will identify the pixels of the text by using any algorithm of your choice and will fill in the sharp edges of the pixels in the device context to create a smoother effect (I can provide the exact algorithm if needed, it's fairly trivial). The size of the passed in device context will be at most 1400x1050 pixels. This function must be extremely fast taking no longer than 100 ms on average to create the smoothed image for a 1400x1050 pixel image on a Celeron 1 Ghz machine. There will be no payment if it takes longer. Since speed is critical, I'd prefer it if this DLL is written in C or C++, but it's not mandatory as long as you meet the speed requirements.

    Erm, wtf? :)



  • maybe it's because I am too tired, but where is the wtf?



  • That was a long-winded way of saying he wanted a Gaussian blur.



  • [quote user="RevEng"]That was a long-winded way of saying he wanted a Gaussian blur.
    [/quote]


    Not quite.  He's got a screen magnifier, and he wants the text to be smoothed.  It can be done without too terribly much trouble using OCR+re-rendering of the text, or using a good adaptive scaling algorithm, but at the $100 price he's asking, I'm certainly not going to bid.



  • OCR and re-render to do smoothing?  Now that really would be front page material!



  • Solving half of captcha + selective blur of 1400x1050... is this possible in 100ms in software?

    I mean - if you don't do anything, because it will already kill the celeron's cache - running any program at the same time will slow down to crawl...



  • does anyone else smell college assignment?



  • Where's the WTF?

    IMO, the WTF is here:

    I can provide the exact algorithm if needed, it's fairly trivial

    The guy is basically saying "I can write it myself", but is asking somebody else to do it for him. His laziness is....

     

    well, standard, really. But still....

     



  • [quote user="Whiskey Tango Foxtrot? Over."]

    IMO, the WTF is here:

    I can provide the exact algorithm if needed, it's fairly trivial

    The guy is basically saying "I can write it myself", but is asking somebody else to do it for him. His laziness is....

     

    well, standard, really. But still....

     

    [/quote]

    It's called delegation.  Also, what says he isn't primarily an ASP programmer, or something?  Sure, any coder worth their salt could eventually knock this out, but if your primary (recent) experience isn't in C++ DLLs and image processing, it'd take a hell of a lot longer than it would for a guy who's been writing nothing but DLLs for the last 17 years.

     I mean, shit.  If you really know what you're doing, there's not much that doesn't fall under the category of "I can write it myself".  However, that doesn't mean that you have time to write it yourself, or even that it's a good idea!



  • [quote user="Whiskey Tango Foxtrot? Over."]

    IMO, the WTF is here:

    I can provide the exact algorithm if needed, it's fairly trivial

    The guy is basically saying "I can write it myself", but is asking somebody else to do it for him. His laziness is....

     

    well, standard, really. But still....

     

    [/quote]I think he's saying he has the algorithm, but when he tried to do it himself, it took 17 seconds to render the smothed image.



  • [quote user="RShilling"][quote user="Whiskey Tango Foxtrot? Over."]

    IMO, the WTF is here:

    I can provide the exact algorithm if needed, it's fairly trivial

    The guy is basically saying "I can write it myself", but is asking somebody else to do it for him. His laziness is....

     

    well, standard, really. But still....

     

    [/quote]I think he's saying he has the algorithm, but when he tried to do it himself, it took 17 seconds to render the smothed image.[/quote]

    Either that, or he's discovered that the text is antialiased, and doesn't know how to handle that.



  • Both XP and Vista expose an API for doing magnification like this. As text is vector, no additional smoothing is needed.

     



  • How the heck are you supposed to smooth text [i]after[/i] it's been rendered to the screen?  Would your algorithm only look for large rectangular regions where the average color is slightly darker than the system default window background?  Or what?


    Sounds impossible to do without just blurring everything.



  • [quote user="dhromed"]

    Both XP and Vista expose an API for doing magnification like this. As text is vector, no additional smoothing is needed.
    [/quote]

    Considering his starting point, I don't think this is going to help.

    The font smoothing function will identify the pixels of the
    text by using any algorithm of your choice and will fill in the sharp
    edges of the pixels in the device context to create a smoother effect

    He specifically states this DLL will be given a device context of a screenshot containing the text.  No vectors here, just plain old raster crap.  The problem would definitely be much simpler if the actual text was available.

    Short of finding the edges of the text (which is still a problem without a perfect solution) and blurring only those edges, I don't know that there's much that can be done to solve this problem elegantly.  The term GIGO comes to mind.

    And for $100?  Maybe he's expecting a grad student to write this.
     



  • The way I see it, he is not asking for full blown OCR, but merely some edge-detection.

    You do not only get a raster, you also get a color. Loop through the raster, if the pixel is of the right color leave it alone, if it is not, look at its neighbours to see how much of them are of the right color. if it has suitable neighbours make the pixels color a weighted average of the original color and the textcolor.

    Of course you can optimize the algoritm (givven the fact there are possibly more non-text pixels then there are text-pixels etc) but that seems to be the gist of the question.
     



  • Good point, the assumption that text is all one color and only the text is that color helps a lot.

    Of course, that assumption may be a WTF in itself. 



  • [quote user="RevEng"]Of course, that assumption may be a WTF in itself. [/quote]

    On my part? Why? This part of the request is telling you exactly that:

    The function will accept [..] the color
    of the font [..]. You may assume that all the text
    in the device context is of the same color (i.e, all black or all blue
    etc) and that nothing else on the screen has the color of the text.


     



  • I wonder what, exactly, he considers "smooth", and what level of pixellization he'll find unacceptable.

    A screenshot of this page, enlarged in Photoshop 400% using whatever algorithm, is very much readable.

     Naturally there's no way he'll get 100% crisp antialiased type. The data just isn't there.
     



  • ooo i love rentacoder:

    "Dear Sire, thankyou for you job offer, me and my devolopmint company of 500 hyly skillt indeviduals in the province of Blabla will gladfully produce your software in only 12 munths for the sum of $5, thankyou again from deepest of our hearts"



  • [quote user="Carnildo"]Either that, or he's discovered that the text is antialiased, and doesn't know how to handle that.[/quote]

    DINGDINGDINGDINGDING!!!

     

    We have a winna!!



  • [quote user="Carnildo"]

    Not quite.  He's got a screen magnifier, and he wants the text to be smoothed.  It can be done without too terribly much trouble using OCR+re-rendering of the text, or using a good adaptive scaling algorithm, but at the $100 price he's asking, I'm certainly not going to bid.

    [/quote]

    Hmm... there is a 100ms speed requirement, but no $100 price tag. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.