Skip to content

Commit f74cb0f

Browse files
committed
Image Zoom
1 parent 748a373 commit f74cb0f

File tree

6 files changed

+238
-404
lines changed

6 files changed

+238
-404
lines changed

CHANGELOG.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
# Version 0.3.1.0 - (2020-12-13)
2+
## Added
3+
- <b>Image Zoom</b> - Because sometimes, it's hard to get that one point just right.
4+
- The user can now right click on either [or both] of the input images to toggle zoom for more accurate point placement
5+
- Comment: <i>Sheesh, this was difficult to implement correctly with Qt. Currently this feature is using a default (and moderate)
6+
zoom strength of 2x, but this may be subject to change in the future - might use 2.5x or 3x if it seems that 2x isn't cutting it.</i>
7+
8+
## Removed
9+
- As of v0.3.0.1's hot pixel fix, PIM's image smoothing feature is deprecated and will now be removed
10+
- Removed Morphing.py's <b>smoothBlend()</b> method as well as the "smoothMode" parameter in <b>getImageAtAlpha()</b>
11+
- Removed all code related to smoothing in MorphingApp.py (a reduction of 77 SLOC)
12+
- Removed <b>self.smoothingBox</b> from MorphingGUI.ui and MorphingGUI.py
13+
- Comment: <i>It's likely that this checkbox will be replaced with an automatic correspondence button at some point.</i>
14+
15+
## Changes
16+
- Optimized the conditional logic found in MorphingApp.py's <b>displayTriangles()</b>
17+
- Optimized a query in Morphing.py's <b>getPoints()</b>
18+
- "np.where(np.array(mask) == True)" → "np.where(np.array(mask))"
19+
- Optimized conditional logic and list pop statements in MorphingApp.py's <b>keyPressEvent()</b>
20+
- Changed the loop in MorphingApp.py's <b>autoCorner()</b> to be less C-like and more Pythonic
21+
- "i = 0; while i < 4: ... i++" → "for leftPoint, rightPoint in zip(tempLeft, tempRight): ..."
22+
- Moved <b>autoCorner()</b>'s invocation of <b>refreshPaint()</b> out of it's loop (i.e. the GUI is now updated once instead of up to four times)
23+
- Changed the notification message displayed when <b>autoCorner()</b> adds one point pair
24+
- Removed a conditional in MorphingApp.py's <b>resizeLeft()</b> and <b>resizeRight()</b> that was unnecessarily reassigning their image type variable
25+
- Converted the syntax of all instances where lists were being reset in MorphingApp.py
26+
- "self.blendList = []" → "self.blendList.clear()"
27+
- Updated a couple source code comments that became deprecated due to recent updates (oops)
28+
29+
## Fixes
30+
- Resolved an oversight where .jpeg images couldn't be loaded into the program
31+
- Comment: <i>To clarify, while it can probably accept other types, PIM is specifically written to work with .jpg, .jpeg, and .png images.</i>
32+
- Corrected unintended behavior in <b>mousePressEvent()</b> where points could also be drawn with the middle and right mouse buttons
33+
134
# Version 0.3.0.1 - (2020-12-01)
235
## Fixes
336
- Fixed a long-standing bug where hot pixels frequently appeared in blended images [[before](https://i.imgur.com/W8RniY5.jpg) and [after](https://i.imgur.com/B5dLjRn.jpg)]
@@ -20,7 +53,7 @@
2053
- Comment: <i>Currently, image zoom functionality has been (somewhat) implemented but point placement will require additional changes.</i>
2154

2255
## Added
23-
- <b>Freestyle Point Placement</b> - Gone are the days where point pairs had to begin with the left image!
56+
- <b>Freestyle Point Placement</b> - Gone are the days when point pairs had to begin with the left image!
2457
- QoL: The user can now place point pairs on the images in whatever order they wish
2558
- Keyboard/mouse input logic has been rewritten to maintain previous behavior with Undo, Delete, OUT, etc.
2659
- <b>Redo (CTRL+Y) Functionality</b>
@@ -190,7 +223,7 @@ release candidate
190223
- Fixed a crash where the user could press the blend button before morphing was even enabled
191224
- Comment: <i>I actually laughed when I accidentally caught this during debugging.. what an entertaining oversight.</i>
192225
- Fixed a bug where the GUI would fail to visibly update during the morphing process
193-
- The blend button now locks up and the notification bar displays a relevant message while the program operates
226+
- The blend button now locks up, and the notification bar displays a relevant message while the program operates
194227
- Comment: <i>These things were already happening in the background; visible changes to the QtGui just wouldn't apply
195228
due to the fact that the MainWindow "wasn't responding." Qt's repaint() method serves as a simple workaround here.</i>
196229
- Fixed a bug where regex in <b>loadDataLeft()</b> and <b>loadDataRight()</b> wasn't correctly detecting '.PNG' images
@@ -273,7 +306,7 @@ of whether the two images have scaled contents
273306
- "if tri.isChecked(): triPref = 1 else: triPref = 0" → "triPref = int(tri.isChecked())"
274307
- Optimized: Removed 24 SLOC (26% reduction) from MorphingApp.py's MainWindow constructor. All GUI initializations have
275308
been shifted from MorphingApp.py to MorphingGUI.ui & MorphingGUI.py.
276-
- Comment: <i>These were pretty much just a waste of space - some of the lines accomplished nothing at all.
309+
- Comment: <i>These were pretty much just a waste of space - some lines accomplished nothing at all.
277310
Other times, MorphingGUI.ui and MorphingGUI.py were enabling elements just for the initializer to immediately
278311
disable them afterwards.</i>
279312
- Optimized: Removed 7 SLOC (32% reduction) from MorphingApp.py's <b>updateTriangleWidget()</b>
@@ -282,7 +315,7 @@ been shifted from MorphingApp.py to MorphingGUI.ui & MorphingGUI.py.
282315
## Fixes
283316
- Fixed an issue where the right image's triangle vertices were being loaded from type List instead of type Array
284317
- Fixed an issue where tooltips could appear over blank space, as some GUI elements were "wider" than they actually were
285-
- Fixed a bug where loading new images with Show Triangles checked would break both the checkbox as well as the triangle
318+
- Fixed a bug where loading new images with Show Triangles checked would break both the checkbox and the triangle
286319
painter
287320
- Comment: <i>This was a particularly nasty bug. It ended up mainly being caused by a state change method that triggered
288321
whenever the triangle box was modified. This method was setting flags at the same time as the calling block, which
@@ -294,7 +327,7 @@ painter
294327
- Fixed a bug where <b>autoCorner()</b> had to place corner points that were off by a pixel
295328
- (1, 1), (1, y - 1), (x - 1, 1), (x - 1, y - 1) → (0, 0), (0, y), (x, 0), (x, y)
296329
- Replaced a global (and hard-coded) DataPath variable that wasn't being used with a dynamic root directory variable. Hard coded
297-
text file paths in <b>loadDataLeft()</b> and <b>loadDataRight()</b> now instead build off of ROOT_DIR
330+
text file paths in <b>loadDataLeft()</b> and <b>loadDataRight()</b> now instead build on ROOT_DIR
298331
- Comment: <i>Now this program can start having release candidates! Once module import woes get sorted out, anyways.</i>
299332
- Removed an unnecessary call to <b>refreshPaint()</b> in <b>loadDataLeft()</b> and <b>loadDataRight()</b>
300333
- Removed a conditional in both <b>loadDataLeft()</b> and <b>loadDataRight()</b> that wasn't necessary
@@ -434,7 +467,7 @@ be easier to see on top of the two images. Clarity is key.</i>
434467
- The program now remembers the user's preference for the "Show Triangles" setting
435468
- If an action causes this setting to become disabled, the program will re-enable it the next time it is available
436469
- <b>Transparency Blending Toggle</b>
437-
- The user is now able to specify whether or not they want to blend the alpha layer of images
470+
- The user is now able to specify whether they want to blend the alpha layer of images
438471
- This setting only affects .PNG images
439472
## Changed
440473
- Changed the following elements in MorphingGUI.ui and MorphingGUI.py:

Morphing/Morphing.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def getPoints(self):
6868
grid = p.contains_points(points)
6969
mask = grid.reshape(self.maxX - self.minX + 1, self.maxY - self.minY + 1)
7070

71-
trueArray = np.where(np.array(mask) == True)
71+
trueArray = np.where(np.array(mask))
7272
coordArray = np.vstack((trueArray[0] + self.minX, trueArray[1] + self.minY, np.ones(trueArray[0].shape[0])))
7373

7474
return coordArray
@@ -101,7 +101,7 @@ def __init__(self, leftImage, leftTriangles, rightImage, rightTriangles):
101101
self.rightInterpolation = RectBivariateSpline(np.arange(self.rightImage.shape[0]), np.arange(self.rightImage.shape[1]), self.rightImage, kx=1, ky=1)
102102

103103

104-
def getImageAtAlpha(self, alpha, smoothMode):
104+
def getImageAtAlpha(self, alpha):
105105
for leftTriangle, rightTriangle in zip(self.leftTriangles, self.rightTriangles):
106106
self.interpolatePoints(leftTriangle, rightTriangle, alpha)
107107

@@ -139,6 +139,3 @@ def interpolatePoints(self, leftTriangle, rightTriangle, alpha):
139139
for x, y, z in zip(targetPoints, leftSourcePoints, rightSourcePoints): # TODO: ~ 53% of runtime
140140
self.leftImage[int(x[1])][int(x[0])] = self.leftInterpolation(y[1], y[0])
141141
self.rightImage[int(x[1])][int(x[0])] = self.rightInterpolation(z[1], z[0])
142-
143-
def smoothBlend(blendImage):
144-
return median_filter(blendImage, size=2)

0 commit comments

Comments
 (0)