Skip to content
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

Changing Centroid Finding Algorithm #59

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f56efab
Horizontal Thresholding
nguy8tri Nov 14, 2021
e494123
Merge branch 'tri-centroiding' of https://github.com/uwcubesat/lost i…
nguy8tri Nov 20, 2021
b1d8c57
Local Centroiding
nguy8tri Nov 29, 2021
3381500
Changes to reflect additional parameters from Master
nguy8tri Dec 16, 2021
a94a8b3
For local thresholding
nguy8tri Dec 16, 2021
f697131
Changes to correct thresholding match
nguy8tri Dec 17, 2021
a424332
Stuff
nguy8tri Jan 4, 2022
1d5eec4
Something
nguy8tri Jan 4, 2022
7b132f4
Revisions of code for local thresholding --Doesn't seem off, but stil…
nguy8tri Jan 13, 2022
a790c8a
Changes are now consistent with normal centroiding algorithm
nguy8tri Jan 13, 2022
d2d57b0
Testing Files
nguy8tri Jan 20, 2022
c9ac940
Fixed Local Thresholding Algorithm??
nguy8tri Jan 30, 2022
b3eb1bd
I hope this actually works
nguy8tri Jan 31, 2022
b614f4e
Done!
nguy8tri Feb 11, 2022
ab1b3bd
Done!
nguy8tri Feb 11, 2022
8e5cd1b
To LF
nguy8tri Feb 15, 2022
591f618
No more cairo
nguy8tri Feb 15, 2022
465769f
More deletes
nguy8tri Feb 15, 2022
56b09c8
More to LF
nguy8tri Feb 17, 2022
b2141a2
To LF
nguy8tri Feb 25, 2022
30a8429
Removing things
nguy8tri Feb 25, 2022
ea96132
Removed
nguy8tri Feb 25, 2022
5acf0f2
Merging with Master
nguy8tri Mar 1, 2022
8681534
Centroiding and updates
nguy8tri Mar 3, 2022
1716f5a
Changes with Response to Comments
nguy8tri Mar 3, 2022
dd04ed6
Changes with Response to Comments
nguy8tri Mar 3, 2022
c97e4b9
Last set of subdivisions
nguy8tri Mar 4, 2022
9b0fd07
Testing Done
nguy8tri Apr 5, 2022
677b11a
More changes
nguy8tri Apr 19, 2022
46f521a
Changes
nguy8tri Apr 19, 2022
a51c5ad
Some debugging
nguy8tri May 14, 2022
5bd5a21
Changes
nguy8tri Jun 10, 2022
bbb9982
Troubleshooting for 2D Local Centroiding
nguy8tri Jun 15, 2022
3ecd13c
Troubleshooting box matching algorithm
nguy8tri Jul 5, 2022
c654db3
Finished Debugging?
nguy8tri Jul 9, 2022
b88284c
Fixing style
nguy8tri Jul 13, 2022
e366966
Deleting Files
nguy8tri Jul 13, 2022
8559fa3
Proving Inverse Statement
nguy8tri Jul 14, 2022
15b0f78
Modified Inverse Test to go both ways
nguy8tri Jul 14, 2022
ec066f5
Finished algorithm?
nguy8tri Aug 19, 2022
67099d8
Clean up recursive method
nguy8tri Aug 19, 2022
1f6f032
Fixed causes of differences
nguy8tri Aug 23, 2022
12900a7
Updated with annotations
nguy8tri Mar 21, 2023
3c16925
More commenting
nguy8tri Mar 21, 2023
e49b2ef
Deleted unnecessary files
nguy8tri Mar 21, 2023
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
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
18 changes: 17 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"files.eol": "\n"
"files.eol": "\n",
"bitset": "cpp",
"chrono": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"set": "cpp",
"ratio": "cpp",
"regex": "cpp",
"future": "cpp",
"iomanip": "cpp",
"mutex": "cpp",
"shared_mutex": "cpp",
"thread": "cpp",
"variant": "cpp",
"list": "cpp"
}
}
237 changes: 237 additions & 0 deletions documentation/man-database.h

Large diffs are not rendered by default.

1,313 changes: 1,313 additions & 0 deletions documentation/man-pipeline.h

Large diffs are not rendered by default.

321 changes: 253 additions & 68 deletions src/centroiders.cpp

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/centroiders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ class DummyCentroidAlgorithm: public CentroidAlgorithm {

class CenterOfGravityAlgorithm : public CentroidAlgorithm {
public:
CenterOfGravityAlgorithm() { };
CenterOfGravityAlgorithm(int subdivisions) : subdivisions(subdivisions) { };
Stars Go(unsigned char *image, int imageWidth, int imageHeight) const override;
private:
int subdivisions;
};

class IterativeWeightedCenterOfGravityAlgorithm : public CentroidAlgorithm {
Expand Down
3 changes: 2 additions & 1 deletion src/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ CentroidAlgorithm *DummyCentroidAlgorithmPrompt() {
}

CentroidAlgorithm *CoGCentroidAlgorithmPrompt() {
return new CenterOfGravityAlgorithm();
int subdivisions = Prompt<int>("How many subdivisions to use");
return new CenterOfGravityAlgorithm(subdivisions);
}

CentroidAlgorithm *IWCoGCentroidAlgorithmPrompt() {
Expand Down
56 changes: 56 additions & 0 deletions test/centroid.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <catch.hpp>

#include <math.h>
#include <iostream>

namespace lost {
int RowOrColumn(long i, int leftover, int div);
int FindSubdivision(long i, int imageWidth, int imageHeight, int subdivisions);
int StartOfSubdivision(int i, int leftover, int div);
}


TEST_CASE("Testing Start and End Rows") {
int row = 0;
int horizontalLeftover = 5;
int horizontalDiv = 10;
CHECK(lost::StartOfSubdivision(row, horizontalLeftover, horizontalDiv) == 0);
CHECK(lost::StartOfSubdivision(row + 1, horizontalLeftover, horizontalDiv) == 11);
}

TEST_CASE("Testing Start and End Columns") {
int col = 0;
int verticalLeftover = 5;
int verticalDiv = 10;
CHECK(lost::StartOfSubdivision(col, verticalLeftover, verticalDiv) == 0);
CHECK(lost::StartOfSubdivision(col + 1, verticalLeftover, verticalDiv) == 11);
}

TEST_CASE("Correct Row: 4th Row") {
CHECK(lost::RowOrColumn(33795 / 1024, 1024 % 100, 1024 / 100) == 3);
}

TEST_CASE("Correct Row: 27th Row") {
CHECK(lost::RowOrColumn((24 * 1024 * 11 + 10 * 2 * 1024 + 20) / 1024, 1024 % 100, 1024 / 100) == 26);
}

TEST_CASE("Correct Row: Last Row 1") {
CHECK(lost::RowOrColumn((1024 * 1024 - 1) / 1024, 1024 % 100, 1024 / 100) == 99);
}

TEST_CASE("Correct Box: Last Subdivision") {
CHECK(lost::FindSubdivision(1024 * 1024 - 1, 1024, 1024, 1024) == 1024 * 1024 - 1);
}

TEST_CASE("Testing Inverse Conjecture") {
int size = 1024;
int subdivisions = 10;
int leftover = size % subdivisions;
int div = size / subdivisions;
for(int i = 0; i < subdivisions; i++) {
int x = lost::StartOfSubdivision(i, leftover, div);
CHECK(lost::RowOrColumn(x, leftover, div) == i);
CHECK(lost::StartOfSubdivision(lost::RowOrColumn(x, leftover, div), leftover, div) == x);
}
}