Video recorder project

Hi Guys!

My name is Kevin, I am new to this.
I bought the OpenMV cam H7 and the LCD shield for a work project.

My goal is simple, I want to track a moving object so i made a device on which the OpenMV cam is mounted; Now, I want to see on the LCD Shield what the camera is seeing and at the same time record the video of the moving object.
Thanks to the examples given I can do both separately but I have a hard time doing both at the same time.

Is it possible?

Yes it’s possible, just combine the two examples and let us know if something doesn’t work.

Hi!

I have tried to combine both but I have discovered that when I run the Video recording “MJPEG” script, the begining of the recorded video is actually what the cam see when I reset it for the first two seconds and the rest is what I really wanted to record.

Do you guys knowwhy I have this? and how can I change it ?

I’m not sure I understand the issue, you can call skip_frames if you want to skip some number of frames (or time).
https://docs.openmv.io/library/omv.sensor.html#sensor.sensor.skip_frames

Let me put it that, for example, if I record something when I reset the cam to get the video file, the first seconds will not be what I wanted to record but rather what the cam is seeing for the first seconds after I reset it.

Post your code…

This is my code but I don’t know if it has anything to do with it because I found the same error with using the mjpeg.py example script from the IDE.

import pyb, time, sensor, image, lcd, mjpeg
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
clock = time.clock()
lcd.init(1) # Initialize the lcd shield.
BLUE_LED_PIN = 3
RED_LED_PIN = 1

pyb.LED(BLUE_LED_PIN).on()
m = mjpeg("example.mjpeg")
for i in range(200):
  pyb.LED(BLUE_LED_PIN).off()
  pyb.LED(RED_LED_PIN)on()
  lcd.display(sensor.snapshot()) # Take a picture and display the image.
  m.add_frame(sensor.snapshot())
  print(clock.fps())
  pyb.LED(RED_LED_PIN).off()
m.close(clock.fps())

The default camera script has the skip frames feature which skips images. I see that you removed that from your script. So, it shouldn’t do that anymore.

Ok thanks!

Another question, is it possible to record 2 videos without resetting the camera in between?

Yes, just open a new file and start recording again.