Repository navigation
Fix png without metadata handling #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
de087ab
Add tests
meesoft 04a2fee
Bitmap constructor
meesoft 76254da
Microsoft_AI_DirectML_SkipDebugLayerCopy
meesoft 2be792a
Update dotnet build version
meesoft b57aede
Fix png metadata transfer
meesoft 55f862a
Fix WorkingDirectory
meesoft 8d48c2c
Add AI tests
meesoft 37eea7e
Prepare release
meesoft 7738374
Improve test
meesoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
|
|
||
|
|
||
| <LangVersion>15</LangVersion> | ||
| <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio> | ||
| <Platforms>x64</Platforms> | ||
| <AppendPlatformToOutputPath>false</AppendPlatformToOutputPath> | ||
|
|
||
| <!-- Use hard links to speed up build --> | ||
| <CreateHardLinksForAdditionalFilesIfPossible>true</CreateHardLinksForAdditionalFilesIfPossible> | ||
| <CreateHardLinksForCopyLocalIfPossible>true</CreateHardLinksForCopyLocalIfPossible> | ||
| <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible> | ||
| <CreateHardLinksForPublishFilesIfPossible>true</CreateHardLinksForPublishFilesIfPossible> | ||
| <!-- Use hard links to speed up build --> | ||
| <CreateHardLinksForAdditionalFilesIfPossible>true</CreateHardLinksForAdditionalFilesIfPossible> | ||
| <CreateHardLinksForCopyLocalIfPossible>true</CreateHardLinksForCopyLocalIfPossible> | ||
| <CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible> | ||
| <CreateHardLinksForPublishFilesIfPossible>true</CreateHardLinksForPublishFilesIfPossible> | ||
|
|
||
| </PropertyGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
PhotoLocatorTest/BitmapOperations/HoleClosingOperationTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| using System.Diagnostics; | ||
|
|
||
| namespace PhotoLocator.BitmapOperations; | ||
|
|
||
| [TestClass] | ||
| public class HoleClosingOperationTest | ||
| { | ||
| [TestMethod] | ||
| public void CloseHolesIteratively_FillsSingleHole() | ||
| { | ||
| int width = 3; | ||
| int height = 1; | ||
| var image = new FloatBitmap(width, height, 1); | ||
| var mask = new FloatBitmap(width, height, 1); | ||
| // set all pixel values to 1 (non-hole) | ||
| for (int x = 0; x < width; x++) | ||
| image[x, 0] = 1f; | ||
| // create a single hole at middle pixel | ||
| image[1, 0] = 0f; // non-hole pixels in mask are 0 | ||
| mask[1, 0] = 1f; // hole indicator | ||
|
|
||
| HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); | ||
|
|
||
| // The center pixel should be replaced by the average of its neighbors (both 1) | ||
| Assert.AreEqual(1f, image[1, 0], 1e-6f, "Center pixel should be filled with average of neighbors"); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public void CloseHolesIteratively_FillsAdjacentHoles() | ||
| { | ||
| int width = 5; | ||
| int height = 1; | ||
| var image = new FloatBitmap(width, height, 1); | ||
| var mask = new FloatBitmap(width, height, 1); | ||
| // set all pixel values to 1 (non-hole) | ||
| for (int x = 0; x < width; x++) | ||
| image[x, 0] = 1f; | ||
| // create holes at positions 1 and 3 | ||
| image[1, 0] = 0f; | ||
| image[3, 0] = 0f; | ||
| mask[1, 0] = 1f; | ||
| mask[3, 0] = 1f; | ||
|
|
||
| HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); | ||
|
|
||
| Assert.AreEqual(1f, image[1, 0], 1e-6f, "Hole at position 1 should be filled"); | ||
| Assert.AreEqual(1f, image[3, 0], 1e-6f, "Hole at position 3 should be filled"); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public void CloseHolesIteratively_FillsBiggerHole() | ||
| { | ||
| var image = new FloatBitmap( | ||
| [ 1, 1, 1, 1 ], | ||
| [ 0.5f, 0, 0, 0 ], | ||
| [ 0.5f, 0, 0, 0 ], | ||
| [ 0.5f, 0, 0, 0 ], | ||
| [ 1, 1, 1, 1 ]); | ||
| var mask = new FloatBitmap( | ||
| [ 0, 0, 0, 0 ], | ||
| [ 0, 1, 1, 1 ], | ||
| [ 0, 1, 1, 1 ], | ||
| [ 0, 1, 1, 1 ], | ||
| [ 0, 0, 0, 0 ]); | ||
|
|
||
| HoleClosingOperation.CloseHolesIteratively(image, mask, 0.5f); | ||
|
|
||
| Debug.WriteLine(image); | ||
| Assert.AreEqual(0.8f, image[1, 1], 1e-6f, "Hole at position 1 should be filled"); | ||
| Assert.AreEqual(1f, image[3, 3], 1e-6f, "Hole at position 3 should be filled"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.