I am trying to use quadtree (4-dimensional tree) to store information in this BMP.
I'm struggling to figure out how to build a tree, given any BMP.
In principle, the structure is such that each sheet is a pixel. Each Node has 4 pointers, each of which points to one of the four remaining quadrants of the image. Thus, each Node divides the current image into 4 parts. By the time you are on the sheet, you are in one specific pixel.
I'm not sure how to go about creating a tree to display a specific image. Assuming the image has dimensions equal to two, what should I do. I understand that a recursive function could probably do it most elegantly, but I'm struggling to figure out how to track where in the image I will be.
This is in C ++, and currently my quadtree.h file contains the root Node *, where Node is defined as a structure with a pixel element and 4 pointers to other nodes. Each internal Node (non leaf node) should contain the average of all 4 RGB values ββto which it leads.
I'm trying to make an algorithm, but I think I might need to include a structure or two in the .h file. Is there a better / cleaner way to solve this problem?
source
share