I want to compare an image of a front of a car with a database of images with other cars and tell me that most likely match of it.
Program firstly shall find key points and descriptors of the database of the images using SURF and try to compare them with Flann matcher.
But I simply can't understand how it should work. I'll have matches of the various pairs of images, but how can I compare the images and show relative output?
Related
I'm currently working on a image processing project opencv python based, and essentially it's quite simple, it uses cv2.matchTemplate and a database to make all the matches, but I think something is done wrong.
The images are get from a few cameras, then the processing starts, based on predefined masks, the ROI of each object is returned the ROI of to then be matched with a database of images.
The problem is, the database has crops are the same size of the ROI predefined, which means the cv2.matchTemplate is always trying to match an image of the same size as the one in the database.
Here's an example with a printed circuit board (which is what my project does, it looks for bad positioned components/missing components).
Simple circuit board
This would be the full raw image, taken from one of the cameras.
Next a predefined filter would be applied to the raw image, I usually convert it to grayscale.
Now, my predefined ROI would crop the image.
Image ROI
Image crop
Notice though it crops way more than the component itself, and this crop will be saved in the database for eventual matches.
But shouldn't I be manually feeding my database with properly images? I mean, is it ideal? wouldn't it take way more matches (images) to get my desired threshold?
I need arguments to convince someone of it, I want to feed my database with well cropped images, but this person just wants to save it automatically.
Thanks!
I find many examples of passing a list of images, and returning a stitched image, but not much information about how these images have beeen stitched together.
In a project, we have a camera fixed still, pointing down, and coveyers pass underneath. The program detects objects and start recording images. However some objects do not enter completely in the image, so we need to capture multiple images and stich then together, but we need to know the position of the stitched image because there are other sensors synchronized with the captured image, and we need to also synchronize their readings within the stitched image (i.e. we know where the reading is within each single capture, but not if captures are stitched together).
In short, given a list of images, how can we find the coordinates of each images relative to each other?
Basically while stiching correspondence between two (or more) images are setup. This is done with some constant key points. After finding those key points the images are warped or transformed & put together, i.e. stitched.
Now those key points could be set/ noted as per a global coordinate system (containing all images). Then one can get the position after stitching too.
Most of the steps are similar to panaroma stitching. You can follow this link for your problem.
Basically, one/some image(s) will be your reference image(s), and you will find the transformation between it and the other ones. These transformations will be your 4*3 homography matrices. Any point in an image can be transformed into another image's coordinate system using these matrices homography. So, you can overcome the occlusion issue that you are trying to solve. Another source for homography.
I have a database of original images and for each original images there are various cropped versions.
This is an example of how the image look like:
Original
Horizontal Crop
Square Crop
This is a very simple example, but most images are like this, some might taken a smaller section of the original image than others.
I was looking at OpenCV in python but I'm very new to this kind of image processing.
The idea is to be able to save the cropping information separate from the image to save space and then generate all the cropping and different aspect ratio on the fly with a cache system instead.
The method you are looking for is called "template matching". You find examples here
https://docs.opencv.org/trunk/d4/dc6/tutorial_py_template_matching.html
For your problem, given the large images, it might be a good idea to constrain the search space by resizing both images by the same factor. So that searching a position that isn't as precise, but allows then to constrain the actual full pixel sized search to a smaller region around that point.
Okay so i am trying to find homography of a soccer match. What i have till now is
Read images from a folder which is basically many cropped images of a template soccer field. Basically this has images for center circle and penalty lines etc.
Read video stream from a file and crop it into many smaller segments.
Loop inside the images in video stream and inside that another loop for images that i read from folder.
Now in the two images that i get through iteration , i applied a green filter because of my assumption that field is green
Use orb to find points and then find matches.
Now the Problem is that because of players and some noise from croud, i am unable to find proper matches for homography. Also removing them is a problem because that also tends to hide the soccer field lines that i need to calculate the homography on.
Any suggestions on this is greatly appreciated. Also below are some sample code and images that i am using.
"Code being used"
Sample images
Output that i am getting
The image on right of output is a frame from video and that on left is the same sample image that i uploaded after filterGreen function as can be seen from the code.
Finally what i want is for the image to properly map to center circle so i can draw a cube in center, Somewhat similar to "This example" . Thanks in advance for helping me out.
An interesting technique to throw at this problem is RASL. It computes homographies that align stacks of related images. It does not require that you specify corresponding points on the images, but operates directly on the image pixels. It is robust against image occlusions (eg, players moving in the foreground).
I've just released a Python implementation here: https://github.com/welch/rasl
(there are also links there to the original RASL paper, MATLAB implementation, and data).
I am unsure if you'd want to crop the input images to that center circle, or if the entire frames can be aligned. Try both and see.
I am looking at an application where I have two images from a single object (a smartphone) acquired using x-ray. The two images have been acquired at different instant. The intensity content of the two images is thus different and I would like to be able to fuse the two images in order to extract some information about the phones.
In between the two images, the set up have been slightly changed such that the phone is not placed at the same pixel value in the two images. To be able to correctly compare the two images, I would need to translate and rotate the images of the phones such that they overlap as much as possible.
For this I am using python and open cv (cv2). I was thinking to use a thresholding and then find the coordinate of the two thresholded images and use the coordinate to map the yellow image on the red one (or the opposite). The attached image shows what I have obtained so far.
The pseudo code is given in the following:
ret1, thresh1 = cv2.threshold(img1.astype(np.uint8),200,255,cv2.THRESH_BINARY_INV)
ret2, thresh2 = cv2.threshold(template.astype(np.uint8),200,255,cv2.THRESH_BINARY_INV)
plt.figure(1)
plt.subplot(121)
plt.imshow(thresh1)
plt.subplot(122)
plt.imshow(thresh2)
plt.show()
where img1 is one image acquired with the first filter and template is the image acquired with the second filter. One can see that the phones are at different position in the yellow and green images respectivelly.
My question is how to perform the next step. How can I find the coordinate of this thresholded images and then superpose the images of the two phones? Is it the right strategy at all or are there better solutions?
I have been looking at this link on template matching, but for the moment I have had no success.
Hei,
Image-registration did the tricks, thanks! I followed the following tutorial:
image-registration and manage to do what I was looking for.
Thanks!
Greg