Basic Dithering/Convert to BW - Printable Version
+- The QB64 Edition (http://www.thejoyfulprogrammer.com/qb64/forum)
+-- Forum: QB64 (/forumdisplay.php?fid=483)
+--- Forum: QB64 Coders Delight (/forumdisplay.php?fid=8)
+---- Forum: Digital Image Processing Filters (/forumdisplay.php?fid=11)
+----- Forum: Dithering (/forumdisplay.php?fid=60)
+----- Thread: Basic Dithering/Convert to BW (/showthread.php?tid=513)
Basic Dithering/Convert to BW - Aureal - 10-04-2016 04:50 PM
This is my simple method to convert an Image to B/W. Can someone help me doing Bayer Dithering?
_FULLSCREEN: _MOUSEHIDE: IF COMMAND$ = "" THEN Parameter$ = "earth.jpg" ELSE Parameter$ = COMMAND$
DIM SHARED VideoWidth: VideoWidth = 800
DIM SHARED VideoHeight: VideoHeight = 600
DIM SHARED PointReturn AS _UNSIGNED LONG
SCREEN _NEWIMAGE(VideoWidth, VideoHeight, 32)
Image = _LOADIMAGE(Parameter$, 32)
_PUTIMAGE (0, 0), Image: SLEEP: RenderDithering
SUB RenderDithering 'Actual Rendering!
x = x + 1
PointReturn = POINT(x, y)
IF PointReturn < 4289243304 THEN PSET (x, y), _RGB32(0, 0, 0) ELSE PSET (x, y), _RGB32(255, 255, 255)
IF x = VideoWidth THEN EXIT DO
IF y = VideoHeight THEN EXIT DO
y = y + 1
x = 0
RE: Basic Dithering/Convert to BW - Waltersmind - 10-05-2016 10:25 PM
That is a really cool threshold demo. Thank you for sharing.
There is a code box feature you can use to place any source code in. This helps in not only viewing the code better since it uses a source code font, but it allows quick and easy selecting of all the code. You can see this feature below.
Since you did not share any images to use with the source code, I had to use my own, which is fine, but many people will not take the time or effort to try out a demo, which is sad, but I have seen it.
I found the perfect image to us in your demo that contains lighting from light to dark. It is an photo of a cat I had a few years back until she passed away. This was one of the best pictures I had taken of her. Her name was Halo.
I decided to share my picture so it could be used in your demo, and since I did, I went a step further. I modified your demo a slight bit to show how rotating through some threshold values would look animated.
You can download the source code and photo below in the *.ZIP file, but here is the modified code so you can quickly see it with downloading it first:
Code Snippet: [Select]
Here is a screenshot of the DEMO:
As for the Bayer dithering... Well... That will be for another thread all together.
The Joyful Programmer
RE: Basic Dithering/Convert to BW - STxAxTIC - 10-06-2016 07:15 PM
Say Aureal, are you the same guy who made an interpreter for, what was it? O2 BASIC? RubenDev perhaps? Just checking.
RE: Basic Dithering/Convert to BW - Aurel - 05-01-2017 02:56 PM
NO i think is not ,My nick is Aurel
and i am aouthor of AurelBasic and Ruben Interpreter.
I also remember your attempt to interpreter.
Nice to find this topic and you