Commit Graph

205 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
11bed4b993 Update to MP-1.9.2 2017-10-09 21:20:06 +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
9db426394f Update OMV Python modules for MP-1.9 2017-09-21 16:58:57 +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
4a62b8b989 Add IM_IS_MUTABLE to check if JPEG or RAW image. 2017-08-24 23:42:05 +02:00
Kwabena W. Agyeman
ae1e00cc2d Fix to match script 2017-08-07 03:47:25 -04: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
200ffeed58 Add LeNet! 2017-07-11 04:10:40 +02: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
Kwabena W. Agyeman
c2c92c9f41 No requirement to size FB anymore. 2017-06-24 12:43:23 -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
d853e43cd6 Fixed binary and/or naming. 2017-06-03 14:27:19 -04: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
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
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
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
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
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
c6009ae05d Fixed apriltags z translation. 2017-03-21 21:01:52 -04:00