Thread: STL, Queues And Images

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Question STL, Queues And Images

    Hi Uall,

    I am trying to make a queue of raw images, but these is first time i am using STL(C++ Standard Template Library). So i had some question, hope you all might clear it up for me. Do you guys thing that i can make a queue of array with the type and size being (unsigned char buffer[1024*800]), why the array is so big. The reason is i am dealing with images and i have to make queue of images. Please let me know if i can do it or not. If i can, can any of you post a example of it. If not that is fine too. But be sure to leave me suggestion.


    Thank and Smilies
    :confused:

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    yes. the size of a queue is constrained only by memory limitations..
    Code:
    queue <unsigned char> array;
    array.push(3);
    pushes one element onto the queue.
    Code:
    cout << array.pop();
    prints the most recently pushed element and removes it from the queue.

    i'm worried about the time constraints, though. 1024*800 is at least 800,000 operations. it might slow you down. a regular array might be a better answer.

  3. #3
    Unregistered
    Guest
    This is what i have got so far, i am working on it. Do you think this will work. Remember i have to make Queue of Array. So think that way......

    Thanks and Smiles


    Code:
    #include<iostream.h>
    #include<fstream.h>
    #include<string>
    
    #include<queue>
    
    class ImageQueue
    {
    public:
    
    	ImageQueue(){
    	 width = 0;
    	 height = 0;
    	 size = 0;
    	 bitCount = 0;
    	}
    
    
    	~ImageQueue(){
    	 width = 0;
    	 height = 0;
    	 size = 0;
    	 bitCount = 0;
    	}
    
    
    	void setWidth(int value){
    		width = value;
    	}
    
    	void setHeight(int value){
    		height = value;
    	}
    
    	void setSize(int value){
    		size = value;
    	}
    
    	void setBitcount(int value){
    		bitCount = value;
    	}
    
    
    	int getWidth(void){
    		return width;
    	}
    	
    	
    	int getHeight(void){
    		return width;
    	}
    
    	
    	int getSize(void){
    		return width;
    	}
    
    	
    	int getBitcount(void){
    		return width;
    	}
    
    private:
    	int width;
    	int height;
    	int size;
    	int bitCount;
    	unsigned char Frame[1024*700];
    };
    
    int main(void)
    {
    	std::queue< ImageQueue > values;
    	std::string filename = "frame1.raw";
    	ifstream Inputfile;
    	
    	Inputfile.open(filename.c_str(),ios::binary);
    	
    	
    	if(!Inputfile.is_open())
    	{
    		cout<<"Cant Open The File"<<endl;
    		cin.get();
    	}
    	while(Inputfile.eof())
    	{
    		char c = Inputfile.get();
    		cout<<c<<endl;
    		cin.get();
    	}
    	
    
    	return 0;
    }

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Mistake made in Peview Relpy

    I am trying to make queue of raw images, And i am also attaching a raw image with my this relpy. So if anyone have any clue let me know....

Popular pages Recent additions subscribe to a feed