Commit Graph

1681 Commits

Author SHA1 Message Date
iabdalkader
aca7b9e8a8 Move the USB voltage level detector after all init code. 2018-03-12 16:45:03 +02:00
iabdalkader
85f06771d3 Include legacy header 2018-03-12 16:42:50 +02:00
iabdalkader
6a303f3d94 Update H7 legacy header. 2018-03-12 16:42:33 +02:00
iabdalkader
0d59d7584e Disable SRAM1/2/3 in bootloader.
* Not actually used
2018-03-12 16:39:19 +02:00
iabdalkader
793c451437 Add Makefile targets using dfu-util. 2018-03-12 16:38:22 +02:00
Ibrahim Abd Elkader
0a5146e393
Merge pull request #322 from kwagyeman/master
Upgrade Drawing Features
2018-03-12 16:38:24 +02:00
Kwabena W. Agyeman
0d63aa52df Fix minor numerical issues.
Couldn't sleep. Needed to make sure this got fixed.

On a side note. We should use a better font. It doesn't really scale
well. Not going to fix now.
2018-03-12 08:51:56 -04:00
Kwabena W. Agyeman
fc74e70c32 Upgrade Drawing Features
Heavily upgraded the drawing features onboard the OpenMV Cam. We now
have all the basic drawing methods folks expect along with all the
parameters you need. Finally! You can make big text fonts.

* Added line thickness support
* Added shape fills
* Added text scaling
* Added draw arrow.
2018-03-12 01:14:03 -04:00
iabdalkader
f27f94b76d Define new memory regions. 2018-03-12 02:40:17 +02:00
iabdalkader
6880482afd Enable D2 SRAM1/2/3 clocks. 2018-03-12 01:36:45 +02:00
iabdalkader
50d27dacee Enable USB clock during sleep. 2018-03-12 01:35:50 +02:00
iabdalkader
6339815ae3 Comment SDMMC definition. 2018-03-10 22:51:33 +02:00
iabdalkader
99dc3365b6 Update H7 CMSIS headers. 2018-03-10 20:17:36 +02:00
iabdalkader
453b41a6ec Update to latest MP. 2018-03-10 20:14:49 +02:00
iabdalkader
2f9da92e12 Fix H7 HSE_VALUE. 2018-03-10 18:58:14 +02:00
iabdalkader
4af7bb4b57 Update H7 ST HAL. 2018-03-10 17:30:03 +02:00
iabdalkader
93ba0a51bb Update to MP 1.9.3 2018-03-09 20:22:29 +02:00
iabdalkader
92b617877c Move USB headers to usbdev to avoid including MP USB headers. 2018-03-09 20:21:18 +02:00
iabdalkader
68e761d55a Fix typo in comment. 2018-03-05 19:18:45 +02:00
Kwabena W. Agyeman
e0e112468e Argument Parsing Done Correctly
All of our argument parsing code has now been updated to handle
positional as well as keyword arguments in our python libraries.

Basically, python allows you to pass some number of positional arguments
to functions/methods followed by keyword arguments (you cannot have more
positional arguments after keyword arguments). Previously, our code
would only look for keyword arguments. Now, it works better and will
grab as many positional arguments as it can followed by processing
keyword arguments. Note: If the case of a positional argument value for
a parameter being passed followed by a keyword for that same parameter
the keyword value is taken (since it comes aftward).

Because arguments were passed in keyword form before this update has no
affect on current code. However, moving forward, argument positions are
now locked and cannot be moved around.
2018-03-05 00:49:36 -05:00
iabdalkader
75d89f7172 Add CMSIS CNN. 2018-03-05 03:10:10 +02:00
iabdalkader
28cc88845c Fix system init. 2018-03-04 17:18:14 +02:00
iabdalkader
11040db094 Update imlib_image_mean to handle RGB images. 2018-03-04 03:29:11 +02:00
iabdalkader
789496e13a Fix OMV2 imlib_config.h 2018-03-04 01:31:06 +02:00
iabdalkader
c0efb0884a Revert c1e5daf6fd.
* FPU_USED is already defined.
2018-03-04 01:08:17 +02:00
iabdalkader
c1e5daf6fd Add FPU_USED to CFLAGS. 2018-03-04 01:07:19 +02:00
iabdalkader
1c91b1dcb1 Update SystemInit. 2018-03-04 01:06:31 +02:00
iabdalkader
bc3807ed30 Fix py_cpufreq. 2018-03-03 22:58:12 +02:00
iabdalkader
de1c6427a6 Wait for PWR_FLAG_VOSRDY 2018-03-02 17:38:35 +02:00
iabdalkader
659abe0225 Clean up system clockconfig function. 2018-03-02 17:37:03 +02:00
iabdalkader
e028215be5 Remove unused functions in system.c 2018-03-02 17:32:00 +02:00
Kwabena W. Agyeman
397abe4746 Cleanup Math Operations
Add binary image support to the math operations and updated them to
support masks. Replace now also support mirroring operations. Finally,
adding missing basic math ops like add/sub/mul/div. The operations are
designed to work as image blending operations so they take care of
scaling their output accordingly.
2018-02-25 22:03:31 -05:00
Kwabena W. Agyeman
fb3d0776f0 Overhaul Binary Functions
Binary() can noew zero things so you can remove bright lights. All the
line ops (and/or/xor/etc) accept masks. Erode and dilate now accept
masks. And finally, you can now pass arguments versus keywords for folks
who don't read the documentation. Also, the binary image type is now
supported for these methods.

I'm putting in all this work because I saw the need for it when I was
doing shadow removal.

Note: Some effort needs to be put into optimizing the py_image.c code
soon. This is on the todo list before the next release.
2018-02-25 00:15:02 -05:00
Kwabena W. Agyeman
646425b2a6 Add color thresholding support to get_histogram/stats.
You can now pass a color threshold list to get histogram and get stats
(along with an invert arg) to control what gets put into the histogram.
2018-02-21 01:27:13 -05:00
iabdalkader
5027e0162e Protect VCP buffer pointer with atomic section.
* Fix issue #313
2018-02-17 00:22:21 +02:00
iabdalkader
7c6ee56862 Move wifi driver to separate files.
* This will enable using wifi from C code.
2018-02-12 23:53:43 +02:00
iabdalkader
eaaf391ec8 Enable threading. 2018-02-12 23:53:00 +02:00
Ibrahim Abd Elkader
43a17f2890
Merge pull request #312 from kwagyeman/wifi_dbg
Add wifi_dbg stub.
2018-02-12 22:21:42 +02:00
iabdalkader
ff75b760f7 Update MP docs. 2018-02-12 00:41:26 +02:00
Kwabena W. Agyeman
11983a0228 Add wifi_dbg stub.
All the notes about how to implement wifi programming are in the code.
Steps:

1. Get wifi_apply_settings() working first and make sure you can turn
the wifi shield on in the right mode. Then add the necessary hooks into
the network code to make it such that previous user wifi code still
works. Also, make sure to handle start and shutdown gracefully.

Basically, get all the lifecycle code working first before moving to the
next step so notning gets in a weird state and bugs creep in...

2. Get the beacon method working. Once this works OpenMV IDE should see
the camera when you hit the connect button.

3. Do the code to turn off the regular usbdbg interface and swtich to
having the data come from wifi_dbg. This isn't a lot of code... but,
will be tricky since you no longer will have USB frames to work with.
All bytes are just going to come randomly and in bursts so you have to
handle the serial stream yourself... (Kwabena can help writing a
statemachine for dealing with this type of stuff if you want. I do it
all the time).
2018-02-08 01:49:29 -05:00
iabdalkader
7ef6bf0e5c Disable unused functions in imlib_config. 2018-02-06 02:26:09 +02:00
iabdalkader
333e5417b1 Disable qrcodes if not used. 2018-02-06 02:17:46 +02:00
iabdalkader
291b06db13 Disable find_rects if not used. 2018-02-06 02:17:01 +02:00
iabdalkader
45dd265d51 Update imlib config. 2018-02-06 02:11:11 +02:00
iabdalkader
9a2bf08c50 Move line functions to line.c 2018-02-06 02:07:36 +02:00
iabdalkader
3010a47930 Disable imlib similarity if not used. 2018-02-05 02:17:48 +02:00
iabdalkader
6d396b809a Enable auto dependency generation. 2018-02-04 18:31:39 +02:00
iabdalkader
2f6c18d286 Update imlib config files. 2018-02-04 16:19:21 +02:00
iabdalkader
581e1ab2d2 Disable rotation correction if not used. 2018-02-04 16:14:04 +02:00
iabdalkader
1935c34f4f Disable phase corr if not used. 2018-02-04 16:08:20 +02:00
iabdalkader
7cb0133bc9 Disable logpolar if not used 2018-02-04 16:01:39 +02:00
iabdalkader
ba2539f09e Add imlib macros to shadow removal. 2018-02-02 16:44:41 +02:00
iabdalkader
45dba499ad Add missing imlib macro. 2018-02-02 16:41:24 +02:00
iabdalkader
c8741f5cc1 Rename OMV_ENABLE to IMLIB_ENABLE. 2018-02-02 01:35:13 +02:00
iabdalkader
5e47520a48 Add imlib config file. 2018-02-02 01:26:21 +02:00
Kwabena W. Agyeman
5377f6f575 Add single image shadow remover code.
Calling remove_shadows() on an image without a background source of
truth image now works. However, that said, the shadow remover isn't
suitable for anything other than removing shadow on an image of concrete
flow or somthing of the like. In general, it can only remove shadows
from a scene that has nothing else in it except for a hard edge shadow.

Improving this to work for anything is about a month of work. I've
researched enough about shadow removal to now know the optimal way to do
it. However, it requires many steps and a large amount of RAM. On the H7
I may revist this as being possible.

...

In order to get the shadow remover working well I had to add a few
features to the image library and fix some of the convolution code.
These fixes will likely be more useful than the shadow removal code.

Note the addition of the new get_threshold() method. This computes
otsu's threshold on a histogram allowing you to pick the optimal color
bounds.
2018-01-28 19:33:04 -05:00
iabdalkader
f608150b02 Bump firmware version. 2018-01-24 15:05:04 +02:00
iabdalkader
a245e5fb14 Update OMV2 stack and heap 2018-01-24 14:51:32 +02:00
Kwabena W. Agyeman
e0ef7d5bcc Add more ifdefs to remove OpenMV Cam M4 features since we're flash
exhausted.
2018-01-24 01:33:45 -05:00
Kwabena W. Agyeman
bfcdcd4793 Add REPL Uart Ini File Setting Support
OpenMV IDE includes an ini file generator which will let you set board
settings easily from the IDE. Currently, the IDE has support for setting
the WiFi shield up along with adding a REPL Uart.

Anyway, this commit adds support for the OpenMV Cam to parse an ini file
on startup to configure things before starting main.py. WiFi support is
not yet implmented. However, we now have the ability to turn the UART
and put the REPL terminal on it on startup given a setting in the ini
file.

(Why not use boot.py like normal MP? While that is more flxible it's
much harder for the IDE to easily write out settings for you which is
what most users will want to do versus coding this up).

...

The movitation for adding REPL UART support in particular is so that the
OpenMV Cam can be used as a slave processor to IoT type processors like
the ESP32/ESP8266/ParticlePhoton/ElectricImp. In particular, a processor
like the ParticlePhoton can control the OpenMV Cam's reset wire. Wake
the camera up by releasing reset, then send a script to it after it
powers on over the UART. The camera will then run the script, do
computer vision, and report results back over the UART to the
ParticlePhoton. Users can then push new scripts to the OpenMV Cam from
the cloud allowing for semi-flexible firmware fixes for the OpenMV Cam
over low data rate networks.

By setting this feature up the need for OpenMV to offer a WiFi IoT
system is reduced as we can now just be the best camera for everything.

...

Due to... I don't know... ctrl-c doesn't work on the duplicated UART.

https://github.com/micropython/micropython/issues/1568

Not sure how to handle this. I don't want to fix it since it needs to be
fixed by MP upstream. Right now the work around is for the mastering MCU
to just reset the OpenMV Cam when it's done with the system.

That said, this does mean that once you start a script using the Open
Terminal command line system you won't be able to stop the script.
2018-01-23 00:22:23 -05:00
Kwabena W. Agyeman
fc9c416a21 Frame Differencing with Shadow Removal
Add in support for shadow removal from the current image using a shadow
free background image. Test results show the algorithm works similar to
max() while still keeping dark objects around. The preformance impact of
the algorithm is not too high. An in memory example can achieve 30 FPS.
2018-01-21 16:41:04 -05:00
Kwabena W. Agyeman
38f2c41877 Add pixel and area threshold settings to get_regression()
You can now make it not return anything for images with a low pixel
count.
2018-01-20 01:57:17 -05:00
Kwabena W. Agyeman
432b39bc17 Add min()/max() for frame differencing.
These have cool ghost image like affects and are useful for frame
differencing.
2018-01-17 02:13:55 -05:00
iabdalkader
abf836519f Support bayer pixel access. 2018-01-16 22:59:01 +02:00
Ibrahim Abd Elkader
633be51050
Merge pull request #304 from kwagyeman/better_phase_correlation
Phase Corr Redo 2
2018-01-16 12:38:42 +02:00
Kwabena W. Agyeman
c78f91b421 Phase Corr Redo 2
Redid the phase correlation code again so it's one method call now. This
method call can either do logpolar phase correlation to get rotation/
scale or translation(x/y). Additionally, it will be able to also do both
at once. However, I don't have that quite working yet.

I've updated the example scripts to reflect the new code too.

Finally, I had to fix a bug in the rotation correction code.

...

Once I've got the full pipeline working I will post scripts for that. I
have all the code in there and it's been somewhat debugged... However, I
can't get a useful phase correlation lock out of the log polar fft mag.
I plan to look into noise filtering and spectral whitening solutions for
this.
2018-01-15 23:29:04 -05:00
Kwabena W. Agyeman
9eba59c6c1 Update to full invariant image.
This commit updates the shadow free invariant image to 2 colors from
just grayscale.

If we need to save ROM room in the future we'll just disable the LUT and
have the algorithm run with the regular C code. Right now this is not an
issue.
2018-01-14 20:05:49 -05:00
iabdalkader
09c38e7c31 Fix find_template bug. 2018-01-13 19:08:35 +02:00
iabdalkader
4d09a13f30 Use ROI for lenet. 2018-01-12 01:23:03 +02:00
Kwabena W. Agyeman
3da3c60e12 Fixed bugs with logpolar/linpolar.
Images look great now.
2018-01-09 01:25:10 -05:00
Kwabena W. Agyeman
7516d7699f Add Advanced Optical Flow scripts
Someone asked me about doing a field of receptors before. These scripts
show how to do that. Also, added example scripts for calling the linear
polar and log polar methods added previously which power
find_rotscale().
2018-01-08 00:10:55 -05:00
Kwabena W. Agyeman
213396d090 Complete Overhaul of phasecorrelation
Just doing one big commit/PR here since I noticed that breaking it up
causes issues.

Anyway, these fixes give us GOOD/WORKING/FAST optical flow now on the
OpenMV Cam M7. A number of changes were made to the optical flow
scripts. You have have absolute and differential estimation example
scripts. Additionally, you also have the ability to measure rotation and
scale changes too. Linear/Log Polar conversion was added for this. Users
may use the new code for generic image manipulation too. Finally, I
updated the power of 2 resolutions since you actually HAVE to use them
with optical flow for the phasecorrelation code to work correctly.

I have some more advanced scripts coming after this. But, This commit is
already getting kinda large so I'm stopping it here.
2018-01-07 17:48:07 -05:00
Ibrahim Abd Elkader
075cfbc0de
Merge pull request #298 from kwagyeman/sensor_fixes
Update invariant table.
2018-01-06 18:42:35 +02:00
Kwabena W. Agyeman
edffa55873 Update invariant table.
Boosted gain by 3X.
2018-01-06 11:07:16 -05:00
iabdalkader
e3872b4c22 Increase gethostbyname timeout. 2018-01-06 00:12:00 +02:00
Kwabena W. Agyeman
30ecbdc4f8 Add white balance control.
You can now get white balance gains from the camera chip and set the
camera to then use these gains again in a new enviorment.
2017-12-31 19:56:02 -05:00
Kwabena W. Agyeman
1cf5211efb Fix bugs with sensor auto gain control. 2017-12-31 17:28:27 -05:00
iabdalkader
b1e84d9955 Fix formatting. 2017-12-31 16:12:17 +02:00
Kwabena W. Agyeman
139cdbdbc9 Add auto gain control ceiling value to be settable by the auto gain
method.

Things are in dB now too. Need to remove the previous settable method.
2017-12-30 23:54:19 -05:00
Kwabena W. Agyeman
aeb0238040 Added hmirror and vflip support to the MT9V034 and example scripts (#294)
* Added hmirror and vflip support to the MT9V034 and example scripts.

* Moved sensor example scripts to one place.

* Add delay to these script for register settling time.
2017-12-31 00:32:01 +02:00
Kwabena W. Agyeman
b906c5f192 Add auto gain control setting support (#293)
You can now get the auto gain setting in dBs and set the value in dBs.
Example scripts are included. Code was tested on the OV7725.
2017-12-30 23:18:35 +02:00
Kwabena W. Agyeman
7be0a7a182 Add exposure control for all sensors (#292)
* Textual register cleanup.

No functional changes.

* Add exposure control support.

You can now set the exposure for the camera in microseconds (versus an
opaque unknown value previously). First, we have a new method called
get_exposure_us() which will get the expsoure time in microseconds. This
let's you determine what the auto exposure algorithm set the exposure
time to. Second, the previously implmented set_auto_exposure() method
which allows you to turn aec off and on accepts a exposure_us keyword
argument when you turn aec off to manually control the exposure.

The next commit will add support for other sensor types.

* Cleanup register formatting.

No functional changes.

* Add exposure control support for the OV2640.

Register access for this chip is a PITA.

* Formatting Cleanup.

No functional changes.

* Add exposure control for ov9650.

Just doing it for all sensors.

* Add missing 2 factor.

* Added exposure control for the MT9V034.

* Add exposure control example.

Works well on the OV7725.
2017-12-30 15:56:11 +02:00
Kwabena W. Agyeman
cbbead0785 Add adaptive thresholding to filters.
I still need to go back and optimizing and cleanup the code. I just
wanted to get the feature in first.
2017-12-27 19:23:48 -05:00
iabdalkader
7cec96a9db Fix H7 build. 2017-12-28 01:04:51 +02:00
Ibrahim Abd Elkader
ece149d8d2
Merge pull request #288 from kwagyeman/sensor_fb_fix
Restore MAIN_FB() size on snapshot()
2017-12-26 21:24:00 +02:00
Ibrahim Abd Elkader
d5721a4f39
Merge pull request #289 from kwagyeman/histeq_update
Refactor histeq()
2017-12-26 13:48:10 +02:00
Kwabena W. Agyeman
dcc31ec37d Refactor histeq()
Just updating the code with the same style as other methods. I have
another new sister method for histeq() comming up next which I'll push
as soon as this PR is done. Didn't want to merge the two into one PR.
2017-12-26 00:02:51 -05:00
Kwabena W. Agyeman
046a2e1825 Restore MAIN_FB() size on snapshot()
This fix allows "copy_to_fb" with a different resolution than the
current frame buffer to work. It also allows the frame buffer to be
resized, etc. In particular, the pooling methods I added for optical
flow work again... you'll also be able to scale the frame buffer too.
2017-12-25 18:00:58 -05:00
Ibrahim Abd Elkader
e0fc302dda
Merge pull request #287 from kwagyeman/compare_methods
Add extra frame buffer.
2017-12-25 19:14:47 +02:00
Kwabena W. Agyeman
27f5110ab7 Add extra frame buffer.
You can now allocate an extra frame buffer for storing images. However,
this takes memory from the main frame buffer. In particular this reduces
the RAM for many methods that do image processing making memory errors
more likely to happen. Note that you may allocate as many extra fb's as
you like. Dealloc happens in reverse order.

Anyway, you can use this method to now storage things like difference
images in RAM allowing for MUCH faster frame difference image
processing.

Moving on, to keep memory management sane... the second fb looks just
like an image and you can use all the image methods to load and update
it, etc. That said, if users deallocate the second FB they need to *NOT*
use the image pointer anymore. There's no way for me to delete the image
pointer in python right now so this is just something that has to be
manually managed (even if I did setup a deconstructor the second FB is
on a stack... so, things wouldn't work so easily with that).
2017-12-24 22:40:26 -05:00
iabdalkader
e1fa2371bb Add missing H7 flash constants. 2017-12-24 22:14:02 +02:00
iabdalkader
a9c8cdb752 Update system.c to support H7. 2017-12-24 22:13:38 +02:00
iabdalkader
f8ba3e4e10 Use MCU_SERIES 2017-12-24 22:11:57 +02:00
iabdalkader
04ce644f55 Add H7 headers and startup. 2017-12-24 22:10:30 +02:00
iabdalkader
a51e0de410 Copy USB code to bootloader.
* The bootloader will be more self-contained.
2017-12-24 21:24:25 +02:00
iabdalkader
e0779b685c Add H7 HAL 2017-12-24 21:23:01 +02:00
iabdalkader
ed761075e4 Update OMV4 board files. 2017-12-24 21:07:50 +02:00
Ibrahim Abd Elkader
6753b93842
Merge pull request #286 from kwagyeman/compare_methods
Add a LUT for illuminvar()
2017-12-24 17:24:31 +02:00
iabdalkader
9cb0ca0b9a Add no-strict-aliasing to STHAL CFLAGS. 2017-12-24 17:21:08 +02:00
Kwabena W. Agyeman
f2c36e780a Add a LUT for illuminvar()
It's now faster to be more useful.

Need to work on HDR for the sensor and making the sensor output better.
I fixed some issues with the illuminvar() method going crazy when it
gets colors with values near 0... but, the shot noise from the sensor
adds a lot of noise to everything. Fixing this will likely solve a lot
of algorithm problems.
2017-12-23 21:16:55 -05:00
Ibrahim Abd Elkader
7346efbf0d
Merge pull request #285 from kwagyeman/compare_methods
Compare methods
2017-12-23 22:22:22 +02:00
Kwabena W. Agyeman
e2025e8d1e SSIM Code
Image comparison using SSIM. It can be used to detect image
differences... but, the algorithm was designed to compare image quality
and look at compression artifacts. Anyway, it works kinda okay for
detecting frame differences.
2017-12-23 15:01:13 -05:00
Kwabena W. Agyeman
e5eb7185fb Line ops can now accept a parameter value. 2017-12-21 22:22:12 -05:00
iabdalkader
f2431de175 Add a list of matching keypoints to keypoints match object. 2017-12-21 21:07:01 +02:00
iabdalkader
eabdcbbbca Add unary_op and subscr to keypoints object. 2017-12-21 19:53:20 +02:00
iabdalkader
ed7cb98b86 Fix bootloader linker script. 2017-12-18 23:38:23 +02:00
Ibrahim Abd Elkader
9b652606dd
Merge pull request #284 from kwagyeman/illuminvar
Add chrominace and illuminace invariant image generators.
2017-12-18 15:36:35 +02:00
Kwabena W. Agyeman
937aa1fa22 Add chrominace and illuminace invariant image generators.
Both algorithms were tested on the OpenMV Cam using images loaded from a
file and work correctly. However, shot noise from the sensor.snapshot()
makes the output value somewhat worthless except in a situation unless
you've controlled for it. Anyway, the illuminvar work best when the
image is constrained to a very particular view point looking at a flat
scene without shadow and then a shadow enters.

(Not adding demo's for these methods since the output looks like crap
unless you've put some work into constraining the scene... need to add
HDR code and other stuff to the sensor module to get better images).
2017-12-17 21:57:08 -05:00
iabdalkader
dca8f3781d Fix low-power modes. 2017-12-17 01:58:37 +02:00
iabdalkader
2fb155aff3 Update docs. 2017-12-10 04:34:51 +02:00
Ibrahim Abd Elkader
f77284e38a
Merge pull request #283 from falkoschindler/master
changing sign of z_rotation() to follow conventions of a right-handed coordinate system...
2017-12-07 11:26:40 +02:00
iabdalkader
9cc209d128 Add WINC BSP mode.
* For programming FW via WINC's debug UART.
2017-12-06 20:33:26 +02:00
iabdalkader
fcc3b0b9c6 Make WINC programmer accept firmware file path. 2017-12-06 17:08:45 +02:00
iabdalkader
475c083c75 Move ffs_strerror declaration to header. 2017-12-06 16:44:57 +02:00
iabdalkader
278fb1c797 Update docs. 2017-12-06 15:30:30 +02:00
iabdalkader
64c2d1a535 Revert "Update docs."
This reverts commit 3eca75774f.
2017-12-06 15:29:23 +02:00
iabdalkader
3eca75774f Update docs. 2017-12-06 14:12:16 +02:00
Falko Schindler
7673aaf742 changing sign of z_rotation() to follow conventions of a right-handed coordinate system with yaw, pitch and roll defined as right-handed rotations about z-, y- and x-axis (http://nghiaho.com/?page_id=846, http://planning.cs.uiuc.edu/node102.html);
partly reverts pull request #200 (https://github.com/openmv/openmv/pull/200/files);
relates to discussion in openmv forum (http://forums.openmv.io/viewtopic.php?f=6&t=538);
note that rotation() is probably effected by this change (but it should not!)
2017-12-06 09:11:52 +01:00
iabdalkader
f79c6ba8d2 Move linker script variables to board config files. 2017-12-04 20:43:49 +02:00
iabdalkader
606cb08d1e Update docs 2017-12-01 13:54:52 +02:00
Kwabena W. Agyeman
7388a3c7be Improved the performance of the get_regression() robust linear
regression code for racing.

No more memcpys all over the place. Not sure why I was doing that.

... code must have been written by an idiot before :) (me).
2017-11-18 22:27:17 -08:00
iabdalkader
a8f74d5f88 Move WINC1500 firmware to top firmware dir. 2017-11-17 15:53:20 +02:00
iabdalkader
7a33f94df9 Bump firmware version. 2017-11-04 18:13:32 +02:00
iabdalkader
b6608cc754 Fix servo pins. 2017-11-01 19:07:29 +02:00
Kwabena W. Agyeman
8d63f6d84b Fix up lens_correction and add example script. 2017-10-28 00:31:01 -04:00
Kwabena W. Agyeman
5e3cf92ac4 Add perspective rotation correction code.
This code will help you undo image rotation issues in the X/Y/Z
direction. The demo shows off the frame buffer spinning around.
2017-10-27 01:21:13 -04:00
iabdalkader
8160e9120e Add MT9V034 initial support. 2017-10-24 03:07:17 +02:00
iabdalkader
9104ef3437 Swap read/write word data. 2017-10-21 23:40:56 +02:00
iabdalkader
d860361fcd Fix cambus read/write-w register width. 2017-10-21 14:18:42 +02:00
iabdalkader
fecf856169 Revert "Add generic cam bus read/write."
This reverts commit d2ebe6f7e2.
2017-10-21 14:17:53 +02:00
iabdalkader
d2ebe6f7e2 Add generic cam bus read/write. 2017-10-19 00:53:43 +02:00
iabdalkader
ff8cf16169 Rename data to reg_data. 2017-10-18 23:19:12 +02:00
iabdalkader
04a14a290f Rename SCCB/I2C driver to cambus. 2017-10-18 23:14:14 +02:00
iabdalkader
d1a5f72a95 Add new cam support files. 2017-10-17 14:14:08 +02:00
Kwabena W. Agyeman
1748000e4d Use special version of nlr_raise again. 2017-10-17 01:14:57 -04:00
iabdalkader
927edcf321 Fix M4 UART pins. 2017-10-12 21:49:37 +02:00
iabdalkader
46da0d9f2f Add roundf to Makefiles. 2017-10-09 21:32:03 +02:00
iabdalkader
c6c7324272 Apply mpconfigboard fix for MP-1.9.2 2017-10-09 21:21:44 +02:00
iabdalkader
11bed4b993 Update to MP-1.9.2 2017-10-09 21:20:06 +02:00
iabdalkader
64143d4a94 Remove frozen code object file. 2017-10-06 01:37:44 +02:00
iabdalkader
20c8b66789 Implement sensor soft sleep. 2017-10-05 01:25:49 +02:00
iabdalkader
f86a5fb63d Fix blob.density()
* Fix issue #268
2017-10-04 11:00:23 +02:00
Kwabena W. Agyeman
cbe2a4aebd Disable find line segments on the M4. 2017-10-03 02:50:55 -04:00
iabdalkader
c961b3eac0 Remove Cortex flags from MP Makefile. 2017-10-02 00:49:36 +02:00
iabdalkader
38aca6e9e8 Disable frozen modules. 2017-10-02 00:47:03 +02:00
iabdalkader
bb0d0e778a Disable OPENMV 1 build. 2017-10-02 00:27:03 +02:00
iabdalkader
afe07324c5 Use 1 DMA handle for SD TX/RX 2017-10-02 00:16:27 +02:00
iabdalkader
763228e30d Update F4 HAL. 2017-10-01 22:57:28 +02:00
iabdalkader
2edc26db6a Update CMSIS. 2017-10-01 22:47:05 +02:00
iabdalkader
5bffa8879a Remove comment. 2017-09-26 00:03:41 +02:00
iabdalkader
608ca9ab87 Remove unused pyb functions. 2017-09-24 21:29:34 +02:00
iabdalkader
6e34bafe6b Add function to execute boot scripts. 2017-09-24 21:16:10 +02:00
iabdalkader
de8caa3006 Remove debugging code. 2017-09-24 20:48:26 +02:00
iabdalkader
0c20049e3d clean up main.c 2017-09-24 01:47:46 +02:00
iabdalkader
5460f7f5e1 Fix FS cache address. 2017-09-24 01:46:41 +02:00
iabdalkader
e2514ee302 Add pendsv debugging flags to top Makefile. 2017-09-23 15:46:06 +02:00
iabdalkader
041a93502b Update SCCB probe function. 2017-09-23 15:45:54 +02:00
iabdalkader
3820cd07b7 Update MP. 2017-09-23 15:45:42 +02:00
iabdalkader
6ae6ce0cf7 Reorder init functions. 2017-09-23 15:45:15 +02:00
iabdalkader
ace083430f Init USB before sensor init to log errors. 2017-09-23 15:00:50 +02:00
iabdalkader
6917e4bb32 Update to micropython 1.9.
* The following issues still need fixing:
*   Al fb_alloc nlr hooks are DISABLED.
*   modnetwork causes cam to hardfault.
*   Had to reduce heap by 1K (vfs buffer had to be moved to bss/data).
*   self-tests are disabled (cam gets stuck after executing).
2017-09-21 16:58:57 +02:00
iabdalkader
07b7fb1f21 Update main.c for MP 1.9. 2017-09-21 16:58:57 +02:00
iabdalkader
1ab776faf1 Use forced exception to stop scripts. 2017-09-21 16:58:57 +02:00
iabdalkader
3ccc418cf3 Update main Makefile for MP 1.9 2017-09-21 16:58:57 +02:00
iabdalkader
113806e51b Update WINC1500 FatFS code 2017-09-21 16:58:57 +02:00
iabdalkader
e43bd3223b Disable nlr/fb-alloc function. 2017-09-21 16:58:57 +02:00
iabdalkader
9db426394f Update OMV Python modules for MP-1.9 2017-09-21 16:58:57 +02:00
iabdalkader
4a521dae32 Update MP header. 2017-09-21 16:58:57 +02:00
iabdalkader
5018ac1cd4 Add wrappers for oofatfs 2017-09-21 16:58:57 +02:00
iabdalkader
be54d3a8c7 Use MicroPython's OOFatFS. 2017-09-21 16:58:57 +02:00
iabdalkader
260479ae0f Lower M4 sensor clock.
* Add PLL config to board to fine tune M4 sensor clock.
* Note M4 sensor clock is lowered, the MCU can't keep up with high FPS.
2017-09-13 23:46:20 +02:00
Ibrahim Abd Elkader
0cf13e8777 Merge pull request #263 from kwagyeman/lsd
Lsd
2017-09-13 18:09:50 +02:00
Kwabena W. Agyeman
5a3153c8b9 Find line segments more stable
Switched the find line segments algorithm to something more stable using
the standard LSD algorithm that's used by OpenCV.
2017-09-13 00:33:31 -04:00
Kwabena W. Agyeman
7dff089e6f Removed QRCodes from the OpenMV Cam M4.
They don't really work that well on it anyway due to having to use a low
res. This makes room for more basic CV features on the M4 which it can
run.
2017-09-03 14:39:14 -04:00
iabdalkader
35ab0a26fc Remove invalid resolutions.
* Fix issue #261
2017-08-29 01:54:43 +02:00
iabdalkader
7da5509aa5 Support writing raw images. 2017-08-26 20:27:48 +02:00
iabdalkader
9f25fa752e Use IM test macros. 2017-08-26 19:48:17 +02:00
iabdalkader
abad31acea Add IM_IS_BINARY. 2017-08-26 19:41:11 +02:00
iabdalkader
4a62b8b989 Add IM_IS_MUTABLE to check if JPEG or RAW image. 2017-08-24 23:42:05 +02:00
iabdalkader
9f71b89187 Fix IM_IS_JPEG macro. 2017-08-24 23:37:16 +02:00
iabdalkader
5dbc3e68b4 Bump firmware version. 2017-08-10 19:39:54 +02:00
iabdalkader
7d05519518 Enable VGA MJPEG. 2017-08-10 04:03:32 +02:00
iabdalkader
43f9535cf0 Support VGA GIFs with BAYER format. 2017-08-10 03:52:37 +02:00
iabdalkader
db4d47c67f Initialize FB Enabled flag. 2017-08-08 18:56:11 +02:00
Kwabena W. Agyeman
ae1e00cc2d Fix to match script 2017-08-07 03:47:25 -04:00
Kwabena W. Agyeman
3caed9461f Fix find_circles 2017-08-07 03:46:08 -04:00
Kwabena W. Agyeman
d284407898 Fixed issues with polar math code. 2017-08-07 01:40:04 -04:00
iabdalkader
5c469e1e27 Update docs. 2017-07-28 13:59:52 +02:00
iabdalkader
9f658e4cfd Enable Servo 3.
* Fix issue #256.
2017-07-18 22:00:12 +02:00
Kwabena W. Agyeman
a4e556e7e3 Add find_rects() using AprilTag's quad detector.
It's awesome.
2017-07-13 01:25:23 -04:00
iabdalkader
aa2bd8a4e2 Add array insertion sort. 2017-07-11 23:48:49 +02:00
iabdalkader
ef3b058842 Minor fix to Haar loading from path.
* Won't need slash anymore.
2017-07-11 23:47:19 +02:00
iabdalkader
652ae88a65 Use ff_wrapper to load Haar cascades.
* Fixes unaligned reads warnings.
2017-07-11 23:37:24 +02:00
iabdalkader
200ffeed58 Add LeNet! 2017-07-11 04:10:40 +02:00
iabdalkader
109e403f7a Fix ORB sorting.
* Using pointers to make the sort stable doesn't work. Each keypoint is allocated individually.
2017-07-08 03:56:25 +02:00
iabdalkader
37b2fc0b31 Make ORB keypoints sort function stable. 2017-07-07 04:13:57 +02:00
iabdalkader
1fea5ac78c Fix ORB bug.
* Clear matched flag when loading descriptor.
2017-07-06 21:41:02 +02:00
Kwabena W. Agyeman
089577173c Improve find lines merging. 2017-07-04 18:23:26 -04:00
Kwabena W. Agyeman
1ed867e39f Fix memory leak with get_regression. 2017-07-04 14:21:11 -04:00
Kwabena W. Agyeman
5f4e690fa1 Add find circles.
Now you can find circles with your OpenMV Cam! The alrogithm can eek out
about 7 FPS on a 160x120 image which is quite impressive given how
computationally expensive circle finding is...
2017-07-04 14:09:21 -04:00
Kwabena W. Agyeman
48f1e0bada Fixed blob issues.
* Angle averaging done correctly using sin/cos now.
* Unspecfied color bounds default to least restrictive instead of most
restrictive.
2017-07-03 13:05:57 -04:00
Kwabena W. Agyeman
cd4ad0dff3 Add linear regression
For easy line following mainly. In non-robust mode the line is computed
using least squares. In robust mode the line is computed using the
Theil-Sen median of slopes method. We do not use the Siegel Median of
Medians operation because it costs more CPU time... but, more
importantly there's no way to improve the centroid estimate so even if
the slope is more robust the line will be drawn in the wrong place.
2017-06-28 01:16:15 -04:00
iabdalkader
7d29104ed6 Add sensor.flush() 2017-06-25 16:48:17 +02:00
iabdalkader
99ec972ad0 Rename main_fb_image_size to fb_buffer_size(). 2017-06-24 23:29:41 +02:00
iabdalkader
062f86c60a Remove *_FB_SIZE macros. 2017-06-24 23:03:09 +02:00
iabdalkader
bfe1f02ffa Remove 4 bytes from FB_SIZE macros. 2017-06-24 22:58:37 +02:00
Kwabena W. Agyeman
c2c92c9f41 No requirement to size FB anymore. 2017-06-24 12:43:23 -04:00
Kwabena W. Agyeman
a02c2bad6c Fix main FB and JPEG FB size and pixels code. 2017-06-24 12:42:02 -04:00
Kwabena W. Agyeman
fffa3a691a Add function to get image size in bytes given the format. 2017-06-24 12:27:23 -04:00
iabdalkader
851b5306a7 Add IMAGE_BPP_BAYER. 2017-06-19 01:50:02 +02:00
Kwabena W. Agyeman
87d53385a6 Improve image load.
It now copies to the frame buffer and will error out if loading an image
that is too large.
2017-06-18 13:57:34 -04:00
Kwabena W. Agyeman
968574b1a5 Add corners to code objects. 2017-06-16 01:56:33 -04:00
Kwabena W. Agyeman
cfe7881dff Improve stream file format.
All chunks are multiples of 16 bytes. Don't want to run into issues with
long alignment now or in the future.
2017-06-12 01:43:57 -04:00
Kwabena W. Agyeman
dc6ab59cfd Add Image Writer/Reader
These two new classes allow you to record image data for later viewing
at the same speed the image data was recorded. Unlike GIF/MJPEG the
image data is stored on the file system completely uncompressed in
native frame buffer format making super fast reading and writing
possible. Recording VGA Grayscale at ~13 FPS is possible along with
playing it back. (That's about 30 Mb/s folks).

...

The motivation for writing these scripts is so that you can record video
of something like a line following track, take that video home, and work
on computer vision algorithms for that data.

These classes should make it a lot easier to use the camera at home now.
2017-06-11 15:53:43 -04:00
Kwabena W. Agyeman
7ec990223f Apply requested fixes. 2017-06-11 13:47:44 -04:00
Kwabena W. Agyeman
f9e124f8cd Refactor framebuffer
Moved structs along with image copying code from sensor into
framebuffer.c so that we can use the new copy_fb_to_jpeg_fb() function
in the image library for methods with "copy_to_fb" so that they update
the IDE preview when called.

Also, I noticed that the MAIN_FB_SIZE() value is not calculated
correctly in all cases. Will fix later. Trying to keep this commit clean
for just the refactoring.

All changes have been tested. Too.
2017-06-10 23:31:42 -04:00
iabdalkader
c8d7a4188f Update built-in README. 2017-06-09 01:00:06 +02:00
iabdalkader
5887129a0a Remove inf file from fresh FS. 2017-06-09 00:30:13 +02:00
iabdalkader
6850a53bf9 Enable RTC. 2017-06-07 22:59:54 +02:00
iabdalkader
4af10aaa2e Fix RTC init. 2017-06-07 22:59:42 +02:00
iabdalkader
a5b25bd5b7 Increase UART char timeout.
* Fix issue #240
2017-06-07 21:26:34 +02:00
Kwabena W. Agyeman
343c4b9092 Add sensor width and height.
Should have added this a long time ago.
2017-06-04 21:49:07 -04:00
iabdalkader
63c3ee85c2 Bump firmware version. 2017-06-04 20:52:02 +02:00
iabdalkader
e287b39968 Fix FW version. 2017-06-04 20:46:24 +02:00
iabdalkader
8cfa8f8b90 Apply SCSI layer fix from MP upstream.
* Fix #236
2017-06-04 20:04:39 +02:00
Kwabena W. Agyeman
744a2d7b04 Upstream Kanji fix. 2017-06-03 15:09:42 -04:00
iabdalkader
9091bc6ba0 Update binary ops docs. 2017-06-03 20:52:49 +02:00
Kwabena W. Agyeman
d853e43cd6 Fixed binary and/or naming. 2017-06-03 14:27:19 -04:00
iabdalkader
2232d78586 Bump firmware version. 2017-05-30 01:26:07 +02:00
iabdalkader
f85540b716 Reset the FPS clock every 2s. 2017-05-30 01:03:15 +02:00
iabdalkader
0666d0a465 Update MP docs. 2017-05-29 21:31:03 +02:00
Kwabena W. Agyeman
2557070422 Fix error with compress_for_ide()
Forgot to add size of start and end markers.
2017-05-28 23:07:11 -04:00
Kwabena W. Agyeman
a039b5d1c7 Change skip_frames() to use a 2 second timeout.
This was necessary due to the increase in the frame rate. The previous
method did not correlate to time.

All scripts updated.
2017-05-27 19:31:41 -04:00
Kwabena W. Agyeman
e9e48d5028 Update QRCode
Fixed issues with QRCode method in response to user reqeust on the
forums: http://forums.openmv.io/viewtopic.php?
f=6&t=286&p=1799&hilit=qrcode#p1799.
2017-05-27 16:21:10 -04:00
Kwabena W. Agyeman
4d6612609e Add more resolution combinations.
With the new frame rate speed increase folks will be asking for smaller
resolutions to get 85 FPS or so when running an algorithm. This commit
adds all scaled modes of frame sizes we already support. We should be
good now on frame sizes for the present and future now.

Todo - skip frames does not run long enough anymore for auto white
balance and gain to stablize before they are turned off in some scripts.
This needs to be adjusted.
2017-05-26 20:09:59 -04:00
iabdalkader
df1bdc65b8 Fix recvfrom return. 2017-05-26 20:29:23 +02:00
iabdalkader
e960546b6b Add keypoints match object. 2017-05-22 19:48:15 +02:00
iabdalkader
1057dce2c9 Fix formatting. 2017-05-22 18:44:41 +02:00
iabdalkader
c59495d215 Call DCMI_VsyncExtiCallback from EXTI9_5 handler. 2017-05-21 22:29:26 +02:00
iabdalkader
8952962e3c Add function to set VSYNC I/O output pin. 2017-05-21 22:27:58 +02:00
iabdalkader
666ee15992 Enable VSYNC output on IO pin for synchronization. 2017-05-21 22:23:53 +02:00
iabdalkader
9d8c6701c0 Fix indent. 2017-05-18 01:53:43 +02:00
iabdalkader
d266332a7a Minor docs fixes. 2017-05-15 23:25:09 +02:00
iabdalkader
e35dbc2108 Lowering OMV2 sensor clock to work with the higher sensor PLL. 2017-05-13 23:04:19 +02:00
iabdalkader
6f4ea1567e Set SCCB clock to 100KHz. 2017-05-13 04:11:36 +02:00
iabdalkader
103bb27f83 Set sensor PLL to 6x and reduce extclk.
* OMV2-F4 extclk = 8MHz * 6 = 48MHz
* OMV3-F7 extclk = 9MHz * 6 = 54MHz
2017-05-13 04:10:04 +02:00
iabdalkader
832819eede Set sensor window to QVGA when res is <= VGA.
* This reduces the readout time allowing to cam to capture more (miss less) frames.
2017-05-13 04:08:33 +02:00
iabdalkader
520537f7b3 Add set resolution macro. 2017-05-13 03:30:13 +02:00
iabdalkader
435644e63f Add find_lines docs 2017-05-11 13:53:09 +02:00
Kwabena W. Agyeman
f4a9c61544 Add find_line_segments
The OpenMV Cam can now infinite lines and line segments from those
infinite lines. find_lines has been updated to allow all this to work.
2017-05-10 21:40:22 -04:00
iabdalkader
dbda114663 Optimize Canny edge detector.
* Use separable convolution.
* Merge thresholding and non-max suppression steps.
2017-05-08 05:02:56 +02:00
iabdalkader
d80196002d Compile additional features only when enabled.
* This fixes "unused" errors with newer toolchains.
2017-05-07 03:39:15 +02:00
Kwabena W. Agyeman
31b7b5bf3e Improved find_lines
Frame rate now can hit 30 FPS when JPEG compression is off. Merging of
lines is perfected too which greatly reduces the noise output. Also,
lines are now objects so you can get their values in an easy way.
2017-05-06 14:31:20 -04:00
iabdalkader
b1196d5f8b Update MP docs 2017-05-01 03:50:58 +02:00
Kwabena W. Agyeman
284a505865 Add ID string to arch output. 2017-04-30 20:09:00 -04:00
Kwabena W. Agyeman
dc599e40eb Improved subscr and get_buffer
In response to PR https://github.com/openmv/openmv/pull/221.

You can now read and write slices of data to and image at a time.
2017-04-29 19:27:13 -04:00
Kwabena W. Agyeman
690ec923ae Add data matrix support.
Add support for decoding data matrices and example scripts.
2017-04-28 19:58:19 -04:00
Ibrahim Abd Elkader
7204a35758 Revert "Add image.raw() function." 2017-04-28 18:01:11 +02:00
skaiu
b64c744f2f Add image.raw() function. 2017-04-28 21:51:31 +08:00
Kwabena W. Agyeman
08b36f2b21 Fix typos. 2017-04-27 00:44:28 -04:00
Kwabena W. Agyeman
aa5131467e Fix UMM_Refactor Issues.
Memory allocation will grow organically now when more RAM is available.
2017-04-27 00:15:16 -04:00
Kwabena W. Agyeman
35e9f988d6 Refactor umm_malloc into it's own file.
We now have a nice and fast malloc system that easily offers 300KB+
dynamic memory... No need to use xalloc anymore except when we're
transfering objects to MP memory space.
2017-04-26 22:48:52 -04:00
Kwabena W. Agyeman
16d711ad5d Pull in upstream quirc fixes from github. 2017-04-25 21:17:12 -04:00
iabdalkader
2c4ec23244 Fix gcc2016q4 warnings.
* Fixed misleading indentation.
* Removed unused static variables.
* Disabled strict aliasing for STM DSP library.
2017-04-23 20:40:07 +02:00
iabdalkader
1fd9bf9251 Enable UART1 for OPENMV3 2017-04-23 20:32:44 +02:00
iabdalkader
6e2ba0e300 Bump firmware version. 2017-03-26 22:25:23 +02:00
iabdalkader
cab69cc64d Reverting last commit.
* Using parentheses for the logical test.
2017-03-26 21:48:59 +02:00
iabdalkader
e29d7769e6 Fix logical test error in zbar. 2017-03-26 21:41:42 +02:00
iabdalkader
3fd7c15094 Update docs. 2017-03-25 23:38:32 +02:00
Ibrahim Abd Elkader
6614d2380c Merge pull request #203 from kwagyeman/master
Image Streaming Code
2017-03-25 18:54:43 +02:00
Kwabena W. Agyeman
55e4809ff6 Image Streaming Code
The user can now call compressed_for_ide() and compress_for_ide() on an
image to make a jpeg compressed image formatted for transmission over a
data link other than USB. Note that OpenMV IDE will automatically handle
one of these compressed images ending up in the frame buffer and display
it like normal.

To send the image data the user can do:

print(img.compress_for_ide(), end='')
print(img.compressed_for_ide(), end='')
uart.write(img.compress_for_ide())
uart.write(img.compressed_for_ide())

and etc. As mentioned above, compress() compresses the image in place.
And that in place compressed image will then end up in the jpeg buffer.
OpenMV IDE will automatically handling decoding these special compressed
images when this happens.

All variations of the above code have been tested and are working.
2017-03-25 12:47:23 -04:00
Kwabena W. Agyeman
bfd048e6f3 Integrate ZBar 2/2
ZBar functionality integrated along with an example script.
2017-03-24 12:45:27 -04:00
Kwabena W. Agyeman
dab290675f ZBar Integration Part 1/2.
Main ZBar code, breaking the commit up because the main file is big.

I will refeactor UMM alloc out of apriltag.c and zbar.c once I'm
finished with this commit stream.

ZBar integration gives us support for basically all 1D linear barcodes.
2017-03-24 11:59:10 -04:00
Kwabena W. Agyeman
c6009ae05d Fixed apriltags z translation. 2017-03-21 21:01:52 -04:00
iabdalkader
fb3582b440 Remove old MAX_INT_FRAME. 2017-03-16 20:34:04 +02:00
iabdalkader
669e9ad072 Removed unused JPEG_OFFS_SIZE. 2017-03-12 19:28:14 +02:00
iabdalkader
15d6b96bed Fix py_image_get_buffer to support writing BAYER. 2017-03-12 19:25:48 +02:00
iabdalkader
4502256e19 Fix py_image assertion message. 2017-03-12 19:19:00 +02:00
iabdalkader
11abb5221b Fix framebuffer size checks.
* Delay the FB size check and corrections to snapshot(). If the frame doesn't
  fit FB it gets cropped for GS, or the sensor is switched to bayer for RGB.
2017-03-12 19:07:26 +02:00
iabdalkader
b0ed5bb7af Add Bayer sensor support. 2017-03-12 03:38:26 +02:00
iabdalkader
5615a25745 Add Bayer support in OV7725 driver. 2017-03-12 03:33:33 +02:00
iabdalkader
d330486758 Add Bayer JPEG support. 2017-03-12 03:32:20 +02:00
iabdalkader
b94182dce4 Add new RAW/BAYER pixel format to support 2BPP VGA. 2017-03-12 03:29:49 +02:00
iabdalkader
002c2894aa Add IM_GET_RAW_PIXEL 2017-03-12 02:36:52 +02:00
iabdalkader
fbc30e9736 Add missing ksize. 2017-03-09 22:46:03 +02:00
iabdalkader
e5aa66cd12 Use sep conv in ORB. 2017-03-09 22:43:24 +02:00
iabdalkader
ea7b87e866 Add separable convolution. 2017-03-09 22:43:05 +02:00
iabdalkader
040a3cb0e4 Use separable gaussian kernels. 2017-03-09 22:41:37 +02:00
iabdalkader
a4561c7efa WINC: Add support for AP mode. 2017-03-09 20:39:53 +02:00
iabdalkader
32dded64fd Use faster SPI GPIO. 2017-03-09 20:23:13 +02:00
iabdalkader
8c0e1603eb Redefine log level when CONF_WINC_DEBUG is enabled. 2017-03-09 20:22:00 +02:00
iabdalkader
096361c711 Remove headers from mp.h 2017-03-09 03:47:24 +02:00
iabdalkader
1d1eede947 Updated docs. 2017-03-07 21:35:35 +02:00
iabdalkader
6d838ff8ee Update docs. 2017-03-04 03:47:41 +02:00
iabdalkader
5e9beab3d6 Bump firmware version. 2017-02-28 18:07:39 +02:00
iabdalkader
a054b5faab Fix cascade step.
* Assumed window width == height.
2017-02-28 17:51:03 +02:00
iabdalkader
7616e487f9 Handle CTRL+D/C/A just like MP boards. 2017-02-23 15:20:14 +02:00
iabdalkader
f7c49cc01d Add CAN init0/deinit in main.c 2017-02-23 15:16:04 +02:00
iabdalkader
2934e88146 Enable CAN2 for OMV2 and OMV3 2017-02-23 15:04:04 +02:00
iabdalkader
f0a389f2cc Enable extra MP modules. 2017-02-23 02:15:04 +02:00
Kwabena W. Agyeman
1b3f444351 Add callbacks back in for emulating pixy. 2017-02-15 13:18:11 -05:00
Kwabena W. Agyeman
cd07c0d5fa AprilTags Fixes
* Made all memory allocations during the exhaustive time safe.
* Added 3D pose output from the AprilTags code.
2017-02-14 18:36:52 -05:00
Kwabena W. Agyeman
b22aadc21f QR Code Bug Fixes
Fixed typo in qrcode script. Moved scripts to new folder. Fixed roi
offset for qrcodes. Use fast functions in qrcode library.
2017-02-10 15:14:29 -05:00
Kwabena W. Agyeman
71e795812f April Tag Release Fixes
Everything works. Running out of memory is fixed and the rotation value
is valid now. For 320x240 operation on the STM32H7 we're going to need
on the order of 1 MB in the entire frame buffer. The code is designed to
handle us getting this amount of memory without any new changes for
320x240 support.
2017-02-10 13:42:35 -05:00
Kwabena W. Agyeman
443ba3bff8 AprilTags Support
Works super good.
2017-02-09 17:37:18 -05:00
Kwabena W. Agyeman
55716a632a AprilTags Main
This file includes all of the relevant header/source files from the
april tag library merged into one big file. Additionally, it also
includes heap/quicksort code. I've done the work of going through
the april tag library line by line and fixing it to use fb_alloc,
floats, and our fast math functions.

Anyway, I'm sending this massive file by itself first since it's so
big. Note that we migh in the future want to pull things out of this
file for our own use later if we need linear algebra support.
2017-02-09 17:04:08 -05:00
Kwabena W. Agyeman
c4b4a86100 Add flag for SWD programmer.
It can now check if the self-test passed.
2017-01-29 19:54:45 -05:00
Kwabena W. Agyeman
3f879ec1b3 Fixed bootloader LED 2017-01-29 19:52:24 -05:00
iabdalkader
0be2676bc1 Bump firmware version. 2017-01-21 23:39:32 +02:00
iabdalkader
3e581156da Fix LED pinout for OMV3. 2017-01-21 23:20:40 +02:00
iabdalkader
1cba92d757 Update docs. 2017-01-21 23:07:43 +02:00
Kwabena W. Agyeman
02af722fe8 Fixed fb_alloc() with mark for recently re-worked code.
I also tested the firmware for about an hour to make sure there was no
stack leak.

Note that I prefer for fb_free() to still be called versus
fb_free_till_mark() doing that for you in the code.

For functions without this fix they will just free the entire fb_alloc
stack when an exception happens. For functions with this fix they will
only free up to and including the mark. Since there are no places in the
firmware where you could start building a second fb_alloc stack when one
is already in place this point is moot currently. But, if we do
something like that in the future the problem will have already been
solved.

Any new code or re-worked code should use the mark function.
2017-01-18 18:39:08 -05:00
iabdalkader
0979ee2c0f Update MP branch 2017-01-18 04:14:11 +02:00
Ibrahim Abd Elkader
f7e04a450b Merge pull request #177 from kwagyeman/update_lens_corr
Speed up lens_corr.
2017-01-16 04:43:56 +02:00
Kwabena W. Agyeman
d6b49adefa Speed up lens_corr.
Speed up the algorithm by fixing the abs() issue. Do not use that
function in any of your code. It by itself cut the speed of the code
in half. I don't know what's in that function but I'm guessing it does
ABS of a float using ints or something.

I made the zoom parameter functional now too so you can use lens_corr to
zoom in on the image. Argument parsing is handled too. Finally, I
updated the only script where this is used.

Note that I'm able to get more than 10 FPS at 160x120 on the M4 and 15
FPS at 160x120 on the M7. Previous this was at about 5 FPS and 7.5 FPS
respectively.
2017-01-15 21:32:55 -05:00
Kwabena W. Agyeman
ed3f226478 Tested stats with examples and fixed bugs
The automatic grayscale and rgb565 color tracking scripts are very cool.
2017-01-15 14:59:42 -05:00
iabdalkader
e4c297d0e3 ORB: Use the normalized arg.
* Extract keypoints from the first scale only if normalized == True.
2017-01-15 17:40:29 +02:00
iabdalkader
bba8e5a9e0 Remove match_descriptor type arg.
* Not really needed can check MP object types.
2017-01-14 01:15:24 +02:00
iabdalkader
c9806c0588 Allow the IDE to interrupt main.py 2017-01-13 03:14:07 +02:00
Kwabena W. Agyeman
0e89b655bf Made set_windowing simpilier.
Tested with updated qr code example script.
2017-01-12 17:41:40 -05:00
iabdalkader
c28d090ee2 ORB: User floorf to get keypoint xy from scale. 2017-01-12 17:32:05 +02:00
iabdalkader
11f5d67669 Cleanup JPEG buffer checks. 2017-01-12 17:31:33 +02:00
iabdalkader
9a7c3defc3 Update JPEG buffer sizes in OMV2 and OMV3 2017-01-12 17:31:11 +02:00
iabdalkader
607db241a5 Move main memory to DTCM on M7.
* Allows bigger fb_alloc buffer
2017-01-12 17:30:24 +02:00
iabdalkader
66a7330d1e Add comment about write buffer. 2017-01-12 17:29:59 +02:00
Kwabena W. Agyeman
1025d23fe8 Add fb_alloc stack unwinding code.
Needs to be linked into MP too.
2017-01-11 23:05:59 -05:00
iabdalkader
cdef215a6e Make match_keypoints more robust.
* Check keypoints sizes.
* Handle zero matches case.
2017-01-12 04:54:40 +02:00
iabdalkader
cfdb4bdc90 Cast sin/cos to ints in draw_keypoints. 2017-01-12 04:52:50 +02:00
iabdalkader
5467993b38 Free FB memory if compress or compressed fail. 2017-01-12 04:51:21 +02:00
iabdalkader
2d201357a6 Add xalloc_try_alloc.
* Doesn't raise exception if there's no memory
2017-01-12 04:47:29 +02:00
Ibrahim Abd Elkader
e82e3ab785 Merge pull request #170 from kwagyeman/fix_compress
Fix compress and compressed.
2017-01-12 04:47:36 +02:00
Kwabena W. Agyeman
9efd7474ae Fix compress and compressed. 2017-01-11 21:21:04 -05:00
iabdalkader
819e95dc07 ORB: check if matches == 0 2017-01-12 03:46:57 +02:00
iabdalkader
a533ed3549 ORB: Fix ROI again.
* Must leave at least patch_size border.
2017-01-12 02:01:55 +02:00
Kwabena W. Agyeman
9f37c83def Minor Speed Improvements to Blob, QRCode, and Stats 2017-01-11 17:09:46 -05:00
Kwabena W. Agyeman
cf4cb787f5 Removed new_image_t, replaced with current image_t. 2017-01-10 18:26:49 -05:00
iabdalkader
5f7b40489b ORB: small fixes.
* Do Gaussian smooth on every level, can't get away with just one level.
* Fix ROI, was bigger than needed, and check roi.w/h instead of scaled image.
2017-01-10 14:49:43 +02:00
iabdalkader
e901221c52 ORB: Use popcount for distance. 2017-01-10 06:39:13 +02:00
iabdalkader
58ef87cd85 ORB: Change default threshold to 85 and min match to 5. 2017-01-10 04:11:41 +02:00
iabdalkader
cfc677ed40 Improve bootloader timing
* Detect when VBUS is connected and wait for enumeration, the IDE
  timeout is only started after enumeration.
* A 2s timeout for enumeration is used so the cam doesn't get stuck
  if it's connected to a charger or a power bank.
2017-01-10 00:58:15 +02:00
iabdalkader
d42b2987a7 Fix lookup types for find_keypoints. 2017-01-09 01:30:08 +02:00
iabdalkader
02334ebea3 Init theta. 2017-01-09 01:11:27 +02:00
iabdalkader
1ab282a7eb ORB: estimate and return the angle of rotation. 2017-01-09 00:59:33 +02:00
iabdalkader
ff6b3d8367 Change default matching threshold to 70. 2017-01-09 00:40:37 +02:00
iabdalkader
c233131ca4 Change default max_keypoints to 100. 2017-01-09 00:29:22 +02:00
iabdalkader
f1f38f3c74 FAST/AGAST: Allocate MAX_CORNERS or the actual max corners. 2017-01-08 19:05:25 +02:00
iabdalkader
b956935550 ORB: Use one array for all octaves.
* Since I'm sorting the whole array and not every octave now.
2017-01-08 18:55:14 +02:00
iabdalkader
6b7eb1a105 Add keypoints detector arg. 2017-01-08 18:40:28 +02:00
iabdalkader
05ea5115b5 Add constants for corner detectors. 2017-01-08 18:33:10 +02:00
iabdalkader
96e4f770c0 Use scale_factor instead of scale in find_features
* Updated all scripts.
2017-01-08 18:23:25 +02:00
iabdalkader
861627d61b Set default keypoint size to 10% of the image size 2017-01-08 17:53:59 +02:00
iabdalkader
dccadd7bf5 ORB, FAST, AGAST: Move keypoints sorting to higher level. 2017-01-08 17:39:55 +02:00
iabdalkader
68346372b1 ORB: Add comments. 2017-01-08 17:36:43 +02:00
iabdalkader
7fa9894bdc ORB: Add max_keypoints and scale_factor args 2017-01-08 17:35:47 +02:00
iabdalkader
9ac0d0b0dd Merge branch 'master' of https://github.com/openmv/openmv 2017-01-08 17:07:07 +02:00
iabdalkader
ee96ba1353 ORB: pre-compute umax. 2017-01-08 16:58:52 +02:00
iabdalkader
ff50b8ffb2 ORB: Don't scale the first octave 2017-01-08 16:57:41 +02:00
iabdalkader
46fd1936da ORB: Gaussian smooth the image once before keypoints extraction. 2017-01-08 16:54:52 +02:00
iabdalkader
24292d4f55 ORB: Quantize angle and fix rotation 2017-01-08 16:52:17 +02:00
Kwabena W. Agyeman
0111084125 Updated stats code
We now have a method to get an the normalized histogram of an image
patch. The histogram is returned as an object with methods too. You can
then get the stats off of the histogram or just get the CDF of it. The
CDF is particularly useful for automatically chaning the the color
tracking bounds.
2017-01-07 20:11:30 -05:00
iabdalkader
6873f17ea0 Write/read keypoint angle when saving/loading descriptors 2017-01-07 18:49:09 +02:00
iabdalkader
d653bdb136 Fix and update ORB.
* Set keypoint angle.
* More downscale levels
* Additional keypoints filter using distance ratio with second best match.
2017-01-07 18:43:38 +02:00
iabdalkader
f47b96360a Fix keypoints size. 2017-01-07 18:42:52 +02:00
iabdalkader
e06a6520a6 Remove dist from keypoints 2017-01-07 18:42:28 +02:00
iabdalkader
17cf2ca139 Skip matched keypoints. 2017-01-07 15:25:44 +02:00
iabdalkader
c758e14bcb Add angle, dist to keypoints 2017-01-07 02:44:19 +02:00
iabdalkader
9e76d775d6 Fix ORB angle calculations. 2017-01-07 02:42:32 +02:00
iabdalkader
6000684cb3 Fix keypoint drawing code. 2017-01-07 02:35:18 +02:00
iabdalkader
ea047bde94 Clean up AGAST. 2017-01-07 02:34:05 +02:00
iabdalkader
e2b5338dc8 Fix fast_alloc point 2017-01-06 19:41:22 +02:00
iabdalkader
a1c3061c1b Optimize keypoints_filter. 2017-01-05 17:01:42 +02:00
iabdalkader
00c30204ee Add rectangle_expand for bounding boxes. 2017-01-05 16:02:47 +02:00
iabdalkader
945a83c789 Add keypoints filtering function.
* This function filters keypoints far from the centroid, it's very useful for finding an accurate bounding box for an object.
  If a bounding box for the object is not needed, the centroid can be used instead since it's not affected too much by outliers.
* The filter finds the centroid of all the previously cross-matched keypoints then finds the mean, variance and standard deviation,
  it then filters keypoints with a distance higher than standard deviation from the centroid.
2017-01-05 05:35:57 +02:00
iabdalkader
f7a8167ce4 * Multiply by octave when clustering ORB points. 2017-01-05 03:35:43 +02:00
iabdalkader
e0b8d0d66d Fix ORB keypoints hamming distance.
* Used the wrong hamming for 4 points.
2017-01-05 01:53:04 +02:00
iabdalkader
e2d0c48401 Replace FREAK with ORB.
* New keypoints descriptor, much better implementation than FREAK.
2017-01-04 05:44:06 +02:00
iabdalkader
d7a223b136 Revert to FAST9 2017-01-03 20:43:27 +02:00
iabdalkader
cf1407cb48 Add AGAST corner detector. 2017-01-03 20:36:08 +02:00
Kwabena W. Agyeman
8dfba8b208 Fixed copy_to_fb for loading images. 2017-01-03 12:25:23 -05:00
iabdalkader
517ab14f40 Clean FB_PIXELS macro.
* No need to check BPP anymore.
2017-01-02 18:37:01 +02:00
iabdalkader
0bb431118b FAST improvements.
* Use all available FB memory to allocate corners.
* Limit the number of max keypoints to 150.
2017-01-02 03:15:16 +02:00
iabdalkader
942ddc5602 Make the lens correction function use less ram.
* Make lens_corr function work with 1/2 the ram needed.
2017-01-01 19:35:21 +02:00
iabdalkader
1b22a29612 Add set_gain/exposure/whitebalance functions.
* Add functions to disable auto functions control and set manual values.
2016-12-29 03:39:06 +02:00
Kwabena W. Agyeman
fbc58cf137 Updated QR Code Library with upstream changes and fixed up scripts for
demo.
2016-12-28 10:57:31 -05:00
Kwabena W. Agyeman
af15ec6eb3 New Blob Code
The new API is backwards compatible with the previous one except for
advanced features. The new blob code uses a flood fill algorithm that is
3x faster in filling out blobs that the previous code. On the M7 the
performance cap of 30 FPS is usually reached.

Additionally, blobs are objects with named attributes now so you don't
have to index access them anymore. However, index access is still
supported.
2016-12-27 19:10:24 -05:00
Kwabena W. Agyeman
6a8ce01e79 Add QRCode detection.
Use the qrcodes script and point your OpenMV Cam at google search
results for QR Codes.
2016-12-27 15:30:35 -05:00
Kwabena W. Agyeman
b668ac7e17 Add collections. 2016-12-27 14:04:30 -05:00
Kwabena W. Agyeman
ba04ff80bd Better Image Lib Primatives 2016-12-27 12:42:47 -05:00
iabdalkader
6480ecfc1a Update docs 2016-12-26 23:04:03 +02:00
iabdalkader
fd384bf1b0 Export OV7725's lens shading correction function. 2016-12-25 02:45:05 +02:00
iabdalkader
ac026d0b91 Fix F7 ADC support 2016-12-22 01:25:22 +02:00
iabdalkader
3ff0039bb8 Clean/Invalidate the M7 cache in the DMA driver. 2016-12-20 23:58:51 +02:00
iabdalkader
be95596e3a Fix OV7725 register name. 2016-12-20 22:25:30 +02:00
iabdalkader
1645ab94b2 Allow image loading directly to FB.
* Allows bigger images to be loaded to FB.
2016-12-14 18:44:23 +02:00
iabdalkader
cafddfed17 Redefine CFLAGS MCU_SERIES in the top Makefile.
* Make sure the MCU_SERIES is defined if MP config files are included outside MP build.
2016-12-14 13:55:53 +02:00
iabdalkader
0f9456fd37 Use WFI while waiting for snapshots. 2016-12-13 21:57:10 +02:00
iabdalkader
274f9bc445 Disable DCMI LINE in DCMI_Init.
* This disables the line interrupt before the first frame.
2016-12-13 21:43:22 +02:00
iabdalkader
edb1eca109 Revert to an older F7 DMA driver.
* The new DMA drivers (>v1.0.1) don't work yet.
2016-12-12 22:51:49 +02:00
iabdalkader
75e48c411d Reverted num of EXTI to 24 for M7 2016-12-11 02:46:09 +02:00
iabdalkader
177f24767b Enable additional GPIO ports for STM32F769xx only 2016-12-10 22:32:52 +02:00