Commit Graph

196 Commits

Author SHA1 Message Date
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
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
040a3cb0e4 Use separable gaussian kernels. 2017-03-09 22:41:37 +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
443ba3bff8 AprilTags Support
Works super good.
2017-02-09 17:37:18 -05: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
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