Author Topic: How to enter 5x crop and move crop window from lua?  (Read 741 times)

Ilia3101

  • Senior
  • ****
  • Posts: 302
How to enter 5x crop and move crop window from lua?
« on: January 07, 2018, 06:26:42 PM »
Is there a way in the lua api to enable crop mode and precisely set position of crop window?

edit: Argh so sorry!!!! meant to put this in the Q and A. Can it be moved?
5D2

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11472
  • 5D Mark Free
Re: How to enter 5x crop and move crop window from lua?
« Reply #1 on: January 07, 2018, 06:34:50 PM »
To enable the crop mode: http://builds.magiclantern.fm/lua_api/modules/lv.html#zoom

Code: [Select]
lv.zoom = 5;

To move it around, it's not exposed, but it's not hard to do so: a wrapper around move_lv_afframe / get_afframe_pos / get_afframe_sensor_res should do the trick (maybe hiding all the complexity and using some logical coords, like percentage or 0...720, 0...480). Wanna try?

5D2 has some issues with accurate positioning when AF is enabled; see comments and workarounds in move_lv_afframe (shoot.c). It's very old code, probably needs refactoring and a second look to figure it out.

Workaround with current API: "press" the joystick center button to center the focus box, then send as many direction presses as you need; at least, this one should be repeatable (positioning-wise) and requires no knowledge about LiveView internals.

Ilia3101

  • Senior
  • ****
  • Posts: 302
Re: How to enter 5x crop and move crop window from lua?
« Reply #2 on: January 07, 2018, 06:47:55 PM »
To enable the crop mode: http://builds.magiclantern.fm/lua_api/modules/lv.html#zoom

Code: [Select]
lv.zoom = 5;
Ah thanks, not too good at searching through API pages.

Workaround with current API: "press" the joystick center button to center the focus box, then send as many direction presses as you need;

Thanks, will use that for now :)

To move it around, it's not exposed, but it's not hard to do so: a wrapper around move_lv_afframe / get_afframe_pos / get_afframe_sensor_res should do the trick (maybe hiding all the complexity and using some logical coords, like percentage or 0...720, 0...480). Wanna try?

Might want to try later on if I have good results with this.

Not what I'm doing here... but do you think it would be possible (probably not in lua) to alternate between two crop positions for every video frame?
5D2

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11472
  • 5D Mark Free
Re: How to enter 5x crop and move crop window from lua?
« Reply #3 on: January 07, 2018, 07:20:26 PM »
Quote
Not what I'm doing here... but do you think it would be possible (probably not in lua) to alternate between two crop positions for every video frame?

If you disable Canon's vertical offset corrections (and whatever other position-dependent calibrations they might be doing), and re-apply them from scratch in post, yes. I remember g3gg0 has a proof of concept somewhere on youtube, maybe around 2012.

Unfortunately, the implementation will be camera-dependent (along the lines of crop_rec_4k). You can already play around with adtg_gui to find what registers may need tweaking for that.

Are you thinking at some sort of 4K with reduced temporal resolution at the borders of the frame, and full coverage in center?

Ilia3101

  • Senior
  • ****
  • Posts: 302
Re: How to enter 5x crop and move crop window from lua?
« Reply #4 on: January 07, 2018, 10:36:04 PM »
If you disable Canon's vertical offset corrections (and whatever other position-dependent calibrations they might be doing), and re-apply them from scratch in post, yes. I remember g3gg0 has a proof of concept somewhere on youtube, maybe around 2012.

Unfortunately, the implementation will be camera-dependent (along the lines of crop_rec_4k). You can already play around with adtg_gui to find what registers may need tweaking for that.
Ah right, that seems a bit high level for me ::) And as it's camera-dependent maybe not even worth the time for such a non versatile feature.

Are you thinking at some sort of 4K with reduced temporal resolution at the borders of the frame, and full coverage in center?
Yep. I'm not sure why no one has really talked about it before, isn't it a pretty obvious solution for quite static shots? Or interview shots where only a subject in the middle moves a lot...

But as a first test I'm writing a script for taking panoramic video (one shot after another) along with a script to blend them together in the middle (though it would only look good in shots without action where the seam is).
5D2

Kharak

  • Hero Member
  • *****
  • Posts: 792
Re: How to enter 5x crop and move crop window from lua?
« Reply #5 on: January 08, 2018, 02:52:47 AM »
This made me think, as Ilia is mentioning alternating window frames on the sensor.

Say, one was recording 1920x1080 crop. Is it possible to record at 24 fps with alternating windows, one Furthest to the left and other furthest to the right to combine a 3D image ? or possibly even higher frame rates to make this effect seamless. I would not mind 24 fps stutter jump between the two frames.

and ofcourse, is the distance between furthest to the left to right, enough to Physically make a 3D Pop? As in, how far apart is the center of a 1920 crop from furthest to the left of the sensor to the right in mm/cm?

 and last but not least, is having only one lens hindering possibility of a 3D perspective?

Just writing this, makes me think a1ex probably already considered it and dumped it because of the answers to these questions.

Still would like a smart explanation from someone.

once you go raw you never go back

Walter Schulz

  • Hero Member
  • *****
  • Posts: 6149
Re: How to enter 5x crop and move crop window from lua?
« Reply #6 on: January 08, 2018, 09:39:55 AM »
You will get no 3D using sensor area shifting. Entrance pupil won't move -> You will get a stitched panorama.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11472
  • 5D Mark Free
Re: How to enter 5x crop and move crop window from lua?
« Reply #7 on: January 08, 2018, 10:00:43 AM »
Yep. I'm not sure why no one has really talked about it before, isn't it a pretty obvious solution for quite static shots? Or interview shots where only a subject in the middle moves a lot...

That should look a bit better than those vertical videos with massive blur on the sides :D

Ilia3101

  • Senior
  • ****
  • Posts: 302
Re: How to enter 5x crop and move crop window from lua?
« Reply #8 on: January 08, 2018, 10:45:09 PM »
 :D


and last but not least, is having only one lens hindering possibility of a 3D perspective?

Ummm no... I did this ages ago already ;D Create a lens filter blue on one side, red on the other - put it on a lens with a big aperture, and you have 3d, red and blue glasses ready video
https://drive.google.com/file/d/1xyOoGdb5VvfAzkAHH2QBjak1oUVuu-pN/view
Only downside is it looks awful.
5D2