Splitting Picture into Quads using Quadtree ? lazarus / 39-Graphics ---------------------------------------------------------------------- Boleeman · 2026-04-06 04:58 Was wondering if anyone has been able to use Lazarus to visually split a loaded picture into Quads using Quadtree (as shown in attachments) ? There are plenty of Python and C++ codes, but nothing much in Lazarus (Pascal) or Delphi. Corpsman had an example of compressing a grayscale bmp image using the Quadtree Algorithm, but I wanted to load a color png and have it dissected into quads using Quadtree. Here are some nice Python implementations: https://github.com/AlexEidt/Quart      (this also has a video at the bottom) https://github.com/fogleman/Quads But how to go about doing it in Lazarus using TBgrabmp? ---------------------------------------------------------------------- Boleeman · 2026-04-12 00:43 Here is a Lazarus quadtree program that uses a set of points. It was made by Corpsman. Still trying the work out how to do it for loaded coloured png images ! ---------------------------------------------------------------------- Dzandaa · 2026-05-22 11:01 Hi Eddie, Try this program. A big thank you to my wife (she's a PH d mathematician) who helped me fix the last bug Lower Threshold = Better Resolution Pan with left button, zoom with the middle button. Just tested on Windows. B-> ---------------------------------------------------------------------- LeP · 2026-05-23 09:52 @DZandaa, thanks for the source. I tried quickly and seems that there some issues about x, y coordinates (may be exchanged) and generate an AV in various point of your source. Try with an image with Height <> Width. I have not time now to debug and report the corrections, but I'll do in the next time. ---------------------------------------------------------------------- Dzandaa · 2026-05-23 10:37 Hi @Lep: Thank  you for testing my program. Effectively, I just tested the algorithm on squares Pictures !!! The x and y of the Double array  are reversed. I corrected that. B-> ---------------------------------------------------------------------- Dzandaa · 2026-05-25 10:38 Hi, Here is a new version showing rectangles boundaries Have a nice day. B-> ---------------------------------------------------------------------- ADMGNS · 2026-06-06 20:44 hello several years ago, i'd studied on quadtree algorithm which was on video codecs, but it was in D7. pls see attachment regs ---------------------------------------------------------------------- Dzandaa · 2026-06-07 10:30 Hi, @ADMGNS : Sorry, I don't use Delphi, just Pascal Lazarus. And the conversion doesn't work well. B-> ---------------------------------------------------------------------- ADMGNS · 2026-06-07 11:16 hello again lazarus conversion plus some minor changes manually, it works minimally now. here is it.. regs ---------------------------------------------------------------------- Dzandaa · 2026-06-07 16:16 Hi, @ADMGNS: It works now, but if I load an image and click cmdColorCount, I have a crash here: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   for k:=0 to nSize1-1 do  begin    c := (p^ shl 8) shr 8; // ie, c := c and $00FFFFFF; // <---- here    inc(hist[c]);     inc(p);  end; Perhaps the size of the picture is too big. Also, you can test with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  for k:=0 to Pred(nSize1) do  I don't know if it is faster. B->