Git Product home page Git Product logo

esp32-opencv's People

Contributors

joachimburket avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-opencv's Issues

Examples for converting between esp32 image formats and opencv Mat

Hi

Fantastic project!

I'm really struggling with performing any opencv operation (such as the canny edge detection in the examples) on the m5stack cameraf - in particular incorporating the operation into the M5CameraExample http-stream at around ln228 after the frame has been successfully grabbed from the camera.

Following the example ttgo code, I am able to get the buffer into the cv::Mat, do the operations but am unsure how to convert the cv::Mat back to a valid camera_fb_t * in order to pass into the handler.

Any pointers would be great!

Operations coverage

Hi, not an issue specifically. Just wanted to get some overview before diving in.

I have an ESP32-S2 and I'd like to use opencv to do simple detection (on-device).

  1. Is this repo working OK overall? Or should I look somewhere else for the moment?
  2. Do you have a list of which OpenCV operations are available for the ESP32?

I am primarily interested in:

Do you think I should be able to get these operations working without too much trouble?

Thank you @joachimBurket for your work!

call of overloaded 'softdouble(int)' is ambiguous

I'm seeing the following error on make that isn't referenced in the docs:

esp32-opencv/modules/core/src/softfloat.cpp:3537:107: error: call of overloaded 'softdouble(int)' is ambiguous
 3537 | static const float64_t exp_prescale = float64_t::fromRaw(0x3ff71547652b82fe) * float64_t(1 << EXPTAB_SCALE);
      |                                                                                                           ^
In file included from esp32-opencv/modules/core/src/softfloat.cpp:68:
esp32-opencv/modules/core/include/opencv2/core/softfloat.hpp:257:14: note: candidate: 'cv::softdouble::softdouble(double)'
  257 |     explicit softdouble( const double a ) { Cv64suf s; s.f = a; v = s.u; }
      |              ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:248:1: note: candidate: 'cv::softdouble::softdouble(int64_t)'
  248 | softdouble::softdouble( const  int64_t a ) { *this =  i64_to_f64(a); }
      | ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:247:1: note: candidate: 'cv::softdouble::softdouble(int32_t)'
  247 | softdouble::softdouble( const  int32_t a ) { *this =  i32_to_f64(a); }
      | ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:246:1: note: candidate: 'cv::softdouble::softdouble(uint64_t)'
  246 | softdouble::softdouble( const uint64_t a ) { *this = ui64_to_f64(a); }
      | ^~~~~~~~~~
esp32-opencv/modules/core/src/softfloat.cpp:245:1: note: candidate: 'cv::softdouble::softdouble(uint32_t)'
  245 | softdouble::softdouble( const uint32_t a ) { *this = ui32_to_f64(a); }
      | ^~~~~~~~~~
In file included from esp32-opencv/modules/core/src/softfloat.cpp:68:
esp32-opencv/modules/core/include/opencv2/core/softfloat.hpp:232:5: note: candidate: 'cv::softdouble::softdouble(const cv::softdouble&)'
  232 |     softdouble( const softdouble& c) { v = c.v; }
      |     ^~~~~~~~~~

Further up in the code it has: #define EXPTAB_SCALE 6 so the complaint seems to be about float64_t(1 << EXPTAB_SCALE) = float64_t(1 << 6) = float64_t(64)?

The definitions all refer to [u]int[size]_t and none for int. I am building this with the xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ compiler. The docs show that it used xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ (the difference being esp-2022r1-11.2.0 vs esp-2019r2-8.2.0).

I don't have the C++ knowledge to formulate a good guess on why this isn't working with the ESP32 build setup vs compiling it for my 64bit Ubuntu machine. Why would the call not be ambiguous in the latter case, but with the ESP32 build it can't decide which method to use?

If I did have to guess I would think there is some difference in how integer types are being handled in the xtensa-esp32-elf/esp-2019r2-8.2.0 compiler vs the xtensa-esp32-elf/esp-2022r1-11.2.0, but I also have no idea how to check that.

[Fix] Enable JPEG support with `-DBUILD_JPEG_TURBO_DISABLE=ON` command

Reason

Opencv use libjpeg-turbo as the default option of jpeg library. However, according to the official page of libjpeg-turbe project,

libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, AVX2, Neon, AltiVec) to accelerate baseline JPEG compression and decompression on x86, x86-64, Arm, and PowerPC systems

The native support for Xtensa platform is not available in libjpeg-turbo, which is why simply enabling -DBUILD_JPEG=ON during compilation may lead to failure

Solution

Use libjpeg instead of libjpeg-turbo. Add -DBUILD_JPEG_TURBO_DISABLE=ON to the cmake command.

Related Links

Have you tested imdecode?

I am reading a JPG image from an SD card and want to use openCV, to create the Mat I need to call imdecode but I am having issues with library:

liblibpng.a(pngerror.c.obj):(.literal.png_free_jmpbuf+0x4): undefined reference to `__wrap_longjmp'

because I am not using png, could there be a way of ignoring that library?

Ninja failed with exited code (1)

hi JoachimBurket, Thank you for your insight and everything usefull library related to openCV. I had followed all oh your instruction but i've always had problem like this
../main/report.cpp: In member function 'void TestCase::executeOn(const imagesList&)':
../main/report.cpp:23:32: error: exception handling disabled, use -fexceptions to enable
} catch(cv::Exception& e) {
^
../main/report.cpp:24:119: error: 'e' was not declared in this scope
cout << "Exception while trying to execute function " << name << " on image " << get<0>(img) << " :\n" << e.msg;
^
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Can you help me abt this?

VERSION of ESP-IDF for example of ttgo demo

Which version of esp-idf do i use for the ttgo demo example to compile seamlessly. I've tried version 5 and there is a lot of component and api related error
also do u have any plan to migrate into the latest stable version of esp-idf?

Thanks.

***ERROR*** A stack overflow in task main has been detected.

hi joachim Burket i want to use opencv library in esp32 but when i compile hello_opencv example i have this problem

entry 0x400806ac
I (27) boot: ESP-IDF v5.0-dev-2332-ge498209ed2 2nd stage bootloader
I (27) boot: compile time 00:34:14
I (27) boot: chip revision: 1
I (31) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00081000 00006000
I (76) boot: 1 phy_init RF data 01 01 00087000 00001000
I (83) boot: 2 factory factory app 00 00 00090000 00177000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 1, min. application chip revision: 0
I (102) esp_image: segment 0: paddr=00090020 vaddr=3f400020 size=3c2b8h (246456) map
I (196) esp_image: segment 1: paddr=000cc2e0 vaddr=3ffb0000 size=03d38h ( 15672) load
I (202) esp_image: segment 2: paddr=000d0020 vaddr=400d0020 size=c3b68h (801640) map
I (479) esp_image: segment 3: paddr=00193b90 vaddr=3ffb3d38 size=0127ch ( 4732) load
I (481) esp_image: segment 4: paddr=00194e14 vaddr=40080000 size=0a150h ( 41296) load
I (501) esp_image: segment 5: paddr=0019ef6c vaddr=50000000 size=00010h ( 16) load
I (507) boot: Loaded app from partition at offset 0x90000
I (507) boot: Disabling RNG early entropy source...
I (521) cpu_start: Pro cpu up.
I (521) cpu_start: Starting app cpu, entry point is 0x40081134
0x40081134: call_start_cpu1 at /home/farhanisixi/esp/esp-idf/components/esp_system/port/cpu_start.c:152

I (508) cpu_start: App cpu up.
I (536) cpu_start: Pro cpu start user code
I (536) cpu_start: cpu freq: 160000000 Hz
I (536) cpu_start: Application information:
I (541) cpu_start: Project name: hello_opencv
I (546) cpu_start: App version: 1
I (550) cpu_start: Compile time: Apr 8 2022 00:34:28
I (557) cpu_start: ELF file SHA256: f13dd3463082c66e...
I (563) cpu_start: ESP-IDF: v5.0-dev-2332-ge498209ed2
I (569) heap_init: Initializing. RAM available for dynamic allocation:
I (576) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (582) heap_init: At 3FFB83B0 len 00027C50 (159 KiB): DRAM
I (589) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (595) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (601) heap_init: At 4008A150 len 00015EB0 (87 KiB): IRAM
I (609) spi_flash: detected chip: generic
I (612) spi_flash: flash io: dio
I (623) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (627) hello_opencv: Starting main

M1 =
[ 0, 0, 255, 0, 0, 255;
0, 0, 255, 0, 0, 255]

M2 =
[ 0, 0, 111, 0, 0, 111;
0, 0, 111, 0, 0, 111]

eye =
[0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0.1, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0.1, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0.1, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0.1, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0.1, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0.1, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0.1, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1]

ones =
[ 3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3;
3, 3, 3, 3]

floats vector =
[3.1415927;
2;
3.01]

Gray matrix =
[ 1, 2, 3, 4, 5;
6, 7, 8, 9, 10;
11, 12, 13, 14, 15]

Thresholded matrix =
[ 0, 0, 0, 0, 0;
0, 0, 255, 255, 255;
255, 255, 255, 255, 255]

Resized matrix =
[ 2, 3, 4, 6;
9, 10, 11, 13]

ERROR A stack overflow in task main has been detected.

Backtrace:0x40081b8a:0x3ffbb7e00x40084c35:0x3ffbb800 0x40087386:0x3ffbb820 0x40086219:0x3ffbb8a0 0x40084d34:0x3ffbb8d0 0x40084ce6:0x00000004 |<-CORRUPTED
0x40081b8a: panic_abort at /home/farhanisixi/esp/esp-idf/components/esp_system/panic.c:409

0x40084c35: esp_system_abort at /home/farhanisixi/esp/esp-idf/components/esp_system/esp_system.c:135

0x40087386: vApplicationStackOverflowHook at /home/farhanisixi/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:378

0x40086219: vTaskSwitchContext at /home/farhanisixi/esp/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:3511

0x40084d34: _frxt_dispatch at /home/farhanisixi/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:433

0x40084ce6: _frxt_int_exit at /home/farhanisixi/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:228

esp32-opencv build error for ESP32S3

Hi, hope you are doing well.

Has anyone tried to build opencv for esp32s3 with the latest toolchain?

I have been able to overcome the softfloat error but am unable to resolve the issues in resize.cpp

'idf.py build' failed with 'ninja: build stopped: subcommand failed'

The esp example like blink or hello_world works fine on my laptop, but when i was trying to run esp32/examples/esp_opencv/tests, i was failed. The error messages are as follows.

dev@Ubuntu:~/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests$ idf.py build
Executing action: all (aliases: build)
Running ninja in directory /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build
Executing "ninja all"...
[0/1] Re-running CMake...
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/sdkconfig
-- App "esp_opencv_tests" version: f485b59-dirty
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/esp-idf/esp32/esp32_out.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp32/ld/esp32.project.ld.in
-- Adding linker script /home/dev/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_local_ctrl esp_netif esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/dev/esp/esp-idf/components/app_trace /home/dev/esp/esp-idf/components/app_update /home/dev/esp/esp-idf/components/asio /home/dev/esp/esp-idf/components/bootloader /home/dev/esp/esp-idf/components/bootloader_support /home/dev/esp/esp-idf/components/bt /home/dev/esp/esp-idf/components/cbor /home/dev/esp/esp-idf/components/cmock /home/dev/esp/esp-idf/components/coap /home/dev/esp/esp-idf/components/console /home/dev/esp/esp-idf/components/cxx /home/dev/esp/esp-idf/components/driver /home/dev/esp/esp-idf/components/efuse /home/dev/esp/esp-idf/components/esp-tls /home/dev/esp/esp-idf/components/esp32 /home/dev/esp/esp-idf/components/esp_adc_cal /home/dev/esp/esp-idf/components/esp_common /home/dev/esp/esp-idf/components/esp_eth /home/dev/esp/esp-idf/components/esp_event /home/dev/esp/esp-idf/components/esp_gdbstub /home/dev/esp/esp-idf/components/esp_hid /home/dev/esp/esp-idf/components/esp_http_client /home/dev/esp/esp-idf/components/esp_http_server /home/dev/esp/esp-idf/components/esp_https_ota /home/dev/esp/esp-idf/components/esp_https_server /home/dev/esp/esp-idf/components/esp_hw_support /home/dev/esp/esp-idf/components/esp_ipc /home/dev/esp/esp-idf/components/esp_local_ctrl /home/dev/esp/esp-idf/components/esp_netif /home/dev/esp/esp-idf/components/esp_pm /home/dev/esp/esp-idf/components/esp_ringbuf /home/dev/esp/esp-idf/components/esp_rom /home/dev/esp/esp-idf/components/esp_serial_slave_link /home/dev/esp/esp-idf/components/esp_system /home/dev/esp/esp-idf/components/esp_timer /home/dev/esp/esp-idf/components/esp_websocket_client /home/dev/esp/esp-idf/components/esp_wifi /home/dev/esp/esp-idf/components/espcoredump /home/dev/esp/esp-idf/components/esptool_py /home/dev/esp/esp-idf/components/expat /home/dev/esp/esp-idf/components/fatfs /home/dev/esp/esp-idf/components/freemodbus /home/dev/esp/esp-idf/components/freertos /home/dev/esp/esp-idf/components/hal /home/dev/esp/esp-idf/components/heap /home/dev/esp/esp-idf/components/idf_test /home/dev/esp/esp-idf/components/jsmn /home/dev/esp/esp-idf/components/json /home/dev/esp/esp-idf/components/libsodium /home/dev/esp/esp-idf/components/log /home/dev/esp/esp-idf/components/lwip /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/main /home/dev/esp/esp-idf/components/mbedtls /home/dev/esp/esp-idf/components/mdns /home/dev/esp/esp-idf/components/mqtt /home/dev/esp/esp-idf/components/newlib /home/dev/esp/esp-idf/components/nghttp /home/dev/esp/esp-idf/components/nvs_flash /home/dev/esp/esp-idf/components/openssl /home/dev/esp/esp-idf/components/partition_table /home/dev/esp/esp-idf/components/perfmon /home/dev/esp/esp-idf/components/protobuf-c /home/dev/esp/esp-idf/components/protocomm /home/dev/esp/esp-idf/components/pthread /home/dev/esp/esp-idf/components/sdmmc /home/dev/esp/esp-idf/components/soc /home/dev/esp/esp-idf/components/spi_flash /home/dev/esp/esp-idf/components/spiffs /home/dev/esp/esp-idf/components/tcp_transport /home/dev/esp/esp-idf/components/tcpip_adapter /home/dev/esp/esp-idf/components/tinyusb /home/dev/esp/esp-idf/components/ulp /home/dev/esp/esp-idf/components/unity /home/dev/esp/esp-idf/components/vfs /home/dev/esp/esp-idf/components/wear_levelling /home/dev/esp/esp-idf/components/wifi_provisioning /home/dev/esp/esp-idf/components/wpa_supplicant /home/dev/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build
[131/980] Performing configure step for 'bootloader'
-- Found Git: /usr/bin/git (found version "2.25.1")
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/dev/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/dev/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/dev/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/dev/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/dev/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/sdkconfig
-- Adding linker script /home/dev/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/dev/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/dev/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/dev/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esptool_py hal log main micro-ecc partition_table soc spi_flash xtensa
-- Component paths: /home/dev/esp/esp-idf/components/bootloader /home/dev/esp/esp-idf/components/bootloader_support /home/dev/esp/esp-idf/components/efuse /home/dev/esp/esp-idf/components/esp32 /home/dev/esp/esp-idf/components/esp_common /home/dev/esp/esp-idf/components/esp_hw_support /home/dev/esp/esp-idf/components/esp_rom /home/dev/esp/esp-idf/components/esptool_py /home/dev/esp/esp-idf/components/hal /home/dev/esp/esp-idf/components/log /home/dev/esp/esp-idf/components/bootloader/subproject/main /home/dev/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/dev/esp/esp-idf/components/partition_table /home/dev/esp/esp-idf/components/soc /home/dev/esp/esp-idf/components/spi_flash /home/dev/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/bootloader
[172/980] Performing build step for 'bootloader'
[1/85] Generating project_elf_src_esp32.c
[2/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[3/85] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[4/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[5/85] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[6/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[7/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[8/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[9/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[10/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/memory_layout_utils.c.obj
[11/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[12/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[13/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[14/85] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[15/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[16/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[17/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_periph.c.obj
[18/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/soc_memory_layout.c.obj
[19/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[20/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sigmadelta_periph.c.obj
[21/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[22/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[23/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[24/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[25/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[26/85] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[27/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[28/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[29/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[30/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash.c.obj
[31/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[32/85] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/esp32/spi_flash_rom_patch.c.obj
[33/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[34/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[35/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[36/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[37/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse_esp32.c.obj
[38/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_qio_mode.c.obj
[39/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash_config_esp32.c.obj
[40/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[41/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[42/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[43/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[44/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[45/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[46/85] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[47/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[48/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[49/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[50/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_fields.c.obj
[51/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_api.c.obj
[52/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/flash_encrypt.c.obj
[53/85] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[54/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[55/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[56/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[57/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[58/85] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_utility.c.obj
[59/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[60/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[61/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_pm.c.obj
[62/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[63/85] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[64/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[65/85] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[66/85] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[67/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[68/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_wdt.c.obj
[69/85] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[70/85] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[71/85] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[72/85] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[73/85] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[74/85] Linking C static library esp-idf/log/liblog.a
[75/85] Linking C static library esp-idf/esp_rom/libesp_rom.a
[76/85] Linking C static library esp-idf/esp_hw_support/libesp_hw_support.a
[77/85] Linking C static library esp-idf/efuse/libefuse.a
[78/85] Linking C static library esp-idf/bootloader_support/libbootloader_support.a
[79/85] Linking C static library esp-idf/spi_flash/libspi_flash.a
[80/85] Linking C static library esp-idf/micro-ecc/libmicro-ecc.a
[81/85] Linking C static library esp-idf/soc/libsoc.a
[82/85] Linking C static library esp-idf/hal/libhal.a
[83/85] Linking C static library esp-idf/main/libmain.a
[84/85] Linking C executable bootloader.elf
[85/85] Generating binary image from built executable
esptool.py v3.1-dev
Generated /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/bootloader/bootloader.bin
[621/980] cd /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/esp-...s on lines above)" /usr/bin/cmake -P /home/dev/esp/esp-idf/tools/cmake/scripts/fail.cmake
FAILED: esp-idf/main/CMakeFiles/spiffs_storage_bin
cd /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/esp-idf/main && /usr/bin/cmake -E echo "Failed to create SPIFFS image for partition 'storage'. " "Check project configuration if using the correct partition table file." && /usr/bin/cmake -E remove /home/dev/esp/esp32_shrunk_opencv/esp32/examples/esp_opencv_tests/build/esp-idf/main/B9YFs.cmake && /usr/bin/cmake -E env "FAIL_MESSAGE=Failing the build (see errors on lines above)" /usr/bin/cmake -P /home/dev/esp/esp-idf/tools/cmake/scripts/fail.cmake
Failed to create SPIFFS image for partition 'storage'. Check project configuration if using the correct partition table file.
CMake Error at /home/dev/esp/esp-idf/tools/cmake/scripts/fail.cmake:3 (message):
Failing the build (see errors on lines above)

[623/980] Building C object esp-idf/esp_serial_slave_link/CMakeFiles/__idf_esp_serial_slave_link.dir/essl_sdio.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1**

Error when using with objdetect module

Hi Joachim,
Thank You very much for this clone. I have successfully compiled it including 'objdetect' module, I just needed to add #pragma GCC optimize ("-O0") fix before virtual void knnSearch in flann/lsh_index.h.

I can compile and flash my project to Esp32-cam (Qr codes recognition), but I'm stuck at boot error. I see your comment in imgwarp.cpp,
// Modif ESP32: allocate buffers on heap. FIXME: changed access from 2 or 3 dimensions to 1 dimension. Need to find usages of these tables to modify access
Can you please point me to right direction? This is the error:

I (29) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (29) boot: compile time 12:46:02
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) qio_mode: Enabling default flash chip QIO
I (45) boot.esp32: SPI Speed      : 80MHz
I (49) boot.esp32: SPI Mode       : QIO
I (54) boot.esp32: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (75) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (82) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (89) boot:  2 factory          factory app      00 00 00010000 00200000
I (97) boot: End of partition table
I (101) boot_comm: chip revision: 1, min. application chip revision: 0
I (108) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=58d60h (363872) map
I (225) esp_image: segment 1: paddr=00068d88 vaddr=3ffb0000 size=07290h ( 29328) load
I (234) esp_image: segment 2: paddr=00070020 vaddr=400d0020 size=13b710h (1292048) map
I (617) esp_image: segment 3: paddr=001ab738 vaddr=3ffb7290 size=024e0h (  9440) load
I (621) esp_image: segment 4: paddr=001adc20 vaddr=40080000 size=12e9ch ( 77468) load
I (650) esp_image: segment 5: paddr=001c0ac4 vaddr=50000000 size=00010h (    16) load
I (661) boot: Loaded app from partition at offset 0x10000
I (662) boot: Disabling RNG early entropy source...
I (673) psram: This chip is ESP32-D0WD
I (674) spiram: Found 64MBit SPI RAM device
I (674) spiram: SPI RAM mode: flash 80m sram 80m
I (679) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (686) cpu_start: Pro cpu up.
I (690) cpu_start: Starting app cpu, entry point is 0x40081694
0x40081694: call_start_cpu1 at /home/jan/esp/esp-idf/components/esp_system/port/cpu_start.c:150

I (682) cpu_start: App cpu up.
I (1187) spiram: SPI SRAM memory test OK
I (1195) cpu_start: Pro cpu start user code
I (1195) cpu_start: cpu freq: 240000000
I (1195) cpu_start: Application information:
I (1198) cpu_start: Project name:     homebox-esp32-cam
I (1204) cpu_start: App version:      v0.1-4-g4d6d526-dirty
I (1210) cpu_start: Compile time:     Jan 31 2022 12:45:55
I (1216) cpu_start: ELF file SHA256:  ff3496a3ec0450c8...
I (1222) cpu_start: ESP-IDF:          v4.3.2-dirty
I (1228) heap_init: Initializing. RAM available for dynamic allocation:
I (1235) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1241) heap_init: At 3FFBDBD8 len 00022428 (137 KiB): DRAM
I (1247) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1254) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1260) heap_init: At 40092E9C len 0000D164 (52 KiB): IRAM
I (1267) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1275) spi_flash: detected chip: generic
I (1279) spi_flash: flash io: qio

abort() was called at PC 0x40104942 on core 0
0x40104942: int abort_return<int>() at /home/jan/esp/esp-idf/components/cxx/cxx_exception_stubs.cpp:28


Backtrace:0x40081b9e:0x3ffe3540 0x4008c885:0x3ffe3560 0x40091cfe:0x3ffe3580 0x40104942:0x3ffe35f0 0x4010496f:0x3ffe3610 0x400f6eb3:0x3ffe3630 0x400e79e6:0x3ffe3650 0x400f701d:0x3ffe3670 0x40147eb2:0x3ffe3690 0x40148e9f:0x3ffe3bd0 0x400d2f87:0x3ffe3bf0 0x400d3199:0x3ffe3c10 0x400818d1:0x3ffe3c50 0x40079579:0x3ffe3c80 |<-CORRUPTED
0x40081b9e: panic_abort at /home/jan/esp/esp-idf/components/esp_system/panic.c:393

0x4008c885: esp_system_abort at /home/jan/esp/esp-idf/components/esp_system/system_api.c:112

0x40091cfe: abort at /home/jan/esp/esp-idf/components/newlib/abort.c:46

0x40104942: int abort_return<int>() at /home/jan/esp/esp-idf/components/cxx/cxx_exception_stubs.cpp:28

0x4010496f: __wrap__Unwind_RaiseException at /home/jan/esp/esp-idf/components/cxx/cxx_exception_stubs.cpp:153

0x400f6eb3: __cxa_throw at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:90

0x400e79e6: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54

0x400f701d: operator new[](unsigned int) at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/new_opv.cc:32

0x40147eb2: cv::initInterTab2D(int, bool) at imgwarp.cpp:?

0x40148e9f: _GLOBAL__sub_I_imgwarp_cpp at imgwarp.cpp:?

0x400d2f87: do_global_ctors at /home/jan/esp/esp-idf/components/esp_system/startup.c:193 (discriminator 3)

0x400d3199: start_cpu0_default at /home/jan/esp/esp-idf/components/esp_system/startup.c:411

0x400818d1: call_start_cpu0 at /home/jan/esp/esp-idf/components/esp_system/port/cpu_start.c:536

adding objdetect for esp32

I'd like to use objdetect, so I tried to add that, however the build fails in a new way, related to insn.
I'm using esp-2021r2-patch3 to overcome #11
Is there a recommended version to build this library?

I also tried esp-2020r3, which had the same failure. I cannot go back any farther as this is the first that supports esp32s3.

in build_opencv_for_esp32.sh :

OPENCV_MODULES_LIST=core,objdetect

output:

[ 50%] Linking CXX static library ../../lib/libopencv_core.a
[ 50%] Built target opencv_core
[ 51%] Processing OpenCL kernels (imgproc)
[ 52%] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/miniflann.cpp.obj
[ 52%] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/flann.cpp.obj
[ 52%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.cpp.obj
[ 52%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.dispatch.cpp.obj
[ 53%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/approx.cpp.obj
[ 53%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/bilateral_filter.dispatch.cpp.obj
[ 54%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/blend.cpp.obj
[ 54%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/box_filter.dispatch.cpp.obj
[ 54%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/canny.cpp.obj
In file included from /Users/mike/work/brew/esp32-opencv/modules/flann/include/opencv2/flann/all_indices.h:44,
from /Users/mike/work/brew/esp32-opencv/modules/flann/src/precomp.hpp:19,
from /Users/mike/work/brew/esp32-opencv/modules/flann/src/miniflann.cpp:1:
/Users/mike/work/brew/esp32-opencv/modules/flann/include/opencv2/flann/lsh_index.h: In member function 'void cvflann::LshIndex::knnSearch(const cvflann::Matrix&, cvflann::Matrix&, cvflann::Matrix&, int, const cvflann::SearchParams&) [with Distance = cvflann::L2]':
/Users/mike/work/brew/esp32-opencv/modules/flann/include/opencv2/flann/lsh_index.h:210:5: error: insn does not satisfy its constraints:
}
^
(insn 667 20 348 62 (set (reg/v:SF 19 f0 [orig:115 result ] [115])
(mem/u/c:SF (symbol_ref/u:SI ("*.LC2851") [flags 0x2]) [0 S4 A32])) "/Users/mike/work/brew/esp32-opencv/modules/flann/include/opencv2/flann/dist.h":158 47 {movsf_internal}
(nil))
during RTL pass: postreload
/Users/mike/work/brew/esp32-opencv/modules/flann/include/opencv2/flann/lsh_index.h:210:5: internal compiler error: in extract_constrain_insn, at recog.c:2210
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See https://gcc.gnu.org/bugs/ for instructions.
make[2]: *** [modules/flann/CMakeFiles/opencv_flann.dir/src/miniflann.cpp.obj] Error 1
make[1]: *** [modules/flann/CMakeFiles/opencv_flann.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Help compiling hello_opencv - dangerous relocation: cannot decode instruction opcode:

Hi there,

Great project!

I'm trying to compile the hello_opencv example for an ESP32-S2 and I'm stuck with the following error and can't seem to find a fix. Just wondering if you have any ideas how to solve it? Seems to be lots of "dangerous relocation" errors.

atmul.dispatch.cpp:(.text._ZN2cv13mulTransposedERKNS_11_InputArrayERKNS_12_OutputArrayEbS2_di+0x2c1): dangerous relocation: cannot decode instruction opcode: (.text._ZN2cv13mulTransposedERKNS_11_InputArrayERKNS_12_OutputArrayEbS2_di+0x2cb) ../main/opencv/libopencv_core.a(matrix_decomp.cpp.obj): in function ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16':
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x20a): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x21a)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x232): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x248)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x3da): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x3e0)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x44d): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x453)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x6b2): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x6c2)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x6da): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x6f6)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x720): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x775)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x9ba): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x97d)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x9f2): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0x9c0)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0xa07): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0xa0d)
matrix_decomp.cpp:(.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0xa1f): dangerous relocation: cannot decode instruction opcode: (.text.ZN2cv3halL6QRImplIfEEiPT_jiiiS3_jS3_S2$constprop$16+0xa25)
../main/opencv/libopencv_core.a(matrix_decomp.cpp.obj): in function cv::hal::LU32f(float*, unsigned int, int, float*, unsigned int, int)': matrix_decomp.cpp:(.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xc1): dangerous relocation: cannot decode instruction opcode: (.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xf0) matrix_decomp.cpp:(.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xd7): dangerous relocation: cannot decode instruction opcode: (.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xe5) matrix_decomp.cpp:(.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xf9): dangerous relocation: cannot decode instruction opcode: (.text._ZN2cv3hal5LU32fEPfjiS1_ji+0xff) matrix_decomp.cpp:(.text._ZN2cv3hal5LU32fEPfjiS1_ji+0x35f): dangerous relocation: cannot decode instruction opcode: (.text._ZN2cv3hal5LU32fEPfjiS1_ji+0x365)

I have only pasted a portion of the output because it is very big, here is the full output https://pastebin.com/4s4drzLd

Thanks

imdecode/imread jpg files

EDIT: I had some trouble reading jpeg files, but I later saw in the cross-compile documentation here that JPEG decoding didn't work at the moment, so you may delete this.

esp32-opencv build failed with error: 'recursive_mutex' in namespace 'std' does not name a type

@joachimBurket I have followed everything as stated in this wikipage here. The configuring and the generation part is fine. When I tried compiling, after making the alloc.cpp fix as stated in the documentation when I proceeded with the build I got the following errors regarding the std::mutex and thread related.

Attaching entire build log.

[  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.obj
[  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.obj
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.obj
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.obj
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzclose.c.obj
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzlib.c.obj
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzread.c.obj
[  4%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzwrite.c.obj
[  4%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inflate.c.obj
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/infback.c.obj
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inftrees.c.obj
[  6%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inffast.c.obj
[  6%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/trees.c.obj
[  7%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/uncompr.c.obj
[  7%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/zutil.c.obj
[  8%] Linking C static library ../lib/libzlib.a
[  8%] Built target zlib
[  8%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/png.c.obj
[  9%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngerror.c.obj
[  9%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngget.c.obj
[ 10%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngmem.c.obj
[ 10%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngpread.c.obj
[ 11%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngread.c.obj
[ 11%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrio.c.obj
[ 11%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrtran.c.obj
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrutil.c.obj
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngset.c.obj
[ 13%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngtrans.c.obj
[ 13%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwio.c.obj
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwrite.c.obj
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwtran.c.obj
[ 15%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwutil.c.obj
[ 15%] Linking C static library ../lib/liblibpng.a
[ 15%] Built target libpng
[ 15%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/alloc.cpp.obj
[ 15%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/assert.cpp.obj
[ 16%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/check_cycles.cpp.obj
[ 16%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/edge.cpp.obj
[ 17%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/execution_engine.cpp.obj
[ 17%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/graph.cpp.obj
[ 18%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_accessor.cpp.obj
[ 18%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor.cpp.obj
[ 19%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor_ref.cpp.obj
[ 19%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor_view.cpp.obj
[ 20%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/metadata.cpp.obj
[ 20%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/metatypes.cpp.obj
[ 20%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/node.cpp.obj
[ 21%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.obj
[ 21%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/search.cpp.obj
[ 22%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/subgraphs.cpp.obj
[ 22%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1f/sources/ade/source/topological_sort.cpp.obj
[ 23%] Linking CXX static library ../lib/libade.a
[ 23%] Built target ade
[ 23%] Built target opencv_videoio_plugins
[ 24%] Processing OpenCL kernels (core)
-- /home/kowshik/Downloads/esp32-opencv-master/build/modules/core/opencl_kernels_core.hpp contains the same content
[ 24%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.obj
In file included from /home/kowshik/Downloads/esp32-opencv-master/modules/core/src/precomp.hpp:49:0,
                 from /home/kowshik/Downloads/esp32-opencv-master/modules/core/src/algorithm.cpp:43:
/home/kowshik/Downloads/esp32-opencv-master/modules/core/include/opencv2/core/utility.hpp:714:14: error: 'recursive_mutex' in namespace 'std' does not name a type
 typedef std::recursive_mutex Mutex;
              ^
/home/kowshik/Downloads/esp32-opencv-master/modules/core/include/opencv2/core/utility.hpp:715:25: error: 'Mutex' is not a member of 'cv'
 typedef std::lock_guard<cv::Mutex> AutoLock;
                         ^
/home/kowshik/Downloads/esp32-opencv-master/modules/core/include/opencv2/core/utility.hpp:715:25: error: 'Mutex' is not a member of 'cv'
/home/kowshik/Downloads/esp32-opencv-master/modules/core/include/opencv2/core/utility.hpp:715:34: error: template argument 1 is invalid
 typedef std::lock_guard<cv::Mutex> AutoLock;
                                  ^
In file included from /home/kowshik/Downloads/esp32-opencv-master/modules/core/src/algorithm.cpp:43:0:
/home/kowshik/Downloads/esp32-opencv-master/modules/core/src/precomp.hpp:365:5: error: 'Mutex' in namespace 'cv' does not name a type
 cv::Mutex& getInitializationMutex();
     ^
cc1plus: warning: unrecognized command line option '-Wno-unnamed-type-template-args'
cc1plus: warning: unrecognized command line option '-Wno-frame-address'
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:103: modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:845: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Please let me know how to fix this? What causes this and I have seen similar error when I tried to build opencv standalone with arm-none-eabi-gcc compiler.

Thanks,
G Kowshik

[Documentation]Add guidance about using this lib with PlatformIO

Reason

Hello, I'm using PlatformIO as my IDE. But I didn't find a guide to use this library in PlatformIO. So I wish to add a guide on getting this library working with PlatformIO.

How to use this lib with PlatformIO

If you are using "espidf" as your framework, you should see "Compiling-esp-idf-project-using-opencv"

If you are using "arduino" as your framework, you should follow the steps below:

  1. copy the pre-built OpenCV library into the lib/ folder in your project.
  2. add a file name "library.json" in lib/opencv folder and and write the content below:
{
    "build":{
        "flags":"-L. -llibade -llibopencv_core -llibopencv_imgcodecs -llibopencv_imgproc -L3rdparty -lliblibpng -llibzlib"
    }
}

your project folder should look like this

├─include
├─lib
│  └─opencv
│      ├─3rdparty
│      ├─opencv2
│      ├─libade.a
│      ├─libopencv_core.a
│      ├─libopencv_imgcodecs.a
│      ├─libopencv_imgproc.a
│      └─library.json
├─src
└─test
  1. include the OpenCV headers needed into your source files. You should include it before include Arduino.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.