Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:viewer:actions:add_view [2023/02/10 15:58]
pieter [Find Best Photo]
— (current)
Line 1: Line 1:
-====== Add View ====== 
- 
-Click on the '+' icon and view mode on the left sidebar to open a new view. Next, click on the [[dev:viewer:viewmodes:reference|Reference View]] or an existing View on the location where a new View should be opened. \\ 
-The available reality data will define the available Open View options.\\ 
-The different View modes are described [[dev:viewer:viewmodes:3d|here]]. 
- 
-===== Find Best Photo ====== 
- 
-==== Input Parameters ==== 
- 
-FIXME Add find photo algorithm information 
- 
-Inputs:  
-  * resources 
-  * focusPosition : The position we want to observe. 
-  * viewPosition : The position we are observing the photo position from. 
-  * minPhotos : The minimum amount of photos to find after applying the requireFocusVisible filter. Ignored if not positive. 
-  * relevantPhotosMax : The maximum number of relevant photos to return. 
-  * searchDistances2D : The array of search distances to use when finding a closest photo. 
-  * findCloserPhotoAlgorithm : The algorithm to sort results and find a closest photo. 
-    * PIXEL_DISTANCE : Identifies the technique to find a closest photo by projecting the search coordinate on the photo and then sorting by distance to the photo center. 
-    * SPATIAL_DISTANCE : Identifies the technique to find a closest photo by taking the 3d distance to the view position (fall back on focus position). 
-  * requireFocusVisible : For planars, only return photo's that have the search position inside the photo? (false to disable) 
-  * isStreetlevel :  We are searching on streetlevel?  
-    * If true the 'is focus visible?' check (enabled by requireFocusVisible) will check whether the focus position is in view 
-    * for each photo by looking at the angular distance between the photo heading (pan) and the heading defined by the vector from photo position to focus position. 
-    * This yields a better result for streetlevel planars (sphericals don't have a 'focus visible' check). 
-  * searchCenter : Identifies searching around the view position. 
-    * FOCUS : Identifies searching around the focus position and selecting the photo closest to the focus position. 
-    * FOCUS_AND_VIEW :  Identifies searching around the focus position and selecting the photo closest to the view position if provided (focus position as fallback).  
-    * VIEW : Identifies searching around the view position and selecting the photo closest to the view position. 
- 
-There are other input parameters, but they do not apply to how the algorithm functions. 
- 
-Some constants :  
- 
-  * AerialDistances = ''25,50,100,200,400,800,1600,3200,6400,12800'' 
-  * StreetlevelDistances = ''3,9,27,81,243,729'' 
- 
-Default parameter values :  
- 
-^ ^ Streetlevel Spherical ^ Streetlevel Planar ^ UAV Planar ^ Oblique Planar ^  
-| focusPosition       | <required> | <required> | <required> | <required> | 
-| viewPosition        | <optional> | <optional> | <optional> | <optional> | 
-| minPhotos           | 0 | 0 | 3 | 0 | 
-| relevantPhotosMax   | 10 | 10 | 10 | 10 | 
-| searchDistances2D   | StreetlevelDistances | StreetlevelDistances | AerialDistances  | AerialDistances | 
-| findCloserPhotoAlgorithm | SPATIAL_DISTANCE  | SPATIAL_DISTANCE<sup>1</sup> | SPATIAL_DISTANCE<sup>1</sup> | PIXEL_DISTANCE<sup>1</sup> | 
-| requireFocusVisible | false | true | true | true | 
-| isStreetlevel       | true | true | false | false | 
-| searchCenter        | FOCUS_AND_VIEW<sup>2</sup> | FOCUS_AND_VIEW<sup>2</sup> | FOCUS_AND_VIEW<sup>2</sup> | FOCUS | 
- 
-<sup>1</sup> Configurable via ''Views -> (Type) Image View -> Open best planar photo by''\\  
-<sup>2</sup> Configurable via ''Views -> Image Views -> Open image from 3D View'' 
- 
-==== Algorithm ==== 
- 
-FindClosestPhoto 
- 
-<code javascript> 
-function(resource,searchDistances2D,viewPosition,focusPosition,parameters) 
-{ 
-  for(searchDistance in searchDistances2D)  
-  { 
-    let searchCenterPosition = (searchCenter = VIEW) ? viewPosition : focusPosition; 
-    let photoList = resource.findPhotosInCircle(searchCenterPosition,searchDistance); 
-    if (requireFocusVisible) 
-    { 
-      if (parameters.isStreetlevel) 
-      { 
-        photoList = keepPhotosWithProjectionInsidePan(photoList,85%); 
-      } 
-      else 
-      { 
-        photoList = keepPhotosWithProjectionInsideMargin(photoList,20%); // projection is inside photo bounds, reduced by a 20% margin? 
-      } 
-      if (photoList.length<10) 
-      { 
-        photoList = keepPhotosWithProjectionInsideMargin(photoList,5%); // projection is inside photo bounds, reduced by a 5% margin? 
-      } 
-    } 
-    if (photoList.length<minPhotos) 
-    { 
-      continue; 
-    } 
-    photoList = sortPhotos(photoList, parameters) 
-    return { 
-      photo: photoList[0], 
-      relevantPhotos: photoList.slice(1,relevantPhotosMax) 
-    } 
-  } 
-} 
-</code> 
- 
-<code javascript> 
-function sortPhotos(photoList) 
-{ 
-  for(photo in photoList) 
-  { 
-    if (parameters.findCloserPhotoAlgorithm = PIXEL_DISTANCE) 
-    { 
-      photo.distance = getDistanceToProjectionCenter(photo,focusPosition) 
-    } 
-    if (parameters.findCloserPhotoAlgorithm  = SPATIAL_DISTANCE) 
-    { 
-      if (viewPosition!=null) 
-      { 
-        distance =  getDistanceToPosition(photo,viewPosition) 
-      } 
-      else 
-      { 
-        distance = getDistanceToPosition(photo,focusPosition) 
-      } 
-    } 
-  } 
-  sortByDistance(photoList); 
-  return photoList; 
-} 
-</code> 
-       
- 
- 
- 
-distanceToProjectionCenter(): projects the focus position on the photo and returns the pixel distance from that position to the photo center. 
  
 
Last modified:: 2023/02/10 15:58