What features do glitched images have that I could detect?

Viewed 222

I'm trying to build a footage filter that only sends only "good" frames to the database.

Here is my current rating function:

def rateImg(img):
    try:
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    except:
        gray = img
    edges = cv2.Canny(gray, 0, 255)
    countours, _ = cv2.findContours(
        edges, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
    num_of_countours = len(countours)
    lap = cv2.Laplacian(gray, cv2.CV_64F).var()
    lap = round(lap, 2)
    return [lap, num_of_countours]

First off, I use variance of Laplacian to calculate the sharpness of an image from a particular time window.

It should technically provide me a "good" frame, but that's not always the case.

The camera I have to use isn't great and sometimes glitches out like this and frames like this have the highest variance of Laplacian.

So, my current solution is to calculate the number of countours in an image and if an image crosses a particular threshold I classify it as "glitched". But with this approach the algorithm rates images with a lot of objects as "glitched".

Also, I have tried detecting squares and rectangles, but that proved to be much less effective than the countour approach.

Is there any way to detect obvious glitches in an image? I feel like there should be, because as a human I can easily classify glitched and normal images at a glance. I just can't seem to pin-point what exactly makes them different.

1 Answers

Is there any way to detect obvious glitches in an image?

Yes, but probably not for complex random glitches, have a look here

this is not a duplicate but in that case, you can detect if there is a horizontal area containing the same RGB value. (Also you can detect if there is a large area of the image containing the same color. Photo taken from the camera would never contain the same RGB value although they look similar, Computer generated images are an exception)

as a human I can easily classify glitched and normal images at a glance.

In fact, you can't identify a glitched image. You try to recognize the objects in it. When you see something "weird" that you don't recognize, you consider it as a glitched image. The machine can't achieve this unless you trained it.

Is there any way to detect obvious glitches in an image

I don't think a person can code a program that can achieve it.

.

what exactly makes them different.

The way you and a machine look at the world. You are directly receiving a clear photo in your brain and you have to 'train' a lot to find if a photo is normal

Just try to observe this "image" which the computer can see

73 64 67 68 64 66 6e 67
73 6e 68 72 67 74 72 79
75 79 65 75 79 65 75 74
6d 6e 79 6d 65 74 75 79
65 6d 6a 74 75 6b 69 20
79 66 74 79 2c 6f 75 69
74 2c 6f 69 79 74 79 2c

I am not a engineer in ML, but i can tell you definitely YES, which i believe you won't be even trying to do it.

I think is a lot more then a comment, but it don't really answer your question. As i am new to StackOverFlow, i am not able to add a comment so I would be posting this as a answer.

Related