Skip to content

Commit

Permalink
WIP: Fixing compile problem on github.
Browse files Browse the repository at this point in the history
  • Loading branch information
carsten0x51h committed May 5, 2024
1 parent 330084b commit d6e90b0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
3 changes: 3 additions & 0 deletions source/focus_finder/common/cimg_fits_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ namespace starmath::io::fits {
}


/**
*
*/
void
write(const ImageT &inImg, const std::string &inFilename, bool override, std::stringstream *ss) {
// TODO: Is it possible to pass a stream?
Expand Down
3 changes: 2 additions & 1 deletion source/focus_finder/common/include/pipeline/view/crop.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <range/v3/view/join.hpp>


#include "../../logging.h"
#include "../../image.h"
#include "../../point.h"
#include "../../rect.h"
Expand Down Expand Up @@ -93,7 +94,7 @@ namespace starmath::pipeline {
| ranges::view::transform(
[=](const auto & crop_region) {

std::cerr << "Cropping region " << crop_region << std::endl;
LOG(debug) << "Cropping region " << crop_region << std::endl;

// See https://github.com/GreycLab/CImg/issues/110
return std::make_shared<cimg_library::CImg<ImageType>>(
Expand Down
9 changes: 7 additions & 2 deletions source/focus_finder/common/include/pipeline/view/write.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ namespace starmath::pipeline::io {
}

/**
* TODO: Rename to read()
* TODO: Idea... maybe rename to starmath::pipeline::io ?
* TODO: write is not a view! It is an action! It must not be lazy!
* -> Using transform() here is potentially wrong... because if we call write() as last step
* of a processing pipeline, nothing will happen, if there is no final "to<vector>()" or
* similar....
* --> write() can be designed as view AND as action -> depending on what is desired. The
* views::write() call can be useful to store a copy to a file in the middle of a pipeline.
* actions::write() must be used, as a final step to finish a pipeline.
*/
template<typename ImageType=float>
auto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ BOOST_AUTO_TEST_CASE(pipeline_astrophotography_image_development_test, * boost::
*/
BOOST_AUTO_TEST_CASE(pipeline_star_recognizer_test)
{
auto clusteredImagesRanges =
// TODO: At least two files...
auto detectedStarImages =
view::single("test_data/image_processing_pipeline/real_world/star_recognizer/test_image_star_recognizer_1.fit.gz")
| read()
| interpolate_bad_pixels(500 /*threshold*/, 3 /*filter size*/)
Expand All @@ -258,18 +259,22 @@ BOOST_AUTO_TEST_CASE(pipeline_star_recognizer_test)
30
)
| crop()
| view::join
| scale_up(3.0F)
| center_on_star(CentroidAlgorithmFactoryT::getInstance(CentroidAlgorithmTypeT::IWC))
| scale_down(3.0F)
| write(std::filesystem::current_path(), "img_%04d.fit") // NOTE; path must exist
// | views::join // crop() gives range<vector<img>, vector<img>, ...> This does not work with ubuntu 22.04 (older version of ranges v3),therefore, transform below...
| view::transform([](const auto & detectedStars /*std::vector<cimg_library::CImg<ImageType>> */){
return detectedStars
| scale_up(3.0F)
| center_on_star(CentroidAlgorithmFactoryT::getInstance(CentroidAlgorithmTypeT::IWC))
| scale_down(3.0F)
| write(std::filesystem::current_path(), "img_%04d.fit") // NOTE; path must exist, TODO: directory should change for each input image...
| to<std::vector>();
})
| actions::join
| to<std::vector>();




// BOOST_TEST(clusteredImagesRanges.size() == 1); // Should correspond to the number of input images
BOOST_TEST(clusteredImagesRanges.size() == 92); // 216 detected stars (without hot-pixel removal)
BOOST_TEST(detectedStarImages.size() == 92); // 216 detected stars (without hot-pixel removal)


// Test; Calculate SNR and HFD
Expand Down

0 comments on commit d6e90b0

Please sign in to comment.