图像的四叉树广度优先存储

该博客介绍了一种使用四叉树对图像进行广度优先存储的方法,通过创建和处理堆节点来构建四叉树。文章详细展示了如何检查输入图像的合法性,并提供了将二维ASCII艺术图片映射为一维数组,然后创建四叉树并获取处理结果的函数。
摘要由CSDN通过智能技术生成
typedef struct quardresult_t
{
    int seq;
    char val;
}QuadResult;

#include <stdlib.h>
#include <iostream>
#include <vector>
#include<malloc.h>  
#include<stdio.h>
#include <string.h>
#include <queue>
#include <math.h>
using namespace std;
/* 象限 */
typedef enum
{
    TOP_RIGHT = 0,
    TOP_LEFT,
    BOTTOM_LEFT,
    BOTTOM_RIGHT
}BLOCKNAME;

typedef  unsigned char IMGTYPE;
class HeapNode
{
public:
    HeapNode(IMGTYPE* image,int imageSize):_image(image),_imageSize(imageSize)
    {
        //cout<<"constructor"<<endl;
    }
    /*~HeapNode()
    {
        if(_image!=NULL)
        {
            delete _image;
            _image=NULL;
        }
    }*/
    IMGTYPE* _image;
    int _imageSize;
    bool isLeaf()
    {
        if(_imageSize==1) return true;
        char pivot=_image[0];
        bool flag=true;
        for(int i=0;i<(_imageSize*_ima
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值