Page 1 of 2

A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 7:20 am
by McFuzz
I've upgraded to 1.29.0-trusty-2016021001 today and noticed that in the UI, the one camera I have that is rotated left with width of 480 and height of 680 is displayed stretched.

Oddly enough, the image is not stretched when viewed through the new "Montage Review" feature.

Stretched:

Image


How it should be:

Image



If I set orientation to normal and reverse the width/height, the image is displayed properly. Ticking the "preserve aspect ratio" button does not resolve the issue.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 3:16 pm
by rayrayray
I have the same issue on my 1.29.0 build. I built a new Ubuntu package yesterday using the do_debian_package.sh script which grabbed the git master branch. OS is Ubuntu 15.10.

EDIT: I had to add a second camera to my test server to see the Montage and Montage Review links. I have the same experience. The image is stretched when clicking directly on the rotated camera and in Montage but shows the correct orientation in Montage Review.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 3:18 pm
by asker
rayrayray wrote:I have the same issue on my 1.29.0 build. I built a new Ubuntu package yesterday using the do_debian_package.sh script which grabbed the git master branch. OS is Ubuntu 15.10.
rayrayray, which instructions did you follow while building with do_debian_package?

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 3:33 pm
by rayrayray
This is where I found it -- https://github.com/ZoneMinder/ZoneMinder/issues/1231
And this is how I'm calling it -- ./do_debian_package.sh wily `date +%Y%m%d`01 local master

The resulting deb packages I've integrated into a Chef cookbook with the intent of fully automating the ZM install on Ubuntu 15.10. I have it working, but it's a bit of a kludge.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 3:45 pm
by asker
ok cool - yeah, I was wondering where you read that because it still hasn't made it to the official docs (which use cmake). Thanks

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 3:52 pm
by rayrayray
I have done a lot of digging after doing a 1.28.xxx build and finding the API missing. :) I really miss the TinyCam compatibility and want to move to zmNinja.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 4:21 pm
by rayrayray
To get back to the rotation issue. I did find some exceptions from CSS in Firefox's dev tools.
zms1.jpg
zms1.jpg (128.38 KiB) Viewed 6945 times
And my monitor config. On my 1.28.xxx server that I built a few days earlier, this is working as expected.
zms2.png
zms2.png (27 KiB) Viewed 6945 times

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 4:23 pm
by rayrayray
Ahhhh, nevermind. The CSS errors don't mean anything. I see the same exceptions from my 1.28.xxx server where the image is not stretched.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 5:31 pm
by McFuzz
Glad to know I ain't the only one! Thankfully it is the only camera behaving that way - but it is also my baby monitor camera XD

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Fri Feb 12, 2016 10:39 pm
by rayrayray
I just noticed that if I view the stream link to nph-zms directly there is no issue with the rotation. Actually just a few lines above the link to the script in the view-source of the page, I can clearly see an issue in the JavaScript.

Code: Select all

var monitorWidth = 640;
var monitorHeight = 400;
var monitorUrl = '';

var scale = 100;

var streamSrc = "/cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=2&connkey=758473&rand=1455316479";
The monitorWidth and monitorHeight values are backward. I'm going to do some more digging.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Sat Feb 13, 2016 3:56 am
by rayrayray
I was able to fix this by modifying www/includes/Monitor.php (full path would be /usr/share/zoneminder/www/includes/Monitor.php on most ZM 1.29.x servers). Try this and let me know if it works for you too.

Comment out these lines near the bottom of the file. Use a /* and */ around them. Save the file and reload the monitor view.

Code: Select all

  
  public function Width() {
                if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
                        return $this->{'Height'};
                }
                return $this->{'Width'};
        }
        public function Height() {
                if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
                        return $this->{'Width'};
                }
                return $this->{'Height'};
        }
Disclaimer: I am not a ZoneMinder developer. I do not present this as anything other than a hack to get this one feature working again. It's possible that doing this breaks something somewhere else. :) I can tell that this code was added very recently ... my 1.28.xxx VM that I built a week ago didn't have these lines in this file.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Sat Feb 13, 2016 6:19 am
by SteveGilvarry
Thought you had dimensions wrong way round, but then saw that was testing it. Will have a look at that code.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Sat Feb 13, 2016 6:28 am
by SteveGilvarry
Is the pic above your current configuration? If so swap Width 640 and Height 480 and leave orientation as is with that code left in.

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Sat Feb 13, 2016 6:52 am
by rayrayray
Alright, reverted my code change and flipped the dimensions... now the feed is the right shape but shows up garbled. That could be something else with my camera, I suppose.
Screenshot_2016-02-13_00-48-09.png
Screenshot_2016-02-13_00-48-09.png (370.25 KiB) Viewed 6896 times

Re: A bug? 1.29.0 -- stretched image on rotated streams

Posted: Sat Feb 13, 2016 6:53 am
by SteveGilvarry
Do you have some image rotation setting in the camera?