invert colors of Image [duplicate] - iphone

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
UIImage color changing?
I have one image with Grey and white color.I want to change Grey color to white and change white color to Grey through code dynamically. Please help.

Better to look out for Open CV framework, because the thing which you are expecting in already available with this framework.
You can get the source from here
Sample Code : Convert RGB to Black & White in OpenCV
Convert image document to black and white with OpenCV
Hope that would give you some new idea about image processing. :)

Related

Detect border edges of a UIImage with white color background and crop it in Swift

I have a UIImage with a background color
It is shown in Orange color for visibility here but in reality it is white color in my case.
How can I detect the edges of the image and crop it to it's shape?
There are solutions posted in Objective-C but I am working in Swift 2.1.1
Also, the previous solutions have some limitations and are not complete like they don't work for white backgrounds
Can someone please post the code for such complex UIImage cropping in Swift...
check GPUImage if it can help you.

Overlapping UIImage with another image [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to implement alpha gradient on a image?
I have 2 images below
With these 2 images I want to create following effect. Any technique you think to mask these images to create required effect.
You could use a gradient mask to create something like this, but you wouldn't get the gloss and shadows that you see in your final image:

Match some predefined pattern ispresent in the image captured from camera or not and if then found their coordinates [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Recognize Black patterns appearing on the four corners of the image ios using opencv or some other technique
I want to create a app like shotnote app(basically its camera feature).
It is a page scanning app that is used to scan special type of paper.
http://itunes.apple.com/us/app/shot-note/id411332997?mt=8
Refer first two screenshots
You can check the functionality what I am searching in the following video:-
http://www.youtube.com/watch?v=8F_1iu4pDkQ
In my app
The paper background will be white and the pattern will be in black.
What I want is when I take a image from camera then it should match with the pattern (image or mages) and if patterns are present in that captured image then image should be cropped like in the way so that the patterns should appear at the corners of the image.
Basically I need to detect that the patterns are present and after that I want their coordinates so that I can crop the image accordingly.
Patterns you can assume as rectangle or L shape .
I am surfing for this from the last two weeks and still struggling with it.
Please provide me some sample code or some suggestions which I should follow.
Any suggestions would be highly appreciated.
Thanks in advance.
If you know that the pattern is always undistorted (i.e. no or very littly perspective in the original image) template matching, e.g. with a normalised cross correlation will do the trick just fine.

How to implement eraser functionality in DrawingApp? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How do I implement a soft eraser stroke in a CGBitmapContext
How can I erase UIBezierPath lines drawn on a transparent view above an image?
In my Drawing app I want to implement Eraser Functionality.
If I have a white Background I will be erase that with change the color to white.
But, do I do if I have to erase the drawing on Background with photo?
How can I do that?
I believe that there are many possible solutions. One of them:
you create two layers (two images). One for the background, another for the drawn stuff.
when you "erase" you draw something. This something must mask background and
masked result must be drawn on the "stuff" layer.
Also you can play with masks, with blending options — I think every one of this features will allow you to implement "eraser" functionality.

UIKit. How to set Transparent color? [duplicate]

This question already has answers here:
How to make one color transparent on a UIImage?
(11 answers)
Closed 7 years ago.
Is there any way to set any color of UIImage (or it CALayer content) as transparent color?
I cannot use single image resource(PNG file) with built-in transparency.
I need to hide some area from first Layer by overlaying second Layer with specific color at that place. So I need to set this specific color as "transparent color" before assembled image drawing.
Image area I need to hide is like background - i.e. specific color will be started from image borders through whole perimeter.
Sounds like you need to use CGImageCreateWithMaskingColors. I recommend reading the "Bitmap Images and Image Masks" part of the Quartz Programming Guide, and check some example code. It's slightly more low-level than your average Cocoa code, but not very hard to accomplish.