3
$\begingroup$

I have a very specific and probably strange question to which I couldn't find any answers.

I'm a computer vision researcher and I need some data for a "small" side project, I want to know if it's possible to create this data with blender (or any other software for that matter).

The data I need consists of many ( >> 1000) short videos (3-5 sec) simulating a licence plate moving through the frame, with tracking and zoom on the license plate. It's easier to understand with a simple example - I need something very similar to the right window in this video between 0:16-0:20. The difference between videos is in different paths/angles in which the licence plate will move through the frame.

Edit: forgot to mention the important part, the different videos should have different number plates.

If anyone from this great community understood my strange request and can give some insights it could help me immensely.

Furthermore, if anyone is up for collaboration, I could explain my motivations, goals, and possible payoff in more details.

$\endgroup$
  • 2
    $\begingroup$ Tracking plate by camera can be done via object constraints (track-to, locked track, etc). Randomizing camera coordinates for every 5 sec is possible with scripting, or drivers I guess. Zooming/pixelating effect in VSE. $\endgroup$ – Serge L Nov 14 '18 at 8:43
  • 1
    $\begingroup$ Blender has a Python API which could be used to generate all desired combinations and render them through scripting $\endgroup$ – Duarte Farrajota Ramos Nov 14 '18 at 11:49
  • 2
    $\begingroup$ This is quick test in Animation Nodes: imgur.com/UuxZPh2. This is a cut from longer sequence, but every 75 frames plate rotates to random angle $\endgroup$ – Serge L Nov 14 '18 at 12:18
  • $\begingroup$ Thanks @SergeL that's exactly the kind of "low quality/low resolution" effect I'm looking for. The pixelating effect is done in VSE as you specified earlier? (I have no idea what it means or how to integrate it with the solution posted below, but I will know what to search for...) $\endgroup$ – artembus Nov 15 '18 at 8:30
  • 1
    $\begingroup$ Yeah, see this blender.stackexchange.com/a/102951/29200 for VSE pixelating technique $\endgroup$ – Serge L Nov 15 '18 at 9:00
2
$\begingroup$

Ramdomizable setup

Basic components/

  • Plate parented to "car", car is driven along a curve using follow path constraint.

  • Camera has a track to constraint, tracking its view axis -Z to the Plate

enter image description here

Zooming in.

Here I've chosen a frame change handler. The handler takes the scene as an argument. Our camera is scene.camera, our target object is the target of the track to constraint.

The camera is put into field of view mode, and the angle is calculated by the handler. Simple equation using the diagonal length of the plate (target) and the distance from camera to target.

Copy , paste and run script below to set up the handler.

import bpy
from math import atan

def zoom_cam(scene):
    cam_obj = scene.camera
    con = cam_obj.constraints.get("Track To")
    obj = con.target
    #w = max(obj.dimensions)
    w = obj.dimensions.length # diagonal on plane.
    mw = obj.matrix_world
    cam = cam_obj.data
    l = mw.translation - cam_obj.matrix_world.translation
    cam.angle = 2 * atan(w / l.length)

# remove the previous for testing
bpy.app.handlers.frame_change_pre.clear()

bpy.app.handlers.frame_change_pre.append(zoom_cam)

Producing this result.

enter image description here

Mixing it up.

Every time the handler comes to frame one could randomly set any or all of

  • the camera object location
  • the curve transform (loc, rot, scale) as well as shape keys
  • swap curve objects with others in scene
  • the plate object texture image (for different plates) Find link re this
  • randomize the zooming in handler
  • put some noise on constraint influence

enter image description here

$\endgroup$
  • $\begingroup$ Sorry to bother you again @batFINGER , after some trial and error I accomplished my goal with the help of the code and guidelines you provided. Now that I have something similar to your last gif, how can I actually render and save multiple videos from this same scene with different parameters? (as I understand, the standard workflow is to render a scene once and you're done, in this case I need to render the same scene multiple times with different parameters set by the frame handler at the first frame and then to save each video to a file with a name generated by said frame handler) $\endgroup$ – artembus Dec 5 '18 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.