Next Version - Wish for constrain camera proportions

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Next Version - Wish for constrain camera proportions

Post by danmilward »

How is the next version coming along. Is there a roadmap and a feature list anywhere?

One thing that would be very handy would be the ability to constrain the proportions of the camera when you set the width and the height.

Currently I have to open up photoshop and work it out from there - there must be some kind of simple mathematical calculation but I'm not very mathematical... I'm a user interface fanatic :P
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

As far as a roadmap, it's a when it's ready type thing. There is no schedule. As far as feature lists, there is the feature request here on the forum and released features are in the README.

As far as your request on the ability to constrain the proportions of the camera...
can you elaborate a bit more as I don't get what you mean.
I take it to mean that you want selectable capture sizes which would constrain the abilities of ZM since many cameras don't conform to standards these days and might be to limiting.
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Post by danmilward »

I would not necessarily have selectable options and sizes.

But rather a check box. If selected it would work out a proportional capture height based on the capture width.

Like this image. I just don't know the math :(

Image
W.
Posts: 108
Joined: Tue Apr 10, 2007 5:06 pm
Location: Latvia

Post by W. »

most of cameras can output only certain resolutions, you cant use arbitrary stuff anyway, you just have to know those resolutions, so I don't see much use for such a feature in ZM.
if common sense is so uncommon, why is it called common then?
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Post by danmilward »

I think you're missing the point.

Today I spent about 30 minutes tabbing between photoshop and zoneminder while I was resizing the camera size to suit. I had to do this to make sure my monitor looked perfect for my client. If the image was not correctly proportioned - then a licence plate might not be recognisable, or a face might look slightly twisted making identification that much harder.

Why do you think TV screens are proportional :P

If there was just that one little bit of math there and a checkbox to turn it on then it would have saved me a big chunk of time.

I've proved that there is a use for this feature because I'd use it - and because there are millions of people just like me out there on the internet (just waiting to find zoneminder) why would we want them to also waste their time when its been identified as useful.

If somebody could tell me the math to scale things like this then I could probably get the Javascript written here at work and then submit it to the forums.
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

Most cameras give images of 4:3 aspect ratio. So it's as simple as this:

Height = (Width * 3) / 4

You could implement it this way: whenever the "Capture Width" textbox changes, fill the "Capture Height" box based on the above formula. It shouldn't be vice-versa, as if the user is not satisfied with the result, he/she can type any desired value in "Capture Height", without "Capture Width" being automatically re-calculated. The users always fill the first box first, so this would be a really nice, handy feature. (Perhaps connected to a "4:3 Aspect Ratio" checkbox's value - in this case it should be vice-versa)

Finding the best resolution is usually trial-based, anyway. I found many other working resolutions as well than those specified on the box. It's worth trying.
v1.25.0 + Ubuntu Linux 12.04 Server
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

[Moved to feature request topic]
It certainly sounds feisable so long as there is the ability to override the feature so I moved this to the correct topic as a request.

No promises though but I do like robi's suggestion.
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Post by danmilward »

I'll get it done and provide you the code. So no excuses ;-)

Thanks guys. Awesome.
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

danmilward wrote:I'll get it done and provide you the code. So no excuses ;-)

Thanks guys. Awesome.
Post is here too 8)
v1.25.0 + Ubuntu Linux 12.04 Server
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Preserve Aspect Ratio - Done!

Post by danmilward »

This works for us. It is brilliant and it has already saved me plenty of time, hopefully Robi can use it and hopefully cordel can integrate it with the next version.

Ciao,... Dan

first change, goes in the script tag:

function preserve_aspect_ratio(edited)
{
if(document.getElementById('aspect_ratio_checkbox').checked == true)
{
monitor_width = parseInt(document.getElementById('monitor_camera_width').value);
monitor_height = parseInt(document.getElementById('monitor_camera_height').value);
switch(edited)
{
case 'width':
document.getElementById('monitor_camera_height').value = Math.round((monitor_width * 3) / 4);
break;
case 'height':
document.getElementById('monitor_camera_width').value = Math.round((monitor_height*4) / 3);
break;
}
}
return '';
}


And second change, goes in the relevant part, do a search for "$zmSlangCaptureWidth":


<tr><td align="left" class="text"><?= $zmSlangCaptureWidth ?> (<?= $zmSlangPixels ?>)</td><td align="left" class="text"><input type="text" name="new_monitor[Width]" value="<?= $new_monitor['Width'] ?>" size="4" class="form" id='monitor_camera_width' onkeyup='preserve_aspect_ratio("width");' /></td></tr>
<tr><td align="left" class="text"><?= $zmSlangCaptureHeight ?> (<?= $zmSlangPixels ?>)</td><td align="left" class="text"><input type="text" name="new_monitor[Height]" value="<?= $new_monitor['Height'] ?>" size="4" class="form" id='monitor_camera_height' onkeyup='preserve_aspect_ratio("height");' /></td></tr>
<tr><td align="left" class="text"></td><td align="left" class="text"><input type="checkbox" name="aspect_ratio_checkbox" value="true" class="form" id='aspect_ratio_checkbox' /><?= $zmSlangPreserveAspect ?></td></tr>

and third change, add to language file:

$zmSlangPreserveAspect = 'Preserve Aspect Ratio';
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

Bump - to the top - as a reminder.
v1.25.0 + Ubuntu Linux 12.04 Server
danmilward
Posts: 35
Joined: Thu Nov 09, 2006 12:02 am
Location: New Zealand

Post by danmilward »

I double that...
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I missed this thread the first time around I think but I have added an entry into bugzilla. The only thing I am a bit concerned about is hardcoding the 3/4 ratio but that may be able to be worked around.
Phil
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

Phil
A suggestion, can it default to how it is now but have an option to display differently (as zm4ms does) that way you could record at 720 x 288 but display at 368 x 288 IF the display is selected to be differnt from the record.

But
This will require some interplolation else the results will be horrible
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi »

zoneminder wrote:I missed this thread the first time around I think but I have added an entry into bugzilla. The only thing I am a bit concerned about is hardcoding the 3/4 ratio but that may be able to be worked around.
Use the settings dialog, add an option like ZM_DEFAULT_ASPECT_RATIO, with two text boxes separated by ":". By default they should contain 4:3, but the user can enter any default aspect ratio he/she wants. This saves in the db as a global option.

In the monitor settings on the Source tab, add a checkbox called 'Keep aspect ratio', then whenever width or height is changed, the other one gets calculated based on the formula above with the values from the settings. If the Checkbox is cleared, the re-calculation doesn't occur. All the values, including checkbox value, are saved in the database, on a per monitor basis (default: Checked).
v1.25.0 + Ubuntu Linux 12.04 Server
Post Reply