I need help to choose me a method which I can apply to my problem. Problem is I have 2 images like this
First image and Second image.
You can see these are images with same same lines, not all lines. I would like you to suggest me a method how to approach this problem. I need to have best match possible and to have the coordinates for these to images how to put them together again, without matching them or using an algorithm again. Btw I prefer python like a programing language for this problem and please do not suggest patented method like surf etc.
Thank you for all answers and help from you.
Have a nice a day.
I need to have best match possible and to have the coordinates for these to images how to put them together again, without matching them or using an algorithm again
I'm not sure what exactly you mean by the highlighted part, but what you're describing seems to be an image stitching problem, or a least part of one.
OpenCV has a class that implements a stitching pipeline.
If you are only interested in finding the correspondences and not the combined image, you could have a look here, where they explain a feature matcher and extractor.
Note, however, that the performance of these feature extractors depends a lot on the parameters you set, so you might have to tune them a bit before it works well.
Related
So lets say I have a objects like a face. I take multiple pictures of the face all at different angles and from far and close. I have a sort of idea of how to make a 3d model out of these pictures but don't know how to accomplish them. My idea goes likes this.
First make code that gets the image object and gets rid of all background "noise".
Second find what part of the 3d model the picture is about and place a tag on the image for where it should fit.
Third collect and overlap all the images together to create a 3d object.
Anyone have any idea how to accomplish any of these steps or any ideas how to create a 3d model out of a series of images? I use python 3.10.4.
It seems that you are asking if there are some Python modules that would help to implement a complete photogrammetry process.
Please note that, even in the existing (and commercial) photogrammetry solutions, the process is not always fully-automated, sometimes it require some manual tweaking & point cloud selection.
Anyway, to the best of my knowledge, what you asked requires to implement the following steps:
detecting common features between the different photographs
infer the position in space of the camera that took each photograph
generate a point cloud of the photographs based on their relative position in space and the common features
convert the point cloud in a 3D mesh.
Possibly, all of these steps can be implemented in Python but I'm not aware that such a "off-the-shelf" module does exist.
There's this commercial solution called: Metashape from Agisoft, it has a python module you can use, but beware that it has its pitfalls (it threw segmentation fault for me at the end of processing which makes things... icky) and the support kind of ignores bigger problems and you can expect that they would ignore your ticket. Still, does the job quite well.
I want to find a character in my input image. When I crop char from an image and use template matching, in almost all cases, it works perfect; but if I use that template for another image with a little different shape of char it fails.
This is my question: How can I find object in my images similar to my template but with a little variety in slope or line thickness or ... ? Is there any way with template matching or do you suggest another methods according to your experience?
I will appreciate any related answer in advance.
I think you are facing a limitation of template matching here. It seems like you are already using the right metric (normalised cross-correlation). Maybe one last thing you can do is to check for 5 templates: a 'perfect' one (take from a perfect image) and 4 rotated versions. Then, for each template you find the best match, and then compare the 5 best matches against each other to pick the best of them.
Depending on how much time you want to invest, and what robustness level you wish to accomplish, you can also use Neural Network ! It will b the more robust approach to this problem. Of course, there are some neural network trained for character detection, for instance here, and some available tutorial like this one.
If you don't want to use NN, you could think of another method which could work with line detection. A '/' character has a quite characteristic shape: a closed path, rotated with a certain angle, with 'inertia' around one single axis. That is easy to describe with some mathematical properties of the detected closed shape. This approach is called shape descriptor and is described (for instance) here. I think that if you have some knowledge on the size of the text, and pretty good image quality, then this 'low-level' approach has some potential. It often works really well.
I hope this helps you to solve your problem.
I am asking a question, because my two week research are started to get me really confused.
I have a bunch of images, from which I want to get the numbers in Runtime (it is needed for reward function in Reinforcment Learning). The thing is, that they are pretty clear for me (I know that it is absolutely different thing for OCR-systems, but that's why I am providing additional images to show what I am talking about)
And I thought that because they are rather clear. So I've tried to use PyTesseract and when it does not worked out I have tried to research which other methods could be useful to me.
... and that's how my search ended here, because two weeks of trying to find out which method would be bestly suited for my problem just raised more questions.
Currently I think that the best resolve for it is to create digit recognizing model from MNIST/SVNH dataset, but is not it a little bit overkill? I mean, images are standardized, they are in Grayscale, they are small, and the numbers font stays the same so I suppose that there is easier way of modyfing those images/using different OCR method.
That is why I am asking for two questions:
Which method should be the most useful for my case, if not model
trained with MNIST/SVNH datasets?
Is there any kind of documentation/books/sources which could make the actual choice of infrastructure easier? I mean, let's say
that in future I will come up again to plan which OCR system to use.
On what basis should I make choice? Is it purely trial and error
thing?
If what you have to recognize are those 7 segment digits, forget about any OCR package.
Use the outline of the window to find the size and position of the digits. Then count the black pixels in seven predefined areas, facing the segments.
I am thinking about creating a database system for images where they are stored with compact signatures and then matched against a "query image" that could be a resized, cropped, brightened, rotated or a flipped version of the stored one. Note that I am not talking about image similarity algorithms but rather strictly about duplicate detection. This would make things a lot simpler. The system wouldn't care if two images have an elephant on them, it would only be important to detect if the two images are in fact the same image.
Histogram comparisons simply won't work for cropped query images. The only viable way to go I see is shape/edge detection. Images would first be somehow discretized, every pixel being converted to an 8-level grayscale for example. The discretized image will contain vast regions in the same colour which would help indicate shapes. These shapes then could be described with coefficients and their relative position could be remembered. Compact signatures would be produced out of that. This process will be carried out over each image being stored and over each query image when a comparison has to be performed. Does that sound like an efficient and realisable algorithm? To illustrate this idea:
removed dead ImageShack link
I know this is an immature research area, I have read Wikipedia on the subject and I would ask you to propose your ideas about such an algorithm.
SURF should do its job.
http://en.wikipedia.org/wiki/SURF
It is fast an robust, it is invariant on rotations and scaling and also on blure and contrast/lightning (but not so strongly).
There is example of automatic panorama stitching.
Check article on SIFT first
http://en.wikipedia.org/wiki/Scale-invariant_feature_transform
If you want to do a feature detection driven model, you could perhaps take the singular value decomposition of the images (you'd probably have to do a SVD for each color) and use the first few columns of the U and V matrices along with the corresponding singular values to judge how similar the images are.
Very similar to the SVD method is one called principle component analysis which I think will be easier to use to compare between images. The PCA method is pretty close to just taking the SVD and getting rid of the singular values by factoring them into the U and V matrices. If you follow the PCA path, you might also want to look into correspondence analysis. By the way, the PCA method was a common method used in the Netflix Prize for extracting features.
How about converting this python codes to C back?
Check out tineye.com They have a good system that's always improving. I'm sure you can find research papers from them on the subject.
The article you might be referring to on Wikipedia on feature detection.
If you are running on Intel/AMD processor, you could use the Intel Integrated Performance Primitives to get access to a library of image processing functions. Or beyond that, there is the OpenCV project, again another library of image processing functions for you. The advantage of a using library is that you can try various algorithms, already implemented, to see what will work for your situation.
I've used Kirsch filter to try and obtain the blood vessels, but the result isn't the best, as shown below:
Although the vessels have been obtained, they aren't bright enough. How do I go about making them 'more visible'?
I worked on retina vessel detection for a bit few years ago, and there are different ways to do it:
If you don't need a top result but something fast, you can use oriented openings, see here and here.
Then you have an other version using mathematical morphology version here.
For better results, here are some ideas:
Personally, I used combination of Gabor filters, and results where pretty good. See the segmentation result here on the first image of drive.
And Gabor can be combined with learning for a good result, or here.
Few years ago, they claimed to have the best algorithm, but I've never had the opportunity to test it. I was sceptic about the performance gap and the way they thresholded the line detector results, it was kind of obscure.
But I know that nowadays, many people try to tackle the problem using CNN, but I've not heard about significant improvements.
[EDIT] To answer your specific question, you can erase the bright ring, and then apply a histogram stretching. But I think that the methods I introduced before will work better than the filter you are using.
looks like, the solution for your problem is histogram equalization (we had the same problem for homework)
http://docs.opencv.org/3.1.0/d5/daf/tutorial_py_histogram_equalization.html#gsc.tab=0