The photomasking application can only currently use photographs with the exact pixel dimensions 5184 x 3456 or I think it will produce misleading polygon results. This is due to the fact that it uses rows and columns as a proxy for real geographic units when it sets a a fake OpenLayers projection. The vector polygons drawn on top of this are then recorded as coordinate strings with these fake coordinates that correspond to the number of rows and columns of the origin source image. In our initial trialling of the photomasking application, we hard-coded a fixed number of rows and columns from one of out example images and, very fortunately, all of the images we have uploaded so far were taken by the same camera with the same settings on the same day, and should have these dimensions. However, were we to upload a different set of photographs whose height and width in pixels was not the same then we would get slightly skewed images (we might not even notice until we went to mask the images though which would be worrying) and misplaced polygons.
What we probably need to do is to replace the hard-coded height and width for the photo in either the first or both of the following places:
The photomasking application can only currently use photographs with the exact pixel dimensions 5184 x 3456 or I think it will produce misleading polygon results. This is due to the fact that it uses rows and columns as a proxy for real geographic units when it sets a a fake OpenLayers projection. The vector polygons drawn on top of this are then recorded as coordinate strings with these fake coordinates that correspond to the number of rows and columns of the origin source image. In our initial trialling of the photomasking application, we hard-coded a fixed number of rows and columns from one of out example images and, very fortunately, all of the images we have uploaded so far were taken by the same camera with the same settings on the same day, and should have these dimensions. However, were we to upload a different set of photographs whose height and width in pixels was not the same then we would get slightly skewed images (we might not even notice until we went to mask the images though which would be worrying) and misplaced polygons.
What we probably need to do is to replace the hard-coded height and width for the photo in either the first or both of the following places:
https://github.com/findsorguk/photomasking/blob/master/template.html#L332 https://github.com/findsorguk/photomasking/blob/master/template.html#L443
We could replace this with a variable defined higher up in the html that gets the image size from the photo on loading it, such as via: http://www.w3schools.com/jsref/prop_img_naturalheight.asp