Video recorder project

OpenMV related project discussion.
Newtodis
Posts: 5
Joined: Fri Nov 29, 2019 10:10 am

Video recorder project

Postby Newtodis » Fri Nov 29, 2019 10:18 am

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?
User avatar
iabdalkader
Posts: 1026
Joined: Sun May 24, 2015 3:53 pm

Re: Video recorder project

Postby iabdalkader » Fri Nov 29, 2019 4:36 pm

Newtodis wrote:
Fri Nov 29, 2019 10:18 am
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.
Newtodis
Posts: 5
Joined: Fri Nov 29, 2019 10:10 am

Re: Video recorder project

Postby Newtodis » Sun Dec 01, 2019 1:20 pm

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 ?
User avatar
iabdalkader
Posts: 1026
Joined: Sun May 24, 2015 3:53 pm

Re: Video recorder project

Postby iabdalkader » Sun Dec 01, 2019 2:05 pm

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.sens ... kip_frames
Newtodis
Posts: 5
Joined: Fri Nov 29, 2019 10:10 am

Re: Video recorder project

Postby Newtodis » Sun Dec 01, 2019 2:25 pm

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.
User avatar
kwagyeman
Posts: 3503
Joined: Sun May 24, 2015 2:10 pm

Re: Video recorder project

Postby kwagyeman » Sun Dec 01, 2019 5:23 pm

Post your code...
Nyamekye,
Newtodis
Posts: 5
Joined: Fri Nov 29, 2019 10:10 am

Re: Video recorder project

Postby Newtodis » Mon Dec 02, 2019 4:14 am

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.

Code: Select all

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())
User avatar
kwagyeman
Posts: 3503
Joined: Sun May 24, 2015 2:10 pm

Re: Video recorder project

Postby kwagyeman » Tue Dec 03, 2019 1:12 am

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.
Nyamekye,
Newtodis
Posts: 5
Joined: Fri Nov 29, 2019 10:10 am

Re: Video recorder project

Postby Newtodis » Tue Dec 03, 2019 8:52 am

Ok thanks!

Another question, is it possible to record 2 videos without resetting the camera in between?
User avatar
kwagyeman
Posts: 3503
Joined: Sun May 24, 2015 2:10 pm

Re: Video recorder project

Postby kwagyeman » Tue Dec 03, 2019 2:54 pm

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

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests