Skip to content
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

Implement vflip and mirror for OV cameras #827

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

sebromero
Copy link
Collaborator

This PR adds support for vertical flipping and horizontal mirroring on OV7670 and OV7675. You can test it by calling:

cam.setVerticalFlip(true);
cam.setHorizontalMirror(true);

@sebromero sebromero marked this pull request as ready for review January 12, 2024 20:00
@aliphys
Copy link
Contributor

aliphys commented Jan 17, 2024

When the two lines are included in the sketch, compilation errors occur.

cam.setVerticalFlip(true);
cam.setHorizontalMirror(true);

Compilation error occurs when compiling for Nicla Vision.

:\Users\user\AppData\Local\Temp\arduino\sketches\334D5B34F33FF8D6C860A353CEE525B2\sketch\CameraCaptureRawBytes.ino.cpp.o: In function `loop':
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2024017-13792-tvczgx.wihpc\CameraCaptureRawBytes/CameraCaptureRawBytes.ino:72: undefined reference to `Camera::setVerticalFlip(bool)'
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2024017-13792-tvczgx.wihpc\CameraCaptureRawBytes/CameraCaptureRawBytes.ino:73: undefined reference to `Camera::setHorizontalMirror(bool)'
collect2.exe: error: ld returned 1 exit status

Using library arducam_dvp at version 1.0.0 in folder: D:\Users\user\Documents\Arduino\libraries\arducam_dvp 
Using library Wire in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nicla\4.1.0\libraries\Wire (legacy)
exit status 1

Compilation error: exit status 1

And Giga R1

"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -E -P -x c -DCM4_BINARY_START=0x60000000 -DCM4_BINARY_END=0x60040000 -DCM4_RAM_END=0x60080000 "C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.1.0\\variants\\GIGA/linker_script.ld" -o "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2/linker_script.ld"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" "-LC:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2" -Wl,--gc-sections -w -Wl,--as-needed -DCM4_BINARY_START=0x60000000 -DCM4_BINARY_END=0x60040000 -DCM4_RAM_END=0x60080000 "@C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.1.0\\variants\\GIGA/ldflags.txt" "-TC:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2/linker_script.ld" "-Wl,-Map,C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2/CameraCaptureRawBytes.ino.map" --specs=nosys.specs -o "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2/CameraCaptureRawBytes.ino.elf" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\sketch\\CameraCaptureRawBytes.ino.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\arducam_dvp\\GC2145\\gc2145.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\arducam_dvp\\Himax_HM01B0\\himax.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\arducam_dvp\\Himax_HM0360\\hm0360.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\arducam_dvp\\OV7670\\ov7670.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\arducam_dvp\\arducam_dvp.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\core\\pure_analog_pins.cpp.o" "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2\\core\\variant.cpp.o" -Wl,--whole-archive "C:\\Users\\user\\AppData\\Local\\Temp\\arduino\\sketches\\334D5B34F33FF8D6C860A353CEE525B2/..\\..\\cores\\arduino_mbed_giga_giga_split_100_0,target_core_cm7_f2191a3dd3ab0896ed020ac7d65676e2\\core.a" "C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.1.0\\variants\\GIGA/libs/libmbed.a" -Wl,--no-whole-archive -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
C:\Users\user\AppData\Local\Temp\arduino\sketches\334D5B34F33FF8D6C860A353CEE525B2\sketch\CameraCaptureRawBytes.ino.cpp.o: In function `setup':
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2024017-13792-tvczgx.wihpc\CameraCaptureRawBytes/CameraCaptureRawBytes.ino:53: undefined reference to `Camera::setVerticalFlip(bool)'
C:\Users\user\AppData\Local\Temp\.arduinoIDE-unsaved2024017-13792-tvczgx.wihpc\CameraCaptureRawBytes/CameraCaptureRawBytes.ino:54: undefined reference to `Camera::setHorizontalMirror(bool)'
collect2.exe: error: ld returned 1 exit status

Using library arducam_dvp at version 1.0.0 in folder: D:\Users\user\Documents\Arduino\libraries\arducam_dvp 
Using library Wire in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.0\libraries\Wire (legacy)
exit status 1

Compilation error: exit status 1

The modified OV7670.cpp file is as follows. mbed core on 4.1.0 staging used
bild


No compilation errors occur when the modified ov7670.cpp in this PR is used without calling the two methods.

@sebromero
Copy link
Collaborator Author

@aliphys The idea is to use the sketch from our core, not the one from the Arducam library.

@sebromero
Copy link
Collaborator Author

I just got confirmation from @karlsoderby that this works. Will merge it now.

@sebromero sebromero merged commit 5af0bd7 into arduino:main Jan 18, 2024
21 checks passed
@sebromero sebromero deleted the sebromero/ov-flip-mirror branch January 18, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants