-
Notifications
You must be signed in to change notification settings - Fork 1
LBP and SURF (python version)
Alexandre Yuji Kajihara edited this page Jan 25, 2024
·
3 revisions
The extract features using LBP or SURF require the installation of OpenCV.
$ git clone https://github.com/opencv/opencv.git -b 4.8.0 --single-branch
$ git clone https://github.com/opencv/opencv_contrib.git -b 4.8.0 --single-branch
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D OPENCV_EXTRA_MODULES_PATH=/home/xandao/opencv/opencv_contrib/modules \
-D PYTHON3_EXECUTABLE=*/bin/python3.11 \
-D PYTHON3_LIBRARY=*/lib/libpython3.11 \
-D PYTHON3_INCLUDE_DIR=*/include/python3.11 \
-D PYTHON3_PACKAGES_PATH=*/lib/python3.11/site-packages \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D BUILD_EXAMPLES=OFF ..
$ make -j$(nproc) && sudo make install
- Replace the asterisk with the local installation of Miniconda. Source: https://stackoverflow.com/a/76843529
The images must be in grayscale mode to run this code.
- Clone this repository;
$ git clone https://github.com/xaaaandao/piperaceae-features
- Access the repository in the terminal;
$ cd pipearceae-features
- Next, it shows an example of how to run a code.
$ python surf_lbp.py -i /home/xandao/pr_dataset/GRAYSCALE/specific_epithet_trusted/256/20 --contrast 2
- The list below contains the arguments available.
Usage: surf_lbp.py [OPTIONS]
Options:
-c, --contrast FLOAT Value that to use in adjusting the contrast.
-i, --input PATH Path to images. [required]
-o, --output PATH Path to store the text and CSV files.
--help Show this message and exit.
- Clone this repository;
$ git clone https://github.com/xaaaandao/piperaceae-features
- Open a project;
- Set the folder that contains the image and other arguments;
- To run, press SHIFT+F10 (or run button).
- This program will create a folder called lbp or surf (depending on user choice).
-
lbp
-
lbp.txt
- Each line contains 59 columns.
- The last column represents the class.
-
info_lbp.csv
,info_levels.csv
,info_sample.csv
-
-
surf
-
surf.txt
- Each line contains 128 columns.
- The last column represents the class.
-
info_surf.csv
,info_levels.csv
,info_samples.csv
-
-
info_levels.csv
andinfo_samples.csv
are files equal between three folders.- It is created for each folder to facilitate the next step (identification).
- This link contains the mean of each row.
-