| 327 | } |
| 328 | |
| 329 | bool IPLFileIO::readRaw24BitInterleaved(int stride, IPLRawImageType format, IPLImage *&image, std::ifstream &file) |
| 330 | { |
| 331 | char buffer[3]; |
| 332 | int x=0; |
| 333 | int y=0; |
| 334 | while(file.good()) |
| 335 | { |
| 336 | file.read(buffer, 3); |
| 337 | |
| 338 | ipl_basetype r,g,b; |
| 339 | if(format == 1) |
| 340 | { |
| 341 | r = ((uchar) buffer[0]) * FACTOR_TO_FLOAT; |
| 342 | g = ((uchar) buffer[1]) * FACTOR_TO_FLOAT; |
| 343 | b = ((uchar) buffer[2]) * FACTOR_TO_FLOAT; |
| 344 | } |
| 345 | else |
| 346 | { |
| 347 | b = ((uchar) buffer[0]) * FACTOR_TO_FLOAT; |
| 348 | g = ((uchar) buffer[1]) * FACTOR_TO_FLOAT; |
| 349 | r = ((uchar) buffer[2]) * FACTOR_TO_FLOAT; |
| 350 | } |
| 351 | |
| 352 | image->plane(0)->cp(x, y) = r; |
| 353 | image->plane(1)->cp(x, y) = g; |
| 354 | image->plane(2)->cp(x, y) = b; |
| 355 | |
| 356 | x++; |
| 357 | if(x % stride == 0) |
| 358 | { |
| 359 | x = 0; |
| 360 | y++; |
| 361 | } |
| 362 | } |
| 363 | return true; |
| 364 | } |
| 365 | |
| 366 | bool IPLFileIO::readRaw32BitInterleaved(int stride, IPLRawImageType format, IPLImage *&image, std::ifstream &file) |
| 367 | { |