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

Add direct binary search (DBS) #25

Open
adrhill opened this issue Jul 11, 2021 · 6 comments
Open

Add direct binary search (DBS) #25

adrhill opened this issue Jul 11, 2021 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@adrhill
Copy link
Collaborator

adrhill commented Jul 11, 2021

As described in [1] and Chapter 7 of Modern Digital Halftoning by Lau & Are.

[1] Analoui, M.; Allebach, J.P. (February 1992). "Model-based Halftoning by Direct Binary Search". Proceedings of the 1992 SPIE/IS&T Symposium on Electronic Imaging Science and Technology. 1666: 9–14.

@adrhill adrhill added the enhancement New feature or request label Jul 11, 2021
@Jay-sanjay
Copy link

what's the issue sir

@ashwanirathee
Copy link
Member

More reference: http://caca.zoy.org/study/part4.html

@adrhill adrhill added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 7, 2023
@adrhill
Copy link
Collaborator Author

adrhill commented Aug 7, 2023

Hi @Jay-sanjay,

together with issues #24 and #26, this issue tracks a dithering algorithm that would be nice to have in DitherPunk.jl.

For a list of already implemented methods, refer to the list in the README and the gallery.

If you are looking to contribute the direct binary search algorithm to DitherPunk.jl, you only need to create an algorithm struct that is a subtype of AbstractDither, a function binarydither! and optionally a function colordither. The source code of ClosestColor is probably the best entry point into the code.

I would be more than glad to assist you if you are interested in contributing! :)

@Jay-sanjay
Copy link

@adrhill Sir, while implementing the binarydither! ( ) function should it return 1 if pixel value in the input image is greater than the threshold and 0 in the else case . What must be done could you please assist me further !

@adrhill
Copy link
Collaborator Author

adrhill commented Aug 31, 2023

Hi @Jay-sanjay, functions binarydither! are supposed to modify the argument output in-place.
In-place modifying functions in Julia are usually indicated by an exclamation point ! in their name by convention.

Writing a 1 into out will turn that pixel white.
Writing a 0 into out will turn that pixel black.

I hope the following screenshot helps to illustrate this:

image

@Jay-sanjay
Copy link

Jay-sanjay commented Aug 31, 2023

Yes , Sir should the algorithm be something like :
binarydither! function should iterate over each pixel in the input image and assign the output pixel to the closest color in the color palette and the distances between the two colors measured via theirdiif. in grayscale values if
it is greater than thresold , return 1
else return 0.

is it enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants