Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed incorrect implmentation of image/conv2 and dsp/conv, hardwired network for p_median3x3_f32 #100

Closed
wants to merge 9 commits into from

Conversation

ebadi
Copy link
Contributor

@ebadi ebadi commented Jun 7, 2015

The array is sorted but not used at all, the median function must take the element in the middle of the sorted array.

@ebadi
Copy link
Contributor Author

ebadi commented Jun 7, 2015

It seems that the median function (in math) is implemented incorrectly as the function doesn’t even use the sorted array! (I fixed it just to show the correct implementation) . Any way I replaced it with QuickSelect method instead which is much faster than current method (unnecessarily sorting all elements to find the element in the middle).

For 3×3 median filter (image) I replaced it with hardwired median search described here :
http://users.utcluj.ro/~baruch/resources/Image/xl23_16.pdf

Codes are in public domain and are taken from here :
http://ndevilla.free.fr/median/median/

@6thimage
Copy link
Contributor

6thimage commented Jun 7, 2015

The fix for p_median is a duplicate of #85 and #96

@ebadi ebadi changed the title Fix a problem in median function Superfast (hardwired network) p_median3x3_f32 and quick_select method for p_median Jun 8, 2015
@ebadi ebadi changed the title Superfast (hardwired network) p_median3x3_f32 and quick_select method for p_median Incorrect implmentation of image/conv2 and dsp/conv, superfast (hardwired network) p_median3x3_f32 Jun 13, 2015
@ebadi
Copy link
Contributor Author

ebadi commented Jun 13, 2015

Counter example for each fix is provided using Matlab code (I used FreeMat available here http://freemat.sourceforge.net/ to try them )

image/conv2: returns incorrect values as it doesn't flip the kernel in vertical and horizontal directions, I fixed this major problem and added support for rectangular kernels too.

dsp/conv : this function also doesn't work correctly as it returns an extra item in the beginning of the output and in addition uses uninitialised memory addresses to compute the final result (assumes these memory addresses are zero)

Signed-off-by: Hamid Ebadi <[email protected]>
@ebadi ebadi changed the title Incorrect implmentation of image/conv2 and dsp/conv, superfast (hardwired network) p_median3x3_f32 Fixed incorrect implmentation of image/conv2 and dsp/conv, hardwired network for p_median3x3_f32 Jun 14, 2015
@ebadi
Copy link
Contributor Author

ebadi commented Jun 16, 2015

See the new pull here : #148

@ebadi ebadi closed this Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants