I get a problem when handling images taken from cell phones.
Image sample:
So, get ghosting especially for the question number area.
I think the reason is a little joggle when press the shutter.
Is there any way to remove the ghosting thus question number area will look more clear?
There is another worse one:
Actually, I find some image denoising functions like cv2.fastNlMeansDenoisingColored(), and it indeed works well upon some images.
Unfortunately, doesn't work for the above two images.
Env: Python3.6.5 Opencv:3.4.0
Thanks.
Wesley
Related
I have been going over this for days now and have hit a road block as I am too scared to try out my hypothesis.
I would like to find out the number of grayed rectangular boxes in this image. However, I am not sure how I can do that. I was thinking of two ways:
i. Getting area of the connected components, calculating their median and getting the number of components between a certain percentile of the area (may sound pretty strange).
ii. Making a machine learning model and find out the similar boxes in the image and count them.
However, I would like them to be more generalized so that I will need to be able to make the solution fit other images that I would need to be processed.
Here is my source Image:
Any sort of help/suggestions and even solutions would be greatly appreciated.
Thanks in advance!
Maybe you are losing a lot of image information with filtering...Do you have an unfiltered source image too? I suppose ML approach would work pretty nice then.
I noticed you could achieve better resolution if your camera is 90 rotated (If you could affect this)
for my school project, I need to find images in a large dataset. I'm working with python and opencv. Until now, I've managed to find an exact match of an image in the dataset but it takes a lot of time even though I had 20 images for the test code. So, I've searched few pages of google and I've tried the code on these pages
image hashing
building an image hashing search engine
feature matching
Also, I've been thinking to search through the hashed dataset, save their paths, then find the best feature matching image among them. But most of the time, my narrowed down working area is so much different than what is my query image.
The image hashing is really great. It looks like what I need but there is a problem: I need to find an exact match, not similar photos. So, I'm asking you guys, if you have any suggestion or a piece of code might help or improve the reference code that I've linked, can you share it with me? I'd be really happy to try or research what you guys send or suggest.
opencv is probably the wrong tool for this. The algorithms there are geared towards finding similar matches, not exact ones. The general idea is to use machine learning to teach the code to recognize what a car looks like so it can detect cars in videos, even when the color or form changes (driving in the shadow, different make, etc).
I've found two approaches work well when trying to build an image database.
Use a normal hash algorithm like SHA-256 plus maybe some metadata (file or image size) to find matches
Resize the image down to 4x4 or even 2x2. Use the pixel RGB values as "hash".
The first approach is to reduce the image to a number. You can then put the number in a look up table. When searching for the image, apply the same hashing algorithm to the image you're looking for. Use the new number to look in the table. If it's there, you have a match.
Note: In all cases, hashing can produce the same number for different pictures. So you have to compare all the pixels of two pictures to make sure it's really an exact match. That's why it sometimes helps to add information like the picture size (in pixels, not file size in bytes).
The second approach allows to find pictures which very similar to the eye but in fact slightly different. Imagine cropping off a single pixel column on the left or tilting the image by 0.01°. To you, the image will be the same but for a computer, they will by totally different. The second approach tries to average small changes out. The cost here is that you will get more collisions, especially for B&W pictures.
Finding exact image matches using hash functions can be done with the undouble library (Disclaimer: I am also the author). It works using a multi-step process of pre-processing the images (grayscaling, normalizing, and scaling), computing the image hash, and the grouping of images based on a threshold value.
I'm trying to make a program that rotates and crops an image ROI (without losing a single pixel of the frame) based just on what minAreaRect() returns (from seeing what it can mark with drawContours).
Now since I don't understand what the function returns other than the rotation angle(list [0:1]) I'm struggling to make that myself. All I found on the internet was a Stack Overflow question with code that wasn't really explained very well and didn't realy work (atleast for openCV 3.6 not)
May I have any clues to what is the return syntax of this function and what is the method and keywords to search for such things, as well as a short little function that can maybe do that rotation and cropping? Since that looks like a quite common and simple thing to achieve.
I am generating images (thumbnails) from a video every 3 seconds. Now I need to discard/remove all the similar images. Is there a way I could this?
I generate thumbnails using FFMPEG. I read about various image-diff solutions like given in this SO post, but I do not want to do this manually. How and what parameters should be considered that could tell if a particular image is similar to other images present.
You can calculate the Structural Similarity Index between images and based on the score keep or discard an image. There are other measures you can use, but basically a method that returns a score. Try PIL or OpenCV
https://pillow.readthedocs.io/en/3.1.x/reference/ImageChops.html?highlight=difference
https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/
I dont have enough reputation to comment my idea on your problem, so i will just go ahead and post it as an answer in hope of helping you.
I am quite confused about the term "similar" but since you are reffering on video frames i am going to assume that you want to avoid having "similar" frames that have been captured because of poor camera movement. If that's the case you might want to consider using salient point descriptors.
To be more specific you can detect salient points (using for instance Harris) and then use a point descriptor algorithm (such as SURF) and discard the frames that have been found to have "too many" similar points with a pre-selected frame.
Keep in mind that in order for the above process to be successful, the frames must be as sharp as possible, i guess you don't want to extract as a thubnail a blurred frame anyway. So applying a blurred images detection might be useful in your case.
So I have quite an interesting image segmentation problem. Here, I have scraped instagram photos which are stacked vertically.
see image here(too long to post): https://imgur.com/a/gPr2J
What I am trying to do is quite simple. I just want to extract each post image from the screenshot, and save it to some directory. I am trying to find ways to make this work, like cropping by pixel color at a certain height but none of it is working perfectly.
Any method that would quickly segment this image. Python BTW.
I think you should start with segmenting each post out. Use the gaps between each post (which are always uniform) to segment each post out.
Then approach capturing the image inside the post - breaking this down into 2 different problems will make your algorithm simpler in my opinion.
I have a few ideas, not entirely sure how will they work for you, but thought they might give you some leads to try out:
1) All these instagram images seems to have a "heart" shaped icon just below the image you want to extract. Maybe figuring out detecting the heart shape might be good idea? Once you have found the "heart" you can look for the image just above it. Since it is a UI, my hope is that all the images that you want to extract will be a fixed number of pixels above the "heart". Moreover, they should also have the same height and width, I think.
2) Another possible idea is to find the edges in the image. Again, the images you want to extract seem to have a strong edge with respect to their background (but so does text and other UI elements). However, these edges should ideally have the largest area (which is also mostly fixed) enclosed between them. So, after finding the edges, you can use the find contours in function in opencv and then filter out the contours which have an area greater than a threshold. Have you tried something like this?