{"id":19473293,"url":"https://github.com/xinario/defocus_segmentation","last_synced_at":"2025-06-18T11:39:50.256Z","repository":{"id":112869362,"uuid":"70090465","full_name":"xinario/defocus_segmentation","owner":"xinario","description":"LBP-based segmentation of defocus blur","archived":false,"fork":false,"pushed_at":"2018-08-18T17:43:41.000Z","size":2222,"stargazers_count":65,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-25T15:36:26.416Z","etag":null,"topics":["blur-detection","computer-vision","defocus-blur","defocus-estimation","defocus-map","defocus-map-estimation","defocus-segmentation","lbp","local-binary-patterns","low-depth-of-field","markov-random-field","out-of-focus","segmentation","sharpness"],"latest_commit_sha":null,"homepage":"","language":"Matlab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xinario.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-05T19:07:09.000Z","updated_at":"2025-01-22T15:42:38.000Z","dependencies_parsed_at":"2023-04-10T18:30:46.378Z","dependency_job_id":null,"html_url":"https://github.com/xinario/defocus_segmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xinario/defocus_segmentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xinario%2Fdefocus_segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xinario%2Fdefocus_segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xinario%2Fdefocus_segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xinario%2Fdefocus_segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xinario","download_url":"https://codeload.github.com/xinario/defocus_segmentation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xinario%2Fdefocus_segmentation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260546229,"owners_count":23025900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blur-detection","computer-vision","defocus-blur","defocus-estimation","defocus-map","defocus-map-estimation","defocus-segmentation","lbp","local-binary-patterns","low-depth-of-field","markov-random-field","out-of-focus","segmentation","sharpness"],"created_at":"2024-11-10T19:18:00.552Z","updated_at":"2025-06-18T11:39:45.242Z","avatar_url":"https://github.com/xinario.png","language":"Matlab","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src='./images/video_exampe.gif' align=\"right\" width=900\u003e\r\n\u003cbr\u003e\r\n\r\n# LBP-Based Segmentation of Defocus Blur\r\n\r\n\r\n\r\n\r\n## Update2:\r\nAdd a python implementation to compute the sharpness metric.\r\n\r\n## Update1:\r\nThe blur maps for the 1000 images in the [blur segmentation dataset](http://www.cse.cuhk.edu.hk/%7Eleojia/projects/dblurdetect/dataset.html) produced by our algorithm can be found [here](https://1drv.ms/u/s!Aj4IQl4ug0_9hEANDaY7WjuOQkxW) for easy comparison.\r\n\r\n##\r\nThis repo provides the code to reproduce our defocus segmentaion results  in our [paper](https://ieeexplore.ieee.org/abstract/document/7403985/).\r\n\u003cimg src=\"./images/figure1.png\" width=\"900px\"/\u003e\r\n\r\n## How to use\r\n\r\n### Prerequistites\r\n- Matlab 2016a\r\n\r\nIf you want to try out the python script, you need\r\n\r\n- Python 3\r\n- Opencv 3 (pip install opencv-python)\r\n\r\n### Getting Started\r\n- Clone this repo:\r\n```bash\r\ngit clone git@github.com:xinario/defocus_segmentation.git\r\n```\r\n\r\n- In Matlab, change your project directiory to \u003cyour download path\\\u003e/defocus_segmentation then run demo.m\r\n\r\n- Note that matlab implementation was used by default to compute the proposed sharpness metric. But you can also switch to .mex code to gain some speed boost. The sharpness metric implementation in .mex code was based on integral image and can run in real time on a single core cpu.\r\n\r\n```\r\nCompute the LBP-based sharpness measure using the mex version.\r\n\r\n1. Install [mexopencv](https://github.com/kyamagu/mexopencv)\r\n\r\n2. Copy lbpSharpness.cpp to \u003cyour mexopencv folder\u003e/src/+cv \r\n\r\n3. Run mexopencv.make() in Matlab command line to compile the provided function.\r\n\r\n4. Comment out line 14 and uncomment line 18, 19 in localSharpScoreLBP.m, then you are good to go.\r\n\r\nAll the results reported in the paper were produced by the mex verison of LBP-based sharpness.\r\n```\r\n\r\n- To use python script\r\n```\r\npython lbpSharpness.py --input ./images/out_of_focus0080.JPG\r\n```\r\n\r\n### Citations\r\nIf you find it useful and are using the code/model/dataset provided here in a publication, please cite our paper:\r\n\r\nYi, Xin, and Mark Eramian. \"LBP-based segmentation of defocus blur.\" IEEE transactions on image processing 25.4 (2016): 1626-1638.\r\n\r\n### Acknowlegements\r\nThe alpha matting code comes from Levin, 2006:\r\n\r\n\u003eA. Levin D. Lischinski and Y. Weiss. *A Closed Form Solution to Natural Image Matting*. \r\nIEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2006, New York.\r\n\r\nThe multi-scale inference code was adopted form Jianping Shi, 2014:\r\n\r\n\u003eJianping Shi, Li Xu, Jiaya Jia. *Discriminative Blur Detection Features*.\r\nIEEE Conference on Computer Vision and Pattern Recognition, 2014. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxinario%2Fdefocus_segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxinario%2Fdefocus_segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxinario%2Fdefocus_segmentation/lists"}