0

prev_frame_gray is the first frame taken in my videoCapture(0). It depicts me holding a phone and c_frame_gray is the next frame where the phone was moved quickly. So now I only want the current frame changes.

frame_diff = cv2.absdiff(c_frame_gray,prev_frame_gray)
edges = cv2.Canny(frame_diff, 40, 40)
_, thresh = cv2.threshold(edges, 0, 80, cv2.THRESH_BINARY)

enter image description here

As shown in image, the blue circle is the image from first frame, red circle is the latest change. I only want the contours in red circle. What am I doing wrong here? or What extra steps should I take?

nekomatic
  • 5,988
  • 1
  • 20
  • 27
CigarDon
  • 79
  • 1
  • 4
  • 14
  • If possible please provide 2 consecutive frames (c_frame, prev_frame) you have used to produce this output. – Kaushik Roy Oct 02 '19 at 06:01
  • By now, your question is quite incomprehensible, at least from my point of view. Please provide the inputs you use in `cv2.absdiff`. And what exactly is the shown image? Is that the output from the `cv2.threshold` from the given code segment? If so, how do you expect to have both frames in that image, keeping in mind that the input is the output from your `cv2.absdiff`!? As I said, quite confusing. Maybe elaborate on what you want to achieve. – HansHirse Oct 02 '19 at 06:02
  • @HansHirse ive made some edits. bit01 currently im comparing two consecutive frames... – CigarDon Oct 02 '19 at 06:13
  • 1
    The abs different shows both positive and negative values because of the abs. If you want to only show one side, then don't use abs. Just subtract one from the other and clip values below 0. – fmw42 Oct 02 '19 at 06:14
  • @fmw42 anywhere i can refer to? – CigarDon Oct 02 '19 at 06:38
  • You can just use image2 - image1 for the difference in Python and then clip values below zero to 0. – fmw42 Oct 02 '19 at 06:49

0 Answers0