Commit Graph

1009 Commits

Author SHA1 Message Date
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
iabdalkader
04a2e89fd5 Optimize JPEG stack usage 2016-02-18 17:55:45 +02:00
Ibrahim Abd Elkader
c771793ac9 Merge pull request #70 from kwagyeman/master
Added new image querying functions.
2016-02-18 10:33:05 +02: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
7f9e95fdd5 Add enable/disable JPEG to preferences dialog. 2016-02-18 05:10:10 +02:00
iabdalkader
5aa3555a36 Add enable/disable JPEG to USB commands. 2016-02-18 04:12:53 +02:00
iabdalkader
da15b6a915 * Allow fb compression to be enabled/disabled.
* This allows reading RGB images on PC if needed.
2016-02-18 04:01:41 +02:00
iabdalkader
8fd89db5fe Add Hardware/Software JPEG flags to sensor flags.
* Not used right now.
2016-02-18 03:26:41 +02:00
iabdalkader
31679cab9a Allow Haar detector to accept ROIs. 2016-02-17 22:36:57 +02:00
iabdalkader
6b52c82e39 Add find face+eyes example script 2016-02-17 22:35:29 +02:00
iabdalkader
6b5cdce4aa Update face detection example 2016-02-17 22:09:02 +02:00
iabdalkader
61f98e6c21 Cleanup old integral image code. 2016-02-17 20:34:21 +02:00
iabdalkader
dc86780578 Use FB_PIXELS() to get a pointer to fb pixels. 2016-02-17 20:32:50 +02:00
iabdalkader
6460fefa15 Fix old integral image lookup 2016-02-17 20:32:33 +02:00
iabdalkader
d658608061 Fix FB_PIXELS() macro.
* If bpp > 2 (means JPEG image) return pixels + bpp (bpp stores image size in JPEG mode)
* If bpp <= 2 (means GS or RGB image) return pixels + w * h * bpp.
2016-02-17 20:27:58 +02:00
iabdalkader
d2ac2c63a8 Use fb_alloc to alloc/free integral images. 2016-02-17 20:06:31 +02:00
iabdalkader
c2e6d96c27 Remove unused xalloc include 2016-02-17 20:01:05 +02:00
iabdalkader
d3d7e5dc39 Use typdef's for sensor enum and structs. 2016-02-17 19:46:45 +02:00
iabdalkader
d639df0bfe Cleanup sensor.h comments. 2016-02-17 19:08:56 +02:00
iabdalkader
c809ec1b53 Add comment about cropping. 2016-02-17 18:49:51 +02:00
iabdalkader
33e552b276 Add DMA2D to sthal's Makefile 2016-02-17 18:48:20 +02:00
iabdalkader
5fdaf08cac Increase heap size by 256 bytes. 2016-02-17 18:47:33 +02:00
iabdalkader
c1bf4ad33d Add one pass standard deviation function. 2016-02-17 18:46:46 +02:00
iabdalkader
027641e51e Improved Haar detector.
* Use a scanning factor proportional to the current scale.
* Use the new integral moving window to allow two integral images
  (sum and sum squared) for fast mean, variance and standard deviation.
* Higher FPS and more accurate detection.
2016-02-17 18:43:47 +02:00
iabdalkader
b7b4153367 Add integral moving window.
* A new integral image implementation that uses a moving window.
* Integral image is computed in steps, each shift computes n new lines.
* This only requires (image_width * (feature_height+1) * 4) bytes.
* Allows Haar detector to run on QVGA, and allows a second squared
  integral image for standard deviation calculations.
2016-02-17 18:43:09 +02:00
iabdalkader
c043ebc233 Update qstrs 2016-02-17 18:16:15 +02:00
iabdalkader
0904f0bb6b Fix FB_PIXELS()
* Return fb->pixels+fb->bpp when JPEG is enabled.
2016-02-17 05:28:28 +02:00
iabdalkader
db667c061f Rename fb_stack to fb_alloc and call init0 in main 2016-02-17 05:24:17 +02:00
Ibrahim Abd Elkader
cfa9b6e440 Merge pull request #67 from kwagyeman/master
Add framebuffer alloc functions.
2016-02-17 05:07:34 +02:00
Kwabena W. Agyeman
024b16d475 Added some helper stuff.
The alloc functions allow you to use the framebuffer as a storage space.
It's very simple but effective. You can alloc which puts some memory on a
stack... and then when you're done you can free which pops the stack.
Pops (frees) must be done in reverse order of pushes (allocs).

In general, functions should call the init code before using the stack.
It could be in a bad state.

Also, I added some wrappers for file system functions to make that stuff
easier. This will be used in the future.
2016-02-16 21:31:35 -05:00
Ibrahim Abd Elkader
983f1783e3 Merge pull request #66 from kwagyeman/master
Update lookup tables and scripts.
2016-02-17 03:57:51 +02:00
Kwabena W. Agyeman
88f37014f1 Finished updating tables.
With new RGB565<->RGB888 scaling. This included redoing the LAB/YUV/XYZ
tables. I translated the table gen code to python also and added
comments as to where the math came from.

And yes, I tested and compared the tables to make sure they weren't
borken. The tables are slightly different... but, if look at the
progression of values loosely you'll see the triplets are very close to
each other when doing a compare. This is to be expected given I used a
slightly better scaling algo.
2016-02-16 19:37:19 -05:00
Ibrahim Abd Elkader
e3b76ebabb Merge pull request #65 from kwagyeman/master
* Move image macros to imlib.c.
* Add prefix to image macros.
* Add RGB LUT, and gen_rgb2rgb.py  script.
2016-02-16 17:24:48 +02:00
Kwabena W. Agyeman
6699ea4d0e Added RGB LUT.
And modified the rainbow table so that the RGB888 to RGB565 translation
is done using a rounding technique versus hard floor. This is also used
for the RGB565<->RGB888 LUTs.

Additionally, I added a bunch of stuff to the image library to make
working with images easier. I will using these helpers in the future.

Finally, I cleaned up trailing space in the font stuff (pet peeve).
2016-02-15 22:12:25 -05:00
Ibrahim Abd Elkader
42db630564 Merge pull request #64 from kwagyeman/master
Fixed up point and rect.
2016-02-15 04:58:46 +02:00
Kwabena W. Agyeman
67b9a815b3 Switch int to int16_t. 2016-02-14 21:54:55 -05:00
Kwabena W. Agyeman
0384d43304 Fixed up point and rect.
Point didn't need many changes. However, for rect I made the merge
function alot better so it won't alloc while merging, just free.
Additionally, I added a function to get the intersecting rectangle of an
image. This will be used for all functions that accept a subimg
argument. This function allows the user to basically pass any wild and
crazy rect they want and the function will find the intersecting area (if
it exists) and return just that to operate on. This is good for "do what
I mean" functionality versus "do what I say".
2016-02-14 21:13:55 -05: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
Ibrahim Abd Elkader
d850325de4 Merge pull request #60 from kwagyeman/master
Cleaned up some whitespace and unnecessary header.
2016-02-14 17:02:18 +02:00
Kwabena W. Agyeman
ffaea46159 Removed unneeded headers.
And... added a comment about the implementation being standard.
2016-02-14 09:38:42 -05:00
Kwabena W. Agyeman
c622e05b58 Re-added timeout.
Given how the SCCB won't fail it should really be 0... but, then the
rountines wouldn't return if there was a failure.
2016-02-14 09:27:04 -05:00
iabdalkader
5deaf38a34 Switch to 2x2 (4:2:0) Chroma Subsampling. 2016-02-14 11:20:04 +02:00
iabdalkader
77239a5891 Support 2x1(4:2:2) Chroma subsampling. 2016-02-14 07:34:43 +02:00
Kwabena W. Agyeman
b6eb26d324 Lowered timeout.
It was previous set to 10 seconds... since the timeout is in ms. Now
it's at 1 second. This represents 100 clocks at 100KHz I2c. Also, I
noticed general call mode was being set for the I2C which is not at all
something we want (the ability to address multiple devices at once).

I tested the changes with all my cameras. No problems. This was 4 units
(2 being the original protos).
2016-02-13 23:05:27 -05:00
Kwabena W. Agyeman
abac52534c Reviewed code. No errors. Cleaned up some whitespace and unncessary
header.
2016-02-13 21:55:10 -05:00
iabdalkader
597b9aeba4 Emit proper JPEG headers for grayscale images. 2016-02-14 01:54:19 +02:00
Ibrahim Abd Elkader
21eabc63bf Merge pull request #59 from kwagyeman/master
Made XALLOC better.
2016-02-14 00:59:50 +02:00