Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions src/Change.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,26 @@ public class Change {

Util util = new Util();
ArrayList<Image> images;
private double magnitude;
protected double increments;
protected int lastListNum, startListNum;
protected int totalImages;

// Initializing change data
public Change(ArrayList<Image> imgs, int sln, int pln) {
public Change(ArrayList<Image> imgs, int sln, int pln, double mag) {
images = imgs;
startListNum = sln;
lastListNum = pln;
totalImages = (lastListNum - startListNum) + 1;
}

// Gets start image of change sequence
public int getStartListNum() {
return startListNum;
magnitude = mag;
increments = magnitude / totalImages;
}

// Gets last image before change
public int getLastListNum() {
return lastListNum;
}

// Gets number of images within this change sequence
public int getTotalImages() {
return totalImages;
}

// Gets the increments dispersed among all images in change sequence
public double getIncrements() {
return increments;
}

// Sets start image of change sequence
public void setStartListNum(int sln) {
startListNum = sln;
}

public void setPrevListNum(int pln) {
lastListNum = pln;
}

// Updates xmp file (settings) of all images within change sequence
public void updateMetadata(String key) {
// Gets start value of change
Expand Down Expand Up @@ -84,4 +63,23 @@ else if(key.equals("Temperature")) {
util.writeFile(currImg, newData);
}
}

// Finds an image name from its list number
private String NumToName(int num) {
for (int i = 0; i < images.size(); i++) {
if (i == num) {
return images.get(i).getName();
}
}
return null;
}

// Returns a string representation of a Change for human readability.
public String toString() {
return NumToName(startListNum) + " - " + NumToName(lastListNum)
+ " (" + startListNum + " - " + lastListNum + ")"
+ " [" + totalImages + " images]\n"
+ "(" + magnitude + ")"
+ " [" + increments + "]";
}
}
37 changes: 0 additions & 37 deletions src/ExposureChange.java

This file was deleted.

30 changes: 0 additions & 30 deletions src/TemperatureChange.java

This file was deleted.

93 changes: 24 additions & 69 deletions src/proRAW.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
public class proRAW {
Util util;
ArrayList<Image> images;
ArrayList<ExposureChange> exposureChanges;
ArrayList<TemperatureChange> temperatureChanges;
ArrayList<Change> exposureChanges;
ArrayList<Change> temperatureChanges;
double exposureIncrements;
int startLocation, endLocation;

// Initializing lists and calling main functions
public proRAW() {
util = new Util();
images = new ArrayList<Image>();
exposureChanges = new ArrayList<ExposureChange>();
temperatureChanges = new ArrayList<TemperatureChange>();
exposureChanges = new ArrayList<Change>();
temperatureChanges = new ArrayList<Change>();

// Outputs welcome text
welcome();
Expand Down Expand Up @@ -207,44 +207,16 @@ public void analyzeExposure() {

// If the exposure is changed between current and next image
if (isExposureChanged(currImg)) {

ExposureChange newChange = new ExposureChange(images, startExpoChange, i);
double exposure = 0;

// If the shutter speed was changed
if (currImg.getShutterSpeed() != nextImg.getShutterSpeed()) {
// Use log and doubling function to calculate stops
if (nextImg.getShutterNum() > currImg.getShutterNum()) {
exposure += (Math.log(nextImg.getShutterNum() / currImg.getShutterNum())) / (Math.log(2));
} else {
exposure -= (Math.log(currImg.getShutterNum() / nextImg.getShutterNum())) / (Math.log(2));
}
}

// If the aperture was changed
if (currImg.getAperture() != nextImg.getAperture()) {
// Use log function to calculate stops
exposure += (Math.log(currImg.getAperture() / nextImg.getAperture())) / (Math.log(Math.sqrt(2)));
}

// If iso was changed
if (currImg.getISO() != nextImg.getISO()) {
// Use log function to calculate stops
if (nextImg.getISO() > currImg.getISO()) {
exposure += (Math.log(nextImg.getISO() / currImg.getISO())) / (Math.log(2));
} else {
exposure -= (Math.log(currImg.getISO() / nextImg.getISO())) / (Math.log(2));
}
}

// If the exposure setting in Photoshop is changed..
if (currImg.getExposureOffset() != nextImg.getExposureOffset()) {
exposure += (nextImg.getExposureOffset() - currImg.getExposureOffset());
}

// Set calculated change to object
newChange.setExpoChange(exposure);

// We set the exposure change accounting for shutter speed, aperture, ISO and the setting
// change in Photoshop/Lightroom.
Change newChange = new Change(
images,
startExpoChange,
i,
(Math.log(nextImg.getShutterNum() / currImg.getShutterNum())) / (Math.log(2))
+ (Math.log(currImg.getAperture() / nextImg.getAperture())) / (Math.log(Math.sqrt(2)))
+ (Math.log(nextImg.getISO() / currImg.getISO())) / (Math.log(2))
+ (nextImg.getExposureOffset() - currImg.getExposureOffset()));
// Save exposure change to exposureChanges list!
// Allowing multiple exposure changes to occur and be analyzed independently
exposureChanges.add(newChange);
Expand Down Expand Up @@ -275,9 +247,12 @@ public void analyzeWB() {
// If white balance is changed
if (isWhiteBalanceChanged(currImg)) {
// Create new temperature change, calculate difference, and set change
TemperatureChange tempChange = new TemperatureChange(images, startWBChange, i);
tempChange.setTemperatureChange(nextImg.getWhiteBalance() - currImg.getWhiteBalance());

Change tempChange = new Change(
images,
startWBChange,
i,
nextImg.getWhiteBalance() - currImg.getWhiteBalance()
);
// Add temperature change to "temperatureChanges" list
temperatureChanges.add(tempChange);
}
Expand Down Expand Up @@ -322,26 +297,16 @@ public void updateMetadata() {
// Prints all change information from all images
public void printChanges() {
for (int i = 0; i < exposureChanges.size(); i++) {
Change change = exposureChanges.get(i);
System.out.println("======== EXPOSURE CHANGE " + i + " ========");
System.out.print(NumToName(exposureChanges.get(i).getStartListNum()) + " - "
+ NumToName(exposureChanges.get(i).getLastListNum()));
System.out.print(" (" + exposureChanges.get(i).getStartListNum() + " - "
+ exposureChanges.get(i).getLastListNum() + ")");
System.out.println(" [" + exposureChanges.get(i).getTotalImages() + " images]");
System.out.print("(" + exposureChanges.get(i).getExpoChange() + ")");
System.out.println(" [" + exposureChanges.get(i).getIncrements() + "]");
System.out.println(change.toString());
}
System.out.println();

for (int i = 0; i < temperatureChanges.size(); i++) {
Change change = temperatureChanges.get(i);
System.out.println("======== WHITE BALANCE CHANGE " + i + " ========");
System.out.print(NumToName(temperatureChanges.get(i).getStartListNum()) + " - "
+ NumToName(temperatureChanges.get(i).getLastListNum()));
System.out.print(" (" + temperatureChanges.get(i).getStartListNum() + " - "
+ temperatureChanges.get(i).getLastListNum() + ")");
System.out.println(" [" + temperatureChanges.get(i).getTotalImages() + " images]");
System.out.print("(" + temperatureChanges.get(i).getTemperatureChange() + ")");
System.out.println(" [" + temperatureChanges.get(i).getIncrements() + "]");
System.out.println(change.toString());
}
}

Expand Down Expand Up @@ -373,16 +338,6 @@ public void noImgErr(File img) {
System.out.println("Error: \"" + img.getAbsolutePath() + "\" does not exist.");
}

// Finds an image name from its list number
public String NumToName(int num) {
for (int i = 0; i < images.size(); i++) {
if (i == num) {
return images.get(i).getName();
}
}
return null;
}

public static void main(String[] args) {
new proRAW();
}
Expand Down