MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / readRaw24BitPlanar

Method readRaw24BitPlanar

IPL/src/IPLFileIO.cpp:405–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405bool IPLFileIO::readRaw24BitPlanar(int stride, IPLRawImageType format, IPLImage *&image, std::ifstream &file)
406{
407 char buffer;
408 int x=0;
409 int y=0;
410
411 // RRRGGGBBB
412 int currentPlane = 0;
413
414 // BBBGGGRRR
415 if(format == IPL_RAW_24BIT_BGR)
416 currentPlane = 2;
417
418 // get length of file:
419 file.seekg (0, file.end);
420 int length = file.tellg();
421 int planeLength = length/3;
422 file.seekg (0, file.beg);
423
424 while(file.good())
425 {
426 file.read(&buffer, 1);
427
428 image->plane(currentPlane)->cp(x, y) = buffer * FACTOR_TO_FLOAT;
429
430 x++;
431 if(x % stride == 0)
432 {
433 x = 0;
434 y++;
435 }
436
437 if(((int) file.tellg()+1) % planeLength == 0)
438 {
439 if(format == IPL_RAW_24BIT_RGB)
440 currentPlane++;
441 else
442 currentPlane--;
443
444 x = 0;
445 y = 0;
446
447 if(currentPlane >= image->getNumberOfPlanes() || currentPlane < 0)
448 return true;
449 }
450 }
451 return true;
452}
453
454bool IPLFileIO::readRaw32BitPlanar(int stride, IPLRawImageType format, IPLImage *&image, std::ifstream &file)
455{

Callers

nothing calls this directly

Calls 1

planeMethod · 0.80

Tested by

no test coverage detected