Commit Graph

335 Commits

Author SHA1 Message Date
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
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
bba8e5a9e0 Remove match_descriptor type arg.
* Not really needed can check MP object types.
2017-01-14 01:15:24 +02: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
Kwabena W. Agyeman
9efd7474ae Fix compress and compressed. 2017-01-11 21:21:04 -05: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
58ef87cd85 ORB: Change default threshold to 85 and min match to 5. 2017-01-10 04:11:41 +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
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
7fa9894bdc ORB: Add max_keypoints and scale_factor args 2017-01-08 17:35:47 +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
f47b96360a Fix keypoints size. 2017-01-07 18:42:52 +02:00
iabdalkader
6000684cb3 Fix keypoint drawing code. 2017-01-07 02:35:18 +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
e2d0c48401 Replace FREAK with ORB.
* New keypoints descriptor, much better implementation than FREAK.
2017-01-04 05:44:06 +02:00
Kwabena W. Agyeman
8dfba8b208 Fixed copy_to_fb for loading images. 2017-01-03 12:25:23 -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
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
199a0d0f63 Make functions return arg image to string operations. 2016-10-17 21:33:47 +02:00
iabdalkader
fdf0b96270 Add clear image function.
* Sets image pixels to 0's.
2016-10-10 17:22:26 +02:00
iabdalkader
ef6e6303c7 Add HoG. 2016-10-10 17:22:04 +02:00
iabdalkader
14b6330b67 Add simple lens correction function. 2016-09-23 18:46:11 +02:00
iabdalkader
af24644f87 Remove match pointer from keypoint struct. 2016-09-23 18:44:23 +02:00
iabdalkader
6beb89c6e6 Fix image.gaussian return object. 2016-09-23 18:25:19 +02:00
iabdalkader
f55c9b48eb Add gaussian function. 2016-09-20 01:03:22 +02:00
iabdalkader
e81f228796 Add simple edge function. 2016-09-14 20:54:53 +02:00
iabdalkader
e104be63df Implement Canny edge detector. 2016-09-13 02:37:43 +02:00
iabdalkader
83451de050 Add Hough Transform. 2016-09-12 22:16:58 +02:00
iabdalkader
627d81f569 Add imlib mask_ellipse. 2016-09-08 03:12:14 +02:00
iabdalkader
9153325c06 Fix LBP for face recognition.
* Rollback to 7x7 windows.
* Use chi square for distance with weights optimized for facerec.
2016-09-08 01:29:17 +02:00
iabdalkader
8cdf53d3fb Return arg image in histeq. 2016-09-04 21:33:41 +02:00
iabdalkader
1cbcb7e434 Add M7 support 2016-08-12 22:43:50 +02:00
iabdalkader
0575314ab3 Make image pool work on arg image without changing FB. 2016-06-20 22:25:25 +02:00
Kwabena W. Agyeman
7af818c4d8 Finished up optical flow code.
* Added pooling functions to make getting small images easy. set_binning
works too... but, it zooms in way to much. pooling functions aout you to
shrink the image while not zooming in.

* To make the pooling functions easy to use I created a version that
pools the image out of place and one that pools the image in place. The
inplace pooling function can work on the frame buffer (see edits to
sensor.c)

* I added the code to do hann windowing to the FFT lib. However, I
commented it out after it improved performance by basically zero.
Specialized windowing stuff will only come in handy for folks trying to
tune their algorithm... not in general for everything.

* I added subpixel resolution for the phase correlation code. You can
now track the image movement really precisely. Additionally, I fixed up
the displacement outputs to give expected results. I also added a QoR
output for the displacement code so that you can know when the results
are bad.

* Finally, an example script has been added to show off the features.
2016-06-18 23:05:44 -04:00
iabdalkader
6adb46e1fa Make copy_to_fb accept (x,y) offset 2016-06-17 00:31:56 +02:00
iabdalkader
e40c50f739 Add diamond search for fast template matching. 2016-06-15 22:59:17 +02:00
iabdalkader
d9b03641f7 Add copy to framebuffer function and example script. 2016-06-15 21:59:36 +02:00
iabdalkader
2767791aae Add loop step argument to template matching. 2016-06-14 00:14:22 +02:00
iabdalkader
a25e0c162e Make template matching use ROIs. 2016-06-14 00:07:54 +02:00
Kwabena W. Agyeman
45fdcc973e Add FFT Code and Phase Correlation Code
The heart of the 1D FFT works. I tested this on the PC. However, 2D FFTs
may have issues and the phase correlation algorithm does not generate
the expected results. That said, most of the work is done. Stuff just
needs to be deubgged.

The FFT lib is designed to handle up to 1024 point real FFTs and 512
complex FFTs. As for 2D FFTs, we can do up to 64x64 pixels. After which,
we don't have enough RAM to handle them because they use up about 128KB
each.

Things to do... the 2D FFT needs to be verified. So, we need to run an
image through it and then back again to verify that there are no
problems. Then we need to compare the 2D FFT output with another 2D FFT
algorithm on the PC...

Once the FFTs are known to be good we then need to make sure the phase
corelation algorithm outs the correct results. We need to test that with
multiple shifted images, etc.
2016-06-12 19:55:45 -04:00
Kwabena W. Agyeman
7a01a9bede Final Imlib Cleanup
Finished going through imlib.c.
-> Histeq uses fb_alloc now and has hook for RGB histeq when reserve YUV
LUT is added (coming soon in next PR).

Cleanuped py_helper.c/h
-> No functional changes. Just added some header info.

Finished going through py_image.c
* 1 - Finished general code cleanup and updating everything to using new
library functions. In particular, I updated the remaining find_*
functions with the new roi clipping code when they accept rois.
* 2 - Made blob stuff return a list when nothing is found so you don't
have to do an if on the returned value anymore.
* 3 - img subscr is more powerful now allowing image reading and
writing. I updated this because I had to use it to find a previous bug
with socket.send() for the WINC driver.
* 4 - Renamed find_eyes to find_eye. Because it just finds one eye.
* 5 - Other than that just general code cleanup to make functions look
consistent.

And yes, changes have been test. Face tracking, eye tracking, keypoints,
etc. all work still.

Future things todo before release:
1 - Change all LAB stuff to YUV.
2 - Add in reverse YUV->RGB LUT and update functions like Mode() to use
this so they don't generate messed up outputs, also histeq() too.
3 - Add any remaining sensor control functions like agc control.
2016-04-25 21:55:49 -04:00
Kwabena W. Agyeman
367e5fdd3d Improved JPEG capabilities.
* Added the ability to control the quality on JPEG functions... However,
due to our JPEG implementation this doesn't seem to help. 90% JPEG
quality images and regular images should be about equal. But, you can
see heavy degredation with 90% still. E.g. text is unreabable. Not
exactly sure why this is happening but it can be fixed later.

* Changed the compress() function to compressed(). Also, it now
compresses using FB_Alloc to prevent realloc issues when compressing.

* Added new compress() function. This function compresses an image in
place and if that image is the frame bufffer then it will update the
frame buffer bpp value to reflect the image was compressed. Users can use
this function to basically finalize the frame buffer and then pass the FB
to functions that need to send image bytes. The benefit of using this
function is that it should allow higher quality JPEGs and let everything
run at a faster speed while connected to the IDE.

I made this function to speed up WiFi. However, I encountered a bug with
the winc.send() method. It appears to zero the bytes it sends. I didn't
debug further except to verify that the image data became zero after
calling send.
2016-04-23 16:37:21 -04:00
Kwabena W. Agyeman
b534dc6ffc Imlib cleanup
*Changed subimg to copy.
*Made blend work the same way as all our other double image argument
functions.
*Changed bilt to replace (the name of bilt is way to esoteric). Replace
gives you the basic assignment op.
* Removed scale/sacled. I removed this code because we don't want to
encourage people to scale things and allocate additional images in
memory. I decided to keep copy() for completeness sakes... but, I don't
see anyone using it. (By completeness sakes I mean that we now have the
assignment op, copy op, etc. for an image object).
* Removed rainbow. This feature is built into the FIR module now.

Moving on, compress needs to be renamed to compressed and a new compress
function will need to be added.

The compress() function will compress the image (or frame buffer, etc)
and not return a new object. The compressed() function will return a new
object and not compress the original image.

The compress function will make it easier for users to compress images
once they are done working on them before sending the image some where.
I don't see compressed() being used much then after adding the
compress() function. Since the compress() function won't use up heap
space this makes it very good.
2016-04-19 21:42:56 -04:00
Kwabena W. Agyeman
16daeb83a2 Fixed blob code.
Removed micropython code from the image libary. Also, blobs are now 10
tuple values by default now. The multilist thing has been removed from
blobs and it will return just a list of blobs instead of a tree of
lists.

Filter functions still work too.
2016-04-13 23:16:51 -04:00
Kwabena W. Agyeman
9e5d379c18 Remove old code.
Pixels, centroid, and orientation are calculated in the blob code now.
As for threshold, it is no longer needed (plus, it required storing a
secondary image in RAM which isn't really something we can handle).
2016-04-09 19:32:14 -04:00
Kwabena W. Agyeman
d1ff36602a New blob code.
Blob tracking has now been updated to work without requiring prior
segmentation of the image. You can still run it on a segmented image,
but, that is not needed anymore.

Use the copy color feature of the OpenMV IDE to get a color in the
image. Once you have that you can then pass the color to find_blobs which
will output a tuple of lists of blobs for each color. By default, all
blobs less than 1/1000th of the image are filtered out, however, you can
add a custom filter function which gets the image and the blob about to
be added to the list and you can decide to filter it or not.

For marker tracking, we now have a function called find markers which
basically merges all the blobs found by find blobs into one list of
blobs. Each new blob will have a color code value which will tell you
what colors are part of that blob. We support tracking up to 30 unique
colors this way.
2016-04-09 11:43:35 -04:00
Kwabena W. Agyeman
401b7b72a8 Added mean, median, and mode filters.
Mean filter -> Fast and easy to use. This will likely be the only filter
that gets alot of action on the M4.

Median filter -> Works really well, but, slow. On grayscale at 160x120
you can get also 10 FPS with it for a 3x3 kernel. That said, it's still
slow. Also, the code only works for 3x3 and 5x5 kernels.

About the previous histogram filter... technically, that filter should be
better. However, it suffers from a startup cost. The operation of finding
the median point in the histogram costs too much to compute. This is
what causes it to be slow. On very large kernels it will be faster than
the sorting median alrogithm I put up... but, large kernels will be too
slow for anyone to use anyway. The paper Ibrahim linked to about it
showed it being used for like 7x7 kernels and up... so, I think the
researcher who thought of the idea was really thinking about the
algorithm for large kernels.

Mode filter -> Works great on grayscale. Not so much on color. I think it
needs to be run on the LAB color space instead of the RGB color space. I
say this because it causes pretty strong artifacts around edges. When we
get more flash we'll be able to have a reverse lookup table for LAB to
make the mode filter better. Until then...
2016-04-04 20:04:50 -04:00
Kwabena W. Agyeman
978b4c12df Add Midpoint filter.
Has a bias value that allows you to control if its really a midpoint,
min, max filter, or something inbetween. Run at 160x120 or lower. 320x240
is slow (seems to be the case for all convoltions at that res).
2016-03-25 21:26:20 -04:00
Kwabena W. Agyeman
0ded05e333 Add color functions.
Now you can convert from rgb to lab/grayscale and vice-versa. Without
this functionality it would be hard to deal with moving between RGB and
LAB.
2016-03-03 23:48:04 -05:00
Kwabena W. Agyeman
488253a8b0 Add statistics function.
You can now get the color stats for an area in the image. The stats
function returns the mean, median, mode, min, max, st_dev,
lower_quartile, and upper_quartile.

This function allows you to automate binary and threshold functions
based on what's in the iamge.
2016-03-01 21:43:52 -05:00
Kwabena W. Agyeman
6ed08213b5 Fix unintialized error.
If the rect was not intersecting these functions would have returned bad
values.
2016-02-29 21:31:59 -05:00
Kwabena W. Agyeman
98f4dde21f Add new morph function.
The morph function lets you convolve the image with a kernel. It's
decently fast right now. But, in the future we'll have to optimize it by
a lot (unrolling loops, using SIMD instructions, etc.).

Anyway, along with morph I added an edge detection test script showing
how you can use a high pass filter on an image to get all the edges in
it. This is not as good as canny edge dection... but, it's about the
same and fast enough.

We'll need a Hough Transform system in the future to make edge dection
useful. Not sure how that will be implemented... so, that's going to be
far away for now.
2016-02-29 18:04:45 -05:00
Kwabena W. Agyeman
fb8b357c24 Dilate and errode working.
The old code did not actually implement the errode anhd dilate kernels
correctly. However, it migh have been a little faster because it avoided
the boundary problem.

In the future we can optimize all the kernel code to have different loops
for doing the edges of image versus the center. But, for now, this is
good enough. QVGA color tracking with kernels will be slow, but, the
speed can be improved with QQVGA resolution. Using a 3x3 kernel is
plenty fast. Larger ones are slower.

I also added the ability for you to set the threshold for erode and
dialte. This lets you make the kenrel a little bit smarter so that it
won't errode or dilate a pixel unless the threshold is met. Meaning,
you'll be able to use erode to erode an image down to 1 pixel wide
lines.
2016-02-28 16:27:49 -05:00
iabdalkader
7e1a4169a7 Add match_descriptor function.
* A single function to match LBP/FREAK descriptors.
2016-02-28 03:39:13 +02:00
iabdalkader
154cb5be69 Change descriptor functions to accept file pointer. 2016-02-28 03:22:07 +02:00
iabdalkader
acafef5207 Revert HaarCascade.
* HaarCascade doesn't really fit into generic descriptor functions.
2016-02-28 02:37:35 +02:00
iabdalkader
67acf7188c Use one load/save function for all descriptors. 2016-02-28 01:38:24 +02:00
Kwabena W. Agyeman
4ed49082a1 Background Subtraction is working!!!
Woot, all the effort to make it so you can manipulate the image buffer
with an image off disk works!

Try out the motion_detection script.
2016-02-27 11:58:37 -05:00
Kwabena W. Agyeman
1121a6f7df Fixed save image.
It now figures out the file type from the file extension. If no file
extension is given it just saves the file as BMP if its not a JPEG image
or JPEG if it's a JPEG image. If you specify an extension and the file is
not of that type then it will give you an error.

The new test_save.py should run until you reach the JPEG image part
where it quits due to lack of JPEG support natively on OV7725 boards.
Maybe JPEG mode should be supoorted by just compressing pictures?
2016-02-26 22:00:04 -05:00
iabdalkader
2b27d1542f Add save LBP descriptor. 2016-02-26 23:12:15 +02:00
Kwabena W. Agyeman
ac3d1e4373 Add BMP/PNM/JPEG image file loading and saving.
There's not a lot of actual functionality changes from the last commit.
However, switching the basic wrapper library to just long_jump on
failure and moving all the state info to structs required changes to all
the base functions in the last commit. The rest of the changes are to
link in the new functionality and to get the code to compile (usbdbg.c
edits).

Next I'll work on a function which abstracts the problem of opening an
image up and executing a line by line function op on it. I already
worked the code out for that. But, it's not in this commit to keep
things streamlined.
2016-02-25 22:26:56 -05:00
iabdalkader
074cf9d5e4 Add pointer to matching keypoint to kp_t struct.
* This way we don't need to allocate the array of matching keypoints
and risk running out of memory due to fragmentation. So all or nothing.
2016-02-26 01:44:23 +02:00
iabdalkader
5ff5419bf1 Return empty list if no blobs were found.
* Fixes #81
2016-02-26 00:47:31 +02:00
Kwabena W. Agyeman
d8ac8f9408 Fix swap bug.
The code clearly did not swap mins and maxes.
2016-02-24 19:07:57 -05:00
iabdalkader
4d7db778fb Remove angle from keypoint.
* Not really used right now and saves 4 bytes per keypoint.
2016-02-23 20:43:33 +02:00
iabdalkader
3a747ef952 Use arrays in FAST/FREAK keypoints.
* Using arrays for FAST/FREAK keypoints, this saves some memory
allocated for intermediate data.
2016-02-23 18:19:49 +02:00
iabdalkader
7a22cb3e5c Extract keypoints in one step.
* Make find_keypoints extract FAST keypoints.
2016-02-23 00:55:54 +02:00
iabdalkader
93d3885a3c Set keypoints threshold range between 0 and 100. 2016-02-22 20:31:24 +02:00
iabdalkader
9d02e2a42a Make match_lbp accept roi and extract second LBP. 2016-02-22 19:41:16 +02:00
iabdalkader
473b8025bf Fix assertion in find_features. 2016-02-22 19:39:26 +02:00
iabdalkader
015181588a Fix assertion in find_features. 2016-02-22 19:35:11 +02:00
iabdalkader
ddcb170af0 Cleanup py_image.c
* Code cleanups in py_image.c
2016-02-22 19:17:14 +02:00
iabdalkader
124a31772c Rename helper functions. 2016-02-22 18:47:35 +02:00
iabdalkader
5860695f5d Move helper functions to new files. 2016-02-22 18:41:50 +02:00
iabdalkader
0f48c12a89 Replace all mp_map_lookup()s with helper functions. 2016-02-22 18:35:00 +02:00
iabdalkader
93dc73c7f2 Fix arg to get_rectangle_kw. 2016-02-22 18:00:20 +02:00
iabdalkader
4c63721efa Use default roi when calling save_image 2016-02-22 17:55:26 +02:00
iabdalkader
4e5b200bdf Make keypoints_match return the % of matching kpts.
* Change keypoints_match to return the percentage of matching keypoints.
2016-02-22 03:31:15 +02:00
iabdalkader
032a6e3e4d Make Haar detector work on ROIs. 2016-02-21 23:01:34 +02:00
iabdalkader
50e53c91bc Change Iris detector to work on a single region.
* This allows the detector to work on ROIs detected by the eye Haar
  cascade, which improves the accuracy and speed of the detection.
2016-02-21 20:38:01 +02:00
Kwabena W. Agyeman
c3cfb117d0 Add frame differencing functions.
The negate function gives you the ability to negate an image before
running difference on it. The difference function will subtract two images
from each other and return the abs() of the result.

I believe it would have been optimal to work on the RGB565 image in the
LAB color space. However, since we don't have an inverse LAB lut this is
not possible. If we could replace LAB with YUV then that would free up
space to have an inverse YUV table (YUV->RGB).
2016-02-20 20:29:19 -05:00
Kwabena W. Agyeman
88d9c02a1b Draw keypoints now accepts lists.
Made draw keypoints accept lists of (x, y, angle) tuples. I did this so
it could be used to show object rotation easily.
2016-02-20 16:04:59 -05:00
Kwabena W. Agyeman
0606f5be44 Added binary image functions.
Pixels, centroid, orientation, along with the basic binary tool kit
functions like and/or/xor.
2016-02-20 11:46:26 -05:00
Kwabena W. Agyeman
b01adfee26 Fixed up drawing code and scripts along with drawing code.
Set pixel works too now.
2016-02-19 22:55:50 -05:00
Kwabena W. Agyeman
a035aae493 Fixed set pixel. 2016-02-19 21:05:02 -05:00
iabdalkader
8d47b7b9b2 Add helper functions to lookup color and int. 2016-02-20 01:24:29 +02:00
Kwabena W. Agyeman
bcd5151412 New drawing functions.
All the drawing functions have been updated to handle automatic clipping
when drawing offscren and work with both grayscale and RGB565.
Additionally, all functions now accept color arguments.

I've also updated the example scripts with the new functions and tested
them out to make sure they work.

Additionally, I wrote a test suite for the drawing functions to make
sure they work.
2016-02-18 22:40:12 -05:00
Kwabena W. Agyeman
f9ae24f3a0 Reverted commands back to old argument format. 2016-02-17 23:50:08 -05:00
Kwabena W. Agyeman
dd6a322646 Added basic image querying functions.
Now you can get the width/height/format along with size. Additionally, I
fixed up get and set pixel.
2016-02-17 23:04:23 -05:00
iabdalkader
31679cab9a Allow Haar detector to accept ROIs. 2016-02-17 22:36:57 +02:00
iabdalkader
d3d7e5dc39 Use typdef's for sensor enum and structs. 2016-02-17 19:46:45 +02:00
Ibrahim Abd Elkader
020ed9369a Merge pull request #63 from kwagyeman/master
Fixed up array functions.
2016-02-15 02:45:11 +02:00
Kwabena W. Agyeman
84a964f930 Fixed up array functions.
There were a lot of missing features in the array module. I added
quicksort based on the MP sort function and I expanded the array code so
you can do stuff like take() which lets you get an object from an array
and easily put it into another array.

I also fixed the "struct array" problems in the code. Anonymous structs
have to go.
2016-02-14 19:29:34 -05:00
iabdalkader
46d91cc95a VJ: Use a scanning step proportional to scale. 2016-02-15 00:58:17 +02:00
iabdalkader
74d084ee6b Add frame size check to keypoints 2016-02-09 01:05:34 +02:00
iabdalkader
69cd07e923 Add sanity checks and meaningful error messages. 2016-02-07 02:34:47 +02:00
iabdalkader
8fabc9b35a Fix image module globals_dict_table 2015-09-22 02:27:51 +02:00
iabdalkader
d031ea87f1 Implement set_pixel 2015-08-20 16:25:37 +02:00
iabdalkader
eb29fc8894 Add sanity checks to draw_string 2015-08-13 23:15:35 +02:00
iabdalkader
54288c5351 Add image module
* Move Image class and misc functions to image module
2015-08-09 13:00:06 +02:00
iabdalkader
856938fea5 Add image get/set pixel 2015-07-31 14:13:09 +02:00
iabdalkader
269345303b Add image subscr 2015-07-31 12:37:45 +02:00
iabdalkader
f34b07f015 Update print function 2015-07-18 07:05:13 +02:00
iabdalkader
765632af91 Check number of stages when loading cascade 2015-07-10 04:10:03 +02:00
iabdalkader
e273e43961 Add stages kw arg to load cascade function 2015-07-10 02:57:30 +02:00
iabdalkader
e00d92f6f7 Fix find_features
* Add all objects to returned list.
2015-07-10 01:36:26 +02:00
iabdalkader
9b068dd992 Add extern ffs_strerror 2015-04-25 23:06:36 +03:00
iabdalkader
ef9bf26981 Add Eye Detector 2014-10-25 15:33:02 +02:00
iabdalkader
cf92de7c8a Modify LBP to use a cascade 2014-10-21 16:51:07 +02:00
iabdalkader
a2780e5a5a Add invert,binary 2014-10-21 16:47:00 +02:00
iabdalkader
90309715c9 Pass RGB to image_threshold and convert to LAB 2014-09-28 16:40:06 +02:00
iabdalkader
ce3d435137 Add load_lbp 2014-09-24 22:25:14 +02:00
iabdalkader
65cd8a133a Update license
* Switch to MIT
* Add license notice to source files
2014-09-20 05:09:52 +02:00
iabdalkader
5f51438029 Add LBP 2014-09-20 02:02:22 +02:00
iabdalkader
8854f0a9d5 Add JPEG encoder 2014-09-17 21:39:19 +02:00
iabdalkader
dcd65daee5 Add threshold, scale KW args to VJ detector 2014-09-12 20:53:43 +02:00
iabdalkader
8bfc2c92a9 Add threshold param to haar detector 2014-09-12 14:32:18 +02:00
iabdalkader
918026a22c Use ROI in Keypoint detector 2014-09-12 13:56:08 +02:00
iabdalkader
f8e08b9749 Add draw_line 2014-09-11 07:05:36 +02:00
iabdalkader
b8d989be57 Update MP branch 2014-09-10 23:16:37 +02:00
iabdalkader
c70960d17e Add save descriptor from ROI 2014-09-10 18:59:34 +02:00
iabdalkader
903f756a7c Misc Fixes, add load/save descriptor 2014-09-09 15:07:22 +02:00
iabdalkader
734eca7e97 Add Color to draw_string 2014-09-03 19:16:41 +02:00
iabdalkader
2e81c7a150 Cleanup Haar code 2014-09-03 16:14:17 +02:00
iabdalkader
b2eb44910a Add subimg 2014-09-02 16:29:20 +02:00
iabdalkader
5fdd6e09a3 Add font rendering 2014-09-01 23:43:06 +02:00
iabdalkader
29202f1f99 Add morphological operations, fix threshold 2014-09-01 16:50:58 +02:00
iabdalkader
25abc200f9 Add FAST/FREAK detector
* Remove SURF code and MP functions
* Add FAST/FREAK keypoint extractor/descriptor
* Add FAST/FREAK Python example
2014-08-27 17:34:58 +02:00
iabdalkader
9572faf78f Add scaled function
* Returns new scaled image
2014-08-25 14:32:31 +02:00
iabdalkader
f1861a332a Add scale, blit and blend functions
* Add scale, blit, blend and rainbow
* Update imlib header
* Export new functions to MP
2014-08-18 12:36:47 +02:00
iabdalkader
30169f3aaa Add buffer protocol to image 2014-06-30 03:46:32 +02:00
iabdalkader
f23336e3ae Return the number of SURF matches 2014-06-25 19:50:45 +02:00
iabdalkader
ad65c304dd Fix exceptions 2014-06-19 23:21:04 +02:00
iabdalkader
c1dab26fca Fix more sources to use HAL 2014-06-18 21:20:22 +02:00
iabdalkader
1e4b6fa8fd Update sources to new HAL 2014-06-18 17:28:46 +02:00
iabdalkader
4df970b418 Move files to OMV 2014-06-14 12:28:45 +02:00