Saturday, December 11, 2010

Tablet + Windows 7 x64 = riiiiiiight!

Well... if you have a Trust, Genius, Aiptek, Nisis, etc. tablet, most likely it is made by a Taiwan company called Waltop. That I have said before on a previous entry, I also recommended taking the drivers from Waltop website (they have x86 and x64 versions), that I can still recommend, however if you're using GIMP on Windows 7 x64 (and I guess Photoshop as well, given the number of threads on several forums) you may notice that, no matter how powerful your PC is or what driver version you use, there is a annoying lag between brush strokes, like the mouse pointer is "holding a dog leash to the brush".
If you're using a Wacom Tablet you may have the same issue.
Luckily this seems to be a Windows problem (aren't you glad?), you have to disable the gestures and flicks that Windows 7 activates by default, you just go to Control Panel -> Hardware and Sound -> Pen and Touch
There, in Pen Options tab, you go to the avaliable settings for each pen action entry and disable each of them where possible, then un-check the checkboxes under Pen buttons, also, in Flicks tab, disable the flicks usage.
There .... GIMP is working :] Fun fact: Open Canvas 1.1 beta 72 revision 1 works flawlessly even if drivers don't work correctly under windows (this is true for windows XP, Vista and 7 - In XP it worked WITHOUT drivers installed) ... Now that's what i call voodoo software... :]

Friday, December 10, 2010

Xmas list 2.... riiiiiight.... (updated)

Since i did adquire some gadgetery goods since last time, i feel like it's a good idea to update this ...
Obsolete entries from my last xmas list:
  • Nokia 5800 XpressMusic
  • Sony Alpha 350k
  • Sony HDR-SR11E
  • Samsung SyncMaster 2233SW
  • Intuos3 A5 Wide USB "Special Edition"
Current entries in my xmas list:
  • Intuos4 Wireless (for the price this costs i'd rather have the pandora)
  • Pandora Handheld
  • Voigtlaender 25mm f/0.95 for MFT
  • Panasonic G Vario 100-300mm f/4.0-5.6
  • LUMIX G VARIO 7-14mm F4.0 ASPH
  • Lensbaby Composer with Tilt Transformer for Micro 4/3rds
Since this might be a bit overly expensive for most pockets, i'll be putting a cheaper list:
Quoting myself from last time:
So ... anyone with a heavy felling in the pocket? I know, i know: "Keep dreaming...".


It's striked down ... unless your browser sucks or the feeds ignore it (I checked that out to avoid confusion) and you don't see that >_>

At the time A350 was a good camera (and i didn't buy it), Canon had 450D ... and that would be a nice choice as well...

In any case i currently have a Panasonic Lumix DMC-GH1 (hacked firmware) + 14-140mm lens + 20mm f/1.7 lens ... a nice small combo for photography that does terrific videos as well - but that Voigtlaender 25mm f/0.95 would sure be handy in extreme low light :]

Currently i actually move away from all Sony and Apple products ... they use several technics to fidelize (not an english word, yay! *sarcasm*) and limit the client to their brands ... and that i cannot accept.

Monday, December 6, 2010

Artificial Bokeh

Bokeh... better use wikipedia explanation: In photography, bokeh is the blur, or the aesthetic quality of the blur, in out-of-focus areas of an image, or "the way the lens renders out-of-focus points of light." Now, this is often used to enhance a subject or give a dreamy or surreal look to a picture, in portraits is often used to achieve a smooth background, and while it's not always desired it appears because of the so called circle of confusion and depth of field (
For achieve the blur of out of focused areas one must often use lens with big apertures or/and a good focal length, and those are usually expensive, heavy, big or a combination of the three... The other way of achieve that effect is to simulate it artificially... and that it's kinda tricky, mainly because the original image to which you want to apply it doesn't have the entire information to do it....
The simplest way to increase blur or create blur to given out of focus areas would be when create miniature looking photos of a city, this is possible because cities are often layered in a simple plane and an overlayed blured picture using a gradient as mask does the trick in most of the cases....
Extending the concept, one can create a mask to protect focused areas and blur the rest, but bokeh doesn't have a regular radius blur, the bigger the distance from the focus plane is the blurrier the area looks, and that brings us to a depth map/mask ... sadly this is not easy to create, nor easy to apply as a mechanism of interpreting the depth must exist.
Taking care of a mechanism for doing it properly, i introduce you to GIMP Focus Blur Filter Plug-in (windows version)... Now how does that plug-in perform.... wonderfully i must say... sadly my 20mm f/1.7, while has a big aperture, sometimes it's not quite enough to blur the background as i wished it would do... so i searched and found this pearl... it is quite awesome to apply... the drawbacks?
I point two: It will take its time to be applied (in a 8MP image might take like 10mins!) and you really need a depth map if you want to see awesome results :]
By the way, black means focused, white means fully unfocused.... in the middle ... is in the middle :] Well, to help you out with the depth map, i'll point you to another plugin: Depth map Plugin (windows version) ... It will create a depth map, but it has a requirement: You need to take two stereoscopic images, and that on moving stuff is only possible with two cameras (preferably identical)... it works pretty well, but you might want to retouch the depth map a bit for best results... Here goes an example of what you could do (Halloween Gothic Bride for the win): The original (well, not quite original, as this was cropped, noise was reduced, color corrected, details sharpened and reduced on the end for web view): The depth map i drawn (clumsy for the win): The end result using Flat model, 25px radius blur, 5px radius shine: This is simply the best plug-in I've ever found - and i don't even explored everything it has to give - this fella is just above tone mapping filter :]

Tuesday, November 16, 2010

Line of code of the day #5

Another LOCOTD.... just for me to remember those nice *cough cough* code lines that i come around from time to time.... i'm currently working as a trainee (until February), i'm currently implementing a custom featured content management system (CMS), i'm using php, mySQL, xhtml, css and a bit of JS for some slideshows... but this LOCOTD is about SQL ...
Store Procedures (SPs), as you may not know, are supported by mySQL for quite some time, however not quite perfectly as you might expect.... On SPs, you basically build a wrap box around one or more SQL statements, you can set variables, use the usual SQL stuff.... in my case i was using a SELECT, like i did for the rest of the dozens of SPs i did before, i was implementing a page like feature in the CMS, for that LIMIT clause is god send, but guess what.... in SPs you can't use non-constant integers in LIMIT parameters... yes.... you can use the arguments of the SP anywhere, except on the LIMIT clause...
So ... "How to solve it?" that would be the question... one way would be using a prepared statement, like this:
CREATE PROCEDURE `fooTable`.`sp_fooTableList` ( limit_arg int ) 
SET @sql = concat('SELECT * FROM `fooTable` LIMIT ', limit_arg); 
EXECUTE stmt; 

An obvious problem with this, is that it broken the extra security provided by SPs... but it is a valid workaround.... quite simple as well.... but because this prepared statement kinda defeat the purpose of having a nicely wrapped SQL statement, i found a way of doing it without recurring to it, i say found and not invented, credit goes to Gert Brigsted, it's easy to follow and understand how and why it works: 
CREATE PROCEDURE `fooDB`.`sp_fooTableList` ( limit_start, limit_end )
SET @rownum:=0;
  SELECT ( @rownum:=@rownum+1) AS Rownumber, `fooTable`.* 
  FROM `fooTable` 
  ORDER BY `fooTable`.`mooCol` DESC
) AS t
WHERE Rownumber > limit_start AND Rownumber <= limit_end;

It looks messy, but it works... sure, it has some impact on performance, but that's the price to pay for security... until LIMIT clause accepts variables as parameters.

Perhaps you are thinking, "That surely is, or will be, fixed in current iterations of mySQL" ... you are right it is, in versions 5.5.6 and 6.0.14, it is 'fixed' ... But not all servers allow you to change mySQL version installed... so, I guess you may run into this problem and have to use one of the above workarounds...
As a side note, this was submitted as bug #11918 by 13 July 2005 and 'solved' by 24 September 2010 .... more than 5 years to 'fix' this 'bug' ... i use quotes because wasn't exactly a bug but more like a non-feature...
Hope it helps someone out there bashing at "ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near: s_limit, e_limit;"