how to make a Kaleidoscope in iPhone - iphone

i am trying to make a Kaleidoscope app in iPhone.
Some one can tell me how can make it, what kind of techs i must use, please !
thanks a lot for your helps, i am so worried now !
Thanks

To generate a random background and then do the two mirror reflections, you will need CoreGraphics/Quartz, and know about layers, and CGContexts. In order to vary the background based on the movement of the iPhone, you need to learn how to read the accelerometer.
This is if you want to make it look similar to a real Kaleidoscope. Otherwise you could take the much simpler approach of creating a graphic formulaicly based on random data that is then cropped to a pie slice and repeated twice to create a simple Kaleidoscope graphic.

Related

compare one image in matlab with a database of images and show the most similar

I have a database of images of one person who is using his hands to show various words and phrases in sign language. The background is white and the only thing changing is the shape of the person's hands and their locations. Now in my gui in matlab, I want the user to be able to choose another image from the same person that was taken at another time doing a sign but wearing the same clothes and then the program will have to compare this against the images in the database and show the most similar. Obviously I can't do pixel by pixel comparison as the images were taken by a hand held mobile camera and slight movement has been inevitable so I should try and locate the hands in the images and compare their shapes. I have no idea how to go about this? I have to say I am new to image processing toolbox in matlab.
Your help is much appreciated
I am doing a phD in computer vision, and I can tell you that it is an unsolved problem. (even in your simple framewrok, with white background)
If you are interested, you might read some works about it ar MIT:
http://people.csail.mit.edu/rywang/handtracking/
or at Oxford:
http://www.robots.ox.ac.uk/~vgg/research/sign_language/index.html
http://www.robots.ox.ac.uk/~vgg/research/hands/index.html
I disagree with you. Such a project can achieve results quickly.
This becomes a problem as soon as the project has to deal with "real life".
Using a single camera, and a completely known background; Opencv provides a simple way to extract hand shape in a image (in about 20 lines of code). You will find plenty of source on the web (have a look at calcbackproj).
After that, what you will have to do is to play with shape, and search for characteristic points.
Begin with some simple signs (example : a circle and a V). How would you recognize one from the other?
There are thousands of papers on sign language; just read the older one to simple ideas flowing :)

Fake long exposure on iOS

I have to implement long exposure photo capabilities to an app. Since i know that this is not really possible i have to fake it. It should work like "Slow Shutter" or "Magic Shutter".
Sadly i got no clue how to achieve this. I know how to take images with the camera (through AVFoundation) but i'm stuck at merging them to fake long shutter times.
Possibly i need to manipulate and combine all the images with coregraphics but i'm not sure about this (even the how). Maybe there's a better solution to this.
I would appreciate every help i can get here,
thank you people!
You might try the plus lighter blend mode.
Well, I suppose it would be possible to average together the results of several shots. I've mucked around a bit with the core graphics stuff to resize images (averaging together adjacent pixels), but with lower res images. The algorithm I used is here -- maybe it'll give you some ideas.
There may, of course, be a better way, and some tricks for working efficiently with high-res images. Can't help you there.
Convert the images to pixel bitmaps. Align and stack the bitmaps. Then try applying various 3D convolution filters to the 3D pixel array.

how to add a repeating background in cocos2d

I am new in iphone and as well in cocos2d
I have some queries about a game i am working on it.
Actually i have a background with some trees and bushes.and i have an object which keeps on moving and my background of trees and bushes is static at the back. I want the application to repeat the background and it give me a look that my object is moving forward.
Can anybody Guide me please.
I also want to implement speed so also guide me that how can i change the speed of background repetition. so that it gives a look that my object is slow or fast
Thanks
waiting for your positive response.
Regards
sHaH
Work through this excellent tutorial:
http://www.raywenderlich.com/3857/how-to-create-dynamic-textures-with-ccrendertexture
It'll surely help you.
The section "Repeating Backgrounds" explains how to make a texture repeat and animate it.
In order to change the speed you can make PIXELS_PER_SECOND a dynamic variable.

Is there a way to quickly modify individual color values in an image?

For example, I have a CGImageRef and I want to shift all pixels which are red to orange. Or to put it in other words: I want to apply a value function on every pixel in an image, which modifies the pixel based on the RGBA values it has. So the value function would calculate the new component values for that pixel based on the current component values and some algorithm applied to it.
I know how I could code that by hand with about 100 lines of code, but I wonder if there is a easier and maybe even faster way?
I believe Brad Larson has mentioned somewhere that things like this can be done on the GPU easily and fast. However, I must support iOS 3.2 so it should not get too fancy.
Would be happy about any ideas.
Thanks!
As far as I know there are no built in functions to achieve what you want.
The easiest way to get GPU acceleration when doing custom image manipulations on the pixel level is using the Accelerate.framework. Accelerate will use the 'best execution path' based on available hardware.
However... the port to iOS was only done for iOS4
(disclaimer: I have little to no experience nor knowledge of everything that's possible in OpenGL, so take my answer as limited within the Core Graphics realms of iOS)

Measuring distance with iPhone camera

How to implement a way to measure distances in real time (video camera?) on the iPhone, like this app that uses a card to compare the size of the card with the actual distance?
Are there any other ways to measure distances? Or how to go about doing this using the card method? What framework should I use?
Well you do have something for reference, hence the use of the card. Saying that after watching the a video for the app I can't seem it seems too user friendly.
So you either need a reference of an object that has some known size, or you need to deduct the size from the image. One idea I just had that might help you do it is what the iPhone's 4 flash (I'm sure it's very complicated by it might just work for some stuff).
Here's what I think.
When the user wants to measure something, he takes a picture of it, but you're actually taking two separate images, one with flash on, one with flash off. Then you can analyze the lighting differences in the image and the flash reflection to determine the scale of the image. This will only work for close and not too shining objects I guess.
But that's about the only other way I thought about deducting scale from an image without any fixed objects.
I like Ron Srebro's idea and have thought about something similar -- please share if you get it to work!
An alternative approach would be to use the auto-focus feature of the camera. Point-and-shoot camera's often have a laser range finder that they use to auto-focus. iPhone doesn't have this and the f-stop is fixed. However, users can change the focus by tapping the camera screen. The phone can also switch between regular and macro focus.
If the API exposes the current focus settings, maybe there's a way to use this to determine range?
Another solution may be to use two laser pointers.
Basically you would shine two laser pointers at, say, a wall in parallel. Then, the further back you go, the beams will look closer and closer together in the video, but they will still remain the same distance apart. Then you can easily come up with some formula to measure the distance based on how far apart the dots are in the photo.
See this thread for more details: Possible to measure distance with an iPhone and laser pointer?.