Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 89eea96

Browse files
authored
Dev/tracking (#94)
* Initial commit * Ensure const-correctness when passing Frame to functions * Enable tracking * Fix variable identifier * Show info overlay during target tracking * Use block matching for tracking * Fix ref. block initialization * Working on centroid tracking * Implement centroid tracking * Update info overlay after tracking mode change * Take img transform into account when showing info overlay * Do not add tracking target outside of image * React to centroid area moving outside of image * Remove old action * Add disabling of tracking * Add mount tab * Start working on mount control widget * Add mount connection dialog * Detect INDI support * Work on INDI connection UI * Add INDI check on top of the project. Properly handle missing INDI library * Add feature flag to disable tracking Ui * Fix opencv4 error; remove warning * Fix compilation with opencv 2.x #skip_ci
1 parent d3580e9 commit 89eea96

28 files changed

Lines changed: 1415 additions & 64 deletions

cmake/GuLinux-Commons.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(GuLinux-Commons-Download NONE)
55
include(ExternalProject)
66
ExternalProject_Add(GuLinux-Commons
77
GIT_REPOSITORY https://github.com/GuLinux/GuLinux-Commons.git
8-
GIT_TAG 7aafede7ec32b576ba6648fa53613f319f215111
8+
GIT_TAG 54213dd4ae0760e349bfba116b273d258d64fbb4
99
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/GuLinux-Commons"
1010
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/GuLinux-Commons-build"
1111
CONFIGURE_COMMAND ""

cmake/find_dependencies.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(FindPkgConfig)
2+
13
# Qt
24
set(CMAKE_AUTOMOC ON)
35
set(CMAKE_AUTOUIC ON)
@@ -19,8 +21,17 @@ find_package(Boost REQUIRED)
1921
# OpenCV
2022
find_package(OpenCV REQUIRED )
2123

24+
# INDI
25+
pkg_check_modules(LIBINDI libindi)
26+
if(LIBINDI_FOUND)
27+
set(HAVE_LIBINDI On CACHE INTERNAL "")
28+
else()
29+
set(HAVE_LIBINDI Off CACHE INTERNAL "")
30+
endif()
31+
32+
2233
include_directories(${OpenCV_INCLUDE_DIRS})
23-
include(FindPkgConfig)
34+
2435

2536
# ccfits
2637
find_library(CCFITS_LIBRARY NAMES ccfits CCfits HINTS ${CCFITS_LIBRARY_PATH})

cmake/functions.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ function(add_driver)
4747
set(enabled_drivers ${enabled_drivers} ${add_driver_NAME} CACHE INTERNAL "")
4848
endfunction()
4949

50+
# Updates the specified CMake variable in the parent scope
51+
macro(update_parent VAR_NAME)
52+
set(${VAR_NAME} ${${VAR_NAME}} PARENT_SCOPE)
53+
endmacro(update_parent)
54+
5055
function(external_project_download IN_FILE OUT_DIR)
5156
configure_file(${IN_FILE} ${OUT_DIR}_download/CMakeLists.txt)
5257
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .

cmake/options.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if(DEBUG_NETWORK_PACKETS)
2929
add_definitions(-DDEBUG_NETWORK_PACKETS)
3030
endif()
3131

32+
option(DISABLE_TRACKING "Disable tracking implementation" ON)
33+
if(DISABLE_TRACKING)
34+
add_definitions(-DDISABLE_TRACKING)
35+
endif()
36+
3237
# Extra executables to be built
3338
if("${CPACK_GENERATOR}" STREQUAL "DragNDrop")
3439
message("Disabling PlanetaryImager network daemon and frontend in bundle mode")

src/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ set(PlanetaryImager_SRCS planetaryimager_main.cpp ${PlanetaryImager_GUI_SRCS})
33

44

55
if(static_qt_windows)
6-
add_definitions(-DSTATIC_WINDOWS_PLUGIN)
6+
add_definitions(-DSTATIC_WINDOWS_PLUGIN)
7+
endif()
8+
9+
10+
if(HAVE_LIBINDI)
11+
add_definitions(-DHAVE_LIBINDI)
712
endif()
813

914
if(OSX_BUNDLE)
@@ -29,8 +34,6 @@ else()
2934
endif()
3035

3136

32-
33-
3437
if(ADD_DRIVERS_BUILD_DIRECTORY)
3538
add_definitions(-DADDITIONAL_DRIVERS_DIRECTORY="${CMAKE_CURRENT_BINARY_DIR}/drivers")
3639
endif()

src/commons/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
set(planetaryimager-commons-INCLUDE_DIRS "" CACHE INTERNAL "")
2+
set(planetaryimager-commons-LINK-DIRS "" CACHE INTERNAL "")
3+
set(planetaryimager-commons-LIBS "" CACHE INTERNAL "")
4+
set(planetaryimager-commons-DEFS "" CACHE INTERNAL "")
5+
16
file(GLOB planetaryimager-commons-SRCS *.cpp)
27
configure_file(version.h.in version.h)
8+
9+
add_subdirectory(mount)
10+
311
add_library(planetaryimager-commons STATIC ${planetaryimager-commons-SRCS})
12+
13+
add_definitions(${planetaryimager-commons-DEFS})
14+
target_include_directories(planetaryimager-commons PRIVATE ${planetaryimager-commons-INCLUDE_DIRS})
15+
link_directories(${planetaryimager-commons-LINK-DIRS})
16+
target_link_libraries(planetaryimager-commons ${planetaryimager-commons-LIBS})
17+
418
add_imager_dependencies(planetaryimager-commons)

src/commons/frame.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ class Frame
5050
uint8_t *data();
5151
QSize resolution() const;
5252
cv::Mat mat() const;
53+
const cv::Mat cmat() const { return mat(); }
5354
uint8_t channels() const;
5455
uint8_t bpp() const;
5556
QDateTime created_utc() const;
5657
ColorFormat colorFormat() const;
5758
ByteOrder byteOrder() const;
58-
59+
5960
QVariantMap const as_variant();
6061
static FramePtr from_variant(const QVariantMap &map);
6162
typedef std::chrono::duration<double> Seconds;

src/commons/mount/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
if(HAVE_LIBINDI)
2+
set(enabled_mounts ${enabled_mounts} INDI CACHE INTERNAL "")
3+
4+
set(mount-SRCS
5+
${CMAKE_CURRENT_SOURCE_DIR}/mount.cpp
6+
${CMAKE_CURRENT_SOURCE_DIR}/indi.cpp
7+
)
8+
9+
list(APPEND planetaryimager-commons-SRCS ${mount-SRCS})
10+
update_parent(planetaryimager-commons-SRCS)
11+
12+
list(APPEND planetaryimager-commons-INCLUDE_DIRS ${LIBINDI_INCLUDE_DIRS})
13+
update_parent(planetaryimager-commons-INCLUDE_DIRS)
14+
15+
list(APPEND planetaryimager-commons-LINK-DIRS ${LIBINDI_LIBRARY_DIRS})
16+
update_parent(planetaryimager-commons-LINK-DIRS)
17+
# Do not use ${LIBINDI_LIBRARIES}; on some installations it may be missing "libindiclient" (which we need),
18+
# and contain "libindidriver" (not needed, and requiring additional dependencies).
19+
list(APPEND planetaryimager-commons-LIBS indiclient)
20+
find_package(Threads REQUIRED)
21+
list(APPEND planetaryimager-commons-LIBS ${CMAKE_THREAD_LIBS_INIT})
22+
update_parent(planetaryimager-commons-LIBS)
23+
24+
message("INDI support enabled (Mount).")
25+
else()
26+
message("INDI support disabled: libindi not found.")
27+
endif()

src/commons/mount/indi.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2018 Filip Szczerek <ga.software@yahoo.com>
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
19+
#include "mount.h"
20+
21+
namespace Mount
22+
{
23+
24+
std::vector<std::string> getIndiDevices(const char *hostname, unsigned port)
25+
{
26+
return { "some device 1" };
27+
}
28+
29+
} // namespace Mount

src/commons/mount/mount.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C) 2018 Filip Szczerek <ga.software@yahoo.com>
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
19+
#include "mount.h"
20+
21+
namespace Mount
22+
{
23+
24+
bool isConnectionSupported(ConnectionType connType)
25+
{
26+
switch (connType)
27+
{
28+
case ConnectionType::INDI:
29+
#ifdef HAVE_LIBINDI
30+
return true;
31+
#else
32+
return false;
33+
#endif
34+
35+
case ConnectionType::SkyWatcher:
36+
return false;
37+
// safety net, returning false as driver is unknown
38+
default:
39+
return false;
40+
}
41+
}
42+
43+
} // namespace Mount

0 commit comments

Comments
 (0)