Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove background of image during runtime in iPhone sdk

enter image description here

I have an image in UIImageView. Those images are generally of clothes or accessories captured from camera on plain backgrounds. Now, I have to give a functionality to users so that they can remove the background from the actual image which is being shown. Something like what is shown in the picture here. As the slider will move the background will start getting removed more and more. Something like the 'instant alpha' brush in the Preview application available in Mac OS X. I wish to do this in native iPhone app.

I know I'll require some algorithm for image processing to do this. Does anyone have anything helpful which I can refer or use in order to get this done? Thank you so much in advance.

like image 284
Dip Dhingani Avatar asked Dec 28 '11 09:12

Dip Dhingani


1 Answers

You can render your image in some context, than change all points you need to the color you want, get image from your context and display it again. This link should help you to get color of a pixel in context. Note, that this method is too slow, so I think you should remember all positions of pixels you need to change to make your app a bit faster.

like image 57
Dennis Pashkov Avatar answered Oct 29 '22 11:10

Dennis Pashkov