-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build problem with OpenCV IDF component (IEC-85) #301
Comments
@Ncouch64 the new version of IDF opencv component released. Please take a look. |
Ok, I was able to get the example features2d project to build with 4.7.0~4 - YAY! Now I am running into a separate problem. So creating the project from the example using I (2717) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 I am assuming that I am doing something wrong here. It has been a good few months since I was fully dug in to ESP work so there is likely some processes that I am overlooking. I thank you @igrr & @dmitry1945 for the continued assistance. |
@Ncouch64 let me check... |
@Ncouch64 I've now created a project from |
Hmm, now this is odd. I am pretty sure I am on the latest IDF version, I will check now and make sure. Ill then try and create another project from the example. Is there anything I should be doing outside of creating the project and building it? Edit: Currently on 5.1.2 using VSCode. |
@Ncouch64 just to be sure, did you run And, see you tomorrow. |
You are totally right these are things I should look into tomorrow. Thanks for the continued assistance. I will be going back at the ESP work tomorrow morning so I will test and post my findings here. |
Ok, updated to 5.2 (was previously 5.1.2), running the submodule update in the features2d project doesn't work for me as it says it is not a git repository - this is after creating a brand new project from the features2d example. After attempting to run the example again I finally got an output of detected features! Weirdly enough it is telling me it still cannot locate the source files. For example its saying it cannot open esp_err.h source file (dependency of esp_camera.h). I will try to do some of my own testing using the CV component now that I got an output to see if I can get a simple project to work. Edit: I also want to mention here, I am not sure if its just my IDF or what but if I have the CV component added into the project it takes anywhere from 10-20 minutes just to open the sdk config and to build the project a similar amount of time. Is this expected or have I done something wrong? Also fixed the above paragraph, something happened in the edit that messed it up. |
@dmitry1945 Have you tested the FAST algorithm running this component? I am having an issue where features are not being detected. |
@Ncouch64 no, I'be tested with some default one... What kind of problem do you have with a FAST? |
Its really interesting actually. So if I use for example goodFeaturesToTrack() it is able to detect features in images. If I use Fast() it is never able to detect features in the image. I am not quite sure what the problem is. |
I also did want to throw out another question, would using the findEssentialMat() function and related functions be too intense for an esp chip to handle? I am wondering if there are too many operations to properly run on ESP. Currently when trying to use this function I get this during build: region `dram0_0_seg' overflowed by 465872 bytes. |
@Ncouch64 it's possible to calculate the findEssentialMat(), but for that you will need to make some changes in opencv. And anyway, it will not be very fast. It will be possible with new Espressif chips. |
Do you feel like an S3 would have a better chance at this? I have one of those on the way. Also thank you for the continued assistance with this component. |
So if I could throw out another question as I am trying to understand use of CV on esp, when I see this during my build process |
@Ncouch64 the findEssentialMat() using inside some tables (arrays), that should be located in constant memory (like |
@Ncouch64 please look to the repo from Peter Marcisovsky (I'm not sure if it's open, let me know if not): He did some changes to the opencv for visual odometry. |
The Github seems to be open, I will look through this resource thank you! |
So if I want to use this in an IDF project I know I need to add it as a submodule. Do I need to add something to the Cmakelists? I am not entirely sure how to make sure it builds using this. |
@Ncouch64 just replace the opencv and opencv_contrib with copy from Peter repo. It should work (I'm not sure). Or, just compare opncv code in opencv component folder with code from Peter, and make some changes by hands. |
Understood, thanks for this info. I will be working on testing this out! |
Just tested it out and it seems when I switch the files over to the ones from Peter's repo and then build the project they are replaced again with the files from the component. Is there some way to make it so that this will not be the case? I am assuming on build it is checking for component differences from the server and replacing them, but I do not know this for sure. |
@dmitry1945 I have encountered another problem and I am going to post it here as I am not seeing this anywhere else and am not sure if this has something to do with the component or not. So I am trying to capture an image, perform a simple canny detection on the image and then save it back to the SDCard. I have done this many times before using OpenCV and ESP. However using this component when I initialize the SDCard the camera fails to capture a frame - see output. --- WARNING: GDB cannot open serial ports accessed as COMx SPIWP:0xee Core 1 register dump: A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00060023 Backtrace: 0x42009da5:0x3fcd2a30 0x4037dff5:0x3fcd2bf0 If I comment out the function to initialize the sdcard I do not have this issue and the camera is able to capture the images. I am not sure what I am doing wrong in this situation. I am using the same code I was using when using my own built version of opencv on esp. Is this something that could be caused by this component? I am thinking maybe not but I dont understand why it wouldnt be working here now? In addition to this I am wondering if it is possible to prevent the component files from being overwritten when attempting to build. If I replace something in the OpenCV files as we discussed above it is overwritten during the build process. |
Hi @Ncouch64, If you have your opencv version, which is working, and the problem that it's overwritten, you can do next.
to the
then, you will be able to change the If the problem inside the opencv, then it will solve the problem. |
Ok awesome I appreciate this, I was assuming something like this could be done. The issue with the version of opencv that I was using is that it can only be built using a container of linux with a very specific IDF version and tons of functionality needed to be removed to get it working. It is far too much hassle to use the old opencv build which I why I am very happy now about the cv component. I will spend some time today getting peter's cv files transferred over and test, I spent a great deal of time yesterday trying to trouble shoot the problem with the camera and I really am not sure why it is happening. Like I said it only happens when I initialize the MicroSD card which makes me think that there is some sort of pin assignment problem or something like this but I have already tested this code to ensure it works so I haven't changed anything except using esp32-camera component and opencv components from the idf component manager. Edit: @dmitry1945 have you tested sdcard functionality utilizing this component. I am really scratching my head at the problem. I think I will try making a blank project with only esp32-cam dependency to see if it may be something I am doing incorrectly. I have tested this on 3 different esp32s3 boards and am encountering the same issue. |
@dmitry1945 I have not tested switching of opencv component yet as I am troubleshooting the cam and sd card at the moment. I did just finish putting together a small script to capture a single image and save to an sd_card without the CV component and the problem of camera failing is not occurring here. I will now try and do the most basic script using the CV component such as maybe turning an image to grayscale and try and save it to sd_card. Could this really be something cause by the component? I am trying to think what would cause that and I just cant figure it out. Regardless, I will let you know what happens with my additional test. Hopefully it can maybe help catch a bug? Edit : Just added in the opencv component as a dependency, and without even adding any of the header-files or using anything from the component, I encounter the frame capture failing. |
Wanted to throw another note here, for TermCriteria they use the variable EPS in opencv which is also defined in ESP. I am still working of figuring out the issue with FAST and the MicroSD Card. I think I might have figured out what I did wrong with FAST but I really cannot figure out what is wrong with the microsd. Have you been able to get it working? For something as simple as saving a cv image to the SD? Edit: After all the testing I did I was unable to get any feature detection to work using FAST. I am not sure what the problem is there. It doesnt fail to build or run, but doesnt return any detected features. |
Hi @Ncouch64, I don't know the details of implementation for the FAST. |
Gotcha, I will try and figure it out but I am not really even sure where to begin. Its really strange to me that saving to SD card works fine at any other point but as soon as I add the CV component as a dependency it just fails to write. Not sure why that would be. Ill mess around with it. |
Wanted to include two other issues I discovered. The GaussianBlur function doesn't seem to function (much like FAST) and the OpenCV component doesn't seem to build with IDF optimization settings enabled. I created a separate issue for that problem. |
Answers checklist.
General issue report
Hello! I am reaching out here with a build problem with the OpenCV component mentioned here in this PR: #94. At first I was thinking it was a problem with my idf but I have been able to get projects build with various other components, as soon as I add the OpenCV component as a dependency I get the build failure. This may be something super simple that I am overlooking but after all my searching around I have not been able to find a solution. Thank you for your time!
Edit: Also should probably mention that this is while doing just one of the examples "features2d" that you can find mentioned on the idf component registry here: https://components.espressif.com/components/espressif/opencv.
The build failure I am getting when using the component:
-- Found Git: C:/Users/na258588/.espressif/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/na258588/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/na258588/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/na258588/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32s3
Processing 3 dependencies:
[1/3] espressif/esp32-camera (2.0.6)
[2/3] espressif/opencv (4.7.0~3)
[3/3] idf (5.1.2)
-- Found Git: C:/Users/na258588/.espressif/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
CMake Error at C:/Users/na258588/esp/esp-idf/tools/cmake/component.cmake:224 (message):
CMake Warning (dev) at build_properties.temp.cmake:8:
Syntax Warning in cmake code at column 47
Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
C:/Users/na258588/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:3 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
fatal: not a git repository (or any of the parent directories): .git
CMake Error at
C:/Users/na258588/.espressif/tools/cmake/3.24.0/share/cmake-3.24/Modules/ExternalProject.cmake:1253
(define_property):
define_property command is not scriptable
Call Stack (most recent call first):
C:/Users/na258588/esp/esp-idf/tools/cmake/kconfig.cmake:1 (include)
C:/Users/na258588/esp/esp-idf/tools/cmake/idf.cmake:43 (include)
C:/Users/na258588/esp/esp-idf/tools/cmake/project.cmake:29 (include)
E:/work/Project/features2d/CMakeLists.txt:5 (include)
C:/Users/na258588/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
C:/Users/na258588/esp/esp-idf/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)
Call Stack (most recent call first):
C:/Users/na258588/esp/esp-idf/tools/cmake/build.cmake:574 (__component_get_requirements)
C:/Users/na258588/esp/esp-idf/tools/cmake/project.cmake:547 (idf_build_process)
CMakeLists.txt:6 (project)
-- Configuring incomplete, errors occurred!
See also "E:/work/Project/features2d/build/CMakeFiles/CMakeOutput.log".
The text was updated successfully, but these errors were encountered: