Webcam image capture issue - opencv

I am trying to do some image tracking by capturing images from a webcam and comparing it with a reference image. The problem I face is that two images of the exact same spot differ in their bitmaps. I am using OpenCV. I need to know a way to capture images so that this kind of jitter is avoided.
Thanks in advance.

Well, I would say that you can't.
Two images will never be the same, due to illumination changes, and thousands of other effects (including electronic noise).
What you want to do is to find a way to uniformize it like applying some kind of gaussian filter.
http://mmlab.disi.unitn.it/wiki/index.php/Mixture_of_Gaussians_using_OpenCV
There are also some good links in this post :
Natural feature tracking with openCV- evaluating the options

Related

Quantifying differences in an image sequence to measure activity

I'm looking for a program that will enable me to quantity the difference between images in an image sequence over time.
We are hoping to use timelapse images to measure the activity of tadpoles by comparing how the images change over time. Tracking the movement of individuals isn’t necessary. The tadpoles are dark and the background of the aquarium is light, however the background isn’t uniform and some of the decor items like dark rocks and foliage make it so that all the tadpoles aren’t visible at all times.
Basically need a program that will allow me to quantity the differences/motion detected in an image sequence (i.e 209 images) and produce data that can be exported...
Any and all suggestions appreciated!!
Your question is rather vague and you don't supply any images or real indication of what you expect as results, so my answer will not be as thorough as it might otherwise be.
You don't mention any tools you are familiar with, but my recommendation would be Python and OpenCV. Alternatives are probably scikit-image, Python Wand.
In general, when trying to detect movement across a series of images, you would:
try and work out what the background is
look for movement by sutracting, or differencing, frames from the background
clean up the difference image
identify objects - maybe by shape or size or colour
maybe track objects
produce statistics
As regards working out the background, I did an example here by finding the median pixel across all images at each location in the images. There is also an OpenCV tutorial here.
As regards cleaning up images, you can probably remove noise in the background subtraction with a small median filter, say 3x3 or 5x5 depending on the resolution of your images.
As regards detecting tadpoles, you will probably want to use OpenCV findContours() and filter by size, or colour, or circularity. There are some fairly decent tutorials on PyImageSearch. There is also an ImageMagick "Connected Component" analysis to find a tennis player that I did here.

Panorama of cylindric objects

I want to get the panorama view of cylindrical objects without using special cameras.
The idea was to get a lot of images from different views, cut the center and join these centers together. But I got bad results.
May be somebody knows the best solution for this purpose? May be it's better recognize from video?
Hugin is a great configurable and agile free cross-platform software to stitch panoramic images. You can definitely use it for your task.
If you want to create your own tool for that purpose, you may find useful to read about Hugin's toolchain workflow to know what steps may be needed to achieve nice results.
A possible work flow may be
Take images.
Correct projection depending on lense parameters.
Find and verify control points on image pairs (possible algorithms: SIFT, SURF).
Geometric optimisation (shift, 3D rotation, etc).
Photometric optimisation (exposure values, vignetting, white balance).
Stitch and blend output (cut the centers and join them smoothly together).
You may skip some steps depending on your image capturing conditions. The more similar images are (same camera and cylinder positions, same lighting, etc.) the less image correction you will need.

How to match images with unknown rotation differences

I have a collection of about 3000 images that were taken from camera suspended from a weather balloon in flight. The camera is pointing a different direction in each image but is generally aimed down, so all the images share a significant area (40-50%) with the previous image but at a slightly different scale and rotated an arbitrary (and not consistent) amount. The image metadata includes a timestamp, so I do know with certainty the correct order of images and the elapsed time between each.
I want to process these images into a single video. If I simply string them together it will be great for making people seasick, but won't really capture the amazingness of the set :)
The specific part I need help with is finding the rotation of the image from the previous image. Is there a library somewhere that can identify regions of overlap between two images when the images themselves are rotated relative to each other? If I can find 2-3 common points (or more), I can do the remaining calculations to determine the amount of rotation and the offset so I can put them together correctly. Alternately, if there is a library that calculates both of those things for me, that would be even better.
I can do this in any language, with a slight preference for either Java or Python. The data is in Hadoop, so Java is the most natural language, but I can use scripting languages as well if necessary.
Since I'm new to image processing, I don't even know where to start. Any help is greatly appreciated!
For a problem like this you could look into SIFT. This algorithm detects local features in images. OpenCV has an implementation of it, you can read about it here.
You could also try SURF, which is a similar type of algorithm. OpenCV also has this implemented, you can read about that here.

Face Authentication

My project is Face Authentication.
System Description: My input is only one image (which was taken when the user logins for the first time) and using that image system should authenticate whenever the user logins to the application. The authentication images may differ from the first input image like -- different illumination conditions, different distance from camera and -10 to 10 degrees variation in pose. The camera used is same (ex: ipad) for all cases.
1) Authentication images are stored each time the user logins. How to
make use of these images to enhance the accuracy of the system??
2) When a new image comes, I need to select the closest image(s) (and
not all stored images) from the image repository and use for
authenticate to reduce the time. How to label an image based on
illumination/distance from camera automatically??
3) How should I make my system to perform decently for changes in
illumination and distance from camera??
Please, can anyone suggest me good alogirthm/papers/opensource-codes for my above questions??
Though it sounds like a research project, I would be extremely grateful if I get any response from someone.
For this task I think you should take a look at OpenCV's Face Recognition API. The API is basically able to identify the structure of a face (within certain limitations of course) and provide you with the coordinates of the image within which the face is available.
Having to deal with just the face in my opinion reduces the need to deal with different background colours which I think is something you do not really need.
Once you have the image of the face, you could scale it up/down to have a uniform size and also change the colour of the image to grey scale. Lastly, I would consider feeding all this information to an Artificial Neural Network since these are able to deal with inconsistencies with the input. This will allow you to increase your knowledge base each time a user logs in.
I'm pretty sure there are other ways to go around this. I would recommend taking a look at Google Scholar to try and find papers which deal with this matter for more information and quite possible other ways to achieve what you are after. Also, keep in mind that with some luck you might also find some open source project which already does most of what you are after.
If you really have a database of photographs of faces, you could probably use that to enhance the features of OpenCV face detection. The way faces are recognized is by comparing the principal components of the picture with those of the face examples in OpenCV database.
Check out:
How to create Haar Cascade (xml) for using with OpenCV?
Seeing that, you could also try to do your own Principal Component Analysis on every picture of a recognized face (use OpenCV face detection for that-> Black out everything exept the face, OpenCV gives you the position and size of the face). Compare the PCA to the ones in your database and match it to the closest. Course, this would work best with a fairly big database, so maybe at the beginning there could be wrong matches.
I think creating your own OpenCV haarcascade would be the best way to go.
Good Luck!

Algorithms for: printer checker

I want to make a program for checking the printed paper for errors.
PDF File: please refer to the second page, top right picture
As you see, that system could identify the errors made by printer.
I want to know how was it achieved. What are existing documents about this?
Or any ideas you have?
Thank you
This can be very easy or very difficult.
if your images are black white and your scan is quite precise you can try with a simple subtraction between the images (scanned and pattern)
if your scan will read the image with a possible deformation or translation the you will need first an image registration algorithm.
if your scan present background noise you will have some trouble with the subtraction and then it turns very difficult.
may be some image samples can help to suggest you a more specific algorithm.
I think you need to some how compare two images in a way that is robust to deformation. As mentioned before, substracting the two images can be a first step. Another more sophisticated way can be to use distance transform (or chamfering based methods for template matching) to compare how similar the two images are in the presence of some deformation. More sophisticated solutions can use methods like shape contexts.

Resources