├── images ├── demo.JPG ├── GrayImage.jpg ├── SRCImage1.jpg ├── SRCImage2.jpg ├── SRCImage3.jpg ├── SRCImage4.jpg ├── SRCImage5.jpg ├── SRCImage6.jpg ├── BasicSegment.jpg ├── OtsuSegment.jpg ├── BanlancedImage.jpg ├── KmeansSegment.jpg ├── MaxEntropySegment.jpg ├── NewMethodSegment.jpg ├── RegionGrowSegment.jpg └── SRCImage1SRCImage0.jpg ├── binary_segmentation ├── ImageSegmentationUI.qrc ├── ImageSegmentor.cpp ├── ImageSegmentationUI.cpp ├── main.cpp ├── ImageSegmentor.h ├── CMakeLists.txt ├── ImageSegmentationUI.ui └── ImageSegmentationUI.h ├── README.md └── .gitignore /images/demo.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/demo.JPG -------------------------------------------------------------------------------- /images/GrayImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/GrayImage.jpg -------------------------------------------------------------------------------- /images/SRCImage1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage1.jpg -------------------------------------------------------------------------------- /images/SRCImage2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage2.jpg -------------------------------------------------------------------------------- /images/SRCImage3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage3.jpg -------------------------------------------------------------------------------- /images/SRCImage4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage4.jpg -------------------------------------------------------------------------------- /images/SRCImage5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage5.jpg -------------------------------------------------------------------------------- /images/SRCImage6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage6.jpg -------------------------------------------------------------------------------- /images/BasicSegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/BasicSegment.jpg -------------------------------------------------------------------------------- /images/OtsuSegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/OtsuSegment.jpg -------------------------------------------------------------------------------- /images/BanlancedImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/BanlancedImage.jpg -------------------------------------------------------------------------------- /images/KmeansSegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/KmeansSegment.jpg -------------------------------------------------------------------------------- /images/MaxEntropySegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/MaxEntropySegment.jpg -------------------------------------------------------------------------------- /images/NewMethodSegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/NewMethodSegment.jpg -------------------------------------------------------------------------------- /images/RegionGrowSegment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/RegionGrowSegment.jpg -------------------------------------------------------------------------------- /images/SRCImage1SRCImage0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/images/SRCImage1SRCImage0.jpg -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentationUI.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/binary_segmentation/ImageSegmentor.cpp -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentationUI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Freeverc/image-processing/HEAD/binary_segmentation/ImageSegmentationUI.cpp -------------------------------------------------------------------------------- /binary_segmentation/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ImageSegmentationUI.h" 2 | #include 3 | 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | ImageSegmentationUI w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Image Processing 2 | Some image processing tests. 3 | 4 | # Image-Binary-Segmentation-master 5 | An image binary segmentation tool based on several algorithms including ostu, k-means, max-entropy reagion-growth and so on. A user interface is made based on QT. 6 | -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace cv; 9 | 10 | extern Mat theImage; 11 | extern Mat theResult; 12 | extern int openflag; 13 | extern QString showName; 14 | 15 | class ImageSegmentor : 16 | public QWidget 17 | { 18 | public: 19 | ImageSegmentor(); 20 | ~ImageSegmentor(); 21 | void exeSegment(); 22 | }; 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Custom files 2 | LocalConfig.cmake 3 | src/util/version.h 4 | 5 | # Custom directories 6 | .idea/ 7 | .vscode 8 | .DS_Store 9 | build*/ 10 | install-debug/ 11 | install-release/ 12 | data/ 13 | doc/_build 14 | bin/ 15 | 16 | # Compiled Object files 17 | *.slo 18 | *.lo 19 | *.o 20 | # *.obj 21 | *.pyc 22 | 23 | # Precompiled Headers 24 | *.gch 25 | *.pch 26 | 27 | # Compiled Dynamic libraries 28 | *.so 29 | *.so.* 30 | *.dylib 31 | *.dll 32 | 33 | # Fortran module files 34 | *.mod 35 | 36 | # Compiled Static libraries 37 | *.lai 38 | *.la 39 | *.a 40 | *.a.* 41 | *.lib 42 | 43 | # Executables 44 | *.exe 45 | *.out 46 | *.app 47 | -------------------------------------------------------------------------------- /binary_segmentation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(point_cluster) 4 | 5 | find_package(Eigen3 REQUIRED) 6 | find_package(PCL 1.8 REQUIRED) 7 | find_package(OpenCV REQUIRED) 8 | 9 | include_directories(${EIGEN3_INCLUDE_DIRS}) 10 | include_directories(${PCL_INCLUDE_DIRS}) 11 | include_directories(${OpenCV_INCLUDE_DIRS}) 12 | 13 | link_directories(${PCL_LIBRARY_DIRS}) 14 | link_directories(${OpenCV_LIBRARY_DIRS}) 15 | 16 | add_definitions(${PCL_DEFINITIONS}) 17 | 18 | add_executable(point_cluster main.cpp cluster.h cluster.cpp) 19 | # add_executable(point_cluster sc.cpp) 20 | 21 | target_link_libraries(point_cluster ${PCL_LIBRARIES}) 22 | target_link_libraries(point_cluster ${OpenCV_LIBRARIES}) -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentationUI.ui: -------------------------------------------------------------------------------- 1 | 2 | ImageSegmentationUIClass 3 | 4 | 5 | ImageSegmentationUIClass 6 | 7 | 8 | 9 | 0 10 | 0 11 | 600 12 | 400 13 | 14 | 15 | 16 | ImageSegmentationUI 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /binary_segmentation/ImageSegmentationUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "ui_ImageSegmentationUI.h" 5 | #include "ImageSegmentor.h" 6 | 7 | class ImageSegmentationUI : public QMainWindow 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | ImageSegmentationUI(QWidget *parent = Q_NULLPTR); 13 | ImageSegmentor * ist; 14 | 15 | int windowWidth = 1500; 16 | int windowHeight = 900; 17 | int imageWidth = windowWidth / 4 * 3 / 3; 18 | int imageHeight = windowHeight / 4 * 3 / 2; 19 | 20 | int imagePosition[6][2] = {{200,windowHeight / 10},{620,windowHeight / 10},{1040,windowHeight / 10}, 21 | {200,windowHeight / 2 +50},{620,windowHeight / 2 + 50},{1040,windowHeight / 2 + 50} }; 22 | string resultPaths[6] = { "OutputImage\\BasicSegment.jpg" , "OutputImage\\OtsuSegment.jpg" , 23 | "OutputImage\\KmeansSegment.jpg" , "OutputImage\\MaxEntropySegment.jpg" , 24 | "OutputImage\\RegionGrowSegment.jpg" , "OutputImage\\NewMethodSegment.jpg" }; 25 | string resultNames[6] = {"BasicThreshold", "OTSU", "K-means", "MaxEntropy", "RegionGrow", "NewMethod"}; 26 | QLabel *labelImage[6]; 27 | QLabel *labelTxtForImage[6]; 28 | QLabel *labelTxtForInstruction; 29 | //QLabel *labelResult1; 30 | //QLabel *labelTxt1; 31 | //QLabel *labelResult2; 32 | //QLabel *labelTxt2; 33 | //QLabel *labelResult3; 34 | //QLabel *labelTxt3; 35 | //QLabel *labelResult4; 36 | //QLabel *labelTxt4; 37 | //QLabel *labelResult5; 38 | //QLabel *labelTxt5; 39 | 40 | void openAndShowImage(); 41 | void imageSegmenting(); 42 | void showSegImage(); 43 | void changeFilename1(); 44 | void changeFilename2(); 45 | void changeFilename3(); 46 | void changeFilename4(); 47 | void changeFilename5(); 48 | void changeFilename6(); 49 | void paintEvent(QPaintEvent *event); 50 | 51 | private: 52 | Ui::ImageSegmentationUIClass ui; 53 | }; 54 | --------------------------------------------------------------------------------