当前位置: 首页>>代码示例>>C++>>正文


C++ MyImage::getImageData方法代码示例

本文整理汇总了C++中MyImage::getImageData方法的典型用法代码示例。如果您正苦于以下问题:C++ MyImage::getImageData方法的具体用法?C++ MyImage::getImageData怎么用?C++ MyImage::getImageData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyImage的用法示例。


在下文中一共展示了MyImage::getImageData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendDecodeSequentialMode

void sendDecodeSequentialMode(void* storage){
	TwoByte* st = (TwoByte*) storage;

	int h = workingImage.getHeight();
	int w = workingImage.getWidth();
										
	Byte* imgd = workingImage.getImageData();
	
	unsigned int q = 1<<quantizationLevel;

	TwoByte* tblock = new TwoByte[192];
	Byte* idctblock = new Byte[192];

	for(int y = 0; y < h; y+=8){
		for(int x = 0; x < w; x+=8){
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int src = ((y + yy)*w + (x + xx))*3;
					int dest = (yy*8 + xx)*3;
					tblock[dest] = st[src]*q;
					tblock[dest + 1] = st[src + 1]*q;  
					tblock[dest + 2] = st[src + 2]*q;  
				}
			}

			doIDCT(tblock, idctblock);
			
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int dest = ((y + yy)*w + (x + xx))*3;
					int src = (yy*8 + xx)*3;
					imgd[dest]  = idctblock[src];					
					imgd[dest + 1] = idctblock[src + 1];					
					imgd[dest + 2] = idctblock[src + 2];  					
				}
			}
			drawImage(&workingImage, nextStart);
			Sleep(latency);
		}
	}
		
	delete[] tblock;
	delete[] idctblock;
	MessageBox(NULL, "DECODING DONE", "Status", NULL);
}
开发者ID:atulkum,项目名称:imageProcessing,代码行数:45,代码来源:Image.cpp

示例2: decodeProgressiveModeSpectralSelection

void decodeProgressiveModeSpectralSelection(TwoByte* st){
	int h = workingImage.getHeight();
	int w = workingImage.getWidth();
										
	Byte* imgd = workingImage.getImageData();
	
	unsigned int q = 1<<quantizationLevel;

	TwoByte* tblock = new TwoByte[192];
	Byte* idctblock = new Byte[192];

	memset(tblock, 0x00, sizeof(TwoByte)*192);
	memset(idctblock, 0x00, sizeof(Byte)*192);

	for(int y = 0; y < h; y+=8){
		for(int x = 0; x < w; x+=8){
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int src = ((y + yy)*w + (x + xx))*3;
					int dest = (yy*8 + xx)*3;
					tblock[dest] = st[src]*q;
					tblock[dest + 1] = st[src + 1]*q;  
					tblock[dest + 2] = st[src + 2]*q;  
				}
			}

			doIDCT(tblock, idctblock);
			
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int dest = ((y + yy)*w + (x + xx))*3;
					int src = (yy*8 + xx)*3;
					imgd[dest]  = idctblock[src];					
					imgd[dest + 1] = idctblock[src + 1];					
					imgd[dest + 2] = idctblock[src + 2];  					
				}
			}
		}
	}
		
	delete[] tblock;
	delete[] idctblock;
	drawImage(&workingImage, nextStart);		
}
开发者ID:atulkum,项目名称:imageProcessing,代码行数:44,代码来源:Image.cpp

示例3: encode

void encode(TwoByte *store){
	int h = originalImage.getHeight();
	int w = originalImage.getWidth();										
	Byte* imgd = originalImage.getImageData();	

	Byte* tblock = new Byte[192];
	double* dctblock = new double[192];
	
	memset(tblock, 0x00, sizeof(Byte)*192);
	memset(dctblock, 0x00, sizeof(double)*192);
	
	unsigned int  q = 1<<quantizationLevel;

	for(int y = 0; y < h; y+=8){
		for(int x = 0; x < w; x+=8){
			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int src = ((y+yy)*w + (x + xx))*3;
					int dest = (yy*8 + xx)*3;
					tblock[dest] = imgd[src];
					tblock[dest + 1] = imgd[src + 1];  
					tblock[dest + 2] = imgd[src + 2];  
				}
			}

			doDCT(tblock, dctblock);			

			for(int yy= 0; yy < 8; yy++){
				for(int xx = 0; xx < 8; xx++){
					int dest = ((y+yy)*w + (x + xx))*3;
					int src = (yy*8 + xx)*3;

					store[dest]  = (TwoByte)(dctblock[src]/q); 
					store[dest + 1] = (TwoByte)(dctblock[src + 1]/q);
					store[dest + 2] = (TwoByte)(dctblock[src + 2]/q);   
				}
			}
		}
	}
	delete[] tblock;
	delete[] dctblock;
}
开发者ID:atulkum,项目名称:imageProcessing,代码行数:42,代码来源:Image.cpp

示例4: main


//.........这里部分代码省略.........
    //Get the corners from the object
    obj_corners[0] = cvPoint(0,0);
    obj_corners[1] = cvPoint( object.cols, 0 );
    obj_corners[2] = cvPoint( object.cols, object.rows );
    obj_corners[3] = cvPoint( 0, object.rows );
    
    char key = 'a';
    int framecount = 0;
    while (key != 27)
    {
       
        
        if (framecount < 5)
        {
            framecount++;
            continue;
        }
        
        cv::Mat des_image, img_matches;
        std::vector<cv::KeyPoint> kp_image;
        std::vector<std::vector<cv::DMatch > > matches;
        std::vector<cv::DMatch > good_matches;
        std::vector<cv::Point2f> obj;
        std::vector<cv::Point2f> scene;
        std::vector<cv::Point2f> scene_corners(4);
        cv::Mat H;

        MyImage *sceneMyPic = new MyImage();
        sceneMyPic->setWidth(352);
        sceneMyPic->setHeight(288);
        sceneMyPic->setImagePath(argv[2]);
        sceneMyPic->ReadImage();

        cv::Mat image(Size(352, 288), CV_8UC3, sceneMyPic->getImageData());

        
        detector.detect( image, kp_image );
        extractor.compute( image, kp_image, des_image );
        
        matcher.knnMatch(des_object, des_image, matches, 2);
        
        for(int i = 0; i < cv::min(des_image.rows-1,(int) matches.size()); i++) //THIS LOOP IS SENSITIVE TO SEGFAULTS
        {
            if((matches[i][0].distance < 0.8*(matches[i][1].distance)) && ((int) matches[i].size()<=2 && (int) matches[i].size()>0))
            {
                good_matches.push_back(matches[i][0]);
            }
        }
        
        drawMatches( object, kp_object, image, kp_image, good_matches, img_matches, cv::Scalar::all(-1), cv::Scalar::all(-1), std::vector<char>(), cv::DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
        
        if (good_matches.size() >= 4)
        {
            
            Point2f averagePoint;
            for( int i = 0; i < good_matches.size(); i++ )
            {
                obj.push_back( kp_object[ good_matches[i].queryIdx ].pt );
                scene.push_back( kp_image[ good_matches[i].trainIdx ].pt );
                averagePoint.x += kp_image[ good_matches[i].trainIdx ].pt.x;
                averagePoint.y += kp_image[ good_matches[i].trainIdx ].pt.y;
            }
            
            averagePoint.x /= good_matches.size();
            averagePoint.y /= good_matches.size();
            int inRange = 0;
开发者ID:ralfcheung,项目名称:OpenCV-Test,代码行数:67,代码来源:main.cpp


注:本文中的MyImage::getImageData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。