[Papywizard] High resolution preset generator  

Everything you need to motorize your head
no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

[Papywizard] High resolution preset generator

by sjhenry » Tue Jul 07, 2009 4:58 am

Here is a preset generator for the PW. It is mentioned here http://www.autopano.net/forum/p44380-2009-05-04-00-11-14#p44380. If you read that thread you find that moving the Merlin head around 10 degrees interval on both yaw axis and pitch axis is faster. You will benefit from this when you are doing gigapixel mosaic with lots of rows and columns.

1. What is it?
This html/javascript program creates a PW preset for a given camera/lens combination with specified rows and columns. This creates a preset and a preview preset that travels on the edge of the mosaic from top-left, top-right, bottom-right, bottom-left to top-left.

2. What is the difference between this and the default PW way of moving the head?
The presets generated from this program will save time. This is done by moving the head around 10 degrees increment in both yaw and pitch axis. The default movement in the PW is to move the head by each position by a) on the odd numbered rows from left to right and b) on the even numbered rows from right to left - a zigzag motion. The preset will generate the same movement if the FOV of the lens is greater than 10 degrees so you are not loosing anything. If it is less than 10 degrees then it will try to find matching column/row combination where the movement needed is around 10 degrees. This script is a complementary to what PW already offers.

3. Where is the screen shot?
a) Picture 1 shows an initial opening screen
b) Picture 2 shows an preset generated screen

4. How to install?
a) Open notepad or any text editor
b) Copy the following code (remove the "Code:" part)
c) Paste that in the text editor
d) Save it with a name (like pw_preset.html)
e) Double click on the name. It will be opened in the default browser.
f) You can create a shortcut as well (see Picture 1).

4. What is the system requirement?
A modern browser - latest version of any browser. I wrote it in html/javascript combination so that it works in most of the browsers. I tested it in IE and Firefox. It works find on these browsers. The javascript needs to be enabled on the browser. The script uses very premitive javascript so it should work in most browsers without any modifications. If you find that it is not running in a browser, please post it in this thread to figure out a solution.

5. What are the fields on the screen?
a) Crop Factor: This dropdown box shows all the possible sensor crop for the DSLR currently available.
Some example,
choose 1.0 for full frame DSLR/film cameras irrespective of camera maker
choose 1.3 for Canon 1D series
choose 1.5 for Nikon crop cameras like D40 etc
choose 1.6 for Canon Rebel series
choose 2.0 for 4/3 and micro 4/3 system
Note that if you use any point and shoot camera, use the crop factor of 1.0 and its 35mm equivalent focal length. For example, Canon A590 has 140mm (35mm equivalent) at tele end. So use crop factor of 1.0 and focal length of 140mm.
b) Aspect Ratio: Choose the maximum sensor aspect ratio for a given camera. Mostly it is 3:2 ration for DSLR.
Some camera offer in camera crop of 4:3 and 16:9. It is best to use the native aspect of the sensor.
c) Overlap: This is the overlap percentage between the adjustant shots in yaw and pitch axis.
d) Orientation: Orientation of the camera when taking the mosaic - Landscape or Portrait.
e) Focal Length: The focal length of the lens used. Don't do any conversion here. If you use 50mm lens on a 1.6 crop body, just enter 50 and not 80.
f) Rows: Number of rows in the mosaic.
g) Columns: Number of columns in the mosaic.
h) Width in Pixels: Frame width in pixels of the picture
i) Height in Pixels: Frame height in pixels of the picture
j) Generate (button): Press this button to generate the preset.
k) Preset (text area): The generated preset will be shown here.

6. How to use it?
Select a value that matches your camera.
Select the correct aspect ratio for your camera.
Select an overlap percentage.
Select the orientation of the camera.
Enter the focal length of the lens.
Enter the number of rows (whole number)
Enter the number of columns (whole number)
Enter the width of the picture in pixels (whole number)
Enter the height of the picture in pixels (whole number)
Press the "Generate" button.

This creates a preset in the bottom text area. The preset name will be 35<2 digit crop factor><orientation>_<focal length>_<rows>_<columns>. Now copy this to a file same as the preset name with an extension of .xml.
For example, you use Canon 450D in portrait with 200 mm lens for 6 rows and 15 columns. The preset name will be 3516P_200_6_15. The preview preset name will be 3516P_200_6_15_preview. Save the preset in a file called 3516P_200_6_15.xml.

Load this preset file into the PW using File->Import Preset File menu.

Set the home position correctly. Select the preview preset (3516P_200_6_15_preview) and see the positions. Note that you have to use the simulation for shutter, otherwise you will take 5 picture of the 4 corners of the mosaic.

Once you set the home position correctly, then select the preset (3516P_200_6_15) and take the mosaic.

7) what is in the tooltip?
a) The tooltip has a Source section where the format used, focal length used, rows and columns are mentioned.
b) The tooltip also has a Target section which shows the resultant horizontal, vertical FOV and sizes.

Code: Select all
<tooltip>
            Source:
                Format: 35mm (1.6 Crop, 3:2 Aspect Ratio, Portrait orientation)
                Focal Length: 100mm lens, overlap: 25%, Horizontal FOV: 6.4, Vertical FOV: 10.7
                Rows: 3, Columns: 5
            Target:
                Horizontal FOV: 35.2, Vertical FOV: 34.2
                Horizontal Size: 11722, Vertical Size: 11389
        </tooltip>

If you have any other questions/feedback about this program, please post it in this thread.


Frederic,
As I mentioned in the other thread, I'll translate this to Python once you implement the Preset Manager within PW.

Jones

The HTML code. Save it in pw_preset.html

Code: Select all
<!--
 ! This program is to generate preset for the Papywizard
 ! program. This program can be used for commercial and/or
 ! non-commercial use for free.
 !
 ! Author: Jones Henry Subbiah (C) 2009.
 !
 ! Disclaimer: The user assumes the responsibility of any
 ! any demage using the preset. The author is not responsible
 ! for anything.
 !
 ! The preset generated assumes top-left corner of the pano
 ! is the home position that is yaw = 0, and pitch = 0. The
 ! name of the preset will be 35mmformat_focallength_rows_columns
-->

<html>
 <head>
  <title>Papywizard Preset Generator</title>
  <script language="javascript">
    var FRAME_WIDTH = 36.0;
    var FRAME_HEIGHT = 24.0;
    var OPTIMUM_DEGREES = 10.0;
    var DEBUG = false;
    var pval = "";

    /*
     * This function appends the message to the text box.
     */
    function write ( message )
    {
        pval += message + "\n";
    }

    /*
     * This function appends debug messages to the text box.
     */
    function debug ( message )
    {
        if ( DEBUG )
            write ( message );
    }

    /*
     * This function calculates the angular field of view.
     */
    function calculate_fov ( frame_length, focal_length )
    {
        return ( 2 * Math.atan ( frame_length / ( 2 * focal_length ) ) * 180 / Math.PI );
    }

    /*
     * This function validates the input.
     * Input validation is done only for text box fields.
     */
    function validate_input()
    {

        if ( isNaN ( parseFloat ( document.main.fl.value ) ) )
        {
             alert ( "Enter a valid focal length" );
             document.main.fl.focus();
             return false;
        }

        if ( isNaN ( parseInt ( document.main.prows.value ) ) )
        {
             alert ( "Enter a valid row number" );
             document.main.prows.focus();
             return false;
        }

        if ( isNaN ( parseInt ( document.main.pcols.value ) ) )
        {
             alert ( "Enter a valid column number" );
             document.main.pcols.focus();
             return false;
        }

        if ( isNaN ( parseInt ( document.main.wip.value ) ) )
        {
             alert ( "Enter a valid pixel width number" );
             document.main.wip.focus();
             return false;
        }

        if ( isNaN ( parseInt ( document.main.hip.value ) ) )
        {
             alert ( "Enter a valid pixel width number" );
             document.main.hip.focus();
             return false;
        }

        return true;
    }

    /*
     * This function rounds a number to a single decimal precision.
     * The trick to is to add 0.05 to the number and truncate at the first
     * decimal position.
     */
    function round21 ( number )
    {
        nnum = number + 0.05;
        nums = nnum.toString();
        numa = nums.split('.');
        return ( numa[0] + '.' + numa[1].charAt(0) );
    }

    /*
     * This function finds the number of yaw positions to skip.
     */
    function yaw_skip_pos ( hfov, vfov )
    {
        var yaw = 0.0;
        var ydiff = 0;

        while ( 1 )
        {
            yaw += hfov;

            if ( yaw > OPTIMUM_DEGREES )
            {
                break;
            }
            ydiff++;
        }

        debug ( "ydiff: " + ydiff );

        if ( ydiff < 1 )
            ydiff = 1;

        debug ( "ydiff: " + ydiff );

        return ( ydiff );
    }

    /*
     * This function finds the number of pitch positions to skip.
     */
    function pitch_skip_pos ( hfov, vfov )
    {
        var pitch = 0.0;
        var pdiff = 0;
        while ( 1 )
        {
            pitch += vfov;

            if ( pitch > OPTIMUM_DEGREES )
            {
                break;
            }
            pdiff++;
        }
        debug ( "pdiff: " + pdiff );

        if ( pdiff < 1 )
            pdiff = 1;

        debug ( "pdiff: " + pdiff );

        return ( pdiff );
    }

    /*
     * This function initializes all the position of the pano.
     * The position is of the form "row,col,pitch,yaw".
     * Each position of the pano is represented here in the String array.
     */
    function initialize_positions ( hfov, vfov, prows, pcols )
    {
        var pos = new Array ( prows * pcols );
        var yaw = 0.0;
        var pitch = 0.0;

        for ( ctr1 = 0; ctr1 < prows; ctr1++ )
        {
            for ( ctr2 = 0; ctr2 < pcols; ctr2++ )
            {
                pos[ctr1 * pcols + ctr2] = ( ctr1 + 1 ) + "," + ( ctr2 + 1 ) + "," + round21 ( pitch, 1 ) + "," + round21 ( yaw, 1 );
                yaw += hfov;
            }
            pitch += vfov;
            yaw = 0;
        }

        for ( ctr1 = 0; ctr1 < pos.length; ctr1++ )
        {
            debug ( "pos[" + ctr1 + "]: " + pos[ctr1] );
        }

        return ( pos );
    }

    /*
     * This function initializes the row, paired row values.
     * The array index is the row number and the array value is the paired row number.
     */
    function initialize_rows ( prows )
    {
        var prs = new Array ( prows );

        for ( ctr1 = 0; ctr1 < prows; ctr1++ )
        {
            prs[ctr1] = -1;
            debug ( "prs[" + ctr1 + "]: " + prs[ctr1] );
        }

        return ( prs );
    }

    /*
     * This function finds the row used already as a paired row.
     */
    function find_paired_row ( prs, prow )
    {
        for ( var ctr = 0; ctr < prs.length; ctr++ )
        {
            if ( prs[ctr] == prow )
            {
                return ( ctr );
            }
        }

        return ( -1 );
    }

    /*
     * This function finds the row and its corresponding paired row.
     */
    function calculate_paired_row ( prs, pdiff )
    {
        var prows = prs.length;

        for ( var ctr = 0; ctr < prows; ctr++ )
        {
            if ( ctr + pdiff < prows )
            {
                prs[ctr] = ctr + pdiff;
            }

            var prw = find_paired_row ( prs, ctr );
            debug ( 'prw: ' + prw );

            if ( prw != -1 )
            {
                debug ( 'here' );
                prs[ctr] = -2;
            }
        }

        for ( ctr1 = 0; ctr1 < prows; ctr1++ )
        {
            debug ( "prs[" + ctr1 + "]: " + prs[ctr1] );
        }

        return ( prs );
    }

    /*
     * This function writes the "pict" element of the preset XML.
     */
    function print_shoot ( pos )
    {
        var val = pos.split(',');
        write ( '            <pict yaw="' + Number ( val[3] ).toFixed(1) + '" pitch="-' + Number ( val[2] ).toFixed(1) + '"/> <!-- ' + Number ( val[0] ).toFixed(0) + ',' + Number ( val[1] ).toFixed(0) + ' -->' );
    }

    /*
     * This function creates the normal move of the head.
     * The normal move is defined as
     *     row 1 as left-to-right
     *     row 2 as right-to-left
     *     row 3 as left-to-right
     *     ...
     */
    function do_normal_move ( prows, pcols, pos )
    {
        for ( var ridx = 0; ridx < prows; ridx++ )
        {
            if ( ( ridx + 1 ) % 2 == 1 )
            {
                var cidx = 0;
                write ( "            <!-- arrange columns left to right in row " + ( ridx + 1 ) + " starting from column " + ( cidx + 1 ) + " -->" );

                for ( ; cidx < pcols; cidx++ )
                {
                    print_shoot ( pos[ridx*pcols+cidx] );
                }
            }
            else
            {
                var cidx = pcols - 1;
                write ( "            <!-- arrange columns right to left in row " + ( ridx + 1 ) + " starting from column " + ( cidx + 1 ) + " -->" );

                for ( ; cidx >= 0; cidx-- )
                {
                    print_shoot ( pos[ridx*pcols+cidx] );
                }
            }
        }
    }

    /*
     * This function creates the special move of the head.
     * The special move is done by moving the head around 10.0 degrees like
     *    row1 columns that have around 10.0 move
     *    row3(paired row) columns that are reverse from the initial row
     *    row2 (non-paired row) columns that are 10.0 degrees apart in the repeating order
     */
    function do_special_move ( prows, pcols, pos, prs, ydiff, pdiff )
    {
        var c = new Array ( pcols );
        var cnt = 0;
        for ( var ridx = 0; ridx < prows; ridx++ )
        {
            if ( prs[ridx] == -2 )
            {
             continue;
            }
            else if ( prs[ridx] == -1 )
            {
                write ( "            <!-- columns in row " + ( ridx + 1 ) + " is not paired -->" );

                for ( var ctr = 0; ctr <= ( ydiff + 1 ); ctr++ )
                {
                    if ( ( ydiff + 1 ) >= ( ctr + 1 ) )
                    {
                         cnt = 0;

                         for ( var cidx = ctr; cidx < pcols; cidx += ydiff + 1 )
                         {
                             c[cnt++] = ridx * pcols + cidx;
                         }

                         if ( ( ctr + 1 ) % 2 == 0 && pcols > 10 )
                         {
                             write ( "            <!-- arrange columns right to left in row " + ( ridx + 1 ) + " starting from column " + ( ctr + 1 ) + " -->" );

                             for ( var aidx = cnt - 1; aidx >= 0; aidx-- )
                             {
                              print_shoot ( pos[c[aidx]] );
                             }
                         }
                         else
                         {
                             write ( "            <!-- arrange columns left to right in row " + ( ridx + 1 ) + " starting from column " + ( ctr + 1 ) + " -->" );

                             for ( var aidx = 0; aidx < cnt; aidx++ )
                             {
                                 print_shoot ( pos[c[aidx]] );
                             }
                         }
                    }
                }
            }
            else
            {
                write ( "            <!-- columns in row " + ( ridx + 1 ) + " is paired with row " + ( prs[ridx] + 1 ) + " -->" );
                for ( var ctr = 0; ctr < ydiff + 1; ctr++ )
                {
                    if ( ctr + ydiff < pcols )
                    {
                        cnt = 0;
                        write ( "            <!-- arrange columns left to right in row " + ( ridx + 1 ) + " starting from column " + ( ctr + 1  ) + " -->" );

                        for ( var cidx = ctr;  cidx < pcols; cidx += ydiff + 1 )
                        {
                            print_shoot ( pos[ridx*pcols+cidx] );
                            c[cnt++] = cidx + 1;
                        }
                    }

                    if ( prs[ridx] < prows && c[cnt-1] > 0 )
                    {
                        write ( "            <!-- arrange columns right to left in row " + ( prs[ridx] + 1 ) + " starting from column " + c[cnt-1] + " -->" );

                        for ( var cidx = cnt - 1; cidx >= 0; cidx-- )
                        {
                            print_shoot ( pos[prs[ridx]*pcols+c[cidx]-1] );
                        }
                    }
                }
            }
        }
    }

    /*
     * This function is the main function that creates the full preset XML.
     */
    function do_preset()
    {
        var thfov = 0.0;
        var hfov = 0.0;
        var tvfov = 0.0;
        var vfov = 0.0;
        var focal_length = 0.0;
        var crop_factor = 0.0;
        var overlap = 0.0;
        var ratio = 0.0;
        var prows = 0;
        var pcols = 0;
        var ar = '';
        var scan_pixel = 0;
        var wip = 0;
        var hip = 0;

        pval = "";

        if ( validate_input() )
        {
            focal_length = parseFloat ( document.main.fl.value );
            crop_factor = parseFloat ( document.main.cf.options[document.main.cf.selectedIndex].value );
            overlap = parseFloat ( document.main.ol.options[document.main.ol.selectedIndex].value );
            ar = (document.main.r.options[document.main.r.selectedIndex].value).split ( ',' );
            ratio = parseFloat ( ar[1] );
            prows = parseInt ( document.main.prows.value );
            pcols = parseInt ( document.main.pcols.value );
            orientation = document.main.or.value;
            wip = parseInt ( document.main.wip.value );
            hip = parseInt ( document.main.hip.value );

            debug ( "focal_length: " + focal_length );
            debug ( "crop_factor: " + crop_factor );
            debug ( "overlap: " + overlap );
            debug ( "ratio: " + ratio );
            debug ( "prows: " + prows );
            debug ( "pcols: " + pcols );
            debug ( "orientation: " + orientation );
            debug ( "wip: " + wip );
            debug ( "hip: " + hip );

            thfov = calculate_fov ( FRAME_WIDTH / crop_factor, focal_length );
            hfov = thfov * ( 1.0 - overlap / ratio / 100.0 );
            hfov = Number ( round21 ( hfov ) );
            tvfov = calculate_fov ( FRAME_HEIGHT / crop_factor, focal_length );
            vfov = tvfov * ( 1.0 - overlap / 100.0 );
            vfov = Number ( round21 ( vfov ) );

            if ( orientation == 'P' )
            {
                var tmp = hfov;
                hfov = vfov;
                vfov = tmp;
            }

            scan_pixel = Math.round ( wip / thfov );
            debug ( "scan_pixel: " + scan_pixel );

            var pos = initialize_positions ( hfov, vfov, prows, pcols );
            var prs = initialize_rows ( prows );
            var ydiff = yaw_skip_pos ( hfov, vfov );
            var pdiff = pitch_skip_pos ( hfov, vfov );
            prs = calculate_paired_row ( prs, pdiff );

            write ( '<?xml version="1.0" encoding="utf-8"?>\n' );
            write ( '<papywizard>\n' );
            write ( '    <preset name="35' + ( crop_factor * 10 ) + orientation + '_' + focal_length + '_' + prows + '_' + pcols + '">' );
            write ( '        <tooltip>' );
            write ( '            Source:' );
            write ( '                Format: 35mm (' + crop_factor + ' Crop, ' + ar[0] + ' Aspect Ratio' + ', ' + ( orientation == 'L' ? 'Landscape' : 'Portrait' ) + ' orientation)' );
            write ( '                Focal Length: ' + focal_length + 'mm lens, overlap: ' + overlap + '%, Horizontal FOV: ' + hfov + ', Vertical FOV: ' + vfov );
            write ( '                Rows: ' + prows + ', Columns: ' + pcols );
            write ( '            Target:' );
            var target_hfov = ( hfov * pcols + thfov * overlap / 100.0 ).toFixed(1);
            var target_vfov = ( vfov * prows + tvfov * overlap / 100.0 ).toFixed(1);
            write ( '                Horizontal FOV: ' + target_hfov + ', Vertical FOV: ' + target_vfov );
            write ( '                Horizontal Size: ' + Math.round ( target_hfov * scan_pixel ) + ', Vertical Size: ' + Math.round ( target_vfov * scan_pixel ) );
            write ( '        </tooltip>' );
            write ( '        <shoot>' );

            if ( hfov > OPTIMUM_DEGREES )
            {
                do_normal_move ( prows, pcols, pos );
            }
            else
            {
                do_special_move ( prows, pcols, pos, prs, ydiff, pdiff );
            }

            write ( '        </shoot>' );
            write ( '    </preset>\n' );

            /*
             * Create the preview preset.
             * This preview preset will have
             *     1. top-left position
             *     2. top-right position
             *     3. bottom-right position
             *     4. bottom-left position
             *     5. top-left position
             */

            write ( '    <preset name="35' + ( crop_factor * 10 ) + orientation + '_' + focal_length + '_' + prows + '_' + pcols + '_preview">' );
            write ( '        <tooltip>' );
            write ( '            A preview preset for the following that travels through the edges of the pano' );
            write ( '            Source:' );
            write ( '                Format: 35mm (' + crop_factor + ' Crop, ' + ar[0] + ' Aspect Ratio' + ', ' + ( orientation == 'L' ? 'Landscape' : 'Portrait' ) + ' orientation)' );
            write ( '                Focal Length: ' + focal_length + 'mm lens, overlap: ' + overlap + '%, Horizontal FOV: ' + hfov + ', Vertical FOV: ' + vfov );
            write ( '                Rows: ' + prows + ', Columns: ' + pcols );
            write ( '            Target:' );
            write ( '                Horizontal FOV: ' + ( hfov * pcols + thfov * overlap / 100.0 ).toFixed(1) + ', Vertical FOV: ' + ( vfov * prows + tvfov * overlap / 100.0 ).toFixed(1) );
            write ( '        </tooltip>' );
            write ( '        <shoot>' );
            print_shoot ( pos[0] );                // top-left
            print_shoot ( pos[pcols-1] );            // top-right
            print_shoot ( pos[(prows-1)*pcols+pcols-1] );    // bottom-right
            print_shoot ( pos[(prows-1)*pcols] );        // bottom-left
            print_shoot ( pos[0] );                // top-left

            write ( '        </shoot>' );
            write ( '    </preset>\n' );
            write ( '</papywizard>' );

            document.main.preset.value = pval;
        }
    }
  </script>
 </head>
 <body onload="document.main.preset.value = '';document.main.fl.focus();" bgcolor="#cccccc">
  <form name="main">
   <table border="0" cellpadding="2" cellspacing="2" width="800">
    <tr>
     <td>Crop Factor</td>
     <td>
      <select name="cf" style="width:100px">
       <option value="1.0">1.0</option>
       <option value="1.3">1.3</option>
       <option value="1.5">1.5</option>
       <option value="1.6" selected>1.6</option>
       <option value="1.7">1.7</option>
       <option value="1.8">1.8</option>
       <option value="2.0">2.0</option>
      </select>
     </td>
     <td>Aspect Ratio</td>

     <td>
      <select name="r" style="width:100px">
       <option value="3:2,1.500000" selected>3:2</option>
       <option value="4:3,1.333333">4:3</option>
       <option value="16:9,1.777778">16:9</option>
      </select>
     </td>
     <td>
      Overlap
     </td>
     <td>
      <select name="ol" style="width:100px">
       <option value="20">20</option>
       <option value="25" selected>25</option>
       <option value="30">30</option>
       <option value="35">35</option>
       <option value="40">40</option>
       <option value="45">45</option>
       <option value="50">50</option>
      </select>
      %
     </td>
    </tr>
    <tr>
     <td>Orientation</td>
     <td>
      <select name="or" style="width:100px">
       <option value="L">Landscape</option>
       <option value="P" selected>Portrait</option>
      </select>
     </td>
     <td>Focal Length</td>
     <td>
      <input type="text" name="fl" style="width:100px" value="100">
     </td>
     <td>Rows</td>
     <td>
      <input type="text" name="prows" style="width:100px" value="3">
     </td>
    </tr>
    <tr>
     <td>Columns</td>
     <td>
      <input type="text" name="pcols" style="width:100px" value="5">
     </td>
     <td>Width in Pixels</td>
     <td>
      <input type="text" name="wip" style="width:100px" value="4272">
     </td>
     <td>Height in Pixels</td>
     <td>
      <input type="text" name="hip" style="width:100px" value="2848">
     </td>
    </tr>
    <tr>
     <td colspan="5">
      Preset
     </td>
     <td>
      <input type="button" value="Generate" style="width:100px" onClick="do_preset();">
     </td>
    </tr>
    <tr>
     <td colspan="6">
      <textarea name="preset" rows="18" cols="95"></textarea>
     </td>
    </tr>
   </table>
  </form>
   <script type="text/javascript" src="presets.js"></script>
 </body>
</html>






Last edited by sjhenry on Mon Jul 20, 2009 1:12 am, edited 1 time in total.

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Tue Jul 07, 2009 8:04 am

Nice! Did you try with a smaller value than 10°? In fact, the limit is more around 6-7°. You may save some more seconds...

Would you like me to put it on the Papywizard web site, once it is in final version? I already have a xml data file to preset converter here:

http://www.papywizard.org/wiki/DataToPresetConverter

I will make a special menu entry, called 'tools'...
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

no avatar
klausesser
Member
 
Posts: 7858
Joined: Mon May 22, 2006 12:18 am
Location: Duesseldorf, Germany

by klausesser » Tue Jul 07, 2009 10:57 am

Hi Frédéric!

Some OT: will you be in Cologne this weekend?

I was so busy with other things - so i´m sorry to be here so rarely the last months.
End of July i´ll have more time to be here again.

best to you, wizzard ;) , Klaus
Simplicity is the keynote of all true elegance. Coco Chanel

no avatar
Gordon
Member
 
Posts: 357
Joined: Wed Oct 08, 2008 12:18 pm
Location: Deep in the woods, UK

by Gordon » Tue Jul 07, 2009 11:46 am

Nice post thank you :)

Gordon
2000th Member :D

GigaPixel Experimenter
Gigapan Beta Unit, Canon Powershot S5IS, Canon 350D, Nikon D40, Manfrotto Tripod, BT-Serial + Papywizard on Nokia 770, Fully-Operational Merlin the Wizard Unit!!!

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Tue Jul 07, 2009 12:05 pm

klausesser wrote:Hi Frédéric!

Some OT: will you be in Cologne this weekend?

No, sorry :(
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

no avatar
bigwade
Member
 
Posts: 282
Joined: Tue Nov 18, 2008 12:34 am
Location: NL

by bigwade » Wed Jul 08, 2009 12:21 am

Hey Jones, nice !
What I miss is the FoV and pixel calculation.
Maybe I don't understand it, but to me it's first do a run with the BT/Nokia/PW module from left corner to right under, then to see how
much rows etc I need, then create a preset......??

User avatar
gkaefer
Member
 
Posts: 3352
Joined: Tue Jun 09, 2009 1:01 pm
Location: Salzburg

by gkaefer » Wed Jul 08, 2009 12:43 am

I did try it with:
Format: 35mm (1.6 Crop, 3:2 Aspect Ratio, Landscape orientation) Focal Length: 18mm lens, overlap: 25%, Horizontal FOV: 53.3, Vertical FOV: 33.9 Rows: 6, Columns: 7 Target: Horizontal FOV: 389.1, Vertical FOV: 214.7

but result shows me only negative pitch values for all images and the images are not loacted inside the square

is this correct od did I something wrong?

PS: I did try it in simulation mode, so homeposition is stick to 0,0 position

PPS: why not adding a field where you can choose/define the top left position. In my case: 0,180 (than if I understood thing would my sceenschot be correct displaying all images inside the square)

Georg


Last edited by gkaefer on Wed Jul 08, 2009 12:55 am, edited 1 time in total.

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Wed Jul 08, 2009 3:15 am

Frederic,

Yes. I tried it from 7 degrees to 13 degrees when I did my initial analysis. In my head with wired setup, it always moves faster at 10 degrees. That is why I chose the 10 degrees. If you want to do more experiments, you can change the value in the javascript variable OPTIMUM_DEGREES to desired value.

Please put this script in your site. It will be helpful for many users.

Jones

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Wed Jul 08, 2009 3:47 am

bigwade,

If you mean the resultant FOV of the pano, then it is in the tooltip comment line. The "Target:" section shows this as

Code: Select all
        <tooltip>
            Source:
                Format: 35mm (1.6 Crop, 3:2 Aspect Ratio, Portrait orientation)
                Focal Length: 100mm lens, overlap: 25%, Horizontal FOV: 6.4, Vertical FOV: 10.7
                Rows: 3, Columns: 5
            Target:
                Horizontal FOV: 35.2, Vertical FOV: 34.2
        </tooltip>

In my C version of the code, I had the pixel calculation. I can add the pixel calculation but I have to get the camera pixel width and height as input as well.

The preview preset is for accurate positioning of the home position. It is difficult to do for a landsape with great composition. That is why I added it.

Jones

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Wed Jul 08, 2009 4:02 am

Georg,

The preset assumes the starting of the pano whether it is a partial pano (mosaic) or a 360 degree that top-left is set to 0 yaw and 0 pitch.

By this, when you do the 360 pano (like the one you generated the preset), then the head needs to be physically in the zenith position - that is camera pointing upwards (90 degrees pitch). Then you set the home position so that position becomes 0 yaw and 0 pitch. That is why all pitch values are in negative with the assumption that the top-left is physically set to 0,0.

Jones

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Wed Jul 08, 2009 7:28 am

But even with negative pitch values, it should work; the GUI is not very nice, but...
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

User avatar
gkaefer
Member
 
Posts: 3352
Joined: Tue Jun 09, 2009 1:01 pm
Location: Salzburg

by gkaefer » Wed Jul 08, 2009 7:58 am

sjhenry wrote:Georg,

The preset assumes the starting of the pano whether it is a partial pano (mosaic) or a 360 degree that top-left is set to 0 yaw and 0 pitch.

By this, when you do the 360 pano (like the one you generated the preset), then the head needs to be physically in the zenith position - that is camera pointing upwards (90 degrees pitch). Then you set the home position so that position becomes 0 yaw and 0 pitch. That is why all pitch values are in negative with the assumption that the top-left is physically set to 0,0.

Jones

thanks for explanation!
Georg

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Thu Jul 09, 2009 9:50 am

sjhenry wrote:Frederic,

[...]
Please put this script in your site. It will be helpful for many users.

I have a problem to put in on the Papywizard wiki: I can't put anything in the head section, so I can't define the js routines. I made a page with the input parameters, which call an external page, giving all form values using POST mecanism:

http://www.papywizard.org/wiki/HighResolutionPresetGenerator

Could you re-write your script so it can be called from an external page, if it is possible?

Another point: is it possible to make it send the xml file, instead of displaying it in the page? This way, the user won't have to cut'n'paste the code. I already use such mecanism here:

http://www.papywizard.org/wiki/DataToPresetConverter
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Fri Jul 10, 2009 3:24 am

It is possible to separate the javascript and html into two different files. Then the external js can be linked as

One more thing. The Generate should be of type button instead of submit. If it is of submit, then it will look for the server side code.

Also regarding the xml output itself, it needs a server side code like php, phython to do it. The reason is that the mime type is by default text/html on the browser. It is not possible to change it to text/xml or application/xml using js so that it will not ask for open or save.

The current script also prints the output horizontal and vertical size as well.

Jones

EDIT: I removed the html plus javascript embedded here. It is easier to deal with one file. I initially split that so that it can be hosted in the Papaywizard site. Sorry for the confusion. Please refer the first thread to see the latest version of the code.
Last edited by sjhenry on Mon Jul 20, 2009 1:15 am, edited 1 time in total.

User avatar
jplorge
Member
 
Posts: 214
Joined: Sun Oct 05, 2008 11:42 pm
Location: Belgium

by jplorge » Fri Jul 10, 2009 8:04 am

Jean-Pierre
Merlin/Orion firmware : 01.09.81 panohead + Papywizard on XP PC and Linux Ubuntu 9.1 & Nokia 800
Manfrotto 303 PAN HEAD with Nikon D70 + Nikon 18-70 in kit - Nikon 80-200 F 2.8 old - Sigma 10-20
Assembly : Ptgui 9.1.3

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Fri Jul 10, 2009 8:05 am

But I can't include the <script></script> tag, as I don't have access to the header. In fact, the wiki code is in the database, and is dynamically generated on the fly...

I will see how to execute JS code on the server side...
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Fri Jul 10, 2009 5:44 pm

You can put the script tag anywhere within the html before the end tag of html. Most mordern browsers will recognize the external script and load it.

Jones

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Fri Jul 10, 2009 9:18 pm

I'll try that...
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Thu Jul 16, 2009 1:04 am

Jean-Pierre,

Thanks for putting it on your site.

Frederic,
You may want to hold putting it in the papywizard site. I have two more scripts like that I want to share with the others. I'll put them here in the thread and once it is finalized then you can put it on your site.

Jones

User avatar
fma38
Member
 
Posts: 5826
Joined: Wed Dec 07, 2005 6:21 pm
Location: Grenoble, France

by fma38 » Thu Jul 16, 2009 7:59 am

Ok.
Frédéric

Canon 20D + 17-40/f4 L USM + 70-200/f4 L USM + 50/f1.4 USM
Merlin/Orion panohead + Papywizard on Nokia N800 and HP TC-1100

User avatar
gkaefer
Member
 
Posts: 3352
Joined: Tue Jun 09, 2009 1:01 pm
Location: Salzburg

by gkaefer » Sun Jul 19, 2009 12:22 pm

you write:
The HTML code. Save it in pw_preset.html

in sourcecode of this file third last line is written:
Code: Select all
<script type="text/javascript" src="presets.js"></script>

and you write:
The javascript source. Save it in pw_preset.js

so changing sourcecode of pw_preset.html to pw_preset.js will give success...

and using IE8 and FireFox 3.0.11 I've to delete following first comment block inside pw_preset.js:

Code: Select all
<!--
 ! This program is to generate preset for the Papywizard
 ! program. This program can be used for commercial and/or
 ! non-commercial use for free.
 !
 ! Author: Jones Henry Subbiah (C) 2009.
 !
 ! Disclaimer: The user assumes the responsibility of any
 ! any demage using the preset. The author is not responsible
 ! for anything.
 !
 ! The preset generated assumes top-left corner of the pano
 ! is the home position that is yaw = 0, and pitch = 0. The
 ! name of the preset will be 35mmformat_focallength_rows_columns
-->

... otherwise I get error:

Line 2: Character 9: ";" expected...

Code: Select all
Details zum Fehler auf der Webseite

Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.21022; FDM; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.30729)
Zeitstempel: Sun, 19 Jul 2009 11:17:25 UTC


Meldung: ';' erwartet
Zeile: 2
Zeichen: 9
Code: 0
URI: file://mybookworld/georg/downloads/papywizzard/pw_presets.js

Liebe Gruesse,
Georg
Last edited by gkaefer on Sun Jul 19, 2009 12:23 pm, edited 1 time in total.

no avatar
sjhenry
Member
 
Posts: 146
Joined: Tue Mar 10, 2009 1:43 am
Location: Colorado, USA

by sjhenry » Mon Jul 20, 2009 1:21 am

Georg,

Thanks for installing the script and finding the issue.

Yes. You are correct that the script shown as html plus javascript will give error if you have the comment. The comment is only good for the html and not for the javascript. Sorry about confusing everyone.

I have updated the script back to one html file. This has the javascript embedded within it and easier to maintain as one file.

I have updated the code in the first thread and removed the reference to javascript file.

Jones

User avatar
Paul
Member
 
Posts: 778
Joined: Sat Aug 30, 2008 4:46 pm
Location: Bonn, Germany

by Paul » Mon Jul 20, 2009 7:23 am

I suggest that you add a comment line in your code snippets indicating a version number and increase the version number when you did a change. That makes it easier to follow the changes and/or additions and checking it again a stored copy/paste on my pc.

Thanks.
Paul

close, but no cigar ... ... ...

no avatar
Gordon
Member
 
Posts: 357
Joined: Wed Oct 08, 2008 12:18 pm
Location: Deep in the woods, UK

by Gordon » Mon Jul 20, 2009 2:53 pm

jhenry is the generator king....

Gordon
2000th Member :D

GigaPixel Experimenter
Gigapan Beta Unit, Canon Powershot S5IS, Canon 350D, Nikon D40, Manfrotto Tripod, BT-Serial + Papywizard on Nokia 770, Fully-Operational Merlin the Wizard Unit!!!

User avatar
gkaefer
Member
 
Posts: 3352
Joined: Tue Jun 09, 2009 1:01 pm
Location: Salzburg

by gkaefer » Tue Jul 21, 2009 12:08 am

Hi Jones,

the preset scripts could be expanded after </table> and before </form> with:

Code: Select all
   </table>

    <tr>
     </p>
     <td>Help: Camera Sensor Pixel size (asuming landscape, use this values on width & height in pixel fields:</td></br>
     <td colspan="6">
        <select name="Camera" size="6"">
          <optgroup label="Canon">
            <option label="EOS 350D  - W=3456 H=2304">EOS 350D  - W=3456 H=2304 </option>
            <option label="EOS 1000D - W=3888 H=2592">EOS 1000D - W=4752 H=3168 </option>
            <option label="EOS 400D  - W=3888 H=2592">EOS 400D  - W=3888 H=2592 </option>
            <option label="EOS 40D   - W=3888 H=2592">EOS 40D   - W=3888 H=2592 </option>
            <option label="EOS 1D Mark III - W=3888 H=2592">EOS 1D Mark III - W=3888 H=2592 </option>
            <option label="EOS 450D  - W=4272 H=2848">EOS 450D  - W=4272 H=2848 </option>
            <option label="EOS 5D    - W=4368 H=2912">EOS 5D    - W=4368 H=2912 </option>
            <option label="EOS 500D  - W=4752 H=3168">EOS 500D  - W=4752 H=3168 </option>
            <option label="EOS 50D   - W=4752 H=3168">EOS 50D   - W=4752 H=3168 </option>
            <option label="EOS 5D Mark II   - W=5612 H=3744">EOS 5D Mark II  - W=5612 H=3744 </option>
            <option label="EOS 1Ds Mark III - W=5612 H=3744">EOS 5D Mark II  - W=5612 H=3744 </option>
          </optgroup>
          <optgroup label="Phase One">
            <option label="P 20+ - W=4080 H=4080">P 20+ - W=4080 H=4080</option>
            <option label="P 21+ - W=4904 H=3678">P 20+ - W=4904 H=3678</option>
            <option label="P 25+ - W=5436 H=4080">P 25+ - W=5436 H=4080</option>
            <option label="P 30+ - W=6496 H=4872">P 30+ - W=6496 H=4872</option>
            <option label="P 45+ - W=7216 H=5412">P 45+ - W=7216 H=5412</option>
            <option label="P 65+ - W=8984 H=6732">P 65+ - W=8984 H=6732</option>
           </optgroup>
          <optgroup label="Sigma">
          </optgroup>
           <optgroup label="Sony">
          </optgroup>
        </select>
     </td>
    </tr>
  </form>

it has no functionality for the form, just help to remember the pixel of own cam... ;-)
I just added cam I own (canon eos400D) and the P65+ I'm waiting for christmas gift ;-)

Liebe Gruesse,
Georg
Last edited by gkaefer on Tue Jul 21, 2009 12:16 am, edited 1 time in total.

Next

Return to Motorized panohead project: Merlin, Orion & Papywizard

Who is online

Users browsing this forum: No registered users and 1 guest