Code Monkey home page Code Monkey logo

Comments (5)

saurabheights avatar saurabheights commented on July 26, 2024

Hi tokenrove,
My apologies for the long delay in reply. Have been heavily busy with few exams and office work since last August.

I worked on this issue and used OpenCV to support all Image types which was necessary for our project. While doing so, I redesigned the code for easy readability. The only issue is since we use OpenCV, I completed the code only for IIR Filter. Supporting other two strategies would require more work and may not be possible with OpenCV only.

Albeit, the changes made for improving the code readability really made a difference. So I propose to first apply these changes. If you like the thoughts, I can apply those changes to your original code without removing other strategies. In case if any change is objectionable, do let me know.

Change 1: Moved to C++. OOPs make a good difference in readability. I am not aware of how much it might affect the execution speed. Something you can comment on.

Change 2: Restructure as follows:-
Directory Structure:-
.
├── include
│   ├── BlockMetricsCalculator.h // Abstract class of local metrics calculator. (BMC)
│   ├── BlockMetricsCalculatorIIR.h // IIR implementation
│   ├── DistanceUtils.h // Stores manhattan_distance related methods
│   ├── GlobalMetricsCalculator.h // The name should suffice for its meaning(GMC)
│   ├── ImageBlurDetector.h // The top layer class which encapsulates BMC and GMC.
│   ├── ImageData.h // Stores all data - input image, intermediate processing resuts, final output
│   ├── ImageUtils.h // For any additional helper methods
│   └── config.h // For configuration.
├── makefile
└── src
├── BlockMetricsCalculatorIIR.cpp
├── GlobalMetricsCalculator.cpp
├── ImageBlurDetector.cpp
├── ImageData.cpp
├── ImageUtils.cpp
└── main.cpp

Some more info: -

main.cpp: creates ImageBlurDetector class object, parses options and sets their value in config.h. Finally, it calls ImageBlurDetector to compute sharpness.

ImageBlurDetector:- Stores current strategy type(enum StrategyType { IIR_FILTER, TONG_LI_ZHANG_ZHANG, MARICHAL_MA_ZHANG }; in config.h), creates corresponding LocalBlurDetector object for the strategy and GlobalBlurDetector.

GlobalBlurDetector: Concrete class to compute Image Global metrics by reading data from ImageData object and making decisions.

BlockMetricsCalculator: - An abstract class which has a method computeLocalMetrics. This method takes an ImageData object, computes Local Sharpness Information and stores it back in ImageData.

BlockMetricsCalculatorIIR: - Concrete implementation of BlockMetricsCalculator for IIR method.

ImageData:- // Stores Image specific data in ImageData class, such as Mat(opencv holder for image) and additional objects of related classes such as - RuleOfThird, FiguresOfMerit, BlockMetrics class. I stored all these other classes in ImageData but they can be in their own separate files.

+Whole Lotta Love, err, I mean comments. I'm pretty sure any newbie would love these changes, but heavy reduction in the speed might not be well taken by users.

from blur-detection.

tokenrove avatar tokenrove commented on July 26, 2024

Thanks for all the thoughtful comments!

I think that if you are considering porting the code to C++, you should fork this project. You have my blessing to do so, but I will not be maintaining this code in C++.

I actually did give a thought to porting this code to Rust, though, which I feel would be a better option going forward. (Also, the last time you poked me about this project, I made some plans for refactoring the code into a useful command-line utility, but never got back to it.)

I might get around to doing that at some point, but in the mean time, I think it's always whoever's writing code can write the rules. If you do fork and the project reaches a better level of maturity, I would be happy to update the README on this project to point newcomers to your fork. (which shouldn't be hard; as you know, this is a piece of code extracted from a project I worked on years ago (at least 7 years ago, I think), and although I appreciate the continuing interest in it I haven't been very active in doing much with it).

from blur-detection.

saurabheights avatar saurabheights commented on July 26, 2024

Hi tokenrove,
C++ is not a necessary option for me. I can ignore it and opt for struct(closest brother to classes). Most of the work is done from my end, and some effort would be needed only in adhering to C and making commits of atomic logical changes for easy PR. If you don't mind, I can give a small PR with a few commits to start. If you think the improvements are worth it, I can go ahead with that. Otherwise, forking would do. Both options require equivalent effort, but the only downside is ending up with two parallel repositories and would require double maintenance down the road. Please let me know whichever option you find more appropriate and I can take that turn.

Just my 2 cents, but such improvement on this project can very well smoothen the way for others with similar interests to dive in this work.

P.S. - Thanks for the "Rush" comment. It looks like a really good language.

from blur-detection.

zhcv avatar zhcv commented on July 26, 2024

@saurabheights , Hi saurabheights, have you moved this repo to C++?
I am instreated in opencv version.

from blur-detection.

saurabheights avatar saurabheights commented on July 26, 2024

@zhcv - I had dropped in the middle as I left my job for MS. You can reach me, email id add at my page-bio. tokenrove - If you are reading this, apologies for unnecessary spam comment.

from blur-detection.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.