Page 1 of 2

Next Version - Wish for constrain camera proportions

Posted: Wed Apr 18, 2007 4:00 am
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

Posted: Wed Apr 18, 2007 6:48 am
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.

Posted: Wed Apr 18, 2007 10:34 am
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

Posted: Wed Apr 18, 2007 10:53 am
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.

Posted: Wed Apr 18, 2007 11:22 am
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.

Posted: Thu Apr 19, 2007 6:28 am
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.

Posted: Thu Apr 19, 2007 6:44 am
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.

Posted: Thu Apr 19, 2007 6:49 am
by danmilward
I'll get it done and provide you the code. So no excuses ;-)

Thanks guys. Awesome.

Posted: Thu Apr 19, 2007 6:54 am
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)

Preserve Aspect Ratio - Done!

Posted: Wed May 02, 2007 3:11 am
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';

Posted: Wed Dec 26, 2007 10:24 am
by robi
Bump - to the top - as a reminder.

Posted: Wed Dec 26, 2007 11:11 am
by danmilward
I double that...

Posted: Fri Dec 28, 2007 12:42 pm
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.

Posted: Fri Dec 28, 2007 12:50 pm
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

Posted: Fri Dec 28, 2007 4:28 pm
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).