Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Траблы со скриптами PhotoShop CS3, HDR и склейка панорамы 
:(
    Опции темы
dr.ZmeY
  Дата 20.12.2007, 15:58 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Политолог
****


Профиль
Группа: Участник Клуба
Сообщений: 3892
Регистрация: 26.3.2002
Где: ..::STALINGRAD::. .

Репутация: нет
Всего: 60



САБЖ!!! При вызове этих сценариев вылетает сообщение, что файл или папка где расположен файл скрипта не найден... Собственно вот сам скрипт Photomerge.jsx

Код

// (c) Copyright 2006-2007.  Adobe Systems, Incorporated.  All rights reserved.

//
// Photomerge in ExtendScript.
// Translated from the original C++ automation & filter plugins
//
// John Peterson, Adobe Systems, 2006
//
// Adobe Patent or Adobe Patent Pending Invention Included Within this File


/*
@@@BUILDINFO@@@ Photomerge.jsx 3.0.0.1
*/

/*
// BEGIN__HARVEST_EXCEPTION_ZSTRING

<javascriptresource>
<name>$$$/JavaScripts/Photomerge/Menu=Photomerge...</name>
<about>$$$/JavaScripts/Photomerge/About=Photomerge^r^rCopyright 2006 Adobe Systems Incorporated. All rights reserved.^r^rCombines several photographs into one continuous image.</about>
<menu>automate</menu>
</javascriptresource>

// END__HARVEST_EXCEPTION_ZSTRING
*/

// on localized builds we pull the $$$/Strings from a .dat file
$.localize = true;

// Put header files in a "Stack Scripts Only" folder.  The "...Only" tells
// PS not to place it in the menu.  For that reason, we do -not- localize that
// portion of the folder name.
var g_StackScriptFolderPath = "";
///app.path +"/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts") + "/" + localize("$$$/Private/Exposuremerge/StackScriptOnly=Stack Scripts Only/");

$.evalFile(g_StackScriptFolderPath + "LatteUI.jsx");

$.evalFile(g_StackScriptFolderPath + "StackSupport.jsx");

$.evalFile(g_StackScriptFolderPath + "CreateImageStack.jsx");

$.evalFile(g_StackScriptFolderPath + "Geometry.jsx");

$.evalFile(g_StackScriptFolderPath + "PolyClip.jsx");

// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// Must leave at zero, otherwise trapping gFileFromBridge fails on QA's debug builds.
$.level = 0; // (Window.version.search("d") != -1) ? 1 : 0;
// debugger; // launch debugger on next line

if (typeof(PMDebug) == 'undefined')
    var PMDebug = false;

/************************************************************/
// photomerge routines

// Debug - write the trapezoid in Matlab format
function dumpTrap( name, corners )
{
    var i;
    if (! PMDebug) return;
    $.write( name + "= [" );
    for (i in corners)
        $.write( ((i > 0) ? "; " : "" ) + corners[i].fX + " " + corners[i].fY );
    $.writeln( "];");
}

StackElement.prototype.dumpMLCorners = function()
{
    // Weed out file suffix (chokes matlab)
    dumpTrap( this.fName.match(/([^.]+)/)[1], this.fCorners );
}

// Set the fCorners of the layer to the bounds of the Photoshop layer.
StackElement.prototype.setCornersToLayerBounds = function( stackDoc )
{
    if (typeof(stackDoc) == "undefined")
        stackDoc = app.activeDocument;
        
    var bounds = stackDoc.layers[this.fName].bounds;
    this.fCorners = new Array();
    this.fCorners[0] = new TPoint( bounds[0].as("px"), bounds[1].as("px") );
    this.fCorners[2] = new TPoint( bounds[2].as("px"), bounds[3].as("px") );
    
    this.fCorners[1] = new TPoint( this.fCorners[2].fX, this.fCorners[0].fY );
    this.fCorners[3] = new TPoint( this.fCorners[0].fX, this.fCorners[2].fY );
}
    

// Add the corner data to the string of per-stackElement information
// that gets passed to the filter plugin
StackElement.prototype.addPieceData = function()
{
    if (typeof(this.fCorners) != "undefined")
    {
        // Add corners in place of trailing '\n'
        this.fString = this.fString.slice(0,-1) + "fCorners=";
        for (j = 0; j < 4; j++)
            this.fString += " " + this.fCorners[j].fX.toString() + " " + this.fCorners[j].fY.toString();
        this.fString += "\t";
        
        if (typeof(this.fScale) != "undefined")
            this.fString += ("fScale=" + this.fScale.toString() + "\t");
            
        if ((typeof(this.fConnectedTo) != "undefined") && this.fConnectedTo)
            this.fString += "fConnectedTo=" + this.fConnectedTo.fLayerID + "\t";
            
        if (typeof(this.fLayerID) != "undefined")
            this.fString += "fLayerID=" + this.fLayerID.toString() + "\t";
            
        this.fString += "\n";
    }
    else
        debugger;    // Corner data missing!
}

StackElement.prototype.overlapArea = function( other )
{
    if (other == this)
        return TPoint.polygonArea( this.fCorners );

    var overlapBounds = TRect.intersection( this.fBoundsCache, other.fBoundsCache );
    if (overlapBounds.isEmpty())
        return 0.0;

    var clipPoly = TPoint.intersectConvexPolygons( this.fCorners, other.fCorners );
    if (! clipPoly)
        return 0.0;
    else return TPoint.polygonArea( clipPoly );
}

// Find the points where the two quadrilaterals intersect (yes, eight is a theoretical max)
// Note situations where one piece intersects the same edge twice - special
// case handled by SoftEdgeBlend
StackElement.prototype.findQuadIntersections = function( other, intersections )
{
    var i, j;
    var curIntersections, numIntersections = 0;

    var innerEdgeIntersections = [ 0, 0, 0, 0 ];
    var outerEdgeIntersections = [ 0, 0, 0, 0 ];
    var thisEdge = false;
    var otherEdge = false;

    for (i = 0; i < 4; i++)
    {
        var eb0 = other.fCorners[i];
        var eb1 = other.fCorners[(i + 1) > 3 ? 0 : i + 1];
        curIntersections = numIntersections;
        for (j = 0; j < 4; j++)
        {
            var ed0 = this.fCorners[j];
            var ed1 = this.fCorners[(j + 1) > 3 ? 0 : j + 1];
            var cross = TPoint.lineSegmentIntersect( eb0, eb1, ed0, ed1 );
            
            if (cross != TPoint.kInfinite)
            {
                intersections[numIntersections++] = cross;
                innerEdgeIntersections[j]++;
            }
        }
        outerEdgeIntersections[i] = numIntersections - curIntersections;
    }

    if (numIntersections == 2)
        for (i = 0; i < 4; i++)
        {
            if (innerEdgeIntersections[i] == 2) thisEdge = true;
            if (outerEdgeIntersections[i] == 2) otherEdge = true;
        }
    
    return {"numIntersections":numIntersections, "thisEdge":thisEdge, "otherEdge":otherEdge};
}

// Look for a point of this that's inside the corners of other.

StackElement.prototype.findSingleInsidePoint = function( other )
{
    var i;
    var result = new Object();
    result.numFound = 0;
    for (i = 0; i < 4; i++)
        if (this.fCorners[i].pointInQuad( other.fCorners ))
        {
            result.numFound++;
            result.insidePt = this.fCorners[i];
        }
    return result;
}

// "Adobe patent application tracking # B349, entitled 'Method and apparatus for Layer-based Panorama Adjustment and Editing', inventor: John Peterson"
//
// Because we're dealing with quads, we can't use the simple scheme
// to generate blend rects that the rectangles use - black stuff
// from the rects will seep in. So instead, we use various heuristics to
// figure out how the quads themselves intersect.  This isn't too hard
// when there's just two intersection points (usual case), but there are
// some pathological cases where there are many more intersections (the octogon
// from one square 45 deg. off from another is the classic example).            

StackElement.prototype.softEdgeBlend = function( other, blendRad )
{
    var i, j;
    var intersections = new Array();    // Worst case is a square inside a 45 degree rot square

    // If there's no distortion, do the blend strictly on the rectangles
/*    if ((!IsQuadMapped() && !other->IsQuadMapped())
        || (IsRectilinear() && other->IsRectilinear()))
    {
        Assert_( other->fWarpedRaster );
        fWarpedRaster->SoftEdgeBlendRasters( *(other->fWarpedRaster), blendRad );
        return;
    }
*/
    var bounds = this.getBounds();

    // Find the points where the two quadrilaterals intersect
    var intResult = this.findQuadIntersections( other, intersections );
    var numIntersections = intResult.numIntersections;
    var thisEdgeTwice = intResult.thisEdge;
    var otherEdgeTwice = intResult.otherEdge;
    
    var thisInsidePt = this.findSingleInsidePoint( other );
    var otherInsidePt = other.findSingleInsidePoint( this );

    // If quads don't overlap, just bail
    if (numIntersections == 0)
        return;

    // Handle cases where just one point overlaps the other piece
    
    var insidePoint;
    if (otherEdgeTwice || ((numIntersections == 2) && (thisInsidePt.numFound == 1)))
    {
        insidePoint = thisInsidePt.insidePt;
        this.makeBlendTrapezoid( intersections[0], intersections[1], insidePoint, blendRad, false );
        return;
    }
    if (thisEdgeTwice /*|| ((numIntersections == 2) && (otherInsidePt.numFound == 1))*/)
    {
        insidePoint = otherInsidePt.insidePt;
        this.makeBlendTrapezoid( intersections[0], intersections[1], insidePoint, blendRad, false );
        return;
    }

    // ...More than two corners overlap, apply heuristics to find reasonable blending 
    $.bp( numIntersections > 8 );

    // If we got more than two points, pick the two furthest apart
    if (numIntersections > 2)
    {
        var max0, max1;
        var maxDist = -1.0;

        for (i = 0; i < numIntersections - 1; i++)
            for (j = i + 1; j < numIntersections; j++)
            {
                var dist = (intersections[i] - intersections[j]).vectorLength();
                if (dist > maxDist)
                {
                    max0 = intersections[i];
                    max1 = intersections[j];
                    maxDist = dist;
                }
            }

        $.bp( maxDist <= -1.0 );
        intersections[0] = max0;
        intersections[1] = max1;
        numIntersections = 2;
    }

    TPoint.clipLineToRect( bounds, intersections[0], intersections[1] );

    // The point furthest away from the cut line on the "other" image
    // is the one that we blend toward (the "dark" corner).
    var maxPoint = 0, maxDist = -1;
    for (i = 0; i < 4; i++)
    {
        var dist = Math.abs( other.fCorners[i].distanceToLine( intersections[0], intersections[1] ) );
        if (dist > maxDist)
        {
            maxDist = dist;
            maxPoint = i;
        }
    }

    this.makeBlendTrapezoid( intersections[0], intersections[1], other.fCorners[maxPoint], blendRad, true );
}

// "Adobe patent application tracking # B349, entitled 'Method and apparatus for Layer-based Panorama Adjustment and Editing', inventor: John Peterson"
//
// Create a layer mask that fades out from the edge0,edge1 cutline towards "insidePt"
// If two points are inside, construct the mask fade from the edge of the image.
//
//                       insidePt
//             |            *           |
//             |           / \          |
//             |          /   \         |
// insetLine-> |       +-/-----\-+      |  --
//             |       |/       \|      |   | radius
// baseLine->  +-------*---------*------+  --
//                    /edge0      \edge1
//                   /             \           
//
//
StackElement.prototype.makeBlendTrapezoid = function( edge0, edge1, insidePt, radius, useCorners )
{
    function sgn(x) { if (x < 0) return -1; if (x > 0) return 1; return 0; }
    function wrap4(i, next)
    {
        i += next;
        if (i > 3) return i % 4;
        if (i < 0) return 3;
        return i;
    }
    
    // Create a layer mask
    selectOneLayer( app.activeDocument, this.fName );
//    app.activeDocument.activeLayer = app.activeDocument.layers[this.fName];    // Broken if multiple layers selected.
    createLayerMask();    // Does nothing if the layer already has a mask
    
    // Create vector perpendicular to edge towards insidePt
    var edgeDir = edge1 - edge0;
    var blendDir = new TPoint( -edgeDir.fY, edgeDir.fX );
    blendDir /= blendDir.vectorLength();    // Make unit length
    
    // Make a polygonal selection covering the area
    var dist = insidePt.distanceToLine( edge0, edge1 );
    var blendOffset = blendDir * dist;
    var blendBox;
    if (! useCorners)
        blendBox = [edge0, edge0+blendOffset, edge1+blendOffset, edge1, edge0];
    else
    {
        // If the cutline slices across the image (two points on each side), then
        //        - Look for the edge edge0 is on
        //        - Figure out which corner is on the same side as "insdePt"
        //        - Construct the blendBox from that.
        var i, nextPtInd;
        for (i = 0; i < 4; i++)
            if (edge0.distanceToLine( this.fCorners[i], this.fCorners[wrap4(i,1)] ) < 0.0001 )
            {
                if (this.fCorners[i].sideOf( edge0, edge1 ) == sgn( dist ))
                    nextPtInd = -1;
                else
                    nextPtInd = 1;
                blendBox = new Array();
                blendBox[0] = edge0;
                blendBox[1] = (nextPtInd < 0) ? this.fCorners[i] : this.fCorners[i+1];
                blendBox[2] = (nextPtInd < 0) ? this.fCorners[wrap4(i, -1)] : this.fCorners[wrap4(i, 2)];
                blendBox[3] = edge1;
                break;
            }
        $.bp( i == 4 );    // Never found edge0?
    }
            
    createPolygonSelection( blendBox );
    
    // Fill it.
    var midPoint = (edge0 + edge1) * 0.5;
    gradientFillLayerMask( midPoint, midPoint + blendDir * radius * sgn(dist) );
    app.activeDocument.selection.deselect();
}

//////////////////////////////////////////////////////////////////////////////////
// Photomerge base class
//////////////////////////////////////////////////////////////////////////////////

const kPhotomergeAdvancedBlendingFlag = app.stringIDToTypeID( "PhotomergeAdvancedBlendingFlag" );    

photomerge = new ImageStackCreator( localize("$$$/AdobePlugin/Shared/Photomerge/Process/Name=Photomerge"),
                                          localize('$$$/AdobePlugin/Shared/Photomerge/Auto/untitled=Untitled_Panorama' ),
                                          localize('$$$/AdobePlugin/Shared/Photomerge/DlogIntro=Choose two or more files to merge into a panorama') );

// For now, alignment is turned OFF, because we want to
// invoke it independantly.              
photomerge.useAlignment            = false;    // We do the alignment, not PS
photomerge.hideAlignment        = true;

photomerge.mustBeSameSize        = false;
photomerge.mustBeUnmodifiedRaw = false;
photomerge.mustNotBe32Bit        = false;
photomerge.radioButtons = ["_LOauto", "_LOnormal", "_LOperspective", "_LOcylindrical", "_LOinteractive"];
photomerge.interactiveFlag        = false;
photomerge.alignmentKey            = "Auto";    // Defaults to perspective
photomerge.compositionFile        = null;

photomerge.advancedBlending        = true;

try {
// We want to steer people to the advanced blending option,
// so have it be on by default, rather than sticky.
//    var desc = app.getCustomOptions("PhotomergeFlags001");
//    photomerge.advancedBlending = desc.getBoolean( kPhotomergeAdvancedBlendingFlag );
}
catch (e)
{
}


// Get the bounds of all of the stackElements.
photomerge.getBounds = function()
{
    var i;
    for (i in this.stackElements)
    {
        if (i == 0) 
            this.fBounds = this.stackElements[i].getBounds();
        else
            this.fBounds.extendTo( this.stackElements[i].getBounds() );
    }
    return this.fBounds;
}

// Align selected layers by content (uses SIFT registration in Photoshop core)
// This just returns the alignment data, it does not actually transform the layers
// unless doTransform is true
photomerge.getAlignmentInfo = function( stackDoc, doTransform )
{
    selectAllLayers(stackDoc, 1);
    const kMargin = 10;
    
    function offsetGroup( delta, group )
    {
        group.bounds.offset( delta );
        var k;
        for (k = 0; k < group.layers.length; ++k)
        {
            group.layers[k].offset( delta );
            if (doTransform)
            {
                selectOneLayer( stackDoc, group.layers[k].fName );
                // Translate gets broken when document DPI isn't 72 DPI...(PR 1417264)
//                activeDocument.activeLayer.translate( UnitValue( delta.fX, "px" ), UnitValue( delta.fY, "px" ) );    
                translateActiveLayer( delta.fX, delta.fY );
            }
        }
    }

    var i, j, alignInfo;
    alignInfo = getActiveDocAlignmentInfo( this.alignmentKey, doTransform );
    // If the alignment fails completely, fake up a plan B...
    // For now, just set the images side by side. 
    if (! alignInfo)
    {
        alert(localize("$$$/AdobePlugin/Shared/Photomerge/alignbad=Some images could not be automatically aligned"));
        var xpos = 0;
        for (i in this.stackElements)
        {
            this.stackElements[i].setCornersToSize();
            this.stackElements[i].offset( new TPoint( xpos, 0 ) );
            xpos += this.stackElements[i].getBounds().getWidth() + kMargin;
        }
        this.fGroups = null;
    }
    else
    {
        var layerList = alignInfo.layerInfo;
        this.fGroups = new Array();
        for (i = 0; i < layerList.length; ++i)
        {
            // Note we depend on stackElement's order matching 
            // the document's sheet list!
            var curGroup = layerList[i].groupNum;
            if (doTransform && layerList[i].corners.length == 0)
                this.stackElements[i].setCornersToLayerBounds( stackDoc );
            else
                this.stackElements[i].fCorners = layerList[i].corners;
            this.stackElements[i].fAlignGroup = curGroup;
            this.stackElements[i].fBaseFlag = layerList[i].baseFlag;
            if (typeof(this.fGroups[curGroup]) == "undefined")
            {
                this.fGroups[curGroup] = new Object();
                this.fGroups[curGroup].hasCorners = layerList[i].corners.length > 0;
                this.fGroups[curGroup].bounds = this.stackElements[i].getBounds();
                this.fGroups[curGroup].layers = new Array();
                this.fGroups[curGroup].xformType = layerList[i].xformType;
            }
            else
                this.fGroups[curGroup].bounds.extendTo( this.stackElements[i].getBounds() );
                
            this.fGroups[curGroup].layers.push( this.stackElements[i] );
        }
        
        // Now move the groups into  place
        // Note carefully: if the corners were given, then the group is already
        // transformed into the proper spot, and we just need to move the corners to
        // match.  So shut off moving the layer pixels around from here on out.
        if (this.fGroups[0].hasCorners)
            doTransform = false;
        offsetGroup( -this.fGroups[0].bounds.getTopLeft(), this.fGroups[0] );
        
        for (i = 1; i < alignInfo.numGroups; ++i)
        {
            var spacing = Math.round(this.fGroups[i-1].bounds.getHeight() / 10.0);
            offsetGroup( -this.fGroups[i].bounds.getTopLeft() + new TPoint(0, spacing + Math.round(this.fGroups[i-1].bounds.fBottom)), 
                           this.fGroups[i] );
        }
    }
    this.getBounds();
}

......


ВТут он выдаёт, что файл не найден, хотя путь прописан верно и файл на месте....
Код

$.evalFile(g_StackScriptFolderPath + "StackSupport.jsx");

$.evalFile(g_StackScriptFolderPath + "CreateImageStack.jsx");

$.evalFile(g_StackScriptFolderPath + "Geometry.jsx");

$.evalFile(g_StackScriptFolderPath + "PolyClip.jsx");


Если у кого работает эта хрень нормально, посмотрите, верно ли прописан путь g_StackScriptFolderPath в моём скрипте (по идее верно, в чём глюк не знаю)


--------------------
PM MAIL WWW ICQ Skype   Вверх
Aloha
Дата 20.12.2007, 22:40 (ссылка) |    (голосов:1) Загрузка ... Загрузка ... Быстрая цитата Цитата


.
**


Профиль
Группа: Участник Клуба
Сообщений: 351
Регистрация: 14.5.2006

Репутация: 6
Всего: 165



dr.ZmeY

Похоже, трабла в том, что в твоем скрипте закомментированы строки, в которых вычисляется путь к папкам со скриптами LatteUI.jsx, StackSupport.jsx и т.д.

В общем найди фрагмент (он прям перед тем куском, в котором возникает ошибка):
Код
var g_StackScriptFolderPath = "";
///app.path +"/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts") + "/" + localize("$$$/Private/Exposuremerge/StackScriptOnly=Stack Scripts Only/");

и замени его вот этим:
Код
var g_StackScriptFolderPath = app.path + "/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts") + "/" + localize("$$$/Private/Exposuremerge/StackScriptOnly=Stack Scripts Only/");


PM   Вверх
dr.ZmeY
Дата 21.12.2007, 09:32 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Политолог
****


Профиль
Группа: Участник Клуба
Сообщений: 3892
Регистрация: 26.3.2002
Где: ..::STALINGRAD::. .

Репутация: нет
Всего: 60



Сенкс, попробую...


--------------------
PM MAIL WWW ICQ Skype   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
December DezmASter
z-END Caramel
  • Старайтесь изложить проблему как можно ясней.
    Как показывает статистика, на один понятный вопрос приходится три правильных ответа.

  • Лучше один раз увидеть, чем сто раз услышать.
    Прикрепляйте к сообщению иллюстрации. Если не знаете как это сделать посмотрите здесь: "Как вставлять картинки?"

  • Как вы спросите - так вам и ответят. Будьте вежливы.

и последнее: форум фотошоп предназначен для того, чтобы учиться. Топики с просьбами "сделайте мне" будут удаляться в раздел

работа


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, December, DezmASter, z-END, Caramel.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Photoshop, Illustrator, Corel и т.п. | Следующая тема »


 




[ Время генерации скрипта: 0.0511 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.