Categories
graphics programming Website work

Extending Justin Talbot's GrabCut Impl [w/ code]

Justin Talbot has done a tremendous job implementing the GrabCut algorithm in C [link to paper, link to code]. I was missing though, the option to load ANY kind of file, not just PPMs and PGMs.
So I tweaked the code a bit to receive a filename and determine how to load it: use the internal P[P|G]M loaders, or offload the work to the OpenCV image loaders that take in many more type. If the OpenCV method is used, the IplImage is converted to the internal GrabCut code representation.

Image<Color>* load( std::string file_name )
{
 if( file_name.find( ".pgm" ) != std::string::npos )
 {
 return loadFromPGM( file_name );
 }
 else if( file_name.find( ".ppm" ) != std::string::npos )
 {
 return loadFromPPM( file_name );
 }
 else
 {
 return loadOpenCV(file_name);
 }
}
void fromImageMaskToIplImage(const Image<Real>* image, IplImage* ipli) {
 for(int x=0;x<image->width();x++) {
 for(int y=0;y<image->height();y++) {
 //Color c = (*image)(x,y);
 Real r = (*image)(x,y);
 CvScalar s = cvScalarAll(0);
 if(r == 0.0) {
 s.val[0] = 255.0;
 }
 cvSet2D(ipli,ipli->height - y - 1,x,s);
 }
 }
}
Image<Color>* loadIplImage(IplImage* im) {
 Image<Color>* image = new Image<Color>(im->width, im->height);
 for(int x=0;x<im->width;x++) {
 for(int y=0;y<im->height;y++) {
 CvScalar v = cvGet2D(im,im->height-y-1,x);
 Real R, G, B;
 R = (Real)((unsigned char)v.val[2])/255.0f;
 G = (Real)((unsigned char)v.val[1])/255.0f;
 B = (Real)((unsigned char)v.val[0])/255.0f;
 (*image)(x,y) = Color(R,G,B);
 }
 }
 return image;
}
Image<Color>* loadOpenCV(std::string file_name) {
 IplImage* im = cvLoadImage(file_name.c_str(),1);
 Image<Color>* i = loadIplImage(im);
 cvReleaseImage(&im);
 return i;
}

Well, there’s nothing fancy here, but it does give you a fully working GrabCut implementation on top of OpenCV… so there’s the contribution.

GrabCutNS::Image<GrabCutNS::Color>* imageGC = GrabCutNS::loadIplImage(orig);
 GrabCutNS::Image<GrabCutNS::Color>* maskGC = GrabCutNS::loadIplImage(mask);
 GrabCutNS::GrabCut *grabCut = new GrabCutNS::GrabCut( imageGC );
 grabCut->initializeWithMask(maskGC);
 grabCut->fitGMMs();
 //grabCut->refineOnce();
 grabCut->refine();
 IplImage* __GCtmp = cvCreateImage(cvSize(orig->width,orig->height),8,1);
 GrabCutNS::fromImageMaskToIplImage(grabCut->getAlphaImage(),__GCtmp);
 //cvShowImage("result",image);
 cvShowImage("tmp",__GCtmp);
 cvWaitKey(30);

I also added the GrabCutNS namespace, to differentiate the Image class from the rest of the code (that probably has an Image already).
Code is as usual available online in the SVN repo.
Enjoy!
Roy.

Categories
Recommended Website

The links are back! [Links of the week]

Hi good people,
Well after a two-week break, I’m back with some more interesting weekly links..
So here’s what I’ve picked up on the web the past 2 weeks:
http://gizmodo.com/5409898/3d-scanning-a-webcams-latest-trick
Awesome 3D reconstruction work with only a webcam! I dig that stuff.
http://www.techcrunch.com/2009/11/20/hot-potato-launch
Me like! An old-new mobile social concept comes to life: Ad-Hoc Social Networks meet Foursquare.
http://www.techcrunch.com/2009/11/23/apple-and-android-now-make-up-75-percent-of-u-s-mobile-web-traffic/
Current mobile-phones OSs and devices usage numbers:
iPhone is slightly rising still: 48% Sep09 to 55% Oct09, Android is growing – 17% Sep09 to 20% Oct09, and Palm is losing height – 10% Sep09 to 5% Oct09.
http://www.techcrunch.com/2009/11/23/linkedin-api-open/
LinkedIn API – well it’s about time!
http://gizmodo.com/5411779/swype-vs-qwerty-fight
The new Virtual Keyboard typing method: SWYPE, takes on the good ol’ QWERTY.
Check out Layar 3.0, awesome 3Ds in AR:
http://gizmodo.com/5417946/dear-new-layar-30-you-got-me-at-beatles
http://www.techcrunch.com/2009/12/02/layar-3-0-mobile-augmented-reality/
The HTML 5.0 craze is upon us, and it is going to change everything we know and think about web applications:
http://www.mobilecrunch.com/2009/12/02/video-webgl-might-eventually-bring-awesome-3d-to-web-apps
http://lifehacker.com/5416100/how-html5-will-change-the-way-you-use-the-web
http://lifehacker.com/5417088/create-abstract-light-art-by-snapping-a-camera+toss-photo/gallery/
Instant wallpaper photo maker: Slow shutter and just throw the camera in the air!
http://gizmodo.com/5420164/htc-2010-product-roadmap-leak-legends-salsa-buzz
This is what HTC has in store for us next year
http://gizmodo.com/5421983/lumino-project-next+generation-lego-crossed-with-microsoft-surface
Surface UI! not new, but this advancement is very interesting..
http://lifehacker.com/5421670/negotiate-anything-by-keeping-three-things-in-mind
Nice video lecture, take a look at 5:00 – speaking about innovative ideas and solutions while negotiating:
Instead of thinking “what will I gain right now”, think about make a long-term partnership with the other side.
http://lifehacker.com/5422413/vevo-is-where-your-missing-music-videos-went-to
My intuition says this is the beginning of a war on YouTube, in the Copyrights arena. Sporadic things have been done already, now let’s have a showdown!

Google is taking over the world – again! Corner

http://lifehacker.com/5411108/google-puts-coupons-on-your-phone-so-you-can-forget-the-scissors
Google coupons!
And then, just as they started to pick up, came Google and busted them all down.
Big G steps in the restaurants ranking business. Yelp, Zagat – behind you!!
http://gizmodo.com/5420737/in-the-future-we-all-will-be-google+approved
http://www.techcrunch.com/2009/12/06/google-local-maps-qr-code/
http://www.techcrunch.com/2009/12/07/google-realtime/
Big G goes realtime web… The REAL realtime web.
http://gizmodo.com/5420894/google-goggles-googles-scary-good-visual-search-app
Big G keeps on rolling… now conquering the visual search domain. what else?
http://lifehacker.com/5408499/youtube-adds-machine+generated-automatic-captions
Speech-to-text is piece of cake for Google…
Have a cracking weekend and See ya’ll next week!
Roy.

Categories
Mobile phones Recommended Website

Weekli Lynks [Links of the week]

Hi
A hefty crop this week…
Stuff I picked up on the web this past week:
http://www.techcrunch.com/2009/11/12/trouble-at-twitter-u-s-visitors-down-8-percent-in-october/
Finally – the Twitter bubble is starting to burst. I was asking myself how long this foolishness will last. I mean, really – only 140 chars? come on…
http://gizmodo.com/5404086/10-human-functions-weve-already-handed-over-to-the-machines/gallery
Robots – you like them and fear them at the same time…
http://gizmodo.com/5403457/10-iphone-apps-to-augment-your-sad-reality/gallery
AR recap on the iPhone.
My 2 cents: this is getting old… and everyone are doing the same thing. Innovation is needed.
http://gizmodo.com/5403646/what-is-this
10 bucks if you guess what this is
http://www.techcrunch.com/2009/11/16/foursquare-api/
We GOTTA do something with this. This is a hot (and interesting) buzz out there: social-location.
http://lifehacker.com/5405684/apostropheme-explains-when-you-really-need-apostrophes
And let that be a lesson for you.
http://www.techcrunch.com/2009/11/16/youtube-direct-gives-news-orgs-a-way-to-accept-user-submitted-videos/
Another cool new thing to integrate with
http://www.mobilecrunch.com/2009/11/16/samsung-announces-new-android-powered-galaxy-spica-i5700/
More android love from Samsung!
http://gizmodo.com/5407454/microsofts-bag+based-computer-interface-for-poking
Microsoft – not so soft… finger-press based interface
http://gizmodo.com/5407319/nokias-n+series-will-ditch-symbian-for-maemo-by-2012
Let’s do something with Maemo!
http://lifehacker.com/5407010/refine-your-image-search-with-google-image-swirl
Try it – it’s cute.
http://gizmodo.com/5407245/the-true-google-phone-may-be-coming-soon
Google on the move into mobile phones, that was anticipated. But looks like the schedule is being pulled back
See ya’ll next week!
Roy.

Categories
Recommended Website

Weenks = Weekly Links [inks of the week]

Hi
Stuff I picked up on the web the last week:
http://www.techcrunch.com/2009/11/05/on-the-go-mobile-coupons-almost-as-cool-as-minority-report-not-quite-as-creepy/
AT&T bust out a new mobile-ads concept, watch the video. It’s an idea we already had, but here it is – in the flesh.
http://www.istartedsomething.com/20091106/microsoft-college-tour-09/
Microsoft taking natural UI forward.
http://gizmodo.com/5400305/even-god-runs-windows-xp
Very thick fog as advertising space – nice!
http://gizmodo.com/5400932/the-history-of-computing-video-shows-why-we-are-doomed
A video trying to explain the amount of data we are going to be exposed to in the near future
http://gizmodo.com/5400618/magic-volumes-have-three-different-magic-shadows
Shadow art can be cool!
http://www.techcrunch.com/2009/11/10/google-go-language/
Google tightens the knot on programmers.
http://gizmodo.com/5402027/video-nokias-vision-of-mobile-devices-in-2015
See what Nokia thinks of the mobile experience in 2015: Social-Augmented-Reality (2:35), Social-Location (1:00), All-Screens (1:55), and more stuff.
Have a great weekend!
Roy.

Categories
Website

Weeks of the link [Links of the week]

Hi
Stuff I picked up on the web the last week:
http://www.techcrunch.com/2009/10/30/dont-be-a-featured-loser-facebook-helps-out-the-unpopular/
I’m liking this! Applications helping people reach out.
What happened to: “You didn’t call your mother in a while! Why don’t you give her a call now… [Click to dial]”
http://gizmodo.com/5395911/disturbingly-cool-big-head-papercraft-halloween-costume
I Love papercraft! and this is amazing.
http://gizmodo.com/5395865/watch-the-xperia-x10s-rachael-interface-in-action
The new Sony-Erricson Android phone showing off.
I think we should take stock on Kick-Ass UI in our projects. This is becoming more and more obvious that it is the future.
Can you see the guy standing in this picture? (tip: you can see his shoes very good)
http://gizmodo.com/5397102/liu-bolin-creates-slowest-least-practical-invisibility-cloak-ever
http://gizmodo.com/5381011/microsoft-couriers-swipes-snips-and-scribbles-the-leaked-interface
Microsoft’s e-book reader – much more than just a reader, but nothing over a tablet PC…
http://www.techcrunch.com/2009/11/04/say-goodbye-to-voicemail-hello-to-ribbit-mobile-500-invites/
You thought Google Voice is the competition? This is the competition’s competition.
http://gizmodo.com/5396860/video-concept-symbian-interface-blends-augmented-reality-maps-and-social-networking
Symbian’s next-gen concept UI – shabby, seen it, done before, too late.
See ya’ll next week!
Enjoy the weekend,
Roy.

Categories
Recommended Website

Links of the (last) week

Hi
Stuff I picked up on the web the past week:
http://gizmodo.com/5388708/1000-cellphones-and-2000-text-messages-playing-tchaikovsky
Cellphone orchestra
http://www.techcrunch.com/2009/10/27/mobile-web-usage-keeps-on-growing-and-growing-and-growing/
Big mobile web numbers curtsy of Opera Mini. 224% YOY growth… (9/08 – 9/09)
http://gizmodo.com/5390090/interactive-multitouch-sphere-will-make-you-feel-like-gandalf
Cool visuals
http://gizmodo.com/5390894/build-your-own-life-hud-with-a-smartphone-and-some-cardboard
This is virtual reality just like this is a car.
http://www.techcrunch.com/2009/10/27/facebook-launches-a-new-hub-for-world-peace/
Nice concept! Go Peace!

Google corner

This week Google decided they take over (what’s left of) the world:
http://www.techcrunch.com/2009/10/26/google-voice-can-now-take-control-of-your-mobile-voicemail/
First – they’ll take your voice mail
http://lifehacker.com/5390307/google-launches-social-search-experiment-to-search-what-your-friends-are-posting
Then they’ll take your social graph
http://gizmodo.com/5391043/android-20-official-its-the-android-weve-been-waiting-for
They will update your Android mobile OS
http://lifehacker.com/5390864/google-voice-air-app-keeps-voicemail-and-sms-on-your-desktop
Desktop Widgets – Behind you!!
http://www.techcrunch.com/2009/10/28/google-redefines-car-gps-navigation-google-maps-navigation-android/
Google takes over the navigation business. TomTom and Garmin stocks plummet by 20-40%.
This proves the saying: “You’re only safe untill google does it.”
‘Till next week
Roy.

Categories
comics Recommended Website

Weekly Links

Hi guys
Weekly links is something of a tradition at work I have been keeping up for a couple of months now. Its time to share them with the world.

Stuff I picked up on the web the last week:

http://gizmodo.com/5382585/10gui-fascinating-multitouch-user-interface-design
Very nice multi-touch desktop experience
http://gizmodo.com/5384680/sonys-360-degree-3d-display-prototype-no-glasses-needed
Sony with a 3D “screen” that looks like a bomb
http://gizmodo.com/5384893/gps-puzzle-box-only-opens-in-one-specific-location
Very nice concept in Location-Based-Something. The box will only open when you actually get to the point
http://www.techcrunch.com/2009/10/19/android-galore-a-complete-list-of-the-android-phones-and-their-specs-droid-best/
Look at that – 24 Android phones already! Definitely going to explode…
http://www.techcrunch.com/2009/10/21/new-google-music-service-launch-imminent/
Google bulldozing into the music biz. Amazon & Apple – behind you!
http://gizmodo.com/5386532/when-robots-attack-theyll-also-come-by-ski
It skis better than me!

Big Numbers Corner

Note: “corners” are topics that seem to be a trend that week.
http://www.techcrunch.com/2009/10/21/how-the-iphone-is-blowing-everyone-else-away-in-charts/
Some interesting big numbers from Morgan-Stanley about the iPhone booming
http://www.techcrunch.com/2009/10/21/web-2-0-summit-facebooks-vp-of-engineering-on-scaling-facebook/
Huge numbers for Facebook
And a comic for finish: (made with: http://superherosquad.marvel.com/create_your_own_comic)
office_fart_comic
Enjoy the weekend!
Roy.

Categories
3d graphics Java opengl programming video

GeekCon 2009: RunVas – Our project [w/ video, img]

runvasHi everyone
In the last weekend I attended GeekCon 2009, a tech-conference, with a friend and colleague Arnon (not Arnon from the blog, who recently had a birthday – Happy B-Day Arnon!). Each team that attended had to create a project they can complete in 2-days of the conference. Our project is called “RunVas”, and the basic idea was to let people run around and paint by doing so. We wanted to combine computer vision with a little artistic angle.
Here’s some more details

Categories
graphics gui programming video

Awesome pictures fusing with a GIMP plugin [w/ code]

desert_bear_arrowSwitching, merging or swapping, call it what you like – it’s a pain to pull off. You need to spend a lot of time tuning the colors, blending the edges and smudging to get a decent result. So I wrote a plugin for the wonderful GIMP program that helps this process. The merge is done using a blending algorithm that blends in the colous from the original image into the pasted image.
I’ll write a little bit about coding GIMP plugins, which is very simple, and some about the algorithm and its sources.
Let’s see how it’s done

Categories
Uncategorized

New Theme, New Toolbar, New Year

Hi dear blog readers
We are trying out a new theme for the blog. We wanted to move out of the default and included themes of WordPress, and into something a bit different.
You will also notice a toolbar at the bottom of the page. It should help you better spread the MoreThenTechnical word! by giving more social networking tools.
So tell us what you think of it! Should we keep it, trash it, or maybe you have an idea of your own?
BTW, tomorrow is new years eve by the jewish calendar, and in Israel we are celebrating the new year (“Rosh Ha’shana”). So these changes to the blog could not have come at a better time – a time for new beginnings.
BTW 2 – I’m working on a post regarding next-generation image editing, so keep posted.
Thanks!
Roy & Arnon