{"id":21189420,"url":"https://github.com/boechat107/imgproc_scripts","last_synced_at":"2025-08-21T19:33:27.281Z","repository":{"id":14700237,"uuid":"17420398","full_name":"boechat107/imgproc_scripts","owner":"boechat107","description":"Miscellaneous image processing scripts","archived":false,"fork":false,"pushed_at":"2016-04-07T09:29:56.000Z","size":102,"stargazers_count":15,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-10-20T18:20:31.014Z","etag":null,"topics":["image-processing","matlab","octave"],"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/boechat107.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}},"created_at":"2014-03-04T22:59:13.000Z","updated_at":"2023-03-27T19:28:23.000Z","dependencies_parsed_at":"2022-09-05T11:50:07.573Z","dependency_job_id":null,"html_url":"https://github.com/boechat107/imgproc_scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fimgproc_scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fimgproc_scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fimgproc_scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fimgproc_scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boechat107","download_url":"https://codeload.github.com/boechat107/imgproc_scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225615275,"owners_count":17496941,"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":["image-processing","matlab","octave"],"created_at":"2024-11-20T18:52:16.105Z","updated_at":"2024-11-20T18:52:16.735Z","avatar_url":"https://github.com/boechat107.png","language":"Matlab","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image processing scripts\n\nOctave or Python scripts to solve some image processing problems. The scripts are\njust a practice to learn some basic techniques or a first and easier implementation \nof more complex ones.\n\nImplemented techniques:\n\n* ellipse detection\n* baseline removal\n* fast inpainting\n\n## Ellipse detection \n\nThe implemented algorithm is based on \n[[1]](http://scholar.google.com/scholar?cluster=3258739622664696123\u0026hl=en\u0026as_sdt=0,5\u0026as_vis=1),\nan efficient application of the classical \n[Hough Transform](http://en.wikipedia.org/wiki/Hough_transform) technique to detect \nellipses on an image. The main problem of the usage of the normal Hough Transform for\nellipse detection is the necessary high dimensional accumulator to store the \nparameters' votes, since the general equation of an ellipse is composed of\n5 variables: the center point [*x0* *y0*], the minor and major half-lengths *a* and\n*b*, and the rotation angle (check this \n[here](http://www.maa.org/external_archive/joma/Volume8/Kalman/General.html)).\nXie's implementation makes some assumptions and can find all parameters with great\naccuracy using just a 1D accumulator. The complexity is\n![O3](http://latex.codecogs.com/gif.latex?O%28n%5E3%29) in the number of nonzero\npixels of the image.\n\nTo test the algorithm, we can run the following code on Octave:\n\n```matlab\noctave:1\u003e img = imread ('resources/ellipse.png');\noctave:2\u003e par = hough_ellipse(img)\npar =\n\n   1.1050e+02   7.4500e+01   8.2514e+01   3.7000e+01   1.8180e-02\n\noctave:3\u003e imshow (img)\noctave:4\u003e hold on\noctave:5\u003e drawEllipse(110.5, 74.5, 82.5, 37, 0)\n```\n\nA window should pop and show a blue ellipse (estimated) over a white one (original).\n\n## Baseline removal \n\nThe implemented algorithm is used to remove baselines of bank checks and can be found\nin \n[[2]](http://www.ee.bgu.ac.il/~dinstein/stip2002/Seminar_papers/Hershkovitz_Extraction%20of%20bankcheck.pdf).\nIt is based on mathematical morphological operations in gray-level and the author claims\nthat it preserves better the differences between the baselines and handwritings and \ngenerates smoother boundaries than binary operations.\n\nThe code here was generalized to be able to remove straight lines in any direction on \ngray scale images.\n\nThe algorithm can be tested using the following lines in Octave:\n\n```matlab \noctave\u003e img = imread('resources/dut.jpg');\noctave\u003e gray = rgb2gray (img);\noctave\u003e h_img = baseline_removal(gray, 20, 3);\noctave\u003e v_img = baseline_removal(gray, 20, 3, 90);\noctave\u003e subplot(1,3,1), imshow(gray)\noctave\u003e subplot(1,3,2), imshow(h_img)\noctave\u003e subplot(1,3,3), imshow(v_img)\n```\n\n## Fast inpainting\n\nThe [*inpainting*](http://www.rabbitmq.com/tutorials/tutorial-two-python.html)\ntechnique aims to reconstruct damaged or missing parts of an image.\nThe implemented technique is described in [3] and seems to be a good start on\nthe field because of its simplicity.\n\nThe script `inpainting_test.m` can be run to see an example.\n\n```matlab\noctave:1\u003e inpainting_test\nwarning: your version of GraphicsMagick limits images to 8 bits per pixel\nElapsed time is 0.0892851 seconds.\n```\n\n![example](https://github.com/boechat107/imgproc_scripts/blob/master/resources/inpaint_ex.png)\n\n[Here](https://sites.google.com/site/rexstribeofimageprocessing/Home/image-inpainting)\nthere are more examples of the usage of this technique.\n\n## References\n\n[1] Y. Xie and Q. Ji, \"A new efficient ellipse detection method\", Pattern Recognition, 2002. Proceedings. 16th, vol. 2, pp. 957–960, 2002.\n\n[2] Ye, X., Cheriet, M., Suen, C., \u0026 Liu, K. (1999). Extraction of bankcheck items by mathematical morphology. International Journal on Document …, 2(2-3), 53–66. doi:10.1007/s100320050037\n\n[3] Oliveira, M., Bowen, B., Richard, M., \u0026 Chang, Y. (2001). Fast digital image inpainting. Appeared in the Proceedings of the International Conference on Visualization, Imaging and Image Processing, (Viip).\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/boechat107/imgproc_scripts/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboechat107%2Fimgproc_scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboechat107%2Fimgproc_scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboechat107%2Fimgproc_scripts/lists"}