├── CAM.txt ├── EV.txt ├── README.md ├── Tone2.txt ├── cam_settings.txt ├── convertFilesToImage.m ├── dngOneExeSDK └── dng_validate.exe ├── generateMetadata.m ├── getWidthHeight.m ├── lastStage.txt ├── main.m ├── mkdir_if_not_exist.m ├── renderStage11Image.m ├── renderStage4Image.m ├── renderToGetIntermediateSize.m ├── rwSettings.txt ├── stageSettings.txt ├── test ├── Canon1DsMkIII_0001Converted.dng ├── Canon1DsMkIII_0004Converted.dng ├── Canon1DsMkIII_0005Converted.dng └── Canon1DsMkIII_0008Converted.dng ├── wb.txt └── wbAndGainSettings.txt /CAM.txt: -------------------------------------------------------------------------------- 1 | 1.77368 2 | 0 3 | 0 4 | 0 5 | 1 6 | 0 7 | 0 8 | 0 9 | 2.05255 10 | -------------------------------------------------------------------------------- /EV.txt: -------------------------------------------------------------------------------- 1 | 0.0 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # camera-pipeline-nonUI 2 | Example for non-UI implementation of [**camera-pipeline-UI**](https://github.com/karaimer/camera-pipeline-UI). 3 | 4 | In this example, dng images under the folder **test** are rendered until the demosaicing stage, and until the end of the camera pipeline. 5 | 6 | Once **main.m** is run, demosaiced images will be placed under the folder **test/stage4**, and their corressponding images at the end of the pipeline will be placed under the folder **test/stage11**. 7 | 8 | -------------------------------------------------------------------------------- /Tone2.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0.00078 3 | 0.0016 4 | 0.00242 5 | 0.00314 6 | 0.00385 7 | 0.0046 8 | 0.00539 9 | 0.00623 10 | 0.00712 11 | 0.00806 12 | 0.00906 13 | 0.01012 14 | 0.01122 15 | 0.01238 16 | 0.01359 17 | 0.01485 18 | 0.01616 19 | 0.01751 20 | 0.0189 21 | 0.02033 22 | 0.0218 23 | 0.02331 24 | 0.02485 25 | 0.02643 26 | 0.02804 27 | 0.02967 28 | 0.03134 29 | 0.03303 30 | 0.03475 31 | 0.03648 32 | 0.03824 33 | 0.04002 34 | 0.04181 35 | 0.04362 36 | 0.04545 37 | 0.0473 38 | 0.04916 39 | 0.05103 40 | 0.05292 41 | 0.05483 42 | 0.05675 43 | 0.05868 44 | 0.06063 45 | 0.06259 46 | 0.06457 47 | 0.06655 48 | 0.06856 49 | 0.07057 50 | 0.07259 51 | 0.07463 52 | 0.07668 53 | 0.07874 54 | 0.08081 55 | 0.0829 56 | 0.08499 57 | 0.0871 58 | 0.08921 59 | 0.09134 60 | 0.09348 61 | 0.09563 62 | 0.09779 63 | 0.09996 64 | 0.10214 65 | 0.10433 66 | 0.10652 67 | 0.10873 68 | 0.11095 69 | 0.11318 70 | 0.11541 71 | 0.11766 72 | 0.11991 73 | 0.12218 74 | 0.12445 75 | 0.12673 76 | 0.12902 77 | 0.13132 78 | 0.13363 79 | 0.13595 80 | 0.13827 81 | 0.14061 82 | 0.14295 83 | 0.1453 84 | 0.14765 85 | 0.15002 86 | 0.15239 87 | 0.15477 88 | 0.15716 89 | 0.15956 90 | 0.16197 91 | 0.16438 92 | 0.1668 93 | 0.16923 94 | 0.17166 95 | 0.1741 96 | 0.17655 97 | 0.17901 98 | 0.18148 99 | 0.18395 100 | 0.18643 101 | 0.18891 102 | 0.19141 103 | 0.19391 104 | 0.19641 105 | 0.19893 106 | 0.20145 107 | 0.20398 108 | 0.20651 109 | 0.20905 110 | 0.2116 111 | 0.21416 112 | 0.21672 113 | 0.21929 114 | 0.22185 115 | 0.2244 116 | 0.22696 117 | 0.2295 118 | 0.23204 119 | 0.23458 120 | 0.23711 121 | 0.23963 122 | 0.24215 123 | 0.24466 124 | 0.24717 125 | 0.24967 126 | 0.25216 127 | 0.25465 128 | 0.25713 129 | 0.25961 130 | 0.26208 131 | 0.26454 132 | 0.267 133 | 0.26945 134 | 0.27189 135 | 0.27433 136 | 0.27676 137 | 0.27918 138 | 0.2816 139 | 0.28401 140 | 0.28641 141 | 0.28881 142 | 0.2912 143 | 0.29358 144 | 0.29596 145 | 0.29833 146 | 0.30069 147 | 0.30305 148 | 0.3054 149 | 0.30774 150 | 0.31008 151 | 0.31241 152 | 0.31473 153 | 0.31704 154 | 0.31935 155 | 0.32165 156 | 0.32395 157 | 0.32623 158 | 0.32851 159 | 0.33079 160 | 0.33305 161 | 0.33531 162 | 0.33756 163 | 0.33981 164 | 0.34205 165 | 0.34428 166 | 0.3465 167 | 0.34872 168 | 0.35093 169 | 0.35313 170 | 0.35532 171 | 0.35751 172 | 0.35969 173 | 0.36187 174 | 0.36404 175 | 0.3662 176 | 0.36835 177 | 0.3705 178 | 0.37264 179 | 0.37477 180 | 0.37689 181 | 0.37901 182 | 0.38112 183 | 0.38323 184 | 0.38533 185 | 0.38742 186 | 0.3895 187 | 0.39158 188 | 0.39365 189 | 0.39571 190 | 0.39777 191 | 0.39982 192 | 0.40186 193 | 0.40389 194 | 0.40592 195 | 0.40794 196 | 0.40996 197 | 0.41197 198 | 0.41397 199 | 0.41596 200 | 0.41795 201 | 0.41993 202 | 0.42191 203 | 0.42388 204 | 0.42584 205 | 0.42779 206 | 0.42974 207 | 0.43168 208 | 0.43362 209 | 0.43554 210 | 0.43747 211 | 0.43938 212 | 0.44129 213 | 0.44319 214 | 0.44509 215 | 0.44698 216 | 0.44886 217 | 0.45073 218 | 0.4526 219 | 0.45447 220 | 0.45632 221 | 0.45817 222 | 0.46002 223 | 0.46186 224 | 0.46369 225 | 0.46551 226 | 0.46733 227 | 0.46914 228 | 0.47095 229 | 0.47275 230 | 0.47454 231 | 0.47633 232 | 0.47811 233 | 0.47989 234 | 0.48166 235 | 0.48342 236 | 0.48518 237 | 0.48693 238 | 0.48867 239 | 0.49041 240 | 0.49214 241 | 0.49387 242 | 0.49559 243 | 0.4973 244 | 0.49901 245 | 0.50072 246 | 0.50241 247 | 0.5041 248 | 0.50579 249 | 0.50747 250 | 0.50914 251 | 0.51081 252 | 0.51247 253 | 0.51413 254 | 0.51578 255 | 0.51742 256 | 0.51906 257 | 0.52069 258 | 0.52232 259 | 0.52394 260 | 0.52556 261 | 0.52717 262 | 0.52878 263 | 0.53038 264 | 0.53197 265 | 0.53356 266 | 0.53514 267 | 0.53672 268 | 0.53829 269 | 0.53986 270 | 0.54142 271 | 0.54297 272 | 0.54452 273 | 0.54607 274 | 0.54761 275 | 0.54914 276 | 0.55067 277 | 0.5522 278 | 0.55371 279 | 0.55523 280 | 0.55673 281 | 0.55824 282 | 0.55973 283 | 0.56123 284 | 0.56271 285 | 0.5642 286 | 0.56567 287 | 0.56715 288 | 0.56861 289 | 0.57007 290 | 0.57153 291 | 0.57298 292 | 0.57443 293 | 0.57587 294 | 0.57731 295 | 0.57874 296 | 0.58017 297 | 0.58159 298 | 0.58301 299 | 0.58443 300 | 0.58583 301 | 0.58724 302 | 0.58864 303 | 0.59003 304 | 0.59142 305 | 0.59281 306 | 0.59419 307 | 0.59556 308 | 0.59694 309 | 0.5983 310 | 0.59966 311 | 0.60102 312 | 0.60238 313 | 0.60373 314 | 0.60507 315 | 0.60641 316 | 0.60775 317 | 0.60908 318 | 0.6104 319 | 0.61173 320 | 0.61305 321 | 0.61436 322 | 0.61567 323 | 0.61698 324 | 0.61828 325 | 0.61957 326 | 0.62087 327 | 0.62216 328 | 0.62344 329 | 0.62472 330 | 0.626 331 | 0.62727 332 | 0.62854 333 | 0.6298 334 | 0.63106 335 | 0.63232 336 | 0.63357 337 | 0.63482 338 | 0.63606 339 | 0.6373 340 | 0.63854 341 | 0.63977 342 | 0.641 343 | 0.64222 344 | 0.64344 345 | 0.64466 346 | 0.64587 347 | 0.64708 348 | 0.64829 349 | 0.64949 350 | 0.65069 351 | 0.65188 352 | 0.65307 353 | 0.65426 354 | 0.65544 355 | 0.65662 356 | 0.65779 357 | 0.65897 358 | 0.66013 359 | 0.6613 360 | 0.66246 361 | 0.66362 362 | 0.66477 363 | 0.66592 364 | 0.66707 365 | 0.66821 366 | 0.66935 367 | 0.67048 368 | 0.67162 369 | 0.67275 370 | 0.67387 371 | 0.67499 372 | 0.67611 373 | 0.67723 374 | 0.67834 375 | 0.67945 376 | 0.68055 377 | 0.68165 378 | 0.68275 379 | 0.68385 380 | 0.68494 381 | 0.68603 382 | 0.68711 383 | 0.68819 384 | 0.68927 385 | 0.69035 386 | 0.69142 387 | 0.69249 388 | 0.69355 389 | 0.69461 390 | 0.69567 391 | 0.69673 392 | 0.69778 393 | 0.69883 394 | 0.69988 395 | 0.70092 396 | 0.70196 397 | 0.703 398 | 0.70403 399 | 0.70506 400 | 0.70609 401 | 0.70711 402 | 0.70813 403 | 0.70915 404 | 0.71017 405 | 0.71118 406 | 0.71219 407 | 0.71319 408 | 0.7142 409 | 0.7152 410 | 0.7162 411 | 0.71719 412 | 0.71818 413 | 0.71917 414 | 0.72016 415 | 0.72114 416 | 0.72212 417 | 0.72309 418 | 0.72407 419 | 0.72504 420 | 0.72601 421 | 0.72697 422 | 0.72794 423 | 0.7289 424 | 0.72985 425 | 0.73081 426 | 0.73176 427 | 0.73271 428 | 0.73365 429 | 0.7346 430 | 0.73554 431 | 0.73647 432 | 0.73741 433 | 0.73834 434 | 0.73927 435 | 0.7402 436 | 0.74112 437 | 0.74204 438 | 0.74296 439 | 0.74388 440 | 0.74479 441 | 0.7457 442 | 0.74661 443 | 0.74751 444 | 0.74842 445 | 0.74932 446 | 0.75021 447 | 0.75111 448 | 0.752 449 | 0.75289 450 | 0.75378 451 | 0.75466 452 | 0.75555 453 | 0.75643 454 | 0.7573 455 | 0.75818 456 | 0.75905 457 | 0.75992 458 | 0.76079 459 | 0.76165 460 | 0.76251 461 | 0.76337 462 | 0.76423 463 | 0.76508 464 | 0.76594 465 | 0.76679 466 | 0.76763 467 | 0.76848 468 | 0.76932 469 | 0.77016 470 | 0.771 471 | 0.77183 472 | 0.77267 473 | 0.7735 474 | 0.77432 475 | 0.77515 476 | 0.77597 477 | 0.7768 478 | 0.77761 479 | 0.77843 480 | 0.77924 481 | 0.78006 482 | 0.78087 483 | 0.78167 484 | 0.78248 485 | 0.78328 486 | 0.78408 487 | 0.78488 488 | 0.78568 489 | 0.78647 490 | 0.78726 491 | 0.78805 492 | 0.78884 493 | 0.78962 494 | 0.7904 495 | 0.79118 496 | 0.79196 497 | 0.79274 498 | 0.79351 499 | 0.79428 500 | 0.79505 501 | 0.79582 502 | 0.79658 503 | 0.79735 504 | 0.79811 505 | 0.79887 506 | 0.79962 507 | 0.80038 508 | 0.80113 509 | 0.80188 510 | 0.80263 511 | 0.80337 512 | 0.80412 513 | 0.80486 514 | 0.8056 515 | 0.80634 516 | 0.80707 517 | 0.8078 518 | 0.80854 519 | 0.80926 520 | 0.80999 521 | 0.81072 522 | 0.81144 523 | 0.81216 524 | 0.81288 525 | 0.8136 526 | 0.81431 527 | 0.81503 528 | 0.81574 529 | 0.81645 530 | 0.81715 531 | 0.81786 532 | 0.81856 533 | 0.81926 534 | 0.81996 535 | 0.82066 536 | 0.82135 537 | 0.82205 538 | 0.82274 539 | 0.82343 540 | 0.82412 541 | 0.8248 542 | 0.82549 543 | 0.82617 544 | 0.82685 545 | 0.82753 546 | 0.8282 547 | 0.82888 548 | 0.82955 549 | 0.83022 550 | 0.83089 551 | 0.83155 552 | 0.83222 553 | 0.83288 554 | 0.83354 555 | 0.8342 556 | 0.83486 557 | 0.83552 558 | 0.83617 559 | 0.83682 560 | 0.83747 561 | 0.83812 562 | 0.83877 563 | 0.83941 564 | 0.84005 565 | 0.84069 566 | 0.84133 567 | 0.84197 568 | 0.84261 569 | 0.84324 570 | 0.84387 571 | 0.8445 572 | 0.84513 573 | 0.84576 574 | 0.84639 575 | 0.84701 576 | 0.84763 577 | 0.84825 578 | 0.84887 579 | 0.84949 580 | 0.8501 581 | 0.85071 582 | 0.85132 583 | 0.85193 584 | 0.85254 585 | 0.85315 586 | 0.85375 587 | 0.85436 588 | 0.85496 589 | 0.85556 590 | 0.85615 591 | 0.85675 592 | 0.85735 593 | 0.85794 594 | 0.85853 595 | 0.85912 596 | 0.85971 597 | 0.86029 598 | 0.86088 599 | 0.86146 600 | 0.86204 601 | 0.86262 602 | 0.8632 603 | 0.86378 604 | 0.86435 605 | 0.86493 606 | 0.8655 607 | 0.86607 608 | 0.86664 609 | 0.8672 610 | 0.86777 611 | 0.86833 612 | 0.86889 613 | 0.86945 614 | 0.87001 615 | 0.87057 616 | 0.87113 617 | 0.87168 618 | 0.87223 619 | 0.87278 620 | 0.87333 621 | 0.87388 622 | 0.87443 623 | 0.87497 624 | 0.87552 625 | 0.87606 626 | 0.8766 627 | 0.87714 628 | 0.87768 629 | 0.87821 630 | 0.87875 631 | 0.87928 632 | 0.87981 633 | 0.88034 634 | 0.88087 635 | 0.8814 636 | 0.88192 637 | 0.88244 638 | 0.88297 639 | 0.88349 640 | 0.88401 641 | 0.88453 642 | 0.88504 643 | 0.88556 644 | 0.88607 645 | 0.88658 646 | 0.88709 647 | 0.8876 648 | 0.88811 649 | 0.88862 650 | 0.88912 651 | 0.88963 652 | 0.89013 653 | 0.89063 654 | 0.89113 655 | 0.89163 656 | 0.89212 657 | 0.89262 658 | 0.89311 659 | 0.8936 660 | 0.89409 661 | 0.89458 662 | 0.89507 663 | 0.89556 664 | 0.89604 665 | 0.89653 666 | 0.89701 667 | 0.89749 668 | 0.89797 669 | 0.89845 670 | 0.89892 671 | 0.8994 672 | 0.89987 673 | 0.90035 674 | 0.90082 675 | 0.90129 676 | 0.90176 677 | 0.90222 678 | 0.90269 679 | 0.90316 680 | 0.90362 681 | 0.90408 682 | 0.90454 683 | 0.905 684 | 0.90546 685 | 0.90592 686 | 0.90637 687 | 0.90683 688 | 0.90728 689 | 0.90773 690 | 0.90818 691 | 0.90863 692 | 0.90908 693 | 0.90952 694 | 0.90997 695 | 0.91041 696 | 0.91085 697 | 0.9113 698 | 0.91173 699 | 0.91217 700 | 0.91261 701 | 0.91305 702 | 0.91348 703 | 0.91392 704 | 0.91435 705 | 0.91478 706 | 0.91521 707 | 0.91564 708 | 0.91606 709 | 0.91649 710 | 0.91691 711 | 0.91734 712 | 0.91776 713 | 0.91818 714 | 0.9186 715 | 0.91902 716 | 0.91944 717 | 0.91985 718 | 0.92027 719 | 0.92068 720 | 0.92109 721 | 0.9215 722 | 0.92191 723 | 0.92232 724 | 0.92273 725 | 0.92314 726 | 0.92354 727 | 0.92395 728 | 0.92435 729 | 0.92475 730 | 0.92515 731 | 0.92555 732 | 0.92595 733 | 0.92634 734 | 0.92674 735 | 0.92713 736 | 0.92753 737 | 0.92792 738 | 0.92831 739 | 0.9287 740 | 0.92909 741 | 0.92947 742 | 0.92986 743 | 0.93025 744 | 0.93063 745 | 0.93101 746 | 0.93139 747 | 0.93177 748 | 0.93215 749 | 0.93253 750 | 0.93291 751 | 0.93328 752 | 0.93366 753 | 0.93403 754 | 0.9344 755 | 0.93478 756 | 0.93515 757 | 0.93551 758 | 0.93588 759 | 0.93625 760 | 0.93661 761 | 0.93698 762 | 0.93734 763 | 0.9377 764 | 0.93807 765 | 0.93843 766 | 0.93878 767 | 0.93914 768 | 0.9395 769 | 0.93986 770 | 0.94021 771 | 0.94056 772 | 0.94092 773 | 0.94127 774 | 0.94162 775 | 0.94197 776 | 0.94231 777 | 0.94266 778 | 0.94301 779 | 0.94335 780 | 0.94369 781 | 0.94404 782 | 0.94438 783 | 0.94472 784 | 0.94506 785 | 0.9454 786 | 0.94573 787 | 0.94607 788 | 0.94641 789 | 0.94674 790 | 0.94707 791 | 0.9474 792 | 0.94774 793 | 0.94807 794 | 0.94839 795 | 0.94872 796 | 0.94905 797 | 0.94937 798 | 0.9497 799 | 0.95002 800 | 0.95035 801 | 0.95067 802 | 0.95099 803 | 0.95131 804 | 0.95163 805 | 0.95194 806 | 0.95226 807 | 0.95257 808 | 0.95289 809 | 0.9532 810 | 0.95351 811 | 0.95383 812 | 0.95414 813 | 0.95445 814 | 0.95475 815 | 0.95506 816 | 0.95537 817 | 0.95567 818 | 0.95598 819 | 0.95628 820 | 0.95658 821 | 0.95688 822 | 0.95718 823 | 0.95748 824 | 0.95778 825 | 0.95808 826 | 0.95838 827 | 0.95867 828 | 0.95897 829 | 0.95926 830 | 0.95955 831 | 0.95984 832 | 0.96013 833 | 0.96042 834 | 0.96071 835 | 0.961 836 | 0.96129 837 | 0.96157 838 | 0.96186 839 | 0.96214 840 | 0.96242 841 | 0.96271 842 | 0.96299 843 | 0.96327 844 | 0.96355 845 | 0.96382 846 | 0.9641 847 | 0.96438 848 | 0.96465 849 | 0.96493 850 | 0.9652 851 | 0.96547 852 | 0.96574 853 | 0.96602 854 | 0.96629 855 | 0.96655 856 | 0.96682 857 | 0.96709 858 | 0.96735 859 | 0.96762 860 | 0.96788 861 | 0.96815 862 | 0.96841 863 | 0.96867 864 | 0.96893 865 | 0.96919 866 | 0.96945 867 | 0.96971 868 | 0.96996 869 | 0.97022 870 | 0.97047 871 | 0.97073 872 | 0.97098 873 | 0.97123 874 | 0.97149 875 | 0.97174 876 | 0.97199 877 | 0.97223 878 | 0.97248 879 | 0.97273 880 | 0.97297 881 | 0.97322 882 | 0.97346 883 | 0.97371 884 | 0.97395 885 | 0.97419 886 | 0.97443 887 | 0.97467 888 | 0.97491 889 | 0.97515 890 | 0.97539 891 | 0.97562 892 | 0.97586 893 | 0.97609 894 | 0.97633 895 | 0.97656 896 | 0.97679 897 | 0.97702 898 | 0.97725 899 | 0.97748 900 | 0.97771 901 | 0.97794 902 | 0.97817 903 | 0.97839 904 | 0.97862 905 | 0.97884 906 | 0.97907 907 | 0.97929 908 | 0.97951 909 | 0.97973 910 | 0.97995 911 | 0.98017 912 | 0.98039 913 | 0.98061 914 | 0.98082 915 | 0.98104 916 | 0.98125 917 | 0.98147 918 | 0.98168 919 | 0.98189 920 | 0.98211 921 | 0.98232 922 | 0.98253 923 | 0.98274 924 | 0.98295 925 | 0.98315 926 | 0.98336 927 | 0.98357 928 | 0.98377 929 | 0.98398 930 | 0.98418 931 | 0.98438 932 | 0.98458 933 | 0.98478 934 | 0.98498 935 | 0.98518 936 | 0.98538 937 | 0.98558 938 | 0.98578 939 | 0.98597 940 | 0.98617 941 | 0.98636 942 | 0.98656 943 | 0.98675 944 | 0.98694 945 | 0.98714 946 | 0.98733 947 | 0.98752 948 | 0.98771 949 | 0.98789 950 | 0.98808 951 | 0.98827 952 | 0.98845 953 | 0.98864 954 | 0.98882 955 | 0.98901 956 | 0.98919 957 | 0.98937 958 | 0.98955 959 | 0.98973 960 | 0.98991 961 | 0.99009 962 | 0.99027 963 | 0.99045 964 | 0.99063 965 | 0.9908 966 | 0.99098 967 | 0.99115 968 | 0.99133 969 | 0.9915 970 | 0.99167 971 | 0.99184 972 | 0.99201 973 | 0.99218 974 | 0.99235 975 | 0.99252 976 | 0.99269 977 | 0.99285 978 | 0.99302 979 | 0.99319 980 | 0.99335 981 | 0.99351 982 | 0.99368 983 | 0.99384 984 | 0.994 985 | 0.99416 986 | 0.99432 987 | 0.99448 988 | 0.99464 989 | 0.9948 990 | 0.99495 991 | 0.99511 992 | 0.99527 993 | 0.99542 994 | 0.99558 995 | 0.99573 996 | 0.99588 997 | 0.99603 998 | 0.99619 999 | 0.99634 1000 | 0.99649 1001 | 0.99664 1002 | 0.99678 1003 | 0.99693 1004 | 0.99708 1005 | 0.99722 1006 | 0.99737 1007 | 0.99751 1008 | 0.99766 1009 | 0.9978 1010 | 0.99794 1011 | 0.99809 1012 | 0.99823 1013 | 0.99837 1014 | 0.99851 1015 | 0.99865 1016 | 0.99879 1017 | 0.99892 1018 | 0.99906 1019 | 0.9992 1020 | 0.99933 1021 | 0.99947 1022 | 0.9996 1023 | 0.99974 1024 | 0.99987 1025 | 1 -------------------------------------------------------------------------------- /cam_settings.txt: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /convertFilesToImage.m: -------------------------------------------------------------------------------- 1 | function convertFilesToImage(xSize, ySize, path, filename) 2 | fd1 = fopen('.\image\r.txt','r'); 3 | fd2 = fopen('.\image\g.txt','r'); 4 | fd3 = fopen('.\image\b.txt','r'); 5 | r = fread(fd1,[ xSize ySize], 'double'); 6 | fclose(fd1); 7 | g = fread(fd2,[ xSize ySize], 'double'); 8 | fclose(fd2); 9 | b = fread(fd3,[ xSize ySize], 'double'); 10 | fclose(fd3); 11 | 12 | image = zeros(ySize, xSize, 3); 13 | image(:,:,1) = r'; 14 | image(:,:,2) = g'; 15 | image(:,:,3) = b'; 16 | image = im2double(image); 17 | 18 | path_for_stg4 = [path '\stage4\']; 19 | mkdir_if_not_exist (path_for_stg4 ); 20 | currentfilename = [path_for_stg4 filename(1:end-4) '_st4.tif']; 21 | filename = currentfilename; 22 | outputFileName = filename; 23 | t = Tiff(outputFileName,'w'); 24 | image = uint16(image*65535); 25 | output_unit16 = image; 26 | tagstruct.ImageLength = size(output_unit16,1); 27 | tagstruct.ImageWidth = size(output_unit16,2); 28 | tagstruct.BitsPerSample = 16; 29 | tagstruct.SamplesPerPixel = 3; 30 | tagstruct.Photometric = Tiff.Photometric.RGB; 31 | % tagstruct.RowsPerStrip = 16; 32 | tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky; 33 | tagstruct.Software = 'MATLAB'; 34 | % tagstruct.DNGVersion = [1; 4; 0; 0]; 35 | t.setTag(tagstruct); 36 | t.write(output_unit16); 37 | t.close(); 38 | delete('.\image\r.txt'); 39 | delete('.\image\g.txt'); 40 | delete('.\image\b.txt'); 41 | end 42 | 43 | -------------------------------------------------------------------------------- /dngOneExeSDK/dng_validate.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karaimer/camera-pipeline-nonUI/7abd5f084d616e3db73b5f411a6d99175f2919b7/dngOneExeSDK/dng_validate.exe -------------------------------------------------------------------------------- /generateMetadata.m: -------------------------------------------------------------------------------- 1 | function generateMetadata( inputFileName, currentfilename ) 2 | path_for_metadata = [inputFileName '\metadata\']; 3 | mkdir_if_not_exist(path_for_metadata); 4 | 5 | inputFileName = [inputFileName '\' currentfilename]; 6 | 7 | system_command = ['.\dngOneExeSDK\dng_validate.exe -d 9999' ' ' inputFileName]; 8 | outputFileName = [path_for_metadata '' currentfilename(1:end-4) '.txt']; 9 | 10 | system([system_command ' >' outputFileName ]); 11 | end 12 | -------------------------------------------------------------------------------- /getWidthHeight.m: -------------------------------------------------------------------------------- 1 | function [width, height] = getWidthHeight( currentfilename ) 2 | renderToGetIntermediateSize(currentfilename); 3 | 4 | inputFileNameforTXTfile = [currentfilename(1:end-4) '.txt']; 5 | fid = fopen(inputFileNameforTXTfile ); 6 | neutral = textscan(fid,'%s'); 7 | fclose(fid); 8 | width = str2num(neutral{1}{6}); 9 | height = str2num(neutral{1}{8}); 10 | end 11 | 12 | -------------------------------------------------------------------------------- /lastStage.txt: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear all 3 | 4 | 5 | folderName = '.\test'; 6 | pathname = [folderName '\*.dng']; 7 | 8 | imagefiles = dir(pathname); 9 | nfiles = length(imagefiles); % Number of files found 10 | 11 | for ii=1:nfiles 12 | currentfilename = imagefiles(ii).name; 13 | file = [folderName '\' currentfilename]; 14 | [width, height] = getWidthHeight(file); 15 | 16 | renderStage4Image(folderName, currentfilename); 17 | convertFilesToImage (width, height, folderName, currentfilename ); 18 | 19 | path_for_stg11 = [folderName '\stage11\']; 20 | mkdir_if_not_exist(path_for_stg11); 21 | st11OutputFileName = [path_for_stg11 currentfilename(1:end-4) '_st11.tif']; 22 | renderStage11Image(folderName, currentfilename, st11OutputFileName); 23 | 24 | generateMetadata(folderName, currentfilename); 25 | end 26 | -------------------------------------------------------------------------------- /mkdir_if_not_exist.m: -------------------------------------------------------------------------------- 1 | function mkdir_if_not_exist(dirpath) 2 | if dirpath(end) ~= '/', dirpath = [dirpath '/']; end 3 | if ~exist(dirpath,'dir') mkdir(dirpath); end 4 | end -------------------------------------------------------------------------------- /renderStage11Image.m: -------------------------------------------------------------------------------- 1 | function renderStage11Image( inputFileName, currentfilename, outputFileName ) 2 | % a = [1 0 1 0]; % with gain [1 0 ... 3 | a = [1 0 1 0]; % with gain [1 0 ... 4 | fileID = fopen('wbAndGainSettings.txt','w'); 5 | fprintf(fileID,'%d\n', a); 6 | fclose(fileID); 7 | 8 | rwSettings = [2]; 9 | fileID = fopen('rwSettings.txt','w'); 10 | fprintf(fileID,'%d\n', rwSettings); 11 | fclose(fileID); 12 | 13 | stageSettings_indicator = [11]; 14 | fileID = fopen('stageSettings.txt','w'); 15 | fprintf(fileID,'%d\n', stageSettings_indicator); 16 | fclose(fileID); 17 | 18 | cam_settings = [0]; 19 | fileID = fopen('cam_settings.txt','w'); 20 | fprintf(fileID,'%d\n',cam_settings); 21 | fclose(fileID); 22 | inputFileName = [inputFileName '\' currentfilename]; 23 | 24 | stage4OutputFileName = ['.\' currentfilename(1:end-4) '_stage11_raw.tif']; 25 | fileID = fopen('lastStage.txt','w'); 26 | laststage_indicator = [5]; 27 | fprintf(fileID,'%d\n', laststage_indicator); 28 | fclose(fileID); 29 | system_command = ['.\dngOneExeSDK\dng_validate.exe -16 -cs1 -tif ' stage4OutputFileName ' ' inputFileName]; 30 | system(system_command); 31 | handles.myData.image = imread(stage4OutputFileName); 32 | delete(stage4OutputFileName); 33 | 34 | saved_image =handles.myData.image; 35 | 36 | t = Tiff(outputFileName,'w'); 37 | output_unit16 = saved_image; 38 | 39 | tagstruct.ImageLength = size(output_unit16,1); 40 | tagstruct.ImageWidth = size(output_unit16,2); 41 | tagstruct.BitsPerSample = 16; 42 | tagstruct.SamplesPerPixel = 3; 43 | tagstruct.Photometric = Tiff.Photometric.RGB; 44 | % tagstruct.RowsPerStrip = 16; 45 | tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky; 46 | tagstruct.Software = 'MATLAB'; 47 | % tagstruct.DNGVersion = [1; 4; 0; 0]; 48 | t.setTag(tagstruct); 49 | t.write(output_unit16); 50 | t.close(); 51 | end 52 | -------------------------------------------------------------------------------- /renderStage4Image.m: -------------------------------------------------------------------------------- 1 | function renderStage4Image( inputFileName, currentfilename ) 2 | a = [1 0 1 0]; % with gain [1 0 ... 3 | fileID = fopen('wbAndGainSettings.txt','w'); 4 | fprintf(fileID,'%d\n', a); 5 | fclose(fileID); 6 | 7 | rwSettings = [0]; 8 | fileID = fopen('rwSettings.txt','w'); 9 | fprintf(fileID,'%d\n', rwSettings); 10 | fclose(fileID); 11 | 12 | stageSettings_indicator = [4]; 13 | fileID = fopen('stageSettings.txt','w'); 14 | fprintf(fileID,'%d\n', stageSettings_indicator); 15 | fclose(fileID); 16 | 17 | cam_settings = [0]; 18 | fileID = fopen('cam_settings.txt','w'); 19 | fprintf(fileID,'%d\n',cam_settings); 20 | fclose(fileID); 21 | inputFileName = [inputFileName '\' currentfilename]; 22 | 23 | stage4OutputFileName = ['.\' currentfilename(1:end-4) '_stage4_raw.tif']; 24 | fileID = fopen('lastStage.txt','w'); 25 | fprintf(fileID,'%d\n', stageSettings_indicator); 26 | fclose(fileID); 27 | system_command = ['.\dngOneExeSDK\dng_validate.exe -16 -cs1 -tif ' stage4OutputFileName ' ' inputFileName]; 28 | system(system_command); 29 | delete(stage4OutputFileName); 30 | end 31 | 32 | -------------------------------------------------------------------------------- /renderToGetIntermediateSize.m: -------------------------------------------------------------------------------- 1 | function renderToGetIntermediateSize( inputFileName ) 2 | a = [1 0 1 0]; % with gain [1 0 ... 3 | fileID = fopen('wbAndGainSettings.txt','w'); 4 | fprintf(fileID,'%d\n', a); 5 | fclose(fileID); 6 | 7 | rwSettings = [0]; 8 | fileID = fopen('rwSettings.txt','w'); 9 | fprintf(fileID,'%d\n', rwSettings); 10 | fclose(fileID); 11 | 12 | stageSettings_indicator = [4]; 13 | fileID = fopen('stageSettings.txt','w'); 14 | fprintf(fileID,'%d\n', stageSettings_indicator); 15 | fclose(fileID); 16 | 17 | cam_settings = [0]; 18 | fileID = fopen('cam_settings.txt','w'); 19 | fprintf(fileID,'%d\n',cam_settings); 20 | fclose(fileID); 21 | % inputFileName = [inputFileName '\' currentfilename]; 22 | 23 | stage4OutputFileName = ['.\' inputFileName(1:end-4) '_stage4_raw.tif']; 24 | % if (get(handles.radiobutton17,'Value') == 0 && get(handles.radiobutton18,'Value') == 1 ) 25 | % this is for save txt images, no need to check if it is write or not. 26 | fileID = fopen('lastStage.txt','w'); 27 | fprintf(fileID,'%d\n', stageSettings_indicator); 28 | fclose(fileID); 29 | system_command = ['.\dngOneExeSDK\dng_validate.exe -16 -cs1 -tif ' stage4OutputFileName ' ' inputFileName]; 30 | system([system_command ' >' inputFileName(1:end-4) '.txt' ]); 31 | delete(stage4OutputFileName); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /rwSettings.txt: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /stageSettings.txt: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /test/Canon1DsMkIII_0001Converted.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karaimer/camera-pipeline-nonUI/7abd5f084d616e3db73b5f411a6d99175f2919b7/test/Canon1DsMkIII_0001Converted.dng -------------------------------------------------------------------------------- /test/Canon1DsMkIII_0004Converted.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karaimer/camera-pipeline-nonUI/7abd5f084d616e3db73b5f411a6d99175f2919b7/test/Canon1DsMkIII_0004Converted.dng -------------------------------------------------------------------------------- /test/Canon1DsMkIII_0005Converted.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karaimer/camera-pipeline-nonUI/7abd5f084d616e3db73b5f411a6d99175f2919b7/test/Canon1DsMkIII_0005Converted.dng -------------------------------------------------------------------------------- /test/Canon1DsMkIII_0008Converted.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karaimer/camera-pipeline-nonUI/7abd5f084d616e3db73b5f411a6d99175f2919b7/test/Canon1DsMkIII_0008Converted.dng -------------------------------------------------------------------------------- /wb.txt: -------------------------------------------------------------------------------- 1 | 0.601722855952964 2 | 1 3 | 0.544870567780092 -------------------------------------------------------------------------------- /wbAndGainSettings.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | 1 4 | 0 5 | --------------------------------------------------------------------------------