logo Sign In

Post #1029311

Author
Williarob
Parent topic
Neverar's A New Hope Technicolor Recreation (Final Version Released!)
Link to post in topic
https://originaltrilogy.com/post/id/1029311/action/topic#1029311
Date created
5-Jan-2017, 2:28 PM

NeverarGreat said:

Williarob said:

NeverarGreat said:

UnitéD2 said:

Thanks to you Neverar and another question : when you recruit color from another source, does it mean you combine luminance information from the BR and chrominance from the source ?

That’s it exactly. I usually replace 50-90% of the chroma with the improved source, sometimes just a few gradients or a small part of the frame, but sometimes the entire frame gets the chroma replaced. In the first 4 reels, I’ve probably replaced the entire color of just 5 or 6 shots, but reel 6 in particular has such horrible color problems that during the dogfight it’s used on probably 1/3 of the shots. It’s surprisingly effective, but it’s essential to make sure everything is registered throughout the shot or you get worse problems like color fringing.

What tools do you use for image registration? Or do you do it manually? I’ve tried Elastix, some ImageJ plugins, and Photoshop’s Auto align layers usually works pretty well.

I’ve done it manually so far, the same process that I used for registering the lightsabers in the Obi/Vader battle. I’ve tried Auto Align Layers on some warped sources and it didn’t improve things, so I didn’t even consider it for this purpose. I suppose that would work though. It would need to be individual images run through as a batch process, right?

That’s right. The weird thing is though, I can only seem to batch it in Photoshop CS3. All newer versions just skip right over the image alignment. I’ve tried it in every version! And it doesn’t matter if I use a recorded action, or pure Javascript, either way, it just doesn’t do the alignment unless I run it in CS3. But here is the script:

/// Begin Script

// options
var folder1 = “Z:/Reel1/Working/{ShotNumber}/Source1”;
var folder2 = “Z:/Reel1/Working/{ShotNumber}/Source2”;
var OutputFolder = “Z:/Reel1/Working/{ShotNumber}/Registered”;

var startFrame = 1;
var endFrame = 150;

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

// Loop through the Print A frames
for(var x = startFrame; x <= endFrame; x++)
{
// convert number to 6 digit, 0 padded string Id
var frameId = x+"";
while (frameId.length < 6) frameId = “0” + frameId; // pad fileId with 0s

// open the print A file
var printADocRef = new File(folder1 + "/Print_A_" + frameId + ".tif");
var printADoc = open(printADocRef);

// open the matching print B file
var printBDocRef = new File(folder2 + "/Print_B_" + frameId + ".tif");
var printBDoc =  open(printBDocRef);

// activate the Print A
app.activeDocument = app.documents.getByName( "Print_A_" + frameId + ".tif" );
		
// select all & copy (SelectAllAndCopy)
app.doAction("SelectAllAndCopy","Default Actions.atn");

// activate the print B doc
app.activeDocument = app.documents.getByName( "Print_B_" + frameId + ".tif" );
	
// perform the alignment
Align();

    // Note: to run your own recorded action(s) use:
//app.doAction("MyActionName","Default Actions.atn");

// remove the print B layer to minimize file size.
app.activeDocument.layers["Layer 0"].remove();

/*
// optional: save the file as a psd
var psd_Opt = new PhotoshopSaveOptions();
psd_Opt.layers = true; // Preserve layers.
psd_Opt.embedColorProfile = true; // Preserve color profile.
psd_Opt.annotations = true; // Preserve annonations.
psd_Opt.alphaChannels = true; // Preserve alpha channels.
psd_Opt.spotColors = true; // Preserve spot colors.
// Save active document in the Auto Save folder
app.activeDocument.saveAs( File( OutputFolder + "/Debug_R1_" + frameId + ".psd" ), psd_Opt, true );
*/

// set the new filename and path
var myFilePath = OutputFolder + "/Print_A_" + frameId + ".tif";

// tiff file options
var tiffFile = new File(myFilePath);
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.byteOrder = ByteOrder.IBM;
tiffSaveOptions.layers = false;
tiffSaveOptions.transparency = false;
tiffSaveOptions.alphaChannels = false;
tiffSaveOptions.interleaveChannels = false;
tiffSaveOptions.embedColorProfile = false;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
tiffSaveOptions.saveImagePyramid = false;

// finally save out the document 
app.activeDocument.saveAs(tiffFile, tiffSaveOptions, true, Extension.LOWERCASE);

// close all open documents
while (documents.length > 0) {
	app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}

} // loop to the next pair of files

// !!! No editing necessary below this line !!!

// Helper functions
function inArray(needle,haystack)
{
var count=haystack.length;
for(var i=0;i<count;i++)
{
if(haystack[i]===needle){return true;}
}
return false;
}

//
//==================== AlignAndFix ==============
//
function Align() {
// Set
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID(‘Lyr ‘), cTID(‘Bckg’));
desc1.putReference(cTID(‘null’), ref1);
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID(‘Opct’), cTID(’#Prc’), 100);
desc2.putEnumerated(cTID('Md '), cTID(‘BlnM’), cTID(‘Nrml’));
desc1.putObject(cTID('T '), cTID('Lyr '), desc2);
executeAction(cTID(‘setd’), desc1, dialogMode);
};

// Set
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID(‘Chnl’), sTID(“selection”));
desc1.putReference(cTID(‘null’), ref1);
desc1.putEnumerated(cTID('T '), cTID(‘Ordn’), cTID(‘None’));
executeAction(cTID(‘setd’), desc1, dialogMode);
};

// Paste
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID(‘AntA’), cTID(‘Annt’), cTID(‘Anno’));
executeAction(cTID(‘past’), desc1, dialogMode);
};

// Select
function step4(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName(cTID('Lyr '), “Layer 0”);
desc1.putReference(cTID(‘null’), ref1);
desc1.putBoolean(cTID(‘MkVs’), false);
executeAction(cTID(‘slct’), desc1, dialogMode);
};

// Select
function step5(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName(cTID('Lyr '), “Layer 1”);
desc1.putReference(cTID(‘null’), ref1);
desc1.putEnumerated(sTID(“selectionModifier”), sTID(“selectionModifierType”), sTID(“addToSelectionContinuous”));
desc1.putBoolean(cTID(‘MkVs’), false);
executeAction(cTID(‘slct’), desc1, dialogMode);
};

// Align
function step7(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID(‘Ordn’), cTID(‘Trgt’));
desc1.putReference(cTID(‘null’), ref1);
desc1.putEnumerated(cTID(‘Usng’), cTID(‘ADSt’), sTID(“ADSContent”));
desc1.putEnumerated(cTID(‘Aply’), sTID(“projection”), cTID(‘Auto’));
executeAction(cTID(‘Algn’), desc1, dialogMode);
};

// Select
function step8(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName(cTID('Lyr '), “Layer 0”);
desc1.putReference(cTID(‘null’), ref1);
desc1.putBoolean(cTID(‘MkVs’), false);
executeAction(cTID(‘slct’), desc1, dialogMode);
};

// Hide
function step9(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var list1 = new ActionList();
var ref1 = new ActionReference();
ref1.putName(cTID('Lyr '), “Layer 1”);
list1.putReference(ref1);
desc1.putList(cTID(‘null’), list1);
executeAction(cTID('Hd '), desc1, dialogMode);
};

// Set
function step10(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID(‘Chnl’), sTID(“selection”));
desc1.putReference(cTID(‘null’), ref1);
var ref2 = new ActionReference();
ref2.putEnumerated(cTID(‘Chnl’), cTID(‘Chnl’), cTID(‘Trsp’));
desc1.putReference(cTID('T '), ref2);
executeAction(cTID(‘setd’), desc1, dialogMode);
};

// Crop
function step11(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
executeAction(cTID(‘Crop’), desc1, dialogMode);
};

step1(); // Set
step2(); // Set
step3(); // Paste
step4(); // Select
step5(); // Select
step7(); // Align
step8(); // Select
//step9(); // Hide
step10(); // Set
step11(); // Crop

};

/// End Script

Most of the bottom part is just the recorded actions converted to Javascript. Just copy it and paste it into a text editor, edit the file paths and the filenames and your start and end numbers and then save it with a .jsx extension. It assumes the images are numbered as a tiff image sequence, e.g. “Print_A_000001.tif”.

To run it, just go to “File -> Scripts -> Browse…” But like I say, I can only get it to work in CS3. If you can make it work in other versions, do let me know!

It works well on most scenes in the film, though not on star fields, smoke filled corridors or especially high motion sequences where frames are just a blur and there are no edges to be found and lined up.