How to compare two images with iphone sdk? - iphone

suppose i have taken one picture from my iphone camera and now i want to compare this image with other images and find best match image from that.
is it possible or not?

there is very less help available for the image processing algorithms in objectiveC, but you can go in deep with Quartz 2D and try to compare images
even Image processing on the iPhone link may be helpful.

There is nothing built into the SDK for comparing images, but any C library for image comparison can probably be used. This question has a good discussion on image comparison algorithms.

Are you just comparing the differences between the two images or are you trying to match objects in the images with objects in other images?
If it's the latter then you may need to look into computer vision and stereo image analysis, particularly image rectification and point matching.
Computer Vision - A Modern Approach by Jean Ponce and David Forsyth is a fairly good book.

Related

How to add Cartoon Color and Cartoon B&W filter effect on Image in iPhone [duplicate]

Is there any filters available in ios to convert a image to cartoonistic image like exactly in the above picture?
For a much faster solution than ImageMagick, you could use the GPUImageToonFilter from my GPUImage framework:
It combines Sobel edge detection with posterization of the image to give a good cartoon-like feel. As implemented in this framework, it's fast enough to run on realtime video from the iPhone's camera, and is probably at least an order of magnitude faster than something similar in ImageMagick. My framework's also a little easier to integrate with an iOS project than ImageMagick.
If you want more of an abstract look to the image, the GPUImageKuwaharaFilter converts images into an oil painting style, as I show in this answer.
Try to use imagemagick for iOS http://www.imagemagick.org/download/iOS/
Of course you need some serval hours how to use imagemagick for iOS.
But then you should also look at: http://www.fmwconcepts.com/imagemagick/cartoon/index.php
and maybe also on:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=11140&start=0&st=0&sk=t&sd=a
This Core Image filter section in the iOS dev library, possibly combined with the script referenced by Jonas and a little luck, might get you where you're going. Not sure, having never used either of these technologies.

How can you change a picture on the iPhone to make it look comicy or black and white?

I was wondering, are there any libraries on the iPhone that allow you to take an image and apply some sort of filter to it so the image turns out black and white, or to make it look comicy, or to skew it?
Start by taking a look at CoreImage. Its available in iOS5. You'll probably want to explore third party options too.
Check out OpenCV. It's an open source library that can be compiled for iOS (there's plenty of tutorials all around the net) and it's specifically made for things like image manipulation.
While it's harder to set up, it's a lot more powerful than CoreImage will be!
There's also plenty of sample code around the net that does things like turn images comicy/black and white/find image outlines/thresholds images etc. There's a small learning curve, but for what you want to do, it's more than worth it :)

imagemagick monochrome convert in iPhone

I have an image in the iPhone that I need to convert to monochrome. The images are photographs of documents and I need as clean a conversion as I can get.
My first solution did a pixel for pixel compare with a threshold, and while it does the conversion fine, shadows can overwhelm the image.
My next trial is to use imagemagick, hoping that there are various noise reduction/despeckle filters that I can apply to clean the image up, which is what this guy is doing.
I have imagemagick running on the iPhone and can apply "MagickWand" methods with no problem. My issue is that I don't think there is one built in that will do what I want. So I turn to the ConvertImageCommand but am lost on how to actually use it.
So I am looking for any guidance or examples. Thanks!
It turns out what I've been looking for is Adaptive Thresholding in my conversion to monochrome.
Chris Greening has created an image processing library that handles this quite well.
So no imagemagick needed.

How are people accomplishing photo filters in iPhoneOS?

What are people using/doing to create photo filters or photoshop like effects on iPhone OS? Things like B&W, sepia, cross-processing, 'vintage' etc. I see ImageMagick can probably do this with a lot of futzing around, any other options?
Brad Larson's GPUImage framework will be your best Option.You can get the framework from here.
Here is another option.
http://www.binpress.com/app/photo-effects-sdk-for-ios/801
ImageMagick was not the way, its to slow. The solution is to access the raw byte data and modify the RGB values pixel by pixel using, among other things, 5x5 matrix transforms. Here is a good place to start:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/11158-share-your-image-proccessing-filter-code.html

Motion detection using iPhone

I saw at least 6 apps in AppStore that take photos when detect motion (i.e. a kind of Spy stuff). Does anybody know what is a general way to do such thing using iPhone SDK?
I guess their apps take photos each X seconds and compare current image with previous to determine if there any difference (read "motion"). Any better ideas?
Thank you!
You could probably also use the microphone to detect noise. That's actually how many security system motion detectors work - but they listen in on ultrasonic sound waves. The success of this greatly depends on the iPhone's mic sensitivity and what sort of API access you have to the signal. If the mic's not sensitive enough, listening for regular human-hearing-range noise might be good enough for your needs (although this isn't "true" motion-detection).
As for images - look into using some sort of string-edit-distance algorithm, but for images. Something that takes a picture every X amount of time, and compares it to the previous image taken. If the images are too different (edit distance too big), then the alarm sounds. This will account for slow changes in daylight, and will probably work better than taking a single reference image at the beginning of the surveillance period and then comparing all other images to that.
If you combine these two methods (image and sound), it may get you what you need.
You could have the phone detect light changes meaning using the sensor at the top front of the phone. I just don't know how you would access that part of the phone
I think you've about got it figured out- the phone probably keeps images where the delta between image B and image A is over some predefined threshold.
You'd have to find an image library written in Objective-C in order to do the analysis.
I have this application. I wrote a library for Delphi 10 years ago but the analysis is the same.
The point is to make a matrix from whole the screen, e.g. 25x25, and then make an average color for each cell. After that, compare the R,G,B,H,S,V of average color from one picture to another and, if the difference is more than set, you have motion.
In my application I use fragment shader to show motion in real time. Any question, feel free to ask ;)