• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ReadImage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ReadImage函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadImage函数的具体用法?C++ ReadImage怎么用?C++ ReadImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ReadImage

inline int ReadImage(const char * path, Image<RGBAColor> * im)
{
    std::vector<unsigned char> ptr;
    int w, h, depth;
    int res = ReadImage(path, &ptr, &w, &h, &depth);
    if (depth !=4) return 0;
    if (res == 1) {
        RGBAColor * ptrCol = (RGBAColor*) &ptr[0];
        //convert raw array to Image
        (*im) = Eigen::Map<Image<RGBAColor>::Base>(ptrCol, h, w);
    }
    return res;
}
开发者ID:zhusa580999999,项目名称:openMVG,代码行数:13,代码来源:image_io.hpp


示例2: main

/* main function */
int main()
{
	// empty buffers
	memset(inputimage, 0, HEIGHT*WIDTH*sizeof(unsigned char));
	memset(outputimage, 0, HEIGHT*WIDTH*sizeof(unsigned char));

	// read image(s)
	ReadImage("testpattern.raw", inputimage);
	InitFilter();
	ProcessImage(inputimage, outputimage);
	WriteImage("smoothed.raw", outputimage);
	return 0;
}
开发者ID:hermana,项目名称:cs425,代码行数:14,代码来源:main.cpp


示例3: CheckSceneAverage

void CheckSceneAverage(const char *filename, float expected) {
  Point2i resolution;
  std::unique_ptr<RGBSpectrum[]> image = ReadImage(filename, &resolution);

  float delta = .02;
  float sum = 0;

  for (int i = 0; i < resolution.x * resolution.y; ++i)
    for (int c = 0; c < 3; ++c)
      sum += image[i][c];
  int nPixels = resolution.x * resolution.y * 3;
  EXPECT_NEAR(expected, sum / nPixels, delta);
}
开发者ID:tdapper,项目名称:pbrt-v3,代码行数:13,代码来源:analytic_scenes.cpp


示例4: ReadImage

void CControl::run_debug_forlist()
{
  cout<<"processing...."<<endl;
  for(int i=0;i<nImgList.size();i++)
    {
      String n_filename=nImgList.at(i);
      //read img in nrawimg
      ReadImage(n_filename);

      //check
      if(!nImgRaw.data)
	continue;

      //get lines in all direction;
      nLineSegExtractor.SetParamters(nImgRaw);
      vector<Point2f> n_linevct=nLineSegExtractor.GetLineSegments();
	     
      //get lines in specific direction
      vector<Point2f> n_filterlinevct;
      float n_angle=90;
      FilterLineAngle(n_linevct,n_filterlinevct,n_angle,nControlOptions.nAngleThhold);

      //get ransac lines;
      vector<Point3f> n_linecoef;
      nRansacExtractor.GetRansacLines(n_linecoef,n_filterlinevct,nControlOptions.nInterval,nControlOptions.nRansacThreshold,nControlOptions.nRansacMininlier);
      if(nIfDebug)
	{
	  // cout<<"angle: "<<n_angle<<' '<<"threshold: "<<nControlOptions.nAngleThhold<<endl;
	  // cout<<"get filter line: "<<n_filterlinevct.size()<<endl;
	  // cout<<"get ransac lines: "<<n_linecoef.size()<<endl;
	  //   Draw_debug;
	  Mat n_img;
	  nImgRaw.copyTo(n_img);
	  Draw_debug(n_img,n_filterlinevct,"1");
	  Mat n_img2;
	  nImgRaw.copyTo(n_img2);
	  Draw_debug(n_img2,n_linevct,"2");
	}	    
      //evaluate;
      Mat n_img3;
      nImgRaw.copyTo(n_img3);
      CEvaluate n_evaluate;
      n_evaluate.SetLines(n_linecoef,n_filterlinevct);
      n_evaluate.GetNearestLines(5);
      cout<<"length: "<<n_evaluate.GetLengthVal()<<endl;
      cout<<"density: "<<n_evaluate.GetDensityVal()<<endl;
      n_evaluate.Draw_debug(n_img3,"passdirection");
    }

  cout<<"complete!!"<<endl;
}
开发者ID:junwangcas,项目名称:Taxi,代码行数:51,代码来源:CControl.cpp


示例5: TestImageModifierStack

void TestImageModifierStack(void)
{
	BeginTests();

	CImage					cImage;
	CImageModifierStack		cStack;
	BOOL					bResult;
	CImageRGBToGrey*		pcGrey;
	CImageHeightToNormals*	pcNormals;
	CImageResampler*		pcSmall;
	CImage					cBak;

	bResult = ReadImage(&cBak, "Input/Adelle.png");
	AssertBool(TRUE, bResult);

	cImage.Copy(&cBak);
	cStack.Init(&cImage);

	pcGrey = cStack.AddModifier<CImageRGBToGrey>();
	pcGrey->Init(RGBTGS_UseRed);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleGrey.raw");
	AssertFileMemory("Input/AdelleGrey.raw", cImage.GetData(), cImage.GetByteSize());
	cImage.Kill();

	pcNormals = cStack.AddModifier<CImageHeightToNormals>();
	pcNormals->Init(IMAGE_DIFFUSE_GREY);
	cImage.Copy(&cBak);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleNormal.raw");
	AssertFileMemory("Input/AdelleNormal.raw", cImage.GetData(), cImage.GetByteSize());
	cImage.Kill();

	pcSmall = cStack.AddModifier<CImageResampler>();
	pcSmall->Init(IR_NearestNeighbour, 21, 16);
	cImage.Copy(&cBak);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleSmall.raw");
	AssertFileMemory("Input/AdelleSmall.raw", cImage.GetData(), cImage.GetByteSize());
	AssertInt(3, cStack.NumModifiers());

	cStack.Kill();
	cImage.Kill();

	cBak.Kill();

	TestStatistics();
}
开发者ID:chrisjaquet,项目名称:Codaphela.Test,代码行数:51,代码来源:TestImageModifierStack.cpp


示例6: Light

GonioPhotometricLight::GonioPhotometricLight(const Transform &light2world,
        const Spectrum &intensity, const string &texname)
    : Light(light2world) {
    lightPos = LightToWorld(Point(0,0,0));
    Intensity = intensity;
    // Create _mipmap_ for _GonioPhotometricLight_
    int width, height;
    RGBSpectrum *texels = ReadImage(texname, &width, &height);
    if (texels) {
        mipmap = new MIPMap<RGBSpectrum>(width, height, texels);
        delete[] texels;
    }
    else mipmap = NULL;
}
开发者ID:3dglazer,项目名称:pbm,代码行数:14,代码来源:goniometric.cpp


示例7: UnformatImage

bool UnformatImage (const std::string &path, Range range)
{
	auto disk = std::make_shared<Disk>();
	if (!ReadImage(path, disk))
		return false;

	ValidateRange(range, MAX_TRACKS, MAX_SIDES, disk->cyls(), disk->heads());

	range.each([&] (const CylHead &cylhead) {
		if (!g_fAbort)
			disk->write_track(cylhead, Track());
	});

	return WriteImage(path, disk);
}
开发者ID:d235j,项目名称:samdisk,代码行数:15,代码来源:cmd_format.cpp


示例8: ReadMPEGImage

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   R e a d M P E G I m a g e                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  ReadMPEGImage() reads an binary file in the MPEG video stream format
%  and returns it.  It allocates the memory necessary for the new Image
%  structure and returns a pointer to the new image.
%
%  The format of the ReadMPEGImage method is:
%
%      Image *ReadMPEGImage(const ImageInfo *image_info,
%        ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o image_info: the image info.
%
%    o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadMPEGImage(const ImageInfo *image_info,
                            ExceptionInfo *exception)
{
#define ReadMPEGIntermediateFormat "pam"

    Image
    *image,
    *images;

    ImageInfo
    *read_info;

    MagickBooleanType
    status;

    /*
      Open image file.
    */
    assert(image_info != (const ImageInfo *) NULL);
    assert(image_info->signature == MagickSignature);
    if (image_info->debug != MagickFalse)
        (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
                              image_info->filename);
    assert(exception != (ExceptionInfo *) NULL);
    assert(exception->signature == MagickSignature);
    image=AcquireImage(image_info);
    status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
    if (status == MagickFalse)
    {
        image=DestroyImageList(image);
        return((Image *) NULL);
    }
    (void) CloseBlob(image);
    (void) DestroyImageList(image);
    /*
      Convert MPEG to PAM with delegate.
    */
    read_info=CloneImageInfo(image_info);
    image=AcquireImage(image_info);
    (void) InvokeDelegate(read_info,image,"mpeg:decode",(char *) NULL,exception);
    image=DestroyImage(image);
    (void) FormatMagickString(read_info->filename,MaxTextExtent,"%s.%s",
                              read_info->unique,ReadMPEGIntermediateFormat);
    images=ReadImage(read_info,exception);
    (void) RelinquishUniqueFileResource(read_info->filename);
    read_info=DestroyImageInfo(read_info);
    return(images);
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:75,代码来源:mpeg.c


示例9: assert

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   R e a d T I L E I m a g e                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  ReadTILEImage tiles a texture on an image.  It allocates the
%  memory necessary for the new Image structure and returns a pointer to the
%  new image.
%
%  The format of the ReadTILEImage method is:
%
%      Image *ReadTILEImage(const ImageInfo *image_info,
%        ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o image_info: the image info.
%
%    o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadTILEImage(const ImageInfo *image_info,
  ExceptionInfo *exception)
{
  Image
    *image,
    *tile_image;

  ImageInfo
    *read_info;

  /*
    Initialize Image structure.
  */
  assert(image_info != (const ImageInfo *) NULL);
  assert(image_info->signature == MagickSignature);
  if (image_info->debug != MagickFalse)
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
      image_info->filename);
  assert(exception != (ExceptionInfo *) NULL);
  assert(exception->signature == MagickSignature);
  read_info=CloneImageInfo(image_info);
  SetImageInfoBlob(read_info,(void *) NULL,0);
  *read_info->magick='\0';
  tile_image=ReadImage(read_info,exception);
  read_info=DestroyImageInfo(read_info);
  if (tile_image == (Image *) NULL)
    return((Image *) NULL);
  image=AcquireImage(image_info,exception);
  if ((image->columns == 0) || (image->rows == 0))
    ThrowReaderException(OptionError,"MustSpecifyImageSize");
  if (*image_info->filename == '\0')
    ThrowReaderException(OptionError,"MustSpecifyAnImageName");
  image->colorspace=tile_image->colorspace;
  image->alpha_trait=tile_image->alpha_trait;
  if (image->alpha_trait == BlendPixelTrait)
    (void) SetImageBackgroundColor(image,exception);
  (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
  if (LocaleCompare(tile_image->magick,"PATTERN") == 0)
    {
      tile_image->tile_offset.x=0;
      tile_image->tile_offset.y=0;
    }
  (void) TextureImage(image,tile_image,exception);
  tile_image=DestroyImage(tile_image);
  if (image->colorspace == GRAYColorspace)
    image->type=GrayscaleType;
  return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:75,代码来源:tile.c


示例10: ReadImage

GLuint Mesh::LoadTexture(char* Filename)
{
	GLint iWidth, iHeight, iComponents;
	GLubyte* m_pImage = ReadImage(Filename, GL_FALSE, &iWidth, &iHeight, &iComponents);
	GLuint m_textureObj;
	
	if(!m_pImage)return false;
    glGenTextures(1, &m_textureObj);
    glBindTexture(GL_TEXTURE_2D, m_textureObj);
    //glTexImage2D(m_textureTarget, 0, GL_RGB, m_pImage->columns(), m_pImage->rows(), 0, GL_RGBA, GL_UNSIGNED_BYTE, m_blob.data());
	glTexImage2D(GL_TEXTURE_2D, 0, iComponents, iWidth, iHeight, 0, iComponents, GL_UNSIGNED_BYTE, m_pImage);
	//gluBuild2DMipmaps(m_textureTarget, iComponents, iWidth, iHeight, iComponents, GL_UNSIGNED_BYTE, m_pImage);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);	
	return m_textureObj;
}
开发者ID:miguel28,项目名称:WatchDog,代码行数:16,代码来源:mesh.cpp


示例11: ReadImage

   static bool ReadImage( FileFormatInstance* instance, I& image )
   {
      if ( !image.IsShared() )
      {
         I tmp( (void*)0, 0, 0 );
         if ( !ReadImage( instance, tmp ) )
            return false;
         image.Assign( tmp );
         return true;
      }

      if ( (*API->FileFormat->ReadImage)( instance->handle, image.Allocator().Handle() ) == api_false )
         return false;
      image.Synchronize();
      return true;
   }
开发者ID:aleixpuig,项目名称:PCL,代码行数:16,代码来源:FileFormatInstance.cpp


示例12: assert

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   R e a d T I L E I m a g e                                                 %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Method ReadTILEImage tiles a texture on an image.  It allocates the
%  memory necessary for the new Image structure and returns a pointer to the
%  new image.
%
%  The format of the ReadTILEImage method is:
%
%      Image *ReadTILEImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
%  A description of each parameter follows:
%
%    o image:  Method ReadTILEImage returns a pointer to the image after
%      reading.  A null image is returned if there is a memory shortage or
%      if the image cannot be read.
%
%    o image_info: Specifies a pointer to a ImageInfo structure.
%
%    o exception: return any errors or warnings in this structure.
%
%
*/
static Image *ReadTILEImage(const ImageInfo *image_info,
  ExceptionInfo *exception)
{
  Image
    *image,
    *tile_image;

  ImageInfo
    *clone_info;

  RectangleInfo
    geometry;
    

  /*
    Initialize Image structure.
  */
  assert(image_info != (const ImageInfo *) NULL);
  assert(image_info->signature == MagickSignature);
  assert(exception != (ExceptionInfo *) NULL);
  assert(exception->signature == MagickSignature);

  clone_info=CloneImageInfo(image_info);
  clone_info->blob=(void *) NULL;
  clone_info->length=0;
  *clone_info->magick='\0';
  tile_image=ReadImage(clone_info,exception);
  DestroyImageInfo(clone_info);
  if (tile_image == (Image *) NULL)
    return((Image *) NULL);

  /*
    Adapt tile image to desired image type.
  */
  if (image_info->type != UndefinedType)
    (void) SetImageType(tile_image,image_info->type);

  /*
    Create tiled canvas image.
  */
  (void) GetGeometry(image_info->size,&geometry.x,&geometry.y,&geometry.width,
                     &geometry.height);
  image=ConstituteTextureImage(geometry.width,geometry.height,tile_image,exception);

  DestroyImage(tile_image);
  return(image);
}
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:78,代码来源:tile.c


示例13: ReadImage

    //--------------------------------------------------------------
    Image::Ptr ReadImage(const std::string& filename, FileFormat::Enum ff, PixelFormat::Enum pf)
    {
        File::Ptr file = OpenFile(filename);

        if (!file) {
            return 0;
        }

        if (ff == FileFormat::AutoDetect) {
            ff = GetFileFormat(filename);
            if (ff == FileFormat::Unknown) {
                ff = FileFormat::AutoDetect;
            }
        }

        return ReadImage(file, ff, pf);
    }
开发者ID:kyuu,项目名称:azura,代码行数:18,代码来源:azura.cpp


示例14: ReadEXR

static bool ReadEXR(const char *name, float **rgba, int *width, int *height) {
    Point2i res;
    std::unique_ptr<RGBSpectrum[]> image = ReadImage(name, &res);
    if (!image) return false;
    *width = res.x;
    *height = res.y;
    *rgba = new float[4 * *width * *height];
    for (int i = 0; i < *width * *height; ++i) {
        Float rgb[3];
        image[i].ToRGB(rgb);
        for (int c = 0; c < 3; ++c) {
            (*rgba)[4 * i + c] = rgb[c];
        }
        (*rgba)[4 * i + 3] = 1.;
    }
    return true;
}
开发者ID:NickYang,项目名称:pbrt-v3,代码行数:17,代码来源:exravg.cpp


示例15: FormatLabel

static void FormatLabel(ImageInfo *image_info,char *label,
  const unsigned int width,unsigned int *font_height)
{
  Image
    *image;

  MonitorHandler
    handler;

  register char
    *p,
    *q;

  if (label == (const char *) NULL)
    return;
  if (*label == '\0')
    return;
  if (strchr(label,'\n') != (char *) NULL)
    return;
  /*
    Format label to fit within a specified width.
  */
  handler=SetMonitorHandler((MonitorHandler) NULL);
  p=label;
  for (q=p+1; *q != '\0'; q++)
  {
    (void) strcpy(image_info->filename,"label:");
    (void) strncat(image_info->filename+6,p,(int) (q-p+1));
    image=ReadImage(image_info);
    if (image == (Image *) NULL)
      break;
    if (image->columns > width)
      {
        while (!isspace((int) (*q)) && (q > p))
          q--;
        if (q == p)
          break;
        *q='\n';
        p=q+1;
      }
    if (image->rows > *font_height)
      *font_height=image->rows;
    DestroyImage(image);
  }
  (void) SetMonitorHandler(handler);
}
开发者ID:vgck,项目名称:opendr2,代码行数:46,代码来源:montage.c


示例16: main

int main(int argc, char** argv) {
    const char *usage = "usage: hdrconv <input file> <output file>\n";
    assert(argc > 2);
    if (argc <= 2) {
        printf("%s", usage);
        return 0;
    }
    
    int width = 0;
    int height = 0;
    Color* pixels = ReadImage(argv[1], &width, &height);
    assert(pixels != 0);
    if (pixels) {
        WriteImage(argv[2], &pixels[0].r, 0, width, height, width, height, 0, 0);
    }
    return 0;
}
开发者ID:ouj,项目名称:hdrconv,代码行数:17,代码来源:main.cpp


示例17: Light

InfiniteAreaLightIS
	::InfiniteAreaLightIS(const Transform &light2world,
				const Spectrum &L, int ns,
				const string &texmap)
	: Light(light2world, ns)
{
	radianceMap = NULL;
	if (texmap != "") {
	int width, height;
	Spectrum *texels =
		ReadImage(texmap, &width, &height);
	if (texels)
		radianceMap =
		new MIPMap<Spectrum>(width, height, texels);
	// Compute scalar-valued image from environment map
	float filter = 1.f / max(width, height);
	int nu = width, nv = height;
	float *img = new float[width*height];
	for (int x = 0; x < nu; ++x) {
		float xp = (float)x / (float)nu;
		for (int y = 0; y < nv; ++y) {
			float yp = (float)y / (float)nv;
			img[y+x*nv] = radianceMap->Lookup(xp, yp, filter).y();
		}
	}
	// Initialize sampling PDFs for infinite area light
	float *func = (float *)alloca(max(nu, nv) * sizeof(float));
	float *sinVals = (float *)alloca(nv * sizeof(float));
	for (int i = 0; i < nv; ++i)
		sinVals[i] = sin(M_PI * float(i+.5)/float(nv));
	vDistribs = new Distribution1D *[nu];
	for (int u = 0; u < nu; ++u) {
		// Compute sampling distribution for column _u_
		for (int v = 0; v < nv; ++v)
			func[v] = img[u*nv+v] *= sinVals[v];
		vDistribs[u] = new Distribution1D(func, nv);
	}
	// Compute sampling distribution for columns of image
	for (int u = 0; u < nu; ++u)
		func[u] = vDistribs[u]->funcInt;
	uDistrib = new Distribution1D(func, nu);
	delete[] img;
	delete[] texels;
	}
	Lbase = L;
}
开发者ID:EiffelOberon,项目名称:pbrt-v1,代码行数:46,代码来源:infinitesample.cpp


示例18: main

int main(int argc, char *argv[]) 
{
  Image  *img[2]; 
  Kernel *K;
  timer  *t1, *t2; 

  /*--------------------------------------------------------*/

  void *trash = malloc(1);                 
  struct mallinfo info;   
  int MemDinInicial, MemDinFinal;
  free(trash); 
  info = mallinfo();
  MemDinInicial = info.uordblks;

  /*--------------------------------------------------------*/

  if (argc != 4)
    Error("Usage: linearfilter <input.scn> <output.scn> <adj. radius>","windowlevel.c");


  t1 = Tic();

  img[0] = ReadImage(argv[1]); 
  K      = GaussianKernel(atof(argv[3]));
  img[1] = LinearFilter(img[0],K);
  WriteImage(img[1],argv[2]); 
  DestroyImage(img[0]); 
  DestroyImage(img[1]); 
  DestroyKernel(K);

  t2 = Toc();
  fprintf(stdout,"Linear filtering in %f ms\n",CompTime(t1,t2)); 


  /* ------------------------------------------------------ */

  info = mallinfo();
  MemDinFinal = info.uordblks;
  if (MemDinInicial!=MemDinFinal)
    printf("\n\nDinamic memory was not completely deallocated (%d, %d)\n",
	   MemDinInicial,MemDinFinal);   

  return(0); 
}
开发者ID:nmoya,项目名称:3d-image-processing,代码行数:45,代码来源:linearfilter.c


示例19: file

void CopyPhoto::Copy(const Path& file_path, const TCHAR* dest_folder, const TCHAR* rename_pattern)
{
	DWORD start= ::GetTickCount();

	CFile file(file_path.c_str(), CFile::modeRead | CFile::shareDenyWrite);// | CFile::osSequentialScan);

	const uint64 length= file.SeekToEnd();

	if (length == 0)
		return;		// do not create empty copies

	Progress(0, length);	// call progress after opening file

	file.SeekToBegin();

	auto_ptr<PhotoInfo> photo;
	PhotoFactory::CreateFn create= 0;
	int type_id= 0;
	if (GetPhotoFactory().MatchPhotoType(file_path.GetExtension(), create, type_id) && type_id != FT_CATALOG)
		photo.reset(create());

	// if there is 'photo' object available try to decode EXIF block
	if (photo.get())
	{
//		FileStream str;
//		VERIFY(str.Open(buffer));

		ReadImage(photo.get(), file_path, length, 0);
	}

	// create destination name
	Path dest= CreateDestPath(file_path, length, photo.get());

	// copy source file to the destination

	const size_t CHUNK= 0x10000;	// 64 KB
	vector<uint8> buffer(CHUNK, 0);

	size_t block= static_cast<size_t>(min<uint64>(CHUNK, length));

	if (file.Read(&buffer.front(), block) != block)
		throw 11111;

}
开发者ID:mikekov,项目名称:ExifPro,代码行数:44,代码来源:CopyPhoto.cpp


示例20: SetSimProperties

// Connect to given device.
// Sets the internal handle if connected as requested
// returns true when successfull otherwise false
bool ArtDrvSim::Connect(unsigned short Device)
{
   if (m_connected)
      return false;
   // basically DeviceIsCamera() also sets the member var of the simFilename
   if (!CheckSimFile(m_simFilename, Device)) return false;

   // this sets the cameras properties
   SetSimProperties((EArtCameraType)Device);

   if ( ! ReadImage(m_simFilename) ) {
       wxMessageBox(wxT("ArtSimCam: cannot find a proper image raw file - please check installation"));
      return false;
   }
   m_ccdsx = 0;
   m_ccdsy = 0;
   m_ccdw = m_camProps.nPixelsX;
   m_ccdh = m_camProps.nPixelsY;
   m_binx = 1;
   m_biny = 1;
	if (m_artSample.imageMem)
	{
		delete m_artSample.imageMem;
		m_artSample.imageMem = NULL;
		m_artSample.dataLength = 0;
	}

	// make a new image buffer if we know the ccd i.e. call this before reading the ccd
   m_artSample.dataLength = m_camProps.nPixelsX * m_camProps.nPixelsY; // WORDS full cam size
   m_artSample.imageMem = new WordImageMem(m_artSample.dataLength); // progressive CCD
   m_artSample.dataLength *= 2; // make BYTES (this is what is needed to be read
   m_artSample.ready = false;

   m_aborted = false;
   m_pSimThread = new ArtSimThread(this);
   m_pSimThread->Create();
   m_pSimThread->Run();   // let's run it

   m_abortExposure = false;
   m_connected = true;
   m_camState = CAMERA_IDLE;

   return m_connected;
}
开发者ID:MarekTP,项目名称:wxAstroCapture,代码行数:47,代码来源:ArtDrvSim.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ReadInt函数代码示例发布时间:2022-05-30
下一篇:
C++ ReadHeader函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap