Interlaced frame - Presence of odd field's data in even fields

asked 2019-04-22 04:59:41 -0600

updated 2019-04-22 05:52:11 -0600

supra56 gravatar image

I am trying to isolate the odd fields and even field from a interlaced frame. The algorithm that I use is simply matrix slicing.

When I display the images, I see that there are remanants of odd field in even field image and vice versa.

What could be the reason? How to avoid this? Am I doing something wrong here?

Here is the Python code I am using. PFA the images. To better visualize the problem, I plotted a line trace of a colum and one can see the jagged trend on the right end of the plot.

import numpy as np
import cv2
import matplotlib.pyplot as plt

file_path=r'E:\DCIM\101D5200\DSC_2689.MOV'
vid=cv2.VideoCapture(file_path)
ret,frame=vid.read()
cropped_frame=cv2.cvtColor(frame[450:650,500:600,:],cv2.COLOR_BGR2GRAY)

even_fields=cropped_frame[::2,:];
odd_fields=cropped_frame[1::2,:];
cv2.imshow('cropped frame',cropped_frame);
cv2.imshow('even rows',even_fields);
cv2.imshow('odd rows',odd_fields);

cv2.waitKey(0)

plt.plot(cropped_frame[3::2,50],'*-');
plt.show()

In the image below, the interlaced frame on the left; even field on the top right; odd field on the bottom left.

image description

Plot of a single colum data from the isolated odd field.

Plot of a single colum data from the isolated odd field

The frame used from the video is also attached for reference.Here is the link

edit retag flag offensive close merge delete

Comments

You want to crop on right side of border?

supra56 gravatar imagesupra56 ( 2019-04-22 05:54:01 -0600 )edit

No, i was trying to isolate the two fields from the interlaced image. I guess I found my mistake. I used the wrong color converter. RGB2Gray gave better results than BGR2Gray.

Karthikyan gravatar imageKarthikyan ( 2019-04-22 11:52:30 -0600 )edit