I am trying to stitch together a series of images created from multiple screen captures of a very large image. The user moved vertically and horizontally at maximum resolution over the source image and took screenshots (including window borders, taskbar, etc.) with some overlap, and wants to put them together again.
There are existing solutions that will stitch photos together, but my case is much simpler than creating a panorama of independent photos because the images match exactly.
I am struggling to come up with an efficient algorithm that will find the largest matching rectangle common to adjacent images. Is there an existing solution or can someone suggest a way?
I am using pseudocode from Longest common substring problem to find matches. This finds horizontal matches when I store the bitmap in a 1 dimensional array, but not vertical matches.
Related
So I have one image that on paper they were drawing lines/circles on particular areas of the image that they had designated certain sides as area 1-4, then 5-6 in the center and then a few specific spots as area 7. They wanted to make this digital. So I put the image on a win form, made it so they can create lines and circles (eventually I'll have it so the lines are measured and stored in an array) However along with storing that I need to store what number area the line/circle was created in for tracking purpose so they can look back later to see where the majority of, in this case flaws, are being circled on the image. (The image represents a real machine part). So right now I'm stuck trying to figure out how to designate certain areas of this image as area 1-4, 5,6 (and multiple 7's).
Is it better to split each area up into its own photo and piece them together like a puzzle? Or is there a better way in code to do this leaving 1 image to work with?
I'm working on an OCR program for one of my classes and I'm trying to find circular closed regions in the text to classify characters. Words have already been skeletonized. For example, in this image:
http://i.imgur.com/VLHJp.jpg
I'd like to find the location of the circular O or even the half circle in the E. I've attempted to convert the pixels into an array and then loop through all the white pixels, finding closed paths but this didn't work. I might not have implemented this correctly however. Any other solutions? Thanks in advance.
Edit:
Unfortunately I cannot use Tesseract or other OCR programs because I have to develop my own for my college class. I've used the AForge library to do many tasks such as the skeletonization and wanted to use the circle detection or shape detection classes there but these shapes are too obtuse to work with that.
One of the ways to find closed areas is to use flood fill algorithms. Assuming a pixel at the edge of the image (e.g. 0,0) can't be in a closed in area start from there and flood out. Then you can eliminate all pixels in that flood.
Work through the other pixels in the image (that aren't part of your set of bounding pixels) and do floods. These floods are 'enclosed', you could eliminate them if they reach the edge of the image if you want to. Each flood should take in a reasonable number of pixels so this algorithm eliminates pixels pretty quickly.
In your case I'd suggest you need to set a minimum area (pixel count) to exclude noise.
We're currently creating a simple application for image manipulation in Silverlight, and we've hit a bit of a snag. We want users to be able to select an area of an image (either by drawing a freehand line around their chosen area or by creating a polygon around it), and then be able to apply effects to the pixels within that selection.
Creating a selection of images is easy enough, but we want a really fast algorithm for deciding which pixels should be manipulated (ie. something to detect which pixels are within the user's selection).
We've thought of three possibilities so far, but we're sure that there must be a really efficient and quick way of doing this that's better than these.
1. Pixel by pixel.
We just go through every pixel in an image and check whether it's within the user selection. Obviously this is far too slow!
2. Using a Line Crossing Algorithim.
The type of thing seen here.
3. Flood Fill.
Select the pixels along the path of the selection and then perform a flood fill within that selection. This might work fine.
This must a problem that's commonly solved, so we're guessing there's a ton more solutions that we've not even thought of.
What would you recommend?
Flood fill algorithm is a good choice.
Take a look at this implementation:
Queue-Linear Flood Fill: A Fast Flood Fill Algorithm
You should be able to use your polygon to create a clipping path. The mini-language for describing polygons for Silverlight is quiet well documented.
Alter the pixels on a copy of your image (all pixels is usually easy to modify than some pixels), then use the clipping path to render only the desired area of the changes back to the original image (probably using an extra buffer bitmap for the result).
Hope this helps. Just throwing the ideas out and see if any stick :)
Basically I want to find the pixel location of a small image inside a large image.
I have searched for something similar to this but have had no luck.
It depends on how similar you want the result to match your query image. If you're trying to match corresponding parts of different photorealistic images, take a look at the Feature detection Wikipedia page. What you want to use depends on the transformation you expect one image to undergo to become the other.
That said, if you are looking for an exact pixel-by-pixel match, a brute-force search is probably bad. That can be O(m^2*n^2) for an m*m image used to search within an n*n image. Using better algorithms, it can be improved to O(n^2), linear in the number of pixels. Downsampling both images and doing a hierarchical kind of search might be a good approach.
You could probably use the AForge Framework to do something like this. It offers a variety of image processing tools. Possibly you could use their blob extraction to extracts blobs then compare those blobs to a stored image you have and see if they match.
If the images are pixel-by-pixel equal, you could start by searching for one pixel that has the same color as pixel (0,0) in the small image. Once found, compare each pixel in the area that would be covered by the small image. If there are no differences you found your position. Else start over by searching for the next pixel matching (0,0).
Booyer-Moore search sounds like a solution here if you treat your pixels as characters and are looking for an exact match. Much faster than per pixel searching as well.
I have a bitmap with black background and some random objects in white. How can I identify these separate objects and extract them from the bitmap?
It should be pretty simple to find the connected white pixel coordinates in the image if the pixels are either black or white. Start scanning pixels row by row until you find a white pixel. Keep track of where you found it, create a new data structure to hold its connected object. Do a recursive search from that pixel to its surrounding pixels, add each connected white pixel's coordinates to the data structure. When your search can't find any more connected white pixels "end" that object. Go back to where you started and continue scanning pixels. Each time you find a white pixel see if it is in one of your existing "objects". If not, create a new object and repeat your search, adding connected white pixels as you go. When you are done, you should have a set of data structures representing collections of connected white pixels. These are your objects. If you need to identify what they are or simplify them into shapes, you'll need to do some googling -- I can't help you there. It's been too long since I took that computer vision course.
Feature extraction is a really complex topic and your question didn't expose the issues you face and the nature of the objects you want to extract.
Usually morphological operators help a lot for such problems (reduce noise, fill gaps, ...) I hope you already discovered AForge. Before you reinvent the wheel have a look at it. Shape recognition or blob analysis are buzz works you can have a look at in google to get some ideas for solutions to your problem.
There are several articles on CodeProject that deals with these kinds of image filters. Unfortunately, I have no idea how they work (and if I did, the answer would probably be too long for here ;P ).
1) Morphological operations to make the objects appear "better"
2) Segmentation
3) Classification
Each topic is a big one. There are simple approches but your description is not too detailed...